Commit 1f0ef651 by Paolo Carlini Committed by Paolo Carlini

fstream.tcc (close): Clean up a bit.

2003-06-10  Paolo Carlini  <pcarlini@unitus.it>

	* include/bits/fstream.tcc (close): Clean up a bit.

	* include/bits/streambuf.tcc (sbumpc): Clean up a bit.

	* include/std/std_fstream.h (_M_destroy_pback): _M_pback_cur_save
	- the saved _M_in_cur, that is - cannot be null.
	(sync): Constify a variable.

	* include/std/std_streambuf.h: Tweak a comment.
	(in_avail): Constify a variable.

From-SVN: r67738
parent 3b1b059c
2003-06-10 Paolo Carlini <pcarlini@unitus.it>
* include/bits/fstream.tcc (close): Clean up a bit.
* include/bits/streambuf.tcc (sbumpc): Clean up a bit.
* include/std/std_fstream.h (_M_destroy_pback): _M_pback_cur_save
- the saved _M_in_cur, that is - cannot be null.
(sync): Constify a variable.
* include/std/std_streambuf.h: Tweak a comment.
(in_avail): Constify a variable.
2003-06-10 Phil Edwards <pme@gcc.gnu.org> 2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot. * docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
......
...@@ -120,13 +120,12 @@ namespace std ...@@ -120,13 +120,12 @@ namespace std
bool __testfail = false; bool __testfail = false;
try try
{ {
const int_type __eof = traits_type::eof();
const bool __testput = this->_M_out_beg < this->_M_out_lim; const bool __testput = this->_M_out_beg < this->_M_out_lim;
if (__testput if (__testput
&& traits_type::eq_int_type(this->overflow(), __eof)) && traits_type::eq_int_type(this->overflow(),
traits_type::eof()))
__testfail = true; __testfail = true;
#if 0 #if 0
// XXX not done // XXX not done
if (_M_last_overflowed) if (_M_last_overflowed)
......
...@@ -47,9 +47,8 @@ namespace std ...@@ -47,9 +47,8 @@ namespace std
int_type __ret; int_type __ret;
if (_M_in_cur < _M_in_end) if (_M_in_cur < _M_in_end)
{ {
char_type __c = *this->_M_in_cur; __ret = traits_type::to_int_type(*this->_M_in_cur);
_M_move_in_cur(1); _M_move_in_cur(1);
__ret = traits_type::to_int_type(__c);
} }
else else
__ret = this->uflow(); __ret = this->uflow();
......
...@@ -191,8 +191,7 @@ namespace std ...@@ -191,8 +191,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.
if (_M_pback_cur_save) _M_pback_cur_save += this->_M_in_cur != this->_M_in_beg;
_M_pback_cur_save += this->_M_in_cur != this->_M_in_beg;
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;
} }
...@@ -373,7 +372,7 @@ namespace std ...@@ -373,7 +372,7 @@ namespace std
if (__testput) if (__testput)
{ {
// Need to restore current position after the write. // Need to restore current position after the write.
off_type __off = this->_M_out_cur - this->_M_out_lim; const off_type __off = this->_M_out_cur - this->_M_out_lim;
// _M_file.sync() will be called within. // _M_file.sync() will be called within.
if (traits_type::eq_int_type(this->overflow(), traits_type::eof())) if (traits_type::eq_int_type(this->overflow(), traits_type::eof()))
......
...@@ -181,7 +181,7 @@ namespace std ...@@ -181,7 +181,7 @@ namespace std
* @if maint * @if maint
* setp (and _M_set_buffer(0) in basic_filebuf) set it equal to * 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 * _M_out_beg, then at each put operation it may be moved
* forward (toward _M_out_end) by _M_out_cur_move. * forward (toward _M_out_end) by _M_move_out_cur.
* @endif * @endif
*/ */
char_type* _M_out_lim; // End limit of used put area. char_type* _M_out_lim; // End limit of used put area.
...@@ -328,7 +328,7 @@ namespace std ...@@ -328,7 +328,7 @@ namespace std
streamsize streamsize
in_avail() in_avail()
{ {
streamsize __ret = _M_in_end - _M_in_cur; const streamsize __ret = _M_in_end - _M_in_cur;
return __ret ? __ret : this->showmanyc(); return __ret ? __ret : this->showmanyc();
} }
......
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