This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3] Fix stringbuf handling of NUL characters
- To: Phil Edwards <pedwards at disaster dot jaj dot com>
- Subject: Re: [v3] Fix stringbuf handling of NUL characters
- From: Benjamin Kosnik <bkoz at gnu dot org>
- Date: Fri, 13 Jul 2001 15:40:30 -0500 (CDT)
- cc: <libstdc++ at sources dot redhat dot com>
> 1 std::string string_with_nulls ("123 \0 456", 9);
> 2 std::stringbuf sbuf (string_with_nulls);
>
> sbuf.str().size() should be 9, but right now, it's only 4. The user in
> the original bug report was constructing (indirectly) a string like the
> one on line 1. But inside istringstream, when we created its stringbuf
> with something like line 2, we were allowing a strlen() call to determine
> how much data to copy.
Ok. With this, and assuming you made the change to string::data(), I think
this is ready to go in as well.
thanks again,
benjamin