Commit 71b46021 by Paolo Carlini Committed by Paolo Carlini

Nathan C.

2003-06-24  Paolo Carlini  <pcarlini@unitus.it>
            Nathan C. Myers  <ncm-nospam@cantrip.org>

	* include/std/std_fstream.h (_M_filepos): Remove.
	(_M_reading, _M_writing): New, encode the various I/O modes:
	'read', 'write' and 'uncommitted'.
	(sync): If there is something to flush, do it, then go to
	'uncommitted' mode.
	* include/bits/fstream.tcc (_M_set_buffer): Overhaul to deal
	with three different cases: __off > 0 (upon underflow),
	__off == 0 (upon overflow), __off == -1 (upon open, setbuf,
	seekoff/pos).
	(_M_underflow): Don't call overflow, set _M_reading to true
	on success, tweak.
	(pbackfail): Set _M_reading to true on pback creation, tweak.
	(overflow): Don't seek, deal with overflow in 'uncommitted' mode,
	set _M_writing to true on success, tweak.
	(seekoff): Simplify, set _M_reading, _M_writing to false, call
	_M_set_buffer(-1) ('uncommitted').
	(open, close, setbuf): Set _M_reading, _M_writing to false and
	call _M_set_buffer(-1), tweak.
	(basic_filebuf): Don't set _M_buf_unified.
	(_M_destroy_internal_buffer): Don't call setg and setp.
	* include/ext/stdio_filebuf.h (stdio_filebuf): Use _M_reading,
	_M_writing and _M_set_buffer(-1).
	* include/std/std_streambuf.h (_M_move_out_cur, _M_move_in_cur,
	_M_out_lim, _M_buf_unified): Remove.
	(basic_streambuf): Don't set _M_out_lim and _M_buf_unified.
	(setp): Don't set _M_out_lim.
	* testsuite/27_io/basic_filebuf/sbumpc/char/1-io.cc: Fix for
	the new logic ('read', 'write' and 'uncommitted' modes): e.g.,
	upon open the mode is 'uncommitted' and therefore the put area
	pointers are null.
	* testsuite/27_io/basic_filebuf/sbumpc/char/1-out.cc: Ditto.
	* testsuite/27_io/basic_filebuf/seekoff/char/3-io.cc: Ditto.
	* testsuite/27_io/basic_filebuf/seekpos/char/3-io.cc: Ditto.
	* testsuite/27_io/basic_filebuf/setbuf/char/1.cc: Ditto.
	* testsuite/27_io/basic_filebuf/sgetc/char/1-io.cc: Ditto.
	* testsuite/27_io/basic_filebuf/sgetc/char/1-out.cc: Ditto.
	* testsuite/27_io/basic_filebuf/sgetn/char/1-io.cc: Ditto.
	* testsuite/27_io/basic_filebuf/sgetn/char/1-out.cc: Ditto.
	* testsuite/27_io/basic_filebuf/snextc/char/1-io.cc: Ditto.
	* testsuite/27_io/basic_filebuf/snextc/char/1-out.cc: Ditto.
	* testsuite/27_io/basic_filebuf/sputbackc/char/1-io.cc: Ditto.
	* testsuite/27_io/basic_filebuf/sputbackc/char/1-out.cc: Ditto.
	* testsuite/27_io/basic_filebuf/sputc/char/1-io.cc: Ditto.
	* testsuite/27_io/basic_filebuf/sputc/char/1-out.cc: Ditto.
	* testsuite/27_io/basic_filebuf/sputc/char/9701-2.cc: Ditto.
	* testsuite/27_io/basic_filebuf/sputn/char/1-io.cc: Ditto.
	* testsuite/27_io/basic_filebuf/sputn/char/1-out.cc: Ditto.
	* testsuite/27_io/basic_filebuf/sputn/char/9701-1.cc: Ditto.
	* testsuite/27_io/basic_filebuf/sungetc/char/1-io.cc: Ditto.
	* testsuite/27_io/basic_filebuf/sungetc/char/1-out.cc: Ditto.

	* include/bits/fstream.tcc (showmanyc): Use only the
	documented derivation interface to basic_streambuf (gptr(),
	setg(), etc.) to work right with user specializations.
	* include/bits/streambuf.tcc (sbumpc, sputbackc, sungetc,
	sputc, xsgetn, xsputn, __copy_streambufs): Likewise.
	* include/std/std_streambuf.h (in_avail, sgetc, uflow, stossc):
	Likewise.
	* include/std/std_fstream.h (_M_create_pback, _M_destroy_pback,
	xsgetn): Likewise.

Co-Authored-By: Nathan C. Myers <ncm-nospam@cantrip.org>

From-SVN: r68420
parent cebebe72
2003-06-24 Paolo Carlini <pcarlini@unitus.it>
Nathan C. Myers <ncm-nospam@cantrip.org>
* include/std/std_fstream.h (_M_filepos): Remove.
(_M_reading, _M_writing): New, encode the various I/O modes:
'read', 'write' and 'uncommitted'.
(sync): If there is something to flush, do it, then go to
'uncommitted' mode.
* include/bits/fstream.tcc (_M_set_buffer): Overhaul to deal
with three different cases: __off > 0 (upon underflow),
__off == 0 (upon overflow), __off == -1 (upon open, setbuf,
seekoff/pos).
(_M_underflow): Don't call overflow, set _M_reading to true
on success, tweak.
(pbackfail): Set _M_reading to true on pback creation, tweak.
(overflow): Don't seek, deal with overflow in 'uncommitted' mode,
set _M_writing to true on success, tweak.
(seekoff): Simplify, set _M_reading, _M_writing to false, call
_M_set_buffer(-1) ('uncommitted').
(open, close, setbuf): Set _M_reading, _M_writing to false and
call _M_set_buffer(-1), tweak.
(basic_filebuf): Don't set _M_buf_unified.
(_M_destroy_internal_buffer): Don't call setg and setp.
* include/ext/stdio_filebuf.h (stdio_filebuf): Use _M_reading,
_M_writing and _M_set_buffer(-1).
* include/std/std_streambuf.h (_M_move_out_cur, _M_move_in_cur,
_M_out_lim, _M_buf_unified): Remove.
(basic_streambuf): Don't set _M_out_lim and _M_buf_unified.
(setp): Don't set _M_out_lim.
* testsuite/27_io/basic_filebuf/sbumpc/char/1-io.cc: Fix for
the new logic ('read', 'write' and 'uncommitted' modes): e.g.,
upon open the mode is 'uncommitted' and therefore the put area
pointers are null.
* testsuite/27_io/basic_filebuf/sbumpc/char/1-out.cc: Ditto.
* testsuite/27_io/basic_filebuf/seekoff/char/3-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/seekpos/char/3-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/setbuf/char/1.cc: Ditto.
* testsuite/27_io/basic_filebuf/sgetc/char/1-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/sgetc/char/1-out.cc: Ditto.
* testsuite/27_io/basic_filebuf/sgetn/char/1-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/sgetn/char/1-out.cc: Ditto.
* testsuite/27_io/basic_filebuf/snextc/char/1-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/snextc/char/1-out.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputbackc/char/1-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputbackc/char/1-out.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputc/char/1-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputc/char/1-out.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputc/char/9701-2.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputn/char/1-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputn/char/1-out.cc: Ditto.
* testsuite/27_io/basic_filebuf/sputn/char/9701-1.cc: Ditto.
* testsuite/27_io/basic_filebuf/sungetc/char/1-io.cc: Ditto.
* testsuite/27_io/basic_filebuf/sungetc/char/1-out.cc: Ditto.
* include/bits/fstream.tcc (showmanyc): Use only the
documented derivation interface to basic_streambuf (gptr(),
setg(), etc.) to work right with user specializations.
* include/bits/streambuf.tcc (sbumpc, sputbackc, sungetc,
sputc, xsgetn, xsputn, __copy_streambufs): Likewise.
* include/std/std_streambuf.h (in_avail, sgetc, uflow, stossc):
Likewise.
* include/std/std_fstream.h (_M_create_pback, _M_destroy_pback,
xsgetn): Likewise.
2003-06-23 Loren J. Rittle <ljrittle@acm.org> 2003-06-23 Loren J. Rittle <ljrittle@acm.org>
* configure.host (freebsd*): Set abi_baseline_pair. * configure.host (freebsd*): Set abi_baseline_pair.
......
...@@ -45,10 +45,10 @@ namespace std ...@@ -45,10 +45,10 @@ namespace std
sbumpc() sbumpc()
{ {
int_type __ret; int_type __ret;
if (_M_in_cur < _M_in_end) if (this->gptr() < this->egptr())
{ {
__ret = traits_type::to_int_type(*this->_M_in_cur); __ret = traits_type::to_int_type(*this->gptr());
_M_move_in_cur(1); this->gbump(1);
} }
else else
__ret = this->uflow(); __ret = this->uflow();
...@@ -61,13 +61,13 @@ namespace std ...@@ -61,13 +61,13 @@ namespace std
sputbackc(char_type __c) sputbackc(char_type __c)
{ {
int_type __ret; int_type __ret;
const bool __testpos = _M_in_beg < _M_in_cur; const bool __testpos = this->eback() < this->gptr();
if (!__testpos || !traits_type::eq(__c, this->_M_in_cur[-1])) if (!__testpos || !traits_type::eq(__c, this->gptr()[-1]))
__ret = this->pbackfail(traits_type::to_int_type(__c)); __ret = this->pbackfail(traits_type::to_int_type(__c));
else else
{ {
_M_move_in_cur(-1); this->gbump(-1);
__ret = traits_type::to_int_type(*this->_M_in_cur); __ret = traits_type::to_int_type(*this->gptr());
} }
return __ret; return __ret;
} }
...@@ -78,10 +78,10 @@ namespace std ...@@ -78,10 +78,10 @@ namespace std
sungetc() sungetc()
{ {
int_type __ret; int_type __ret;
if (_M_in_beg < _M_in_cur) if (this->eback() < this->gptr())
{ {
_M_move_in_cur(-1); this->gbump(-1);
__ret = traits_type::to_int_type(*_M_in_cur); __ret = traits_type::to_int_type(*this->gptr());
} }
else else
__ret = this->pbackfail(); __ret = this->pbackfail();
...@@ -94,10 +94,10 @@ namespace std ...@@ -94,10 +94,10 @@ namespace std
sputc(char_type __c) sputc(char_type __c)
{ {
int_type __ret; int_type __ret;
if (_M_out_cur < _M_out_end) if (this->pptr() < this->epptr())
{ {
*_M_out_cur = __c; *this->pptr() = __c;
_M_move_out_cur(1); this->pbump(1);
__ret = traits_type::to_int_type(__c); __ret = traits_type::to_int_type(__c);
} }
else else
...@@ -113,15 +113,15 @@ namespace std ...@@ -113,15 +113,15 @@ namespace std
streamsize __ret = 0; streamsize __ret = 0;
while (__ret < __n) while (__ret < __n)
{ {
const size_t __buf_len = _M_in_end - _M_in_cur; const size_t __buf_len = this->egptr() - this->gptr();
if (__buf_len) if (__buf_len)
{ {
const size_t __remaining = __n - __ret; const size_t __remaining = __n - __ret;
const size_t __len = std::min(__buf_len, __remaining); const size_t __len = std::min(__buf_len, __remaining);
traits_type::copy(__s, _M_in_cur, __len); traits_type::copy(__s, this->gptr(), __len);
__ret += __len; __ret += __len;
__s += __len; __s += __len;
_M_move_in_cur(__len); this->gbump(__len);
} }
if (__ret < __n) if (__ret < __n)
...@@ -147,15 +147,15 @@ namespace std ...@@ -147,15 +147,15 @@ namespace std
streamsize __ret = 0; streamsize __ret = 0;
while (__ret < __n) while (__ret < __n)
{ {
const size_t __buf_len = _M_out_end - _M_out_cur; const size_t __buf_len = this->epptr() - this->pptr();
if (__buf_len) if (__buf_len)
{ {
const size_t __remaining = __n - __ret; const size_t __remaining = __n - __ret;
const size_t __len = std::min(__buf_len, __remaining); const size_t __len = std::min(__buf_len, __remaining);
traits_type::copy(_M_out_cur, __s, __len); traits_type::copy(this->pptr(), __s, __len);
__ret += __len; __ret += __len;
__s += __len; __s += __len;
_M_move_out_cur(__len); this->pbump(__len);
} }
if (__ret < __n) if (__ret < __n)
...@@ -189,12 +189,12 @@ namespace std ...@@ -189,12 +189,12 @@ namespace std
typename _Traits::int_type __c = __sbin->sgetc(); typename _Traits::int_type __c = __sbin->sgetc();
while (!_Traits::eq_int_type(__c, _Traits::eof())) while (!_Traits::eq_int_type(__c, _Traits::eof()))
{ {
const size_t __n = __sbin->_M_in_end - __sbin->_M_in_cur; const size_t __n = __sbin->egptr() - __sbin->gptr();
if (__n > 1) if (__n > 1)
{ {
const size_t __wrote = __sbout->sputn(__sbin->_M_in_cur, const size_t __wrote = __sbout->sputn(__sbin->gptr(),
__n); __n);
__sbin->_M_move_in_cur(__wrote); __sbin->gbump(__wrote);
__ret += __wrote; __ret += __wrote;
if (__wrote < __n) if (__wrote < __n)
break; break;
......
...@@ -127,7 +127,9 @@ namespace __gnu_cxx ...@@ -127,7 +127,9 @@ namespace __gnu_cxx
this->_M_mode = __mode; this->_M_mode = __mode;
this->_M_buf_size = __size; this->_M_buf_size = __size;
_M_allocate_internal_buffer(); _M_allocate_internal_buffer();
_M_set_buffer(0); this->_M_reading = false;
this->_M_writing = false;
_M_set_buffer(-1);
} }
} }
...@@ -142,7 +144,9 @@ namespace __gnu_cxx ...@@ -142,7 +144,9 @@ namespace __gnu_cxx
this->_M_mode = __mode; this->_M_mode = __mode;
this->_M_buf_size = __size; this->_M_buf_size = __size;
_M_allocate_internal_buffer(); _M_allocate_internal_buffer();
_M_set_buffer(0); this->_M_reading = false;
this->_M_writing = false;
_M_set_buffer(-1);
} }
} }
} // namespace __gnu_cxx } // namespace __gnu_cxx
......
...@@ -137,19 +137,18 @@ namespace std ...@@ -137,19 +137,18 @@ namespace std
* @endif * @endif
*/ */
bool _M_buf_allocated; bool _M_buf_allocated;
// _M_reading == false && _M_writing == false for 'uncommitted' mode;
// _M_reading == true for 'read' mode;
// _M_writing == true for 'write' mode;
//
// NB: _M_reading == true && _M_writing == true is unused.
bool _M_reading;
bool _M_writing;
// XXX Needed? // XXX Needed?
bool _M_last_overflowed; bool _M_last_overflowed;
// The position in the buffer corresponding to the external file
// pointer.
/**
* @if maint
* @doctodo
* @endif
*/
char_type* _M_filepos;
//@{ //@{
/** /**
* @if maint * @if maint
...@@ -175,8 +174,8 @@ namespace std ...@@ -175,8 +174,8 @@ namespace std
{ {
if (!_M_pback_init) if (!_M_pback_init)
{ {
_M_pback_cur_save = this->_M_in_cur; _M_pback_cur_save = this->gptr();
_M_pback_end_save = this->_M_in_end; _M_pback_end_save = this->egptr();
this->setg(&_M_pback, &_M_pback, &_M_pback + 1); this->setg(&_M_pback, &_M_pback, &_M_pback + 1);
_M_pback_init = true; _M_pback_init = true;
} }
...@@ -191,7 +190,7 @@ namespace std ...@@ -191,7 +190,7 @@ namespace std
if (_M_pback_init) if (_M_pback_init)
{ {
// Length _M_in_cur moved in the pback buffer. // Length _M_in_cur moved in the pback buffer.
_M_pback_cur_save += this->_M_in_cur != this->_M_in_beg; _M_pback_cur_save += this->gptr() != this->eback();
this->setg(this->_M_buf, _M_pback_cur_save, _M_pback_end_save); this->setg(this->_M_buf, _M_pback_cur_save, _M_pback_end_save);
_M_pback_init = false; _M_pback_init = false;
} }
...@@ -365,23 +364,23 @@ namespace std ...@@ -365,23 +364,23 @@ namespace std
sync() sync()
{ {
int __ret = 0; int __ret = 0;
const bool __testput = this->_M_out_beg < this->_M_out_lim;
// Make sure that the internal buffer resyncs its idea of // Make sure that the internal buffer resyncs its idea of
// the file position with the external file. // the file position with the external file.
if (__testput) // NB: _M_file.sync() will be called within.
if (this->pbase() < this->pptr())
{ {
// Need to restore current position after the write. int_type __tmp = this->overflow();
const off_type __off = this->_M_out_cur - this->_M_out_lim; if (traits_type::eq_int_type(__tmp, traits_type::eof()))
// _M_file.sync() will be called within.
if (traits_type::eq_int_type(this->overflow(), traits_type::eof()))
__ret = -1; __ret = -1;
else if (__off) else
_M_file.seekoff(__off, ios_base::cur); {
_M_set_buffer(-1);
_M_reading = false;
_M_writing = false;
}
} }
else
_M_file.sync();
_M_last_overflowed = false; _M_last_overflowed = false;
return __ret; return __ret;
} }
...@@ -398,9 +397,10 @@ namespace std ...@@ -398,9 +397,10 @@ namespace std
streamsize __ret = 0; streamsize __ret = 0;
if (this->_M_pback_init) if (this->_M_pback_init)
{ {
if (__n && this->_M_in_cur == this->_M_in_beg) if (__n && this->gptr() == this->eback())
{ {
*__s++ = *this->_M_in_cur++; *__s++ = *this->gptr();
this->gbump(1);
__ret = 1; __ret = 1;
} }
_M_destroy_pback(); _M_destroy_pback();
...@@ -427,10 +427,13 @@ namespace std ...@@ -427,10 +427,13 @@ namespace std
_M_output_unshift(); _M_output_unshift();
// This function sets the pointers of the internal buffer, both get // This function sets the pointers of the internal buffer, both get
// and put areas. Typically, __off == _M_in_end - _M_in_beg upon // and put areas. Typically:
// _M_underflow; __off == 0 upon overflow, seekoff, open, setbuf. //
// __off == egptr() - eback() upon underflow/uflow ('read' mode);
// __off == 0 upon overflow ('write' mode);
// __off == -1 upon open, setbuf, seekoff/pos ('uncommitted' mode).
// //
// NB: _M_out_end - _M_out_beg == _M_buf_size - 1, since _M_buf_size // NB: epptr() - pbase() == _M_buf_size - 1, since _M_buf_size
// reflects the actual allocated memory and the last cell is reserved // reflects the actual allocated memory and the last cell is reserved
// for the overflow char of a full put area. // for the overflow char of a full put area.
void void
...@@ -439,14 +442,15 @@ namespace std ...@@ -439,14 +442,15 @@ namespace std
const bool __testin = this->_M_mode & ios_base::in; const bool __testin = this->_M_mode & ios_base::in;
const bool __testout = this->_M_mode & ios_base::out; const bool __testout = this->_M_mode & ios_base::out;
if (__testin) if (__testin && __off > 0)
this->setg(this->_M_buf, this->_M_buf, this->_M_buf + __off); this->setg(this->_M_buf, this->_M_buf, this->_M_buf + __off);
if (__testout && this->_M_buf_size > 1) else
{ this->setg(this->_M_buf, this->_M_buf, this->_M_buf);
this->setp(this->_M_buf, this->_M_buf + this->_M_buf_size - 1);
this->_M_out_lim += __off; if (__testout && __off == 0 && this->_M_buf_size > 1 )
} this->setp(this->_M_buf, this->_M_buf + this->_M_buf_size - 1);
_M_filepos = this->_M_buf + __off; else
this->setp(NULL, NULL);
} }
}; };
......
...@@ -176,25 +176,6 @@ namespace std ...@@ -176,25 +176,6 @@ namespace std
char_type* _M_out_cur; // Current put area. char_type* _M_out_cur; // Current put area.
char_type* _M_out_end; // End of put area. char_type* _M_out_end; // End of put area.
//@{
/**
* @if maint
* setp (and _M_set_buffer(0) in basic_filebuf) set it equal to
* _M_out_beg, then at each put operation it may be moved
* forward (toward _M_out_end) by _M_move_out_cur.
* @endif
*/
char_type* _M_out_lim; // End limit of used put area.
//@}
/**
* @if maint
* True iff _M_in_* and _M_out_* buffers should always point to
* the same place. True for fstreams, false for sstreams.
* @endif
*/
bool _M_buf_unified;
/** /**
* @if maint * @if maint
* Place to stash in || out || in | out settings for current streambuf. * Place to stash in || out || in | out settings for current streambuf.
...@@ -216,50 +197,11 @@ namespace std ...@@ -216,50 +197,11 @@ namespace std
*/ */
fpos<__state_type> _M_pos; fpos<__state_type> _M_pos;
// Correctly sets the _M_in_cur pointer, and bumps the
// _M_out_cur pointer as well if necessary.
void
_M_move_in_cur(off_type __n) // argument needs to be +-
{
const bool __testout = _M_out_cur;
_M_in_cur += __n;
if (__testout && _M_buf_unified)
_M_out_cur += __n;
}
// Correctly sets the _M_out_cur pointer, and bumps the
// appropriate _M_out_lim and _M_in_end pointers as well. Necessary
// for the un-tied stringbufs, in in|out mode.
// Invariant:
// __n + _M_out_[cur, lim] <= _M_out_end
// Assuming all _M_out_[beg, cur, lim] pointers are operating on
// the same range:
// _M_out_beg <= _M_*_ <= _M_out_end
void
_M_move_out_cur(off_type __n) // argument needs to be +-
{
_M_out_cur += __n;
if (__builtin_expect(_M_buf_unified, false))
{
const bool __testin = _M_in_cur;
if (__testin)
_M_in_cur += __n;
if (_M_out_cur > _M_out_lim)
{
_M_out_lim = _M_out_cur;
// NB: in | out buffers drag the _M_in_end pointer along...
if (__testin)
_M_in_end += __n;
}
}
}
public: public:
/// Destructor deallocates no buffer space. /// Destructor deallocates no buffer space.
virtual virtual
~basic_streambuf() ~basic_streambuf()
{ {
_M_buf_unified = false;
_M_mode = ios_base::openmode(0); _M_mode = ios_base::openmode(0);
} }
...@@ -330,7 +272,7 @@ namespace std ...@@ -330,7 +272,7 @@ namespace std
streamsize streamsize
in_avail() in_avail()
{ {
const streamsize __ret = _M_in_end - _M_in_cur; const streamsize __ret = this->egptr() - this->gptr();
return __ret ? __ret : this->showmanyc(); return __ret ? __ret : this->showmanyc();
} }
...@@ -373,8 +315,8 @@ namespace std ...@@ -373,8 +315,8 @@ namespace std
sgetc() sgetc()
{ {
int_type __ret; int_type __ret;
if (_M_in_cur < _M_in_end) if (this->gptr() < this->egptr())
__ret = traits_type::to_int_type(*this->_M_in_cur); __ret = traits_type::to_int_type(*this->gptr());
else else
__ret = this->underflow(); __ret = this->underflow();
return __ret; return __ret;
...@@ -461,7 +403,6 @@ namespace std ...@@ -461,7 +403,6 @@ namespace std
basic_streambuf() basic_streambuf()
: _M_in_beg(0), _M_in_cur(0), _M_in_end(0), : _M_in_beg(0), _M_in_cur(0), _M_in_end(0),
_M_out_beg(0), _M_out_cur(0), _M_out_end(0), _M_out_beg(0), _M_out_cur(0), _M_out_end(0),
_M_out_lim(0), _M_buf_unified(false),
_M_mode(ios_base::openmode(0)),_M_buf_locale(locale()) _M_mode(ios_base::openmode(0)),_M_buf_locale(locale())
{ } { }
...@@ -553,7 +494,7 @@ namespace std ...@@ -553,7 +494,7 @@ namespace std
void void
setp(char_type* __pbeg, char_type* __pend) setp(char_type* __pbeg, char_type* __pend)
{ {
_M_out_beg = _M_out_cur = _M_out_lim = __pbeg; _M_out_beg = _M_out_cur = __pbeg;
_M_out_end = __pend; _M_out_end = __pend;
} }
...@@ -703,10 +644,10 @@ namespace std ...@@ -703,10 +644,10 @@ namespace std
int_type __ret = traits_type::eof(); int_type __ret = traits_type::eof();
const bool __testeof = traits_type::eq_int_type(this->underflow(), const bool __testeof = traits_type::eq_int_type(this->underflow(),
__ret); __ret);
if (!__testeof && _M_in_cur < _M_in_end) if (!__testeof && this->gptr() < this->egptr())
{ {
__ret = traits_type::to_int_type(*_M_in_cur); __ret = traits_type::to_int_type(*this->gptr());
++_M_in_cur; this->gbump(1);
} }
return __ret; return __ret;
} }
...@@ -786,8 +727,8 @@ namespace std ...@@ -786,8 +727,8 @@ namespace std
void void
stossc() stossc()
{ {
if (_M_in_cur < _M_in_end) if (this->gptr() < this->egptr())
++_M_in_cur; this->gbump(1);
else else
this->uflow(); this->uflow();
} }
......
...@@ -46,11 +46,11 @@ void test05() ...@@ -46,11 +46,11 @@ void test05()
{ {
constraint_filebuf fb_03; constraint_filebuf fb_03;
fb_03.open(name_03, ios_base::out | ios_base::in | ios_base::trunc); fb_03.open(name_03, ios_base::out | ios_base::in | ios_base::trunc);
VERIFY( fb_03.write_position() ); VERIFY( !fb_03.write_position() );
VERIFY( !fb_03.read_position() ); VERIFY( !fb_03.read_position() );
int_type c5 = fb_03.sbumpc(); int_type c5 = fb_03.sbumpc();
VERIFY( c5 == traits_type::eof() ); VERIFY( c5 == traits_type::eof() );
VERIFY( fb_03.write_position() ); VERIFY( !fb_03.write_position() );
VERIFY( !fb_03.read_position() ); VERIFY( !fb_03.read_position() );
} }
...@@ -58,9 +58,9 @@ void test05() ...@@ -58,9 +58,9 @@ void test05()
{ {
constraint_filebuf fb_01; constraint_filebuf fb_01;
fb_01.open(name_01, ios_base::in | ios_base::out); fb_01.open(name_01, ios_base::in | ios_base::out);
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
int_type c1 = fb_01.sbumpc(); int_type c1 = fb_01.sbumpc();
VERIFY( c1 == '/' ); VERIFY( c1 == '/' );
int_type c3 = fb_01.sbumpc(); int_type c3 = fb_01.sbumpc();
VERIFY( c3 == '/' ); VERIFY( c3 == '/' );
...@@ -80,7 +80,7 @@ void test05() ...@@ -80,7 +80,7 @@ void test05()
VERIFY( c2 == '9' ); VERIFY( c2 == '9' );
VERIFY( c3 == '0' ); VERIFY( c3 == '0' );
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
VERIFY( fb_01.read_position() ); VERIFY( fb_01.read_position() );
} }
} }
......
...@@ -45,13 +45,13 @@ void test05() ...@@ -45,13 +45,13 @@ void test05()
{ {
constraint_filebuf fb_02; constraint_filebuf fb_02;
fb_02.open(name_02, ios_base::out | ios_base::trunc); fb_02.open(name_02, ios_base::out | ios_base::trunc);
VERIFY( fb_02.write_position() ); VERIFY( !fb_02.write_position() );
VERIFY( !fb_02.read_position() ); VERIFY( !fb_02.read_position() );
int_type c2 = fb_02.sbumpc(); int_type c2 = fb_02.sbumpc();
VERIFY( c2 == traits_type::eof() ); VERIFY( c2 == traits_type::eof() );
int_type c4 = fb_02.sbumpc(); int_type c4 = fb_02.sbumpc();
VERIFY( c4 == traits_type::eof() ); VERIFY( c4 == traits_type::eof() );
VERIFY( fb_02.write_position() ); VERIFY( !fb_02.write_position() );
VERIFY( !fb_02.read_position() ); VERIFY( !fb_02.read_position() );
} }
} }
......
...@@ -59,7 +59,7 @@ void test05() ...@@ -59,7 +59,7 @@ void test05()
{ {
constraint_filebuf fb_03; constraint_filebuf fb_03;
fb_03.open(name_01, ios_base::out | ios_base::in); fb_03.open(name_01, ios_base::out | ios_base::in);
VERIFY( fb_03.write_position() ); VERIFY( !fb_03.write_position() );
VERIFY( !fb_03.read_position() ); VERIFY( !fb_03.read_position() );
// 27filebuf-3.txt = bd23456789:;<=>?... // 27filebuf-3.txt = bd23456789:;<=>?...
//beg //beg
...@@ -111,7 +111,7 @@ void test05() ...@@ -111,7 +111,7 @@ void test05()
fb_03.pubsync(); fb_03.pubsync();
c3 = fb_03.sgetc(); c3 = fb_03.sgetc();
VERIFY( c1 == c3 ); VERIFY( c1 == c3 );
VERIFY( fb_03.write_position() ); VERIFY( !fb_03.write_position() );
VERIFY( fb_03.read_position() ); VERIFY( fb_03.read_position() );
} }
} }
......
...@@ -60,7 +60,7 @@ void test05() ...@@ -60,7 +60,7 @@ void test05()
{ {
constraint_filebuf fb_03; constraint_filebuf fb_03;
fb_03.open(name_01, ios_base::out | ios_base::in); fb_03.open(name_01, ios_base::out | ios_base::in);
VERIFY( fb_03.write_position() ); VERIFY( !fb_03.write_position() );
VERIFY( !fb_03.read_position() ); VERIFY( !fb_03.read_position() );
pt_1 = fb_03.pubseekoff(78, ios_base::beg); pt_1 = fb_03.pubseekoff(78, ios_base::beg);
off_1 = pt_1; off_1 = pt_1;
...@@ -84,7 +84,7 @@ void test05() ...@@ -84,7 +84,7 @@ void test05()
VERIFY( off_1 > off_2 ); VERIFY( off_1 > off_2 );
fb_03.sputn("\nof the wonderful things he does!!\nok", 37); fb_03.sputn("\nof the wonderful things he does!!\nok", 37);
fb_03.pubsync(); fb_03.pubsync();
VERIFY( fb_03.write_position() ); VERIFY( !fb_03.write_position() );
VERIFY( !fb_03.read_position() ); VERIFY( !fb_03.read_position() );
fb_03.close(); fb_03.close();
VERIFY( !fb_03.is_open() ); VERIFY( !fb_03.is_open() );
......
...@@ -79,7 +79,7 @@ void test05() ...@@ -79,7 +79,7 @@ void test05()
// setbuf // setbuf
// pubsetbuf(char_type* s, streamsize n) // pubsetbuf(char_type* s, streamsize n)
f_tmp.pubsetbuf(0, 0); f_tmp.pubsetbuf(0, 0);
VERIFY( !f_tmp.check_pointers() ); VERIFY( f_tmp.check_pointers() );
} }
} }
......
...@@ -48,13 +48,13 @@ void test05() ...@@ -48,13 +48,13 @@ void test05()
{ {
constraint_filebuf fb_03; // in | out constraint_filebuf fb_03; // in | out
fb_03.open(name_03, ios::out | ios::in | ios::trunc); fb_03.open(name_03, ios::out | ios::in | ios::trunc);
VERIFY( fb_03.write_position() ); VERIFY( !fb_03.write_position() );
VERIFY( !fb_03.read_position() ); VERIFY( !fb_03.read_position() );
c1 = fb_03.sgetc(); c1 = fb_03.sgetc();
c2 = fb_03.sbumpc(); c2 = fb_03.sbumpc();
VERIFY( c1 == traits_type::eof() ); VERIFY( c1 == traits_type::eof() );
VERIFY( c1 == c2 ); VERIFY( c1 == c2 );
VERIFY( fb_03.write_position() ); VERIFY( !fb_03.write_position() );
VERIFY( !fb_03.read_position() ); VERIFY( !fb_03.read_position() );
} }
...@@ -62,7 +62,7 @@ void test05() ...@@ -62,7 +62,7 @@ void test05()
{ {
constraint_filebuf fb_01; // in constraint_filebuf fb_01; // in
fb_01.open(name_01, ios::in | ios::out); fb_01.open(name_01, ios::in | ios::out);
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
c1 = fb_01.sgetc(); c1 = fb_01.sgetc();
VERIFY( c1 == '/' ); VERIFY( c1 == '/' );
c2 = fb_01.sgetc(); c2 = fb_01.sgetc();
...@@ -74,7 +74,7 @@ void test05() ...@@ -74,7 +74,7 @@ void test05()
VERIFY( c1 == '/' ); VERIFY( c1 == '/' );
VERIFY( c2 == ' ' ); VERIFY( c2 == ' ' );
VERIFY( c3 == ' ' ); VERIFY( c3 == ' ' );
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
VERIFY( fb_01.read_position() ); VERIFY( fb_01.read_position() );
} }
} }
......
...@@ -47,7 +47,7 @@ void test05() ...@@ -47,7 +47,7 @@ void test05()
{ {
constraint_filebuf fb_02; // out constraint_filebuf fb_02; // out
fb_02.open(name_02, ios::out | ios::trunc); fb_02.open(name_02, ios::out | ios::trunc);
VERIFY( fb_02.write_position() ); VERIFY( !fb_02.write_position() );
VERIFY( !fb_02.read_position() ); VERIFY( !fb_02.read_position() );
c1 = fb_02.sgetc(); c1 = fb_02.sgetc();
VERIFY( c1 == traits_type::eof() ); VERIFY( c1 == traits_type::eof() );
...@@ -57,7 +57,7 @@ void test05() ...@@ -57,7 +57,7 @@ void test05()
c1 = fb_02.sbumpc(); c1 = fb_02.sbumpc();
c2 = fb_02.sgetc(); c2 = fb_02.sgetc();
VERIFY( c1 == c2 ); VERIFY( c1 == c2 );
VERIFY( fb_02.write_position() ); VERIFY( !fb_02.write_position() );
VERIFY( !fb_02.read_position() ); VERIFY( !fb_02.read_position() );
} }
} }
......
...@@ -55,11 +55,11 @@ void test05() ...@@ -55,11 +55,11 @@ void test05()
{ {
constraint_filebuf fb_03; constraint_filebuf fb_03;
fb_03.open(name_03, ios_base::out | ios_base::in | ios_base::trunc); fb_03.open(name_03, ios_base::out | ios_base::in | ios_base::trunc);
VERIFY( fb_03.write_position() ); VERIFY( !fb_03.write_position() );
VERIFY( !fb_03.read_position() ); VERIFY( !fb_03.read_position() );
strmsz_1 = fb_03.sgetn(carray1, 10); strmsz_1 = fb_03.sgetn(carray1, 10);
VERIFY( strmsz_1 == 0 ); VERIFY( strmsz_1 == 0 );
VERIFY( fb_03.write_position() ); VERIFY( !fb_03.write_position() );
VERIFY( !fb_03.read_position() ); VERIFY( !fb_03.read_position() );
} }
...@@ -70,7 +70,7 @@ void test05() ...@@ -70,7 +70,7 @@ void test05()
// to trigger the same underflow situation everywhere. // to trigger the same underflow situation everywhere.
fb_01.pubsetbuf(buffer, 8192); fb_01.pubsetbuf(buffer, 8192);
fb_01.open(name_01, ios_base::in | ios_base::out); fb_01.open(name_01, ios_base::in | ios_base::out);
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
strmsz_1 = fb_01.in_avail(); strmsz_1 = fb_01.in_avail();
strmsz_2 = fb_01.sgetn(carray1, 10); strmsz_2 = fb_01.sgetn(carray1, 10);
VERIFY( strmsz_2 == 10 ); VERIFY( strmsz_2 == 10 );
...@@ -87,7 +87,7 @@ void test05() ...@@ -87,7 +87,7 @@ void test05()
VERIFY( strmsz_1 > 0 ); VERIFY( strmsz_1 > 0 );
strmsz_2 = fb_01.sgetn(carray2, strmsz_1 + 5); strmsz_2 = fb_01.sgetn(carray2, strmsz_1 + 5);
VERIFY( strmsz_1 == strmsz_2 ); //at the end of the actual file VERIFY( strmsz_1 == strmsz_2 ); //at the end of the actual file
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
VERIFY( !fb_01.read_position() ); VERIFY( !fb_01.read_position() );
} }
} }
......
...@@ -53,7 +53,7 @@ void test05() ...@@ -53,7 +53,7 @@ void test05()
{ {
constraint_filebuf fb_02; constraint_filebuf fb_02;
fb_02.open(name_02, ios_base::out | ios_base::trunc); fb_02.open(name_02, ios_base::out | ios_base::trunc);
VERIFY( fb_02.write_position() ); VERIFY( !fb_02.write_position() );
VERIFY( !fb_02.read_position() ); VERIFY( !fb_02.read_position() );
strmsz_2 = fb_02.in_avail(); strmsz_2 = fb_02.in_avail();
strmsz_2 = fb_02.sgetn(carray2, 10); strmsz_2 = fb_02.sgetn(carray2, 10);
...@@ -66,7 +66,7 @@ void test05() ...@@ -66,7 +66,7 @@ void test05()
VERIFY( strmsz_2 == 0 ); VERIFY( strmsz_2 == 0 );
c4 = fb_02.sgetc(); c4 = fb_02.sgetc();
VERIFY( c4 == traits_type::eof() ); VERIFY( c4 == traits_type::eof() );
VERIFY( fb_02.write_position() ); VERIFY( !fb_02.write_position() );
VERIFY( !fb_02.read_position() ); VERIFY( !fb_02.read_position() );
} }
} }
......
...@@ -48,11 +48,11 @@ void test05() ...@@ -48,11 +48,11 @@ void test05()
{ {
constraint_filebuf fb_03; constraint_filebuf fb_03;
fb_03.open(name_03, ios_base::out | ios_base::in | ios_base::trunc); fb_03.open(name_03, ios_base::out | ios_base::in | ios_base::trunc);
VERIFY( fb_03.write_position() ); VERIFY( !fb_03.write_position() );
VERIFY( !fb_03.read_position() ); VERIFY( !fb_03.read_position() );
c3 = fb_03.snextc(); c3 = fb_03.snextc();
VERIFY( c3 == traits_type::eof() ); VERIFY( c3 == traits_type::eof() );
VERIFY( fb_03.write_position() ); VERIFY( !fb_03.write_position() );
VERIFY( !fb_03.read_position() ); VERIFY( !fb_03.read_position() );
} }
...@@ -60,7 +60,7 @@ void test05() ...@@ -60,7 +60,7 @@ void test05()
{ {
constraint_filebuf fb_01; constraint_filebuf fb_01;
fb_01.open(name_01, ios_base::in | ios_base::out); fb_01.open(name_01, ios_base::in | ios_base::out);
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
int_type c4 = fb_01.sbumpc(); int_type c4 = fb_01.sbumpc();
VERIFY( c4 == '/' ); VERIFY( c4 == '/' );
c4 = fb_01.sbumpc(); c4 = fb_01.sbumpc();
...@@ -71,7 +71,7 @@ void test05() ...@@ -71,7 +71,7 @@ void test05()
VERIFY( c1 == '9' ); VERIFY( c1 == '9' );
c4 = fb_01.sgetc(); c4 = fb_01.sgetc();
VERIFY( c4 == '9' ); VERIFY( c4 == '9' );
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
VERIFY( fb_01.read_position() ); VERIFY( fb_01.read_position() );
} }
} }
......
...@@ -48,13 +48,13 @@ void test05() ...@@ -48,13 +48,13 @@ void test05()
{ {
constraint_filebuf fb_02; constraint_filebuf fb_02;
fb_02.open(name_02, ios_base::out | ios_base::trunc); fb_02.open(name_02, ios_base::out | ios_base::trunc);
VERIFY( fb_02.write_position() ); VERIFY( !fb_02.write_position() );
VERIFY( !fb_02.read_position() ); VERIFY( !fb_02.read_position() );
c2 = fb_02.snextc(); c2 = fb_02.snextc();
VERIFY( c2 == traits_type::eof() ); VERIFY( c2 == traits_type::eof() );
c2 = fb_02.snextc(); c2 = fb_02.snextc();
VERIFY( c2 == traits_type::eof() ); VERIFY( c2 == traits_type::eof() );
VERIFY( fb_02.write_position() ); VERIFY( !fb_02.write_position() );
VERIFY( !fb_02.read_position() ); VERIFY( !fb_02.read_position() );
} }
} }
......
...@@ -50,7 +50,7 @@ void test01() ...@@ -50,7 +50,7 @@ void test01()
{ {
constraint_filebuf fb_01; constraint_filebuf fb_01;
fb_01.open(name_01, ios_base::out | ios_base::in | ios_base::trunc); fb_01.open(name_01, ios_base::out | ios_base::in | ios_base::trunc);
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
VERIFY( !fb_01.read_position() ); VERIFY( !fb_01.read_position() );
strmsz_1 = fb_01.sputn("racadabras", 10);//"abracadabras or what?" strmsz_1 = fb_01.sputn("racadabras", 10);//"abracadabras or what?"
strmsz_2 = fb_01.sputn(", i wanna reach out and", 10); strmsz_2 = fb_01.sputn(", i wanna reach out and", 10);
...@@ -90,7 +90,7 @@ void test01() ...@@ -90,7 +90,7 @@ void test01()
c3 = fb_01.sgetc(); c3 = fb_01.sgetc();
VERIFY( c3 == c2 ); VERIFY( c3 == c2 );
VERIFY( strmsz_1 + 1 == strmsz_2 ); VERIFY( strmsz_1 + 1 == strmsz_2 );
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
VERIFY( fb_01.read_position() ); VERIFY( fb_01.read_position() );
} }
} }
......
...@@ -48,7 +48,7 @@ void test01() ...@@ -48,7 +48,7 @@ void test01()
{ {
constraint_filebuf fb_01; // out constraint_filebuf fb_01; // out
fb_01.open(name_01, ios::out | ios::trunc); fb_01.open(name_01, ios::out | ios::trunc);
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
VERIFY( !fb_01.read_position() ); VERIFY( !fb_01.read_position() );
c1 = fb_01.sgetc(); c1 = fb_01.sgetc();
VERIFY( c1 == traits_type::eof() ); VERIFY( c1 == traits_type::eof() );
...@@ -58,7 +58,7 @@ void test01() ...@@ -58,7 +58,7 @@ void test01()
c1 = fb_01.sbumpc(); c1 = fb_01.sbumpc();
c2 = fb_01.sputbackc('a'); c2 = fb_01.sputbackc('a');
VERIFY( c1 == c2 ); VERIFY( c1 == c2 );
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
VERIFY( !fb_01.read_position() ); VERIFY( !fb_01.read_position() );
} }
} }
......
...@@ -52,7 +52,7 @@ void test05() ...@@ -52,7 +52,7 @@ void test05()
{ {
constraint_filebuf fb_03; constraint_filebuf fb_03;
fb_03.open(name_03, ios_base::out | ios_base::in | ios_base::trunc); fb_03.open(name_03, ios_base::out | ios_base::in | ios_base::trunc);
VERIFY( fb_03.write_position() ); VERIFY( !fb_03.write_position() );
VERIFY( !fb_03.read_position() ); VERIFY( !fb_03.read_position() );
c1 = fb_03.sputc('b'); c1 = fb_03.sputc('b');
VERIFY( c1 == 'b' ); VERIFY( c1 == 'b' );
......
...@@ -51,7 +51,7 @@ void test05() ...@@ -51,7 +51,7 @@ void test05()
{ {
constraint_filebuf fb_02; constraint_filebuf fb_02;
fb_02.open(name_02, ios_base::out | ios_base::trunc); fb_02.open(name_02, ios_base::out | ios_base::trunc);
VERIFY( fb_02.write_position() ); VERIFY( !fb_02.write_position() );
VERIFY( !fb_02.read_position() ); VERIFY( !fb_02.read_position() );
c1 = fb_02.sputc('a'); c1 = fb_02.sputc('a');
VERIFY( c1 == 'a' ); VERIFY( c1 == 'a' );
......
...@@ -55,7 +55,7 @@ void test11() ...@@ -55,7 +55,7 @@ void test11()
dfbuf_01.open(name_05, std::ios_base::out); dfbuf_01.open(name_05, std::ios_base::out);
over_called = false; over_called = false;
dfbuf_01.sputc('i'); dfbuf_01.sputc('i');
VERIFY( !over_called ); VERIFY( over_called );
over_expected = dfbuf_01.pub_epptr() == dfbuf_01.pub_pptr(); over_expected = dfbuf_01.pub_epptr() == dfbuf_01.pub_pptr();
over_called = false; over_called = false;
dfbuf_01.sputc('v'); dfbuf_01.sputc('v');
......
...@@ -50,7 +50,7 @@ void test05() ...@@ -50,7 +50,7 @@ void test05()
{ {
constraint_filebuf fb_03; constraint_filebuf fb_03;
fb_03.open(name_03, ios_base::out | ios_base::in | ios_base::trunc); fb_03.open(name_03, ios_base::out | ios_base::in | ios_base::trunc);
VERIFY( fb_03.write_position() ); VERIFY( !fb_03.write_position() );
VERIFY( !fb_03.read_position() ); VERIFY( !fb_03.read_position() );
strmsz_1 = fb_03.sputn("racadabras", 10);//"abracadabras or what?" strmsz_1 = fb_03.sputn("racadabras", 10);//"abracadabras or what?"
VERIFY( strmsz_1 == 10 ); VERIFY( strmsz_1 == 10 );
......
...@@ -49,7 +49,7 @@ void test05() ...@@ -49,7 +49,7 @@ void test05()
{ {
constraint_filebuf fb_02; constraint_filebuf fb_02;
fb_02.open(name_02, ios_base::out | ios_base::trunc); fb_02.open(name_02, ios_base::out | ios_base::trunc);
VERIFY( fb_02.write_position() ); VERIFY( !fb_02.write_position() );
VERIFY( !fb_02.read_position() ); VERIFY( !fb_02.read_position() );
strmsz_1 = fb_02.sputn("racadabras", 10); strmsz_1 = fb_02.sputn("racadabras", 10);
VERIFY( strmsz_1 == 10 ); VERIFY( strmsz_1 == 10 );
......
...@@ -59,7 +59,7 @@ void test11() ...@@ -59,7 +59,7 @@ void test11()
dfbuf_02.open(name_05, std::ios_base::out); dfbuf_02.open(name_05, std::ios_base::out);
over_called = false; over_called = false;
dfbuf_02.sputn("sonne's", 7); dfbuf_02.sputn("sonne's", 7);
VERIFY( !over_called ); VERIFY( over_called );
over_expected = dfbuf_02.pub_epptr() == dfbuf_02.pub_pptr(); over_expected = dfbuf_02.pub_epptr() == dfbuf_02.pub_pptr();
over_called = false; over_called = false;
dfbuf_02.sputn(" peak", 5); dfbuf_02.sputn(" peak", 5);
......
...@@ -50,7 +50,7 @@ void test01() ...@@ -50,7 +50,7 @@ void test01()
{ {
constraint_filebuf fb_01; constraint_filebuf fb_01;
fb_01.open(name_01, ios_base::out | ios_base::in | ios_base::trunc); fb_01.open(name_01, ios_base::out | ios_base::in | ios_base::trunc);
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
VERIFY( !fb_01.read_position() ); VERIFY( !fb_01.read_position() );
fb_01.sputc('u'); fb_01.sputc('u');
fb_01.sputc('v'); fb_01.sputc('v');
...@@ -71,7 +71,7 @@ void test01() ...@@ -71,7 +71,7 @@ void test01()
VERIFY( c1 != c2 ); VERIFY( c1 != c2 );
VERIFY( strmsz_2 != strmsz_1 ); VERIFY( strmsz_2 != strmsz_1 );
VERIFY( strmsz_2 == 1 ); VERIFY( strmsz_2 == 1 );
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
VERIFY( fb_01.read_position() ); VERIFY( fb_01.read_position() );
} }
} }
......
...@@ -48,7 +48,7 @@ void test01() ...@@ -48,7 +48,7 @@ void test01()
{ {
constraint_filebuf fb_01; // out constraint_filebuf fb_01; // out
fb_01.open(name_01, ios::out | ios::trunc); fb_01.open(name_01, ios::out | ios::trunc);
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
VERIFY( !fb_01.read_position() ); VERIFY( !fb_01.read_position() );
c1 = fb_01.sgetc(); c1 = fb_01.sgetc();
VERIFY( c1 == traits_type::eof() ); VERIFY( c1 == traits_type::eof() );
...@@ -58,7 +58,7 @@ void test01() ...@@ -58,7 +58,7 @@ void test01()
c1 = fb_01.sbumpc(); c1 = fb_01.sbumpc();
c2 = fb_01.sungetc(); c2 = fb_01.sungetc();
VERIFY( c1 == c2 ); VERIFY( c1 == c2 );
VERIFY( fb_01.write_position() ); VERIFY( !fb_01.write_position() );
VERIFY( !fb_01.read_position() ); VERIFY( !fb_01.read_position() );
} }
} }
......
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