incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: [PATCH] STDCXX-515
Date Tue, 14 Aug 2007 15:47:11 GMT
Farid Zaripov wrote:
>   Below is the patch for fix STDCXX-515.
> 
>   ChangeLog:
>   * sstream.cc (xsputn): Correct write position after growing the
> buffer.

Why do we need to do it in xsputn()? Isn't str() supposed to keep
pptr() at the right offset after growing the buffer?

Martin

> 
> 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