diff options
author | Paolo Carlini <pcarlini@unitus.it> | 2003-06-10 21:27:12 +0200 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2003-06-10 19:27:12 +0000 |
commit | 9335d80ab9e0ebdf8a380445a1b28613bbb37e1e (patch) | |
tree | 5d928134ddd43b2d1cd1ab110cf0effb3cd36eec /libstdc++-v3/include/bits/fstream.tcc | |
parent | 346eeb157eed29835cbe240fcd0f68c58f3decce (diff) | |
download | gcc-9335d80ab9e0ebdf8a380445a1b28613bbb37e1e.zip gcc-9335d80ab9e0ebdf8a380445a1b28613bbb37e1e.tar.gz gcc-9335d80ab9e0ebdf8a380445a1b28613bbb37e1e.tar.bz2 |
fstream.tcc (overflow): According to 27.5.2.4.5, overflow() returns not_eof(eof()).
2003-06-10 Paolo Carlini <pcarlini@unitus.it>
* include/bits/fstream.tcc (overflow): According to
27.5.2.4.5, overflow() returns not_eof(eof()).
* testsuite/27_io/basic_filebuf/overflow/char/2.cc: New.
* testsuite/27_io/basic_filebuf/overflow/char/2-unbuf.cc: Ditto.
2003-06-10 Paolo Carlini <pcarlini@unitus.it>
* include/bits/fstream.tcc (_M_underflow): Check overflow return
value; tweak slightly.
From-SVN: r67726
Diffstat (limited to 'libstdc++-v3/include/bits/fstream.tcc')
-rw-r--r-- | libstdc++-v3/include/bits/fstream.tcc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libstdc++-v3/include/bits/fstream.tcc b/libstdc++-v3/include/bits/fstream.tcc index d988309..46dbdb21 100644 --- a/libstdc++-v3/include/bits/fstream.tcc +++ b/libstdc++-v3/include/bits/fstream.tcc @@ -193,9 +193,6 @@ namespace std // fileops happen... _M_destroy_pback(); - const size_t __buflen = this->_M_buf_size > 1 - ? this->_M_buf_size - 1 : 1; - if (this->_M_in_cur < this->_M_in_end) { __ret = traits_type::to_int_type(*this->_M_in_cur); @@ -205,10 +202,13 @@ namespace std } // Sync internal and external buffers. - if (__testout && this->_M_out_beg < this->_M_out_lim) - this->overflow(); + if (__testout && this->_M_out_beg < this->_M_out_lim + && traits_type::eq_int_type(this->overflow(), __ret)) + return __ret; // Get and convert input sequence. + const size_t __buflen = this->_M_buf_size > 1 + ? this->_M_buf_size - 1 : 1; streamsize __elen = 0; streamsize __ilen = 0; if (__check_facet(_M_codecvt).always_noconv()) @@ -348,8 +348,8 @@ namespace std { // Unbuffered. char_type __conv = traits_type::to_char_type(__c); - if (!__testeof && _M_convert_to_external(&__conv, 1)) - __ret = __c; + if (__testeof || _M_convert_to_external(&__conv, 1)) + __ret = traits_type::not_eof(__c); } } _M_last_overflowed = true; |