Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 43670 invoked from network); 4 Oct 2007 12:10:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Oct 2007 12:10:44 -0000 Received: (qmail 59132 invoked by uid 500); 4 Oct 2007 12:10:33 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 59126 invoked by uid 500); 4 Oct 2007 12:10:33 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 59007 invoked by uid 99); 4 Oct 2007 12:10:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Oct 2007 05:10:32 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Oct 2007 12:10:42 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 3E747714187 for ; Thu, 4 Oct 2007 05:09:52 -0700 (PDT) Message-ID: <3919035.1191499792241.JavaMail.jira@brutus> Date: Thu, 4 Oct 2007 05:09:52 -0700 (PDT) From: "Farid Zaripov (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Updated: (STDCXX-576) std::basic_streambuf<>::xsputn() incorrectly inserts the data, that is the part of the internal buffer In-Reply-To: <7566691.1191499551432.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/STDCXX-576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Farid Zaripov updated STDCXX-576: --------------------------------- Attachment: sstream.cc.diff The patch is attached. > std::basic_streambuf<>::xsputn() incorrectly inserts the data, that is the part of the internal buffer > ------------------------------------------------------------------------------------------------------ > > Key: STDCXX-576 > URL: https://issues.apache.org/jira/browse/STDCXX-576 > Project: C++ Standard Library > Issue Type: Bug > Components: 27. Input/Output > Affects Versions: trunk > Environment: All > Reporter: Farid Zaripov > Assignee: Farid Zaripov > Fix For: 4.2 > > Attachments: 27.stringbuf.xsputn.stdcxx-576.cpp, sstream.cc.diff > > > The test below aborts on assert. > test.cpp: > ------------------ > #include // for stringbuf > #include // for string > #include // for assert() > struct PubBuf: std::stringbuf > { > char* Pbase () const { return this->pbase (); } > }; > int main () > { > // 512 is the default buffer size of the basic_stringbuf > std::string s (512, 'a'); > std::stringbuf sbuf (s); > PubBuf& buf = (PubBuf&)sbuf; > std::streamsize res = buf.sputn (buf.Pbase (), 128); > s.append (s.begin (), s.begin () + 128); > const std::string& str = buf.str (); > assert (res == 128); > assert (str.size () == s.size ()); > assert (str == s); > return 0; > } > ------------------ > The test output: > ------------------ > test: test.cpp:25: int main (): Assertion `str == s' failed. > Aborted > ------------------ -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.