From: Paolo Carlini Date: Thu, 27 Nov 2003 13:13:19 +0000 (+0000) Subject: std_streambuf.h (__copy_streambufs): Remove the first, unused, basic_ios<> parameter. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fb8d46385113884eb18abef5bee948c955f298ae;p=gcc.git std_streambuf.h (__copy_streambufs): Remove the first, unused, basic_ios<> parameter. 2003-11-27 Paolo Carlini * include/std/std_streambuf.h (__copy_streambufs): Remove the first, unused, basic_ios<> parameter. * src/streambuf-inst.cc: Likewise. * include/bits/streambuf.tcc: Likewise. * include/bits/istream.tcc (operator>>(__streambuf_type*)): Tweak accordingly the call. * include/bits/ostream.tcc (operator<<(__streambuf_type*)): Likewise. * include/bits/streambuf.tcc (__copy_streambufs): Remove redundant try/catch. From-SVN: r73992 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index fd4aaaf3d1e..8d8a4b15a4e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,17 @@ +2003-11-27 Paolo Carlini + + * include/std/std_streambuf.h (__copy_streambufs): Remove + the first, unused, basic_ios<> parameter. + * src/streambuf-inst.cc: Likewise. + * include/bits/streambuf.tcc: Likewise. + * include/bits/istream.tcc (operator>>(__streambuf_type*)): + Tweak accordingly the call. + * include/bits/ostream.tcc (operator<<(__streambuf_type*)): + Likewise. + + * include/bits/streambuf.tcc (__copy_streambufs): Remove + redundant try/catch. + 2003-11-26 Benjamin Kosnik PR libstdc++/9371 diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc index 4055ca79308..0d85cc1bda1 100644 --- a/libstdc++-v3/include/bits/istream.tcc +++ b/libstdc++-v3/include/bits/istream.tcc @@ -409,7 +409,7 @@ namespace std { try { - if (!__copy_streambufs(*this, this->rdbuf(), __sbout)) + if (!__copy_streambufs(this->rdbuf(), __sbout)) __err |= ios_base::failbit; } catch(...) diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc index fecaa93eeeb..c7da8c66011 100644 --- a/libstdc++-v3/include/bits/ostream.tcc +++ b/libstdc++-v3/include/bits/ostream.tcc @@ -304,7 +304,7 @@ namespace std { try { - if (!__copy_streambufs(*this, __sbin, this->rdbuf())) + if (!__copy_streambufs(__sbin, this->rdbuf())) __err |= ios_base::failbit; } catch(...) diff --git a/libstdc++-v3/include/bits/streambuf.tcc b/libstdc++-v3/include/bits/streambuf.tcc index 559c5b9874f..494b9f0056d 100644 --- a/libstdc++-v3/include/bits/streambuf.tcc +++ b/libstdc++-v3/include/bits/streambuf.tcc @@ -113,38 +113,32 @@ namespace std // necessary. template streamsize - __copy_streambufs(basic_ios<_CharT, _Traits>& __ios, - basic_streambuf<_CharT, _Traits>* __sbin, + __copy_streambufs(basic_streambuf<_CharT, _Traits>* __sbin, basic_streambuf<_CharT, _Traits>* __sbout) { streamsize __ret = 0; - try + typename _Traits::int_type __c = __sbin->sgetc(); + while (!_Traits::eq_int_type(__c, _Traits::eof())) { - typename _Traits::int_type __c = __sbin->sgetc(); - while (!_Traits::eq_int_type(__c, _Traits::eof())) + const size_t __n = __sbin->egptr() - __sbin->gptr(); + if (__n > 1) { - const size_t __n = __sbin->egptr() - __sbin->gptr(); - if (__n > 1) - { - const size_t __wrote = __sbout->sputn(__sbin->gptr(), __n); - __sbin->gbump(__wrote); - __ret += __wrote; - if (__wrote < __n) - break; - __c = __sbin->underflow(); - } - else - { - __c = __sbout->sputc(_Traits::to_char_type(__c)); - if (_Traits::eq_int_type(__c, _Traits::eof())) - break; - ++__ret; - __c = __sbin->snextc(); - } + const size_t __wrote = __sbout->sputn(__sbin->gptr(), __n); + __sbin->gbump(__wrote); + __ret += __wrote; + if (__wrote < __n) + break; + __c = __sbin->underflow(); + } + else + { + __c = __sbout->sputc(_Traits::to_char_type(__c)); + if (_Traits::eq_int_type(__c, _Traits::eof())) + break; + ++__ret; + __c = __sbin->snextc(); } } - catch(...) - { __throw_exception_again; } return __ret; } @@ -155,14 +149,14 @@ namespace std extern template class basic_streambuf; extern template streamsize - __copy_streambufs(basic_ios&, basic_streambuf*, + __copy_streambufs(basic_streambuf*, basic_streambuf*); #ifdef _GLIBCXX_USE_WCHAR_T extern template class basic_streambuf; extern template streamsize - __copy_streambufs(basic_ios&, basic_streambuf*, + __copy_streambufs(basic_streambuf*, basic_streambuf*); #endif #endif diff --git a/libstdc++-v3/include/std/std_streambuf.h b/libstdc++-v3/include/std/std_streambuf.h index 23b982193de..fe82b3bcda0 100644 --- a/libstdc++-v3/include/std/std_streambuf.h +++ b/libstdc++-v3/include/std/std_streambuf.h @@ -56,8 +56,7 @@ namespace std */ template streamsize - __copy_streambufs(basic_ios<_CharT, _Traits>& _ios, - basic_streambuf<_CharT, _Traits>* __sbin, + __copy_streambufs(basic_streambuf<_CharT, _Traits>* __sbin, basic_streambuf<_CharT, _Traits>* __sbout); /** @@ -153,8 +152,8 @@ namespace std friend class ostreambuf_iterator; friend streamsize - __copy_streambufs<>(basic_ios& __ios, - __streambuf_type* __sbin,__streambuf_type* __sbout); + __copy_streambufs<>(__streambuf_type* __sbin, + __streambuf_type* __sbout); protected: //@{ diff --git a/libstdc++-v3/src/streambuf-inst.cc b/libstdc++-v3/src/streambuf-inst.cc index 49cb6052560..5d1879a6fae 100644 --- a/libstdc++-v3/src/streambuf-inst.cc +++ b/libstdc++-v3/src/streambuf-inst.cc @@ -45,12 +45,12 @@ namespace std template streamsize - __copy_streambufs(basic_ios&, basic_streambuf*, + __copy_streambufs(basic_streambuf*, basic_streambuf*); #ifdef _GLIBCXX_USE_WCHAR_T template streamsize - __copy_streambufs(basic_ios&, basic_streambuf*, + __copy_streambufs(basic_streambuf*, basic_streambuf*); #endif } //std