Commit e70b1b77 by Paolo Carlini Committed by Paolo Carlini

std_sstream.h (str()): Revert the best of the previous 'improvement'...

2003-05-01  Paolo Carlini  <pcarlini@unitus.it>

	* include/std/std_sstream.h (str()): Revert the best of the
	previous 'improvement', incorrect due to the COW nature of
	v3 basic_string; simplify.

From-SVN: r66357
parent f4731b64
2003-05-01 Paolo Carlini <pcarlini@unitus.it> 2003-05-01 Paolo Carlini <pcarlini@unitus.it>
* include/std/std_sstream.h (str()): Revert the best of the
previous 'improvement', incorrect due to the COW nature of
v3 basic_string; simplify.
2003-05-01 Paolo Carlini <pcarlini@unitus.it>
* include/bits/streambuf.tcc (__copy_streambufs): Adjust the * include/bits/streambuf.tcc (__copy_streambufs): Adjust the
type of __avail to ptrdiff_t to avoid signed-unsigned warning. type of __avail to ptrdiff_t to avoid signed-unsigned warning.
......
...@@ -136,14 +136,9 @@ namespace std ...@@ -136,14 +136,9 @@ namespace std
__string_type __ret = _M_string; __string_type __ret = _M_string;
if (this->_M_mode & ios_base::out) if (this->_M_mode & ios_base::out)
{ {
// This is the deal: _M_string.size() is a value that
// represents the size of the initial string used to
// created the buffer, and may not be the correct size of
// the current stringbuf internal buffer.
const __size_type __len = _M_string.size();
const __size_type __nlen = this->_M_out_lim const __size_type __nlen = this->_M_out_lim
- this->_M_out_beg; - this->_M_out_beg;
if (__nlen > __len) if (__nlen)
__ret = __string_type(this->_M_out_beg, __ret = __string_type(this->_M_out_beg,
this->_M_out_beg + __nlen); this->_M_out_beg + __nlen);
} }
......
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