aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2004-10-03 16:28:16 +0000
committerPaolo Carlini <pcarlini@suse.de>2004-10-03 16:28:16 +0000
commitca2ac3d32102377ff62aa99810874752c46a4061 (patch)
treea6f6fd6c36b47218a1933f0c47f652d44d5d2c46 /libstdc++-v3/include/std
parent1ca23fa80a4bc938cab406fb12be71f0d7b1ca96 (diff)
2004-10-03 Paolo Carlini <pcarlini@suse.de>
Merged to mainline at tag libstdcxx_so_7-merge-20041003. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/libstdcxx_so_7-branch@88456 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std')
-rw-r--r--libstdc++-v3/include/std/std_sstream.h27
1 files changed, 12 insertions, 15 deletions
diff --git a/libstdc++-v3/include/std/std_sstream.h b/libstdc++-v3/include/std/std_sstream.h
index 6b5728b94ce..3420999164c 100644
--- a/libstdc++-v3/include/std/std_sstream.h
+++ b/libstdc++-v3/include/std/std_sstream.h
@@ -111,8 +111,8 @@ namespace std
*/
explicit
basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out)
- : __streambuf_type(), _M_mode(), _M_string()
- { _M_stringbuf_init(__mode); }
+ : __streambuf_type(), _M_mode(__mode), _M_string()
+ { }
/**
* @brief Starts with an existing string buffer.
@@ -140,8 +140,7 @@ namespace std
__string_type
str() const
{
- const bool __testout = this->_M_mode & ios_base::out;
- if (__testout)
+ if (this->pptr())
{
// The current egptr() may not be the actual string end.
if (this->pptr() > this->egptr())
@@ -169,7 +168,7 @@ namespace std
}
protected:
- // Common initialization code for both ctors goes here.
+ // Common initialization code goes here.
/**
* @if maint
* @doctodo
@@ -220,7 +219,7 @@ namespace std
// things will quickly blow up.
// Step 1: Destroy the current internal array.
- _M_string = __string_type(__s, __n);
+ _M_string.assign(__s, __n);
// Step 2: Use the external array.
_M_sync(__s, 0, 0);
@@ -254,20 +253,19 @@ namespace std
{
const bool __testin = this->_M_mode & ios_base::in;
const bool __testout = this->_M_mode & ios_base::out;
- const __size_type __len = _M_string.size();
+ char_type* __end = __base + _M_string.size();
if (__testin)
- this->setg(__base, __base + __i, __base + __len);
+ this->setg(__base, __base + __i, __end);
if (__testout)
{
this->setp(__base, __base + _M_string.capacity());
this->pbump(__o);
- // We need a pointer to the string end anyway, even when
- // !__testin: in that case, however, for the correct
- // functioning of the streambuf inlines all the get area
- // pointers must be identical.
+ // egptr() always tracks the string end. When !__testin,
+ // for the correct functioning of the streambuf inlines
+ // the other get area pointers are identical.
if (!__testin)
- this->setg(__base + __len, __base + __len, __base + __len);
+ this->setg(__end, __end, __end);
}
}
@@ -277,9 +275,8 @@ namespace std
_M_update_egptr()
{
const bool __testin = this->_M_mode & ios_base::in;
- const bool __testout = this->_M_mode & ios_base::out;
- if (__testout && this->pptr() > this->egptr())
+ if (this->pptr() && this->pptr() > this->egptr())
if (__testin)
this->setg(this->eback(), this->gptr(), this->pptr());
else