stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov" <Farid_Zari...@epam.com>
Subject [PATCH] STDCXX-515
Date Thu, 09 Aug 2007 17:27:06 GMT
  Below is the patch for fix STDCXX-515.

  ChangeLog:
  * sstream.cc (xsputn): Correct write position after growing the
buffer.

Index: sstream.cc
===================================================================
--- sstream.cc	(revision 564229)
+++ sstream.cc	(working copy)
@@ -185,10 +185,16 @@
         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 ());
     }
 

Farid.

Mime
View raw message