This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
basic_string operator<< broken in for wchar_t in egcs 1.1.1
- To: egcs-bugs at cygnus dot com, egcs-patches at cygnus dot com
- Subject: basic_string operator<< broken in for wchar_t in egcs 1.1.1
- From: baron at peanut dot engr dot sgi dot com (Baron Roberts)
- Date: Wed, 17 Feb 1999 09:13:07 -0800 (PST)
BUG: STL basic_string operator<< broken in egcs 1.1.1 on RedHat Linux 5.2
-------------------------------------------------------------------------
The basic_string operator<< incorrectly assumes a single byte per
character. This breaks for a wchar_t string. The operator should
multiple the length of the string by the character size when providing
the stream size to the ostream write() method.
The fix effects the file:
libstdc++/std/bastring.cc
ChangeLog entries and diff -cp follow.
libstdc++ ChangeLog
-------------------
Wed Feb 17 09:13:15 1999 Baron Roberts <baron@sgi.com>
* std/bastring.cc (operator<<): Stream size must be legnth
of string multiplied by the size of the character type.
egcs-1.1.1/libstdc++/std/bastring.cc
------------------------------------
*** bastring.cc Wed Feb 17 09:13:15 1999
--- /usr/include/g++-2/std/bastring.cc Wed Jan 27 11:59:37 1999
*************** template <class charT, class traits, cla
*** 467,473 ****
ostream &
operator<< (ostream &o, const basic_string <charT, traits, Allocator>& s)
{
! return o.write (s.data (), s.length () * sizeof(charT));
}
template <class charT, class traits, class Allocator>
--- 467,473 ----
ostream &
operator<< (ostream &o, const basic_string <charT, traits, Allocator>& s)
{
! return o.write (s.data (), s.length ());
}
template <class charT, class traits, class Allocator>
____________________________________________________
Baron Roberts Phone (650) 933-1653
http://www.sgi.com mailto:baron@sgi.com
Application Technology Group, Silicon Graphics Inc.
____________________________________________________