std_fstream.h (basic_filebuf): _M_pback_destroy to _M_destroy_pback.

2003-04-27  Benjamin Kosnik  <bkoz@redhat.com>

	* include/std/std_fstream.h (basic_filebuf): _M_pback_destroy to
	_M_destroy_pback. _M_pback_create to
	_M_create_pback. _M_underflow_common to
	_M_underflow. _M_really_overflow to _M_overflow.
	* include/bits/fstream.tcc: Same.
	* src/fstream.cc: Same.
	* include/std/std_streambuf.h (basic_streambuf): _M_in_cur_move to
	_M_move_in_cur.  _M_out_cur_move to _M_move_out_cur.
	* include/bits/streambuf.tcc: Same.
	* include/bits/fstream.tcc: Same.
	* include/bits/sstream.tcc: Same.

From-SVN: r66149
This commit is contained in:
Benjamin Kosnik 2003-04-28 04:54:54 +00:00 committed by Benjamin Kosnik
parent afc6aaab24
commit aa438e8f2b
7 changed files with 59 additions and 47 deletions

View File

@ -1,3 +1,17 @@
2003-04-27 Benjamin Kosnik <bkoz@redhat.com>
* include/std/std_fstream.h (basic_filebuf): _M_pback_destroy to
_M_destroy_pback. _M_pback_create to
_M_create_pback. _M_underflow_common to
_M_underflow. _M_really_overflow to _M_overflow.
* include/bits/fstream.tcc: Same.
* src/fstream.cc: Same.
* include/std/std_streambuf.h (basic_streambuf): _M_in_cur_move to
_M_move_in_cur. _M_out_cur_move to _M_move_out_cur.
* include/bits/streambuf.tcc: Same.
* include/bits/fstream.tcc: Same.
* include/bits/sstream.tcc: Same.
2003-04-27 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/locale_classes.h (locale::_Impl): Change _M_names

View File

@ -126,8 +126,7 @@ namespace std
const bool __testput = this->_M_out_beg < this->_M_out_lim;
if (__testput
&& traits_type::eq_int_type(_M_really_overflow(__eof),
__eof))
&& traits_type::eq_int_type(_M_overflow(__eof), __eof))
__testfail = true;
#if 0
@ -135,7 +134,7 @@ namespace std
if (_M_last_overflowed)
{
_M_output_unshift();
_M_really_overflow(__eof);
_M_overflow(__eof);
}
#endif
}
@ -147,7 +146,7 @@ namespace std
// NB: Do this here so that re-opened filebufs will be cool...
this->_M_mode = ios_base::openmode(0);
_M_destroy_internal_buffer();
_M_pback_destroy();
_M_destroy_pback();
if (!_M_file.close())
__testfail = true;
@ -214,7 +213,7 @@ namespace std
__ret = traits_type::not_eof(__i);
else
{
_M_pback_create();
_M_create_pback();
*this->_M_in_cur = __c;
__ret = __i;
}
@ -233,7 +232,7 @@ namespace std
{
if (!traits_type::eq(__c, *this->_M_in_cur))
{
_M_pback_create();
_M_create_pback();
*this->_M_in_cur = __c;
}
__ret = __i;
@ -263,14 +262,14 @@ namespace std
else if (__testput)
{
*this->_M_out_cur = traits_type::to_char_type(__c);
_M_out_cur_move(1);
_M_move_out_cur(1);
__ret = traits_type::not_eof(__c);
}
else
__ret = this->_M_really_overflow(__c);
__ret = this->_M_overflow(__c);
}
_M_last_overflowed = false; // Set in _M_really_overflow, below.
_M_last_overflowed = false; // Set in _M_overflow, below.
return __ret;
}
@ -344,7 +343,7 @@ namespace std
template<typename _CharT, typename _Traits>
typename basic_filebuf<_CharT, _Traits>::int_type
basic_filebuf<_CharT, _Traits>::
_M_really_overflow(int_type __c)
_M_overflow(int_type __c)
{
int_type __ret = traits_type::eof();
const bool __testput = this->_M_out_beg < this->_M_out_lim;
@ -449,7 +448,7 @@ namespace std
if (this->is_open() && !__testfail && (__testin || __testout))
{
// Ditch any pback buffers to avoid confusion.
_M_pback_destroy();
_M_destroy_pback();
if (__way != ios_base::cur || __off != 0)
{

View File

@ -173,7 +173,7 @@ namespace std
if ((__testout || __testboth)
&& __newoffo + __off >= 0 && __endo - __beg >= __newoffo + __off)
{
_M_out_cur_move(__newoffo + __off - (this->_M_out_cur - __beg));
_M_move_out_cur(__newoffo + __off - (this->_M_out_cur - __beg));
__ret = pos_type(__newoffo);
}
}
@ -217,7 +217,7 @@ namespace std
if (__testposi)
this->_M_in_cur = this->_M_in_beg + __pos;
if (__testposo)
_M_out_cur_move((__pos) - (this->_M_out_cur - __beg));
_M_move_out_cur((__pos) - (this->_M_out_cur - __beg));
__ret = pos_type(off_type(__pos));
}
}

View File

@ -48,7 +48,7 @@ namespace std
if (_M_in_cur < _M_in_end)
{
char_type __c = *this->_M_in_cur;
_M_in_cur_move(1);
_M_move_in_cur(1);
__ret = traits_type::to_int_type(__c);
}
else
@ -67,7 +67,7 @@ namespace std
__ret = this->pbackfail(traits_type::to_int_type(__c));
else
{
_M_in_cur_move(-1);
_M_move_in_cur(-1);
__ret = traits_type::to_int_type(*this->_M_in_cur);
}
return __ret;
@ -81,7 +81,7 @@ namespace std
int_type __ret;
if (_M_in_beg < _M_in_cur)
{
_M_in_cur_move(-1);
_M_move_in_cur(-1);
__ret = traits_type::to_int_type(*_M_in_cur);
}
else
@ -98,7 +98,7 @@ namespace std
if (_M_out_cur < _M_out_end)
{
*_M_out_cur = __c;
_M_out_cur_move(1);
_M_move_out_cur(1);
__ret = traits_type::to_int_type(__c);
}
else
@ -122,7 +122,7 @@ namespace std
traits_type::copy(__s, _M_in_cur, __len);
__ret += __len;
__s += __len;
_M_in_cur_move(__len);
_M_move_in_cur(__len);
}
if (__ret < __n)
@ -156,7 +156,7 @@ namespace std
traits_type::copy(_M_out_cur, __s, __len);
__ret += __len;
__s += __len;
_M_out_cur_move(__len);
_M_move_out_cur(__len);
}
if (__ret < __n)
@ -201,7 +201,7 @@ namespace std
{
__xtrct = __sbout->sputn(__sbin->_M_in_cur, __avail);
__ret += __xtrct;
__sbin->_M_in_cur_move(__xtrct);
__sbin->_M_move_in_cur(__xtrct);
if (__xtrct != __avail)
break;
}

View File

@ -152,7 +152,7 @@ namespace std
// Assumptions:
// _M_in_cur has already been moved back
void
_M_pback_create()
_M_create_pback()
{
if (!_M_pback_init)
{
@ -170,7 +170,7 @@ namespace std
// Assumptions:
// The pback buffer has only moved forward.
void
_M_pback_destroy() throw()
_M_destroy_pback() throw()
{
if (_M_pback_init)
{
@ -288,7 +288,7 @@ namespace std
* @endif
*/
int_type
_M_underflow_common(bool __bump);
_M_underflow(bool __bump);
// [documentation is inherited]
virtual int_type
@ -303,7 +303,7 @@ namespace std
pbackfail(int_type __c = _Traits::eof());
// NB: For what the standard expects of the overflow function,
// see _M_really_overflow(), below. Because basic_streambuf's
// see _M_overflow(), below. Because basic_streambuf's
// sputc/sputn call overflow directly, and the complications of
// this implementation's setting of the initial pointers all
// equal to _M_buf when initializing, it seems essential to have
@ -328,7 +328,7 @@ namespace std
* @endif
*/
int_type
_M_really_overflow(int_type __c = _Traits::eof());
_M_overflow(int_type __c = _Traits::eof());
// Convert internal byte sequence to external, char-based
// sequence via codecvt.
@ -382,8 +382,7 @@ namespace std
off_type __off = this->_M_out_cur - this->_M_out_lim;
// _M_file.sync() will be called within
if (traits_type::eq_int_type(_M_really_overflow(),
traits_type::eof()))
if (traits_type::eq_int_type(_M_overflow(), traits_type::eof()))
__ret = -1;
else if (__off)
_M_file.seekoff(__off, ios_base::cur, __sync);
@ -414,7 +413,7 @@ namespace std
++__s;
++this->_M_in_cur;
}
_M_pback_destroy();
_M_destroy_pback();
}
if (__ret < __n)
__ret += __streambuf_type::xsgetn(__s, __n - __ret);
@ -425,7 +424,7 @@ namespace std
virtual streamsize
xsputn(const char_type* __s, streamsize __n)
{
_M_pback_destroy();
_M_destroy_pback();
return __streambuf_type::xsputn(__s, __n);
}
@ -501,7 +500,7 @@ namespace std
// Explicit specialization declarations, defined in src/fstream.cc.
template<>
basic_filebuf<char>::int_type
basic_filebuf<char>::_M_underflow_common(bool __bump);
basic_filebuf<char>::_M_underflow(bool __bump);
template<>
basic_filebuf<char>::int_type
@ -514,7 +513,7 @@ namespace std
#ifdef _GLIBCPP_USE_WCHAR_T
template<>
basic_filebuf<wchar_t>::int_type
basic_filebuf<wchar_t>::_M_underflow_common(bool __bump);
basic_filebuf<wchar_t>::_M_underflow(bool __bump);
template<>
basic_filebuf<wchar_t>::int_type

View File

@ -239,7 +239,7 @@ namespace std
// Correctly sets the _M_in_cur pointer, and bumps the
// _M_out_cur pointer as well if necessary.
void
_M_in_cur_move(off_type __n) // argument needs to be +-
_M_move_in_cur(off_type __n) // argument needs to be +-
{
const bool __testout = _M_out_cur;
_M_in_cur += __n;
@ -256,7 +256,7 @@ namespace std
// the same range:
// _M_buf <= _M_*_ <= _M_out_end
void
_M_out_cur_move(off_type __n) // argument needs to be +-
_M_move_out_cur(off_type __n) // argument needs to be +-
{
const bool __testin = _M_in_cur;

View File

@ -38,7 +38,7 @@ namespace std
{
template<>
basic_filebuf<char>::int_type
basic_filebuf<char>::_M_underflow_common(bool __bump)
basic_filebuf<char>::_M_underflow(bool __bump)
{
int_type __ret = traits_type::eof();
const bool __testin = _M_mode & ios_base::in;
@ -51,13 +51,13 @@ namespace std
// normal buffers and jet outta here before expensive
// fileops happen...
if (_M_pback_init)
_M_pback_destroy();
_M_destroy_pback();
if (_M_in_cur < _M_in_end)
{
__ret = traits_type::to_int_type(*_M_in_cur);
if (__bump)
_M_in_cur_move(1);
_M_move_in_cur(1);
return __ret;
}
@ -68,7 +68,7 @@ namespace std
if (__testget)
{
if (__testout)
_M_really_overflow();
_M_overflow();
else if (_M_in_cur != _M_filepos)
_M_file.seekoff(_M_in_cur - _M_filepos,
ios_base::cur, __testsync, ios_base::in);
@ -90,7 +90,7 @@ namespace std
_M_out_cur = _M_in_cur;
__ret = traits_type::to_int_type(*_M_in_cur);
if (__bump)
_M_in_cur_move(1);
_M_move_in_cur(1);
else if (__testsync)
{
// If we are synced with stdio, we have to unget the
@ -109,17 +109,17 @@ namespace std
template<>
basic_filebuf<char>::int_type
basic_filebuf<char>::underflow()
{ return _M_underflow_common(false); }
{ return _M_underflow(false); }
template<>
basic_filebuf<char>::int_type
basic_filebuf<char>::uflow()
{ return _M_underflow_common(true); }
{ return _M_underflow(true); }
#ifdef _GLIBCPP_USE_WCHAR_T
template<>
basic_filebuf<wchar_t>::int_type
basic_filebuf<wchar_t>::_M_underflow_common(bool __bump)
basic_filebuf<wchar_t>::_M_underflow(bool __bump)
{
int_type __ret = traits_type::eof();
const bool __testin = _M_mode & ios_base::in;
@ -132,13 +132,13 @@ namespace std
// normal buffers and jet outta here before expensive
// fileops happen...
if (_M_pback_init)
_M_pback_destroy();
_M_destroy_pback();
if (_M_in_cur < _M_in_end)
{
__ret = traits_type::to_int_type(*_M_in_cur);
if (__bump)
_M_in_cur_move(1);
_M_move_in_cur(1);
return __ret;
}
@ -149,7 +149,7 @@ namespace std
if (__testget)
{
if (__testout)
_M_really_overflow();
_M_overflow();
else if (_M_in_cur != _M_filepos)
_M_file.seekoff(_M_in_cur - _M_filepos,
ios_base::cur, __testsync, ios_base::in);
@ -195,7 +195,7 @@ namespace std
_M_out_cur = _M_in_cur;
__ret = traits_type::to_int_type(*_M_in_cur);
if (__bump)
_M_in_cur_move(1);
_M_move_in_cur(1);
else if (__testsync)
{
// If we are synced with stdio, we have to unget the
@ -214,11 +214,11 @@ namespace std
template<>
basic_filebuf<wchar_t>::int_type
basic_filebuf<wchar_t>::underflow()
{ return _M_underflow_common(false); }
{ return _M_underflow(false); }
template<>
basic_filebuf<wchar_t>::int_type
basic_filebuf<wchar_t>::uflow()
{ return _M_underflow_common(true); }
{ return _M_underflow(true); }
#endif
} // namespace std