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
from fixed size array.
(locale): Change _S_categories as well.
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
if (_M_last_overflowed)
{
_M_output_unshift();
- _M_really_overflow(__eof);
+ _M_overflow(__eof);
}
#endif
}
// 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;
__ret = traits_type::not_eof(__i);
else
{
- _M_pback_create();
+ _M_create_pback();
*this->_M_in_cur = __c;
__ret = __i;
}
{
if (!traits_type::eq(__c, *this->_M_in_cur))
{
- _M_pback_create();
+ _M_create_pback();
*this->_M_in_cur = __c;
}
__ret = __i;
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;
}
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;
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)
{
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);
}
}
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));
}
}
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
__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;
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
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
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)
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)
{
__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;
}
// Assumptions:
// _M_in_cur has already been moved back
void
- _M_pback_create()
+ _M_create_pback()
{
if (!_M_pback_init)
{
// Assumptions:
// The pback buffer has only moved forward.
void
- _M_pback_destroy() throw()
+ _M_destroy_pback() throw()
{
if (_M_pback_init)
{
* @endif
*/
int_type
- _M_underflow_common(bool __bump);
+ _M_underflow(bool __bump);
// [documentation is inherited]
virtual int_type
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
* @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.
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);
++__s;
++this->_M_in_cur;
}
- _M_pback_destroy();
+ _M_destroy_pback();
}
if (__ret < __n)
__ret += __streambuf_type::xsgetn(__s, __n - __ret);
virtual streamsize
xsputn(const char_type* __s, streamsize __n)
{
- _M_pback_destroy();
+ _M_destroy_pback();
return __streambuf_type::xsputn(__s, __n);
}
// 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
#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
// 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;
// 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;
{
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;
// 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;
}
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);
_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
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;
// 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;
}
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);
_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
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