stdcxx-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Farid Zaripov (JIRA)" <j...@apache.org>
Subject [jira] Updated: (STDCXX-515) std::basic_streambuf<>::xsputn() writes characters at the end, but not at the current position if reallocation of internal buffer occurs
Date Tue, 25 Mar 2008 14:19:24 GMT

     [ https://issues.apache.org/jira/browse/STDCXX-515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Farid Zaripov updated STDCXX-515:
---------------------------------

    Description: 
The test below asserts on i == 512.

{code:title=test.cpp}
#include <sstream>
#include <string>
#include <cassert>

int main ()
{
    for (size_t i = 1; i <= 1024; ++i) {
        std::stringstream strm;
        std::string s (i, 'a');
        strm << s;
        strm.seekp (-1, std::ios::cur);
        s.erase (0, 1);
        strm << "bc";
        s.append ("bc");
        assert (strm.str () == s);
    }

    return 0;
}
{code}

The test output:
{noformat}
test: test.cpp:15: int main (): Assertion `strm.str () == s' failed.
Aborted
{noformat}

  was:
The test below asserts on i == 512.

test.cpp:
------------------
#include <sstream>
#include <string>
#include <cassert>

int main ()
{
    for (size_t i = 1; i <= 1024; ++i) {
        std::stringstream strm;
        std::string s (i, 'a');
        strm << s;
        strm.seekp (-1, std::ios::cur);
        s.erase (0, 1);
        strm << "bc";
        s.append ("bc");
        assert (strm.str () == s);
    }

    return 0;
}
------------------

The test output:
------------------
test: test.cpp:15: int main (): Assertion `strm.str () == s' failed.
Aborted
------------------



Disabled formatting.

> std::basic_streambuf<>::xsputn() writes characters at the end, but not at the current
position if reallocation of internal buffer occurs
> ----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: STDCXX-515
>                 URL: https://issues.apache.org/jira/browse/STDCXX-515
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 27. Input/Output
>    Affects Versions: 4.2.0
>         Environment: All
>            Reporter: Farid Zaripov
>            Assignee: Farid Zaripov
>             Fix For: 4.2.0
>
>
> The test below asserts on i == 512.
> {code:title=test.cpp}
> #include <sstream>
> #include <string>
> #include <cassert>
> int main ()
> {
>     for (size_t i = 1; i <= 1024; ++i) {
>         std::stringstream strm;
>         std::string s (i, 'a');
>         strm << s;
>         strm.seekp (-1, std::ios::cur);
>         s.erase (0, 1);
>         strm << "bc";
>         s.append ("bc");
>         assert (strm.str () == s);
>     }
>     return 0;
> }
> {code}
> The test output:
> {noformat}
> test: test.cpp:15: int main (): Assertion `strm.str () == s' failed.
> Aborted
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message