diff options
author | Paolo Carlini <pcarlini@unitus.it> | 2003-04-29 00:15:58 +0200 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2003-04-28 22:15:58 +0000 |
commit | 44b84cc9182bffe8b7d751fe4ca1d90ebcce512d (patch) | |
tree | b1851108b34e4e71b0c332de99d9c680050362b4 /libstdc++-v3/include/bits/streambuf.tcc | |
parent | ca78f36ae3b7b61eb78dc8e7d624add10e8718df (diff) | |
download | gcc-44b84cc9182bffe8b7d751fe4ca1d90ebcce512d.zip gcc-44b84cc9182bffe8b7d751fe4ca1d90ebcce512d.tar.gz gcc-44b84cc9182bffe8b7d751fe4ca1d90ebcce512d.tar.bz2 |
streambuf.tcc (__copy_streambufs): Don't use _M_buf_size (synced input is now correctly dealt with elsewhere)...
2003-04-28 Paolo Carlini <pcarlini@unitus.it>
* include/bits/streambuf.tcc (__copy_streambufs): Don't use
_M_buf_size (synced input is now correctly dealt with
elsewhere); when the output buffer is full don't fall back
to a snextc-sputc loop, call overflow instead.
From-SVN: r66190
Diffstat (limited to 'libstdc++-v3/include/bits/streambuf.tcc')
-rw-r--r-- | libstdc++-v3/include/bits/streambuf.tcc | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/libstdc++-v3/include/bits/streambuf.tcc b/libstdc++-v3/include/bits/streambuf.tcc index 05e5a65..1d1843f 100644 --- a/libstdc++-v3/include/bits/streambuf.tcc +++ b/libstdc++-v3/include/bits/streambuf.tcc @@ -188,8 +188,6 @@ namespace std typedef typename _Traits::off_type off_type; streamsize __ret = 0; - const off_type __buf_size = - __sbin->_M_buf_size > 0 ? __sbin->_M_buf_size : 1; try { for (;;) @@ -208,10 +206,9 @@ namespace std else { streamsize __charsread; - const off_type __size = std::min(__buf_size, - off_type(__sbout->_M_out_end - - __sbout->_M_out_cur)); - if (__size > 1) + const off_type __size = __sbout->_M_out_end + - __sbout->_M_out_cur; + if (__size) { _CharT* __buf = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) @@ -224,15 +221,15 @@ namespace std else { __xtrct = __charsread = 0; - int_type __c = __sbin->sgetc(); - while (!_Traits::eq_int_type(__c, _Traits::eof())) + const int_type __c = __sbin->sgetc(); + if (!_Traits::eq_int_type(__c, _Traits::eof())) { ++__charsread; - if (_Traits::eq_int_type(__sbout->sputc(_Traits::to_char_type(__c)), + if (_Traits::eq_int_type(__sbout->overflow(__c), _Traits::eof())) break; ++__xtrct; - __c = __sbin->snextc(); + __sbin->sbumpc(); } } __ret += __xtrct; |