aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@unitus.it>2003-05-02 01:20:33 +0200
committerPaolo Carlini <paolo@gcc.gnu.org>2003-05-01 23:20:33 +0000
commite70b1b7788ab76c22634d4e0e3d65ab7e55d667a (patch)
treed907659c8892ebec5c10eae41dc42c5346e76557
parentf4731b64d269a2c16727a3db9da868707e0cbb14 (diff)
downloadgcc-e70b1b7788ab76c22634d4e0e3d65ab7e55d667a.zip
gcc-e70b1b7788ab76c22634d4e0e3d65ab7e55d667a.tar.gz
gcc-e70b1b7788ab76c22634d4e0e3d65ab7e55d667a.tar.bz2
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
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/include/std/std_sstream.h9
2 files changed, 8 insertions, 7 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index fe53992..cd55a6b 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,11 @@
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
type of __avail to ptrdiff_t to avoid signed-unsigned warning.
diff --git a/libstdc++-v3/include/std/std_sstream.h b/libstdc++-v3/include/std/std_sstream.h
index dcfdea6..1d9a549 100644
--- a/libstdc++-v3/include/std/std_sstream.h
+++ b/libstdc++-v3/include/std/std_sstream.h
@@ -136,14 +136,9 @@ namespace std
__string_type __ret = _M_string;
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
- - this->_M_out_beg;
- if (__nlen > __len)
+ - this->_M_out_beg;
+ if (__nlen)
__ret = __string_type(this->_M_out_beg,
this->_M_out_beg + __nlen);
}