+2003-04-20 Paolo Carlini <pcarlini@unitus.it>
+
+ * include/bits/sstream.tcc (pbackfail): Remove redundant
+ NULL pointer check from test involving _M_in_*.
+ (overflow, seekoff, seekpos): Const qualify bool variables.
+ * include/std/std_sstream.h (underflow): Remove redundant
+ NULL pointer check from test involving _M_in_*.
+ (_M_really_sync): Const qualify bool variables.
+ * src/fstream.cc (_M_underflow_common): Remove redundant
+ NULL pointer check from test involving _M_in_*, const qualify
+ bool variables.
+
+ * include/std/std_streambuf.h (sgetc): Remove redundant
+ variable.
+
2003-04-18 Paolo Carlini <pcarlini@unitus.it>
According to 5.9 para 2 (second bullet) for pointers p, q
pbackfail(int_type __c)
{
int_type __ret = traits_type::eof();
- bool __testeof = traits_type::eq_int_type(__c, traits_type::eof());
- bool __testpos = this->_M_in_cur && this->_M_in_beg < this->_M_in_cur;
+ const bool __testeof =
+ traits_type::eq_int_type(__c, traits_type::eof());
+ const bool __testpos = this->_M_in_beg < this->_M_in_cur;
// Try to put back __c into input sequence in one of three ways.
// Order these tests done in is unspecified by the standard.
basic_stringbuf<_CharT, _Traits, _Alloc>::
overflow(int_type __c)
{
- bool __testout = this->_M_mode & ios_base::out;
+ const bool __testout = this->_M_mode & ios_base::out;
if (__builtin_expect(!__testout, false))
return traits_type::eof();
- bool __testeof = traits_type::eq_int_type(__c, traits_type::eof());
+ const bool __testeof =
+ traits_type::eq_int_type(__c, traits_type::eof());
if (__builtin_expect(__testeof, false))
return traits_type::not_eof(__c);
// suit particular needs.
__size_type __len = std::max(__size_type(_M_string.capacity() + 1),
__size_type(512));
- bool __testput = this->_M_out_cur < this->_M_out_end;
+ const bool __testput = this->_M_out_cur < this->_M_out_end;
if (__builtin_expect(!__testput && __len > _M_string.max_size(), false))
return traits_type::eof();
pos_type __ret = pos_type(off_type(-1));
bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
- bool __testboth = __testin && __testout && __way != ios_base::cur;
+ const bool __testboth = __testin && __testout && __way != ios_base::cur;
__testin &= !(__mode & ios_base::out);
__testout &= !(__mode & ios_base::in);
off_type __pos = __sp; // Use streamoff operator to do conversion.
char_type* __beg = NULL;
char_type* __end = NULL;
- bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
- bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
+ const bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;
+ const bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;
// NB: Ordered.
bool __testposi = false;
virtual int_type
underflow()
{
- if (this->_M_in_cur && this->_M_in_cur < this->_M_in_end)
+ if (this->_M_in_cur < this->_M_in_end)
return traits_type::to_int_type(*gptr());
else
return traits_type::eof();
virtual void
_M_really_sync(char_type* __base, __size_type __i, __size_type __o)
{
- bool __testin = this->_M_mode & ios_base::in;
- bool __testout = this->_M_mode & ios_base::out;
+ const bool __testin = this->_M_mode & ios_base::in;
+ const bool __testout = this->_M_mode & ios_base::out;
__size_type __len = _M_string.size();
this->_M_buf = __base;
int_type
sgetc()
{
- int_type __ret;
if (_M_in_cur < _M_in_end)
- __ret = traits_type::to_int_type(*(this->gptr()));
+ return traits_type::to_int_type(*(this->gptr()));
else
- __ret = this->underflow();
- return __ret;
+ return this->underflow();
}
/**
basic_filebuf<char>::_M_underflow_common(bool __bump)
{
int_type __ret = traits_type::eof();
- bool __testin = _M_mode & ios_base::in;
- bool __testout = _M_mode & ios_base::out;
+ const bool __testin = _M_mode & ios_base::in;
+ const bool __testout = _M_mode & ios_base::out;
// Sync with stdio.
- bool __sync = _M_buf_size <= 1;
+ const bool __sync = _M_buf_size <= 1;
if (__testin)
{
if (_M_pback_init)
_M_pback_destroy();
- if (_M_in_cur && _M_in_cur < _M_in_end)
+ if (_M_in_cur < _M_in_end)
{
__ret = traits_type::to_int_type(*_M_in_cur);
if (__bump)
// Sync internal and external buffers.
// NB: __testget -> __testput as _M_buf_unified here.
- bool __testget = _M_in_cur && _M_in_beg < _M_in_cur;
- bool __testinit = _M_is_indeterminate();
+ const bool __testget = _M_in_beg < _M_in_cur;
+ const bool __testinit = _M_is_indeterminate();
if (__testget)
{
if (__testout)
basic_filebuf<wchar_t>::_M_underflow_common(bool __bump)
{
int_type __ret = traits_type::eof();
- bool __testin = _M_mode & ios_base::in;
- bool __testout = _M_mode & ios_base::out;
+ const bool __testin = _M_mode & ios_base::in;
+ const bool __testout = _M_mode & ios_base::out;
// Sync with stdio.
- bool __sync = _M_buf_size <= 1;
+ const bool __sync = _M_buf_size <= 1;
if (__testin)
{
if (_M_pback_init)
_M_pback_destroy();
- if (_M_in_cur && _M_in_cur < _M_in_end)
+ if (_M_in_cur < _M_in_end)
{
__ret = traits_type::to_int_type(*_M_in_cur);
if (__bump)
// Sync internal and external buffers.
// NB: __testget -> __testput as _M_buf_unified here.
- bool __testget = _M_in_cur && _M_in_beg < _M_in_cur;
- bool __testinit = _M_is_indeterminate();
+ const bool __testget = _M_in_beg < _M_in_cur;
+ const bool __testinit = _M_is_indeterminate();
if (__testget)
{
if (__testout)