This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[Patch] Check overflow return value in _M_underflow
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: libstdc++ at gcc dot gnu dot org
- Cc: bkoz <bkoz at redhat dot com>
- Date: Tue, 10 Jun 2003 12:55:20 +0200
- Subject: [Patch] Check overflow return value in _M_underflow
Hi all, hi Benjamin,
as discussed a while ago privately, this adds the missing check.
Tested x86-linux, ok with you?
Paolo.
////////
2003-06-10 Paolo Carlini <pcarlini@unitus.it>
* include/bits/fstream.tcc (_M_underflow): Check overflow return
value; tweak slightly.
diff -prN libstdc++-v3-orig/include/bits/fstream.tcc libstdc++-v3/include/bits/fstream.tcc
*** libstdc++-v3-orig/include/bits/fstream.tcc Tue Jun 10 02:02:02 2003
--- libstdc++-v3/include/bits/fstream.tcc Tue Jun 10 12:30:12 2003
*************** namespace std
*** 193,201 ****
// fileops happen...
_M_destroy_pback();
- const size_t __buflen = this->_M_buf_size > 1
- ? this->_M_buf_size - 1 : 1;
-
if (this->_M_in_cur < this->_M_in_end)
{
__ret = traits_type::to_int_type(*this->_M_in_cur);
--- 193,198 ----
*************** namespace std
*** 205,214 ****
}
// Sync internal and external buffers.
! if (__testout && this->_M_out_beg < this->_M_out_lim)
! this->overflow();
// Get and convert input sequence.
streamsize __elen = 0;
streamsize __ilen = 0;
if (__check_facet(_M_codecvt).always_noconv())
--- 202,214 ----
}
// Sync internal and external buffers.
! if (__testout && this->_M_out_beg < this->_M_out_lim
! && traits_type::eq_int_type(this->overflow(), __ret))
! return __ret;
// Get and convert input sequence.
+ const size_t __buflen = this->_M_buf_size > 1
+ ? this->_M_buf_size - 1 : 1;
streamsize __elen = 0;
streamsize __ilen = 0;
if (__check_facet(_M_codecvt).always_noconv())