[v3] Fix stringbuf handling of NUL characters

Lars Gullik Bjønnes larsbj@lyx.org
Thu Jul 12 00:42:00 GMT 2001


Phil Edwards <pedwards@disaster.jaj.com> writes:

| Index: std_sstream.h
| ===================================================================
| RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/std_sstream.h,v
| retrieving revision 1.7
| diff -u -3 -r1.7 std_sstream.h
| --- std_sstream.h	2001/06/12 22:14:08	1.7
| +++ std_sstream.h	2001/07/12 02:52:25
| @@ -75,7 +75,7 @@
|        explicit 
|        basic_stringbuf(const __string_type& __str,
|  		      ios_base::openmode __mode = ios_base::in | ios_base::out)
| -      : __streambuf_type(), _M_string(__str.c_str())
| +      : __streambuf_type(), _M_string(__str.c_str(), __str.size())
|        { _M_stringbuf_init(__mode); }
|  
|        // Get and set:

wouldn't 

+        : __streambuf_type(), _M_string(__str.data(), __str.size())

be even better in this case?

-- 
	Lgb



More information about the Libstdc++ mailing list