public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/5286: std::wofstream writing wchar_t* strings
@ 2002-02-19 19:11 bkoz
  0 siblings, 0 replies; 5+ messages in thread
From: bkoz @ 2002-02-19 19:11 UTC (permalink / raw)
  To: bkoz, gcc-bugs, gcc-prs, kingleo

Synopsis: std::wofstream writing wchar_t* strings

State-Changed-From-To: feedback->closed
State-Changed-By: bkoz
State-Changed-When: Tue Feb 19 18:09:19 2002
State-Changed-Why:
    Fixed.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5286


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libstdc++/5286: std::wofstream writing wchar_t* strings
@ 2002-02-07 17:48 bkoz
  0 siblings, 0 replies; 5+ messages in thread
From: bkoz @ 2002-02-07 17:48 UTC (permalink / raw)
  To: bkoz, gcc-bugs, gcc-prs, kingleo

Synopsis: std::wofstream writing wchar_t* strings

State-Changed-From-To: analyzed->feedback
State-Changed-By: bkoz
State-Changed-When: Thu Feb  7 17:48:53 2002
State-Changed-Why:
    Please try it now, after:
    
    002-02-07  Benjamin Kosnik  <bkoz@redhat.com>
    
    	libstdc++/5286
    	libstdc++/3860
    	* include/std/std_fstream.h (filebuf::__file_type): Change to
    	__basic_file<char>.
    	(filebuf::_M_convert_to_external): Declare.
    	* include/bits/fstream.tcc (filebuf::_M_convert_to_external): Define
    	codecvt bits for wide streams.
    	(filebuf::_M_really_overflow): Use it.
    	(filebuf::underflow): Use codecvt.
    	* config/locale/codecvt_specializations_ieee_1003.1-200x.h: 
    	(codecvt<__enc_traits>::do_out): Deal with partial.
    	(codecvt<__enc_traits>::do_encoding): Return something useful.
    	* src/codecvt.cc (codecvt<wchar_t>::do_encoding): Return sizeof
    	wchar_t.
    	* testsuite/22_locale/codecvt_members_unicode_char.cc (test01):
    	Change expected encoding output.
    	(test02): Same.
    	* testsuite/22_locale/codecvt_members_wchar_t_char.cc (test01): Same.
    	(test02): Same.
    
    

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5286


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libstdc++/5286: std::wofstream writing wchar_t* strings
@ 2002-02-01 13:35 bkoz
  0 siblings, 0 replies; 5+ messages in thread
From: bkoz @ 2002-02-01 13:35 UTC (permalink / raw)
  To: bkoz, gcc-bugs, gcc-prs, kingleo, nobody

Synopsis: std::wofstream writing wchar_t* strings

Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-By: bkoz
Responsible-Changed-When: Fri Feb  1 13:35:05 2002
Responsible-Changed-Why:
    Mine.
State-Changed-From-To: closed->analyzed
State-Changed-By: bkoz
State-Changed-When: Fri Feb  1 13:35:05 2002
State-Changed-Why:
    Will be fixed in 3.1.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5286


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: libstdc++/5286: std::wofstream writing wchar_t* strings
@ 2002-01-06  8:01 rodrigc
  0 siblings, 0 replies; 5+ messages in thread
From: rodrigc @ 2002-01-06  8:01 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, kingleo, nobody

Synopsis: std::wofstream writing wchar_t* strings

State-Changed-From-To: open->closed
State-Changed-By: rodrigc
State-Changed-When: Sun Jan  6 08:01:11 2002
State-Changed-Why:
    I'm marking this as a duplicate of PR 3860:
    http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3860

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5286


^ permalink raw reply	[flat|nested] 5+ messages in thread

* libstdc++/5286: std::wofstream writing wchar_t* strings
@ 2002-01-06  0:16 kingleo
  0 siblings, 0 replies; 5+ messages in thread
From: kingleo @ 2002-01-06  0:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5286
>Category:       libstdc++
>Synopsis:       std::wofstream writing wchar_t* strings
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 06 00:16:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Martin Oberzalek
>Release:        gcc version 3.0.3
>Organization:
>Environment:
i686 Athlon Debian/GNU/Linux/unstable
Linux 2.4.13-pre6
>Description:
std::wofstream::write( wchar_t*, n );

This function does not writes n elements of the wchar_t* string into the file. 
It writes n bytes of the wchar_t* string into the file.
>How-To-Repeat:
Simple compile the code with g++-3.0.3 and execute the program and then have a look at the created file "foobar".
On my system od says this:
$ od -c foobar
0000000   S  \0  \0  \0   h  \0  \0  \0   i  \0  \0
0000013

The string "Shithappens" won't be written completely as an UCS-4LE (on i386) string to the file. Only 11 bytes, thats the number of letters of the word "Shithappens", will be written to the file.
>Fix:
Workaround:
 wstring s = L"Shithappens";
 out.write( s.c_str(), s.size() * sizeof( wchar_t ) );

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-c++src; name="wfstream.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="wfstream.cpp"

I2luY2x1ZGUgPGZzdHJlYW0+CiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPHN0cmluZz4K
CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpCnsKICB3b2ZzdHJlYW0gb3V0KCAiZm9v
YmFyIiwgc3RkOjppb3NfYmFzZTo6b3V0IHwgc3RkOjppb3NfYmFzZTo6dHJ1bmMgKTsKCiAgaWYo
IG91dC5nb29kKCkgKQogICAgewogICAgIG91dCA8PCBMIlNoaXRoYXBwZW5zIjsKCiAgICAgLy8g
V29ya2Fyb3VuZDoKICAgICAvLyAgICAgIHdzdHJpbmcgcyA9IEwiU2hpdGhhcHBlbnMiOwogICAg
IC8vICAgICAgb3V0LndyaXRlKCBzLmNfc3RyKCksIHMuc2l6ZSgpICogc2l6ZW9mKCB3Y2hhcl90
ICkgKTsKICAgIH0KICBlbHNlCiAgICB3Y291dCA8PCAiY2Fubm90IG9wZW4gZmlsZSIgPDwgZW5k
bDsKICAgIAogIHdjb3V0IDw8ICJkb25lIiA8PCBlbmRsOwoKICByZXR1cm4gMDsKfQo=


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-02-20  2:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-19 19:11 libstdc++/5286: std::wofstream writing wchar_t* strings bkoz
  -- strict thread matches above, loose matches on Subject: below --
2002-02-07 17:48 bkoz
2002-02-01 13:35 bkoz
2002-01-06  8:01 rodrigc
2002-01-06  0:16 kingleo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).