You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Farid Zaripov (JIRA)" <ji...@apache.org> on 2007/10/04 14:20:51 UTC
[jira] Closed: (STDCXX-576) std::basic_streambuf<>::xsputn()
incorrectly inserts the data, that is the part of the internal buffer
[ https://issues.apache.org/jira/browse/STDCXX-576?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Farid Zaripov closed STDCXX-576.
--------------------------------
> 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 <sstream> // for stringbuf
> #include <string> // for string
> #include <cassert> // 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.