[EMAIL PROTECTED] wrote:
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 <[EMAIL PROTECTED]>
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;
first_ and last_ are not reserved names -- names of local variables
in library headers (including .cc files) must be in the private
namespace reserved to the implementation, such as, __first and
__last. You might want to add the names first_ and last_ to the
17.names.cpp test to help us catch this mistake in the future
(and I really need to fix valarray so that the test compiles!)
Also, since the function has grown quite a bit it needs to be moved
outside of the enclosing template. It looks small enough that it
can stay inline (i.e., still defined in the header).
Martin
+
+ 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