[Patch] Fix seek to beg after grow bug

Paolo Carlini pcarlini@unitus.it
Tue Feb 18 20:07:00 GMT 2003


Hi,

the below is the fix for the problem noticed by Peter Hrenka today.
We had this code in str():

        __size_type __len = _M_string.size();

        if (this->_M_out_cur > this->_M_out_beg)
          __len = std::max(__size_type(this->_M_out_end
                           - this->_M_out_beg), __len);

which failed to compute the correct __len when _M_out_cur was
equal to _M_out_beg upon a seek to ios_base::beg.

We must check instead that _M_out_end > _M_out_beg, since
_M_out_end >= _M_out_cur and stores the current string end.

Tested x86-linux. I'd like to apply it to mainline, and, after a
little while of additional testing, 3_3 too.

Ok?

Paolo.

//////////
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_peter
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20030218/c78a3fd9/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch_peter
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20030218/c78a3fd9/attachment-0001.ksh>


More information about the Libstdc++ mailing list