Commit fb8d4638 by Paolo Carlini Committed by Paolo Carlini

std_streambuf.h (__copy_streambufs): Remove the first, unused, basic_ios<> parameter.

2003-11-27  Paolo Carlini  <pcarlini@suse.de>

	* 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
parent 81a5b587
2003-11-27 Paolo Carlini <pcarlini@suse.de>
* 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 <bkoz@redhat.com> 2003-11-26 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/9371 PR libstdc++/9371
......
...@@ -409,7 +409,7 @@ namespace std ...@@ -409,7 +409,7 @@ namespace std
{ {
try try
{ {
if (!__copy_streambufs(*this, this->rdbuf(), __sbout)) if (!__copy_streambufs(this->rdbuf(), __sbout))
__err |= ios_base::failbit; __err |= ios_base::failbit;
} }
catch(...) catch(...)
......
...@@ -304,7 +304,7 @@ namespace std ...@@ -304,7 +304,7 @@ namespace std
{ {
try try
{ {
if (!__copy_streambufs(*this, __sbin, this->rdbuf())) if (!__copy_streambufs(__sbin, this->rdbuf()))
__err |= ios_base::failbit; __err |= ios_base::failbit;
} }
catch(...) catch(...)
......
...@@ -113,38 +113,32 @@ namespace std ...@@ -113,38 +113,32 @@ namespace std
// necessary. // necessary.
template<typename _CharT, typename _Traits> template<typename _CharT, typename _Traits>
streamsize streamsize
__copy_streambufs(basic_ios<_CharT, _Traits>& __ios, __copy_streambufs(basic_streambuf<_CharT, _Traits>* __sbin,
basic_streambuf<_CharT, _Traits>* __sbin,
basic_streambuf<_CharT, _Traits>* __sbout) basic_streambuf<_CharT, _Traits>* __sbout)
{ {
streamsize __ret = 0; 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(); const size_t __n = __sbin->egptr() - __sbin->gptr();
while (!_Traits::eq_int_type(__c, _Traits::eof())) if (__n > 1)
{ {
const size_t __n = __sbin->egptr() - __sbin->gptr(); const size_t __wrote = __sbout->sputn(__sbin->gptr(), __n);
if (__n > 1) __sbin->gbump(__wrote);
{ __ret += __wrote;
const size_t __wrote = __sbout->sputn(__sbin->gptr(), __n); if (__wrote < __n)
__sbin->gbump(__wrote); break;
__ret += __wrote; __c = __sbin->underflow();
if (__wrote < __n) }
break; else
__c = __sbin->underflow(); {
} __c = __sbout->sputc(_Traits::to_char_type(__c));
else if (_Traits::eq_int_type(__c, _Traits::eof()))
{ break;
__c = __sbout->sputc(_Traits::to_char_type(__c)); ++__ret;
if (_Traits::eq_int_type(__c, _Traits::eof())) __c = __sbin->snextc();
break;
++__ret;
__c = __sbin->snextc();
}
} }
} }
catch(...)
{ __throw_exception_again; }
return __ret; return __ret;
} }
...@@ -155,14 +149,14 @@ namespace std ...@@ -155,14 +149,14 @@ namespace std
extern template class basic_streambuf<char>; extern template class basic_streambuf<char>;
extern template extern template
streamsize streamsize
__copy_streambufs(basic_ios<char>&, basic_streambuf<char>*, __copy_streambufs(basic_streambuf<char>*,
basic_streambuf<char>*); basic_streambuf<char>*);
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
extern template class basic_streambuf<wchar_t>; extern template class basic_streambuf<wchar_t>;
extern template extern template
streamsize streamsize
__copy_streambufs(basic_ios<wchar_t>&, basic_streambuf<wchar_t>*, __copy_streambufs(basic_streambuf<wchar_t>*,
basic_streambuf<wchar_t>*); basic_streambuf<wchar_t>*);
#endif #endif
#endif #endif
......
...@@ -56,8 +56,7 @@ namespace std ...@@ -56,8 +56,7 @@ namespace std
*/ */
template<typename _CharT, typename _Traits> template<typename _CharT, typename _Traits>
streamsize streamsize
__copy_streambufs(basic_ios<_CharT, _Traits>& _ios, __copy_streambufs(basic_streambuf<_CharT, _Traits>* __sbin,
basic_streambuf<_CharT, _Traits>* __sbin,
basic_streambuf<_CharT, _Traits>* __sbout); basic_streambuf<_CharT, _Traits>* __sbout);
/** /**
...@@ -153,8 +152,8 @@ namespace std ...@@ -153,8 +152,8 @@ namespace std
friend class ostreambuf_iterator<char_type, traits_type>; friend class ostreambuf_iterator<char_type, traits_type>;
friend streamsize friend streamsize
__copy_streambufs<>(basic_ios<char_type, traits_type>& __ios, __copy_streambufs<>(__streambuf_type* __sbin,
__streambuf_type* __sbin,__streambuf_type* __sbout); __streambuf_type* __sbout);
protected: protected:
//@{ //@{
......
...@@ -45,12 +45,12 @@ namespace std ...@@ -45,12 +45,12 @@ namespace std
template template
streamsize streamsize
__copy_streambufs(basic_ios<char>&, basic_streambuf<char>*, __copy_streambufs(basic_streambuf<char>*,
basic_streambuf<char>*); basic_streambuf<char>*);
#ifdef _GLIBCXX_USE_WCHAR_T #ifdef _GLIBCXX_USE_WCHAR_T
template template
streamsize streamsize
__copy_streambufs(basic_ios<wchar_t>&, basic_streambuf<wchar_t>*, __copy_streambufs(basic_streambuf<wchar_t>*,
basic_streambuf<wchar_t>*); basic_streambuf<wchar_t>*);
#endif #endif
} //std } //std
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment