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
This commit is contained in:
Paolo Carlini 2003-04-29 00:15:58 +02:00 committed by Paolo Carlini
parent ca78f36ae3
commit 44b84cc918
2 changed files with 14 additions and 10 deletions

View File

@ -1,3 +1,10 @@
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.
2003-04-28 Paolo Carlini <pcarlini@unitus.it> 2003-04-28 Paolo Carlini <pcarlini@unitus.it>
* include/bits/sstream.tcc (pbackfail): Shorten a bit (6 lines) * include/bits/sstream.tcc (pbackfail): Shorten a bit (6 lines)

View File

@ -188,8 +188,6 @@ namespace std
typedef typename _Traits::off_type off_type; typedef typename _Traits::off_type off_type;
streamsize __ret = 0; streamsize __ret = 0;
const off_type __buf_size =
__sbin->_M_buf_size > 0 ? __sbin->_M_buf_size : 1;
try try
{ {
for (;;) for (;;)
@ -208,10 +206,9 @@ namespace std
else else
{ {
streamsize __charsread; streamsize __charsread;
const off_type __size = std::min(__buf_size, const off_type __size = __sbout->_M_out_end
off_type(__sbout->_M_out_end - __sbout->_M_out_cur;
- __sbout->_M_out_cur)); if (__size)
if (__size > 1)
{ {
_CharT* __buf = _CharT* __buf =
static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT) static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)
@ -224,15 +221,15 @@ namespace std
else else
{ {
__xtrct = __charsread = 0; __xtrct = __charsread = 0;
int_type __c = __sbin->sgetc(); const int_type __c = __sbin->sgetc();
while (!_Traits::eq_int_type(__c, _Traits::eof())) if (!_Traits::eq_int_type(__c, _Traits::eof()))
{ {
++__charsread; ++__charsread;
if (_Traits::eq_int_type(__sbout->sputc(_Traits::to_char_type(__c)), if (_Traits::eq_int_type(__sbout->overflow(__c),
_Traits::eof())) _Traits::eof()))
break; break;
++__xtrct; ++__xtrct;
__c = __sbin->snextc(); __sbin->sbumpc();
} }
} }
__ret += __xtrct; __ret += __xtrct;