Author: faridz
Date: Tue Aug 28 11:14:27 2007
New Revision: 570514
URL: http://svn.apache.org/viewvc?rev=570514&view=rev
Log:
2007-08-28 Farid Zaripov <[EMAIL PROTECTED]>
STDCXX-515
* sstream.cc (xsputn): Correct write position after growing the buffer.
Modified:
incubator/stdcxx/trunk/include/sstream.cc
Modified: incubator/stdcxx/trunk/include/sstream.cc
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/include/sstream.cc?rev=570514&r1=570513&r2=570514&view=diff
==============================================================================
--- incubator/stdcxx/trunk/include/sstream.cc (original)
+++ incubator/stdcxx/trunk/include/sstream.cc Tue Aug 28 11:14:27 2007
@@ -185,9 +185,15 @@
const _RWSTD_SIZE_T __bufsize =
__n + (this->pptr () - this->pbase ());
+ // preserve current pptr() since str() would seek to end
+ const streamsize __cur = this->pptr () - this->pbase ();
+
// grow the buffer if necessary to accommodate the whole
// string plus the contents of the buffer up to pptr()
str (this->_C_buffer, __bufsize);
+
+ // restore pptr()
+ this->pbump (__cur - (this->pptr () - this->pbase ()));
_RWSTD_ASSERT (__n <= this->epptr () - this->pptr ());
}