aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std/fstream
diff options
context:
space:
mode:
authorDavid Krauss <potswa@mac.com>2010-09-22 19:40:43 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2010-09-22 19:40:43 +0000
commit3531cf5ef365860700c5e89483f3a86ac969c6a4 (patch)
treea04325d2591098556af14addef9debb056684968 /libstdc++-v3/include/std/fstream
parent5d64ee190c8875dec5f15c0287a425a1e62041a9 (diff)
downloadgcc-3531cf5ef365860700c5e89483f3a86ac969c6a4.zip
gcc-3531cf5ef365860700c5e89483f3a86ac969c6a4.tar.gz
gcc-3531cf5ef365860700c5e89483f3a86ac969c6a4.tar.bz2
re PR libstdc++/45628 (std::fstream::tellg invalidates I/O buffer)
2010-09-22 David Krauss <potswa@mac.com> PR libstdc++/45628 * include/bits/fstream.tcc (basic_filebuf::underflow): Add state transition to avoid modality requiring seekoff(0,ios::cur). (basic_filebuf::pbackfail): Likewise. (basic_filebuf::overflow): Likewise. (basic_filebuf::_M_seek): Avoid minor unnecessary conversion. (basic_filebuf::seekoff): Remove code to _M_get_ext_pos; make (0, ios::cur) a special case preserving buffer contents. (basic_filebuf::_M_get_ext_pos): New function to obtain status about codecvt extern_t buffer for overflow and seekoff. * include/std/fstream (basic_filebuf::_M_get_ext_pos): Likewise. * config/abi/pre/gnu.ver: Export new symbols. * testsuite/27_io/basic_filebuf/seekoff/char/45628-1.cc: New, verifies that seekoff(0, ios::cur) preserves buffers. * testsuite/27_io/basic_filebuf/seekoff/char/45628-2.cc: Likewise. for codecvt case. More lenient as it may still flush put area. * testsuite/27_io/basic_filebuf/seekoff/char/4.cc: Modify to check that seekoff is not required between read and write. * testsuite/27_io/basic_filebuf/seekoff/wchar_t/4.cc: Likewise. * testsuite/27_io/basic_filebuf/sync/wchar_t/1.cc: Remove. * testsuite/27_io/basic_filebuf/sync/wchar_t/1.cc: Likewise. * testsuite/util/testsuite_character.h (codecvt::do_length): Comply with 22.2.1.5.2/10 "Returns ... the LARGEST value in the range..." From-SVN: r164529
Diffstat (limited to 'libstdc++-v3/include/std/fstream')
-rw-r--r--libstdc++-v3/include/std/fstream5
1 files changed, 4 insertions, 1 deletions
diff --git a/libstdc++-v3/include/std/fstream b/libstdc++-v3/include/std/fstream
index 00690be..0ffd33d 100644
--- a/libstdc++-v3/include/std/fstream
+++ b/libstdc++-v3/include/std/fstream
@@ -351,9 +351,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
seekpos(pos_type __pos,
ios_base::openmode __mode = ios_base::in | ios_base::out);
- // Common code for seekoff and seekpos
+ // Common code for seekoff, seekpos, and overflow
pos_type
_M_seek(off_type __off, ios_base::seekdir __way, __state_type __state);
+
+ int
+ _M_get_ext_pos(__state_type &__state);
virtual int
sync();