Author: faridz Date: Fri Jun 8 08:30:35 2007 New Revision: 545533 URL: http://svn.apache.org/viewvc?view=rev&rev=545533 Log: 2007-06-08 Farid Zaripov STDCXX-427 * sstream (str): Function updated according to 27.7.1.2, p1 Modified: incubator/stdcxx/trunk/include/sstream Modified: incubator/stdcxx/trunk/include/sstream URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/include/sstream?view=diff&rev=545533&r1=545532&r2=545533 ============================================================================== --- incubator/stdcxx/trunk/include/sstream (original) +++ incubator/stdcxx/trunk/include/sstream Fri Jun 8 08:30:35 2007 @@ -125,9 +125,22 @@ virtual ~basic_stringbuf (); _C_string_type str () const { - const _RWSTD_SIZE_T __slen = (this->egptr () < this->pptr () ? - this->pptr () : this->egptr ()) - this->pbase (); - return _C_string_type (this->_C_buffer, __slen); + const char_type * first_ = 0; + const char_type * last_ = 0; + + if (this->_C_is_out ()) { + // in out only or in|out mode + first_ = this->pbase (); + last_ = this->egptr () < this->pptr () ? + this->pptr () : this->egptr (); + } + else if (this->_C_is_in ()) { + // in in only mode + first_ = this->eback (); + last_ = this->egptr (); + } + + return _C_string_type (first_, last_ - first_); } #ifdef _RWSTD_NO_EXT_STRINGBUF_STR