Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 82532 invoked from network); 25 Mar 2008 15:11:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Mar 2008 15:11:47 -0000 Received: (qmail 16068 invoked by uid 500); 25 Mar 2008 15:11:46 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 16052 invoked by uid 500); 25 Mar 2008 15:11:46 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 16043 invoked by uid 99); 25 Mar 2008 15:11:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Mar 2008 08:11:46 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of msebor@gmail.com designates 64.233.170.184 as permitted sender) Received: from [64.233.170.184] (HELO rn-out-0910.google.com) (64.233.170.184) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Mar 2008 15:11:06 +0000 Received: by rn-out-0910.google.com with SMTP id s28so1964512rnb.13 for ; Tue, 25 Mar 2008 08:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; bh=krKR3q7fj+UVyiRdpWa4kvCsNqiZVJaeX/wcduVS2sA=; b=tmlh0CervyzakaKPLl8RBHYPD/xvzUcF0nJkcQUOosxOkg8z3iZivddFWLRbOEvU8Em8LoKOJJZqAhU9LSvf4gnWuyWmNLq6/xCxOheWUQAtlUGVErbm7zxhWhhW3qU2qQOaei2gX5VQ+8rvl6QwGT9BirxYynLOAhnG8S/a6Fo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=fT4KUVqfpc5BKp6WQvM4uurESOuf9ixRfrtiMRuqPCafh8Ndm7t9f5KhKbxH+LGNPBikm6IqFVCrz7R2mvtuhqGeRUNfnOxJe64pFF04IqYbMJ0ITihL/VQiUS2wCfZquzcdPT06n49GklNLgNsd2pA5Z4GyJVfbrh/mBQVTndM= Received: by 10.140.144.4 with SMTP id r4mr3405360rvd.175.1206457876436; Tue, 25 Mar 2008 08:11:16 -0700 (PDT) Received: from localhost.localdomain ( [71.229.200.170]) by mx.google.com with ESMTPS id b34sm5070512rvf.22.2008.03.25.08.11.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 25 Mar 2008 08:11:15 -0700 (PDT) Message-ID: <47E91612.3060000@roguewave.com> Date: Tue, 25 Mar 2008 09:11:14 -0600 From: Martin Sebor Organization: Rogue Wave Software, Inc. User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: svn commit: r640831 - /stdcxx/trunk/include/sstream.cc References: <20080325143305.9337C1A9832@eris.apache.org> In-Reply-To: <20080325143305.9337C1A9832@eris.apache.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: Martin Sebor X-Virus-Checked: Checked by ClamAV on apache.org Any idea what caused it? I've gone through the recent history of the function and this looks like the likely change might be this one: http://svn.apache.org/viewvc?view=rev&revision=442675 but the test wasn't failing. Maybe because the test doesn't cause the buffer to reallocate? Martin faridz@apache.org wrote: > Author: faridz > Date: Tue Mar 25 07:33:02 2008 > New Revision: 640831 > > URL: http://svn.apache.org/viewvc?rev=640831&view=rev > Log: > 2008-03-25 Farid Zaripov > > STDCXX-792 > * include/sstream.cc (str): Save pptr and restore is at the end if > str() is called with internal buffer to increase the capacity of > buffer (i.e. from xsputn() or overflow()). > (xsputn): Remove fix for STDCXX-515 because the pptr now is > preserved in str(). > > Modified: > stdcxx/trunk/include/sstream.cc > > Modified: stdcxx/trunk/include/sstream.cc > URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/sstream.cc?rev=640831&r1=640830&r2=640831&view=diff > ============================================================================== > --- stdcxx/trunk/include/sstream.cc (original) > +++ stdcxx/trunk/include/sstream.cc Tue Mar 25 07:33:02 2008 > @@ -82,8 +82,10 @@ > _ValueAlloc __alloc; > > // new buffer and size > - char_type *__buf; > - _RWSTD_SIZE_T __bufsize = __slen; > + char_type *__buf; > + _RWSTD_SIZE_T __bufsize = __slen; > + // saved offset of pptr > + _RWSTD_STREAMSIZE __off = -1; > > if (__s == this->_C_buffer) { > // special case: str(_C_buffer, _C_bufsize + N) called > @@ -94,6 +96,8 @@ > // set `slen' to the number of initialized characters > // in the buffer > __slen = this->egptr () - this->pbase (); > + // save the offset of pptr > + __off = this->pptr () - this->pbase (); > } > > if (this->_C_bufsize < __bufsize) { > @@ -166,8 +170,12 @@ > if (this->_C_is_out ()) { > this->setp (this->_C_buffer, this->_C_buffer + this->_C_bufsize); > > - if ( __s != __buf && this->_C_state & ios_base::in > - || this->_C_state & (ios_base::app | ios_base::ate)) { > + if (0 <= __off) { > + // restore the pptr > + this->pbump (__off); > + } > + else if ( this->_C_state & ios_base::in > + || this->_C_state & (ios_base::app | ios_base::ate)) { > // in input or append/ate modes seek to end > // (see also lwg issue 562 for clarification) > this->pbump (__slen); > @@ -204,15 +212,9 @@ > __off = this->pbase () - __s; > } > > - // 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 ()); > > > >