Bug 12077 - [3.4 only] wcin.rdbuf()->in_avail() return value too high
[3.4 only] wcin.rdbuf()->in_avail() return value too high
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: libstdc++
3.4.0
: P2 normal
: 3.4.1
Assigned To: Paolo Carlini
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2003-08-27 11:09 UTC by Pétur Runólfsson
Modified: 2004-04-21 10:00 UTC (History)
1 user (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2003-12-31 16:04:00


Attachments
Test case (1.92 KB, text/plain)
2003-08-27 11:09 UTC, Pétur Runólfsson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pétur Runólfsson 2003-08-27 11:09:09 UTC
When stdin is bound to a regular file, wcin.rdbuf()->showmanyc() returns the
number of bytes in the file, which may be higher than the number of
characters in the file when using multibyte character sets such as utf-8.
Comment 1 Pétur Runólfsson 2003-08-27 11:09:54 UTC
Created attachment 4660 [details]
Test case
Comment 2 Paolo Carlini 2004-03-18 17:04:06 UTC
... so, shall I add to stdio_sync_filebuf a non-trivial imbue and tweak
showmanyc consistently, similarly to basic_filebuf?!?

Thanks.
Comment 3 Pétur Runólfsson 2004-03-19 08:39:40 UTC
> ... so, shall I add to stdio_sync_filebuf a non-trivial imbue and tweak
> showmanyc consistently, similarly to basic_filebuf?!?

There's no way to find out the conversion used by the underlying FILE*, so
the only reasonable thing to do is to return 0 from showmanyc.
Comment 4 CVS Commits 2004-03-19 19:31:43 UTC
Subject: Bug 12077

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	paolo@gcc.gnu.org	2004-03-19 19:31:38

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/include/ext: stdio_sync_filebuf.h 
	libstdc++-v3/testsuite/27_io/objects/char: 9.cc 
Added files:
	libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t: 12077.cc 

Log message:
	2004-03-19  Paolo Carlini  <pcarlini@suse.de>
	Petur Runolfsson  <peturr02@ru.is>
	
	PR libstdc++/12077
	* include/ext/stdio_sync_filebuf.h (showmanyc): Remove, there's
	no way to find out the conversion used by the underlying FILE*.
	* testsuite/ext/stdio_sync_filebuf/wchar_t/12077.cc: New.
	* testsuite/27_io/objects/char/9.cc: Tweak.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.2409&r2=1.2410
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/ext/stdio_sync_filebuf.h.diff?cvsroot=gcc&r1=1.7&r2=1.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12077.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/objects/char/9.cc.diff?cvsroot=gcc&r1=1.4&r2=1.5

Comment 5 CVS Commits 2004-04-21 09:59:17 UTC
Subject: Bug 12077

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	paolo@gcc.gnu.org	2004-04-21 09:59:12

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/include/ext: stdio_sync_filebuf.h 
	libstdc++-v3/testsuite/27_io/objects/char: 9.cc 
Added files:
	libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t: 12077.cc 

Log message:
	2004-04-21  Paolo Carlini  <pcarlini@suse.de>
	Petur Runolfsson  <peturr02@ru.is>
	
	PR libstdc++/12077
	* include/ext/stdio_sync_filebuf.h (showmanyc): Remove, there's
	no way to find out the conversion used by the underlying FILE*.
	* testsuite/ext/stdio_sync_filebuf/wchar_t/12077.cc: New.
	* testsuite/27_io/objects/char/9.cc: Tweak.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.2224.2.77&r2=1.2224.2.78
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/ext/stdio_sync_filebuf.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.7&r2=1.7.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/12077.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.2.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/objects/char/9.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.4&r2=1.4.4.1

Comment 6 Paolo Carlini 2004-04-21 10:00:44 UTC
Fixed for 3.4.1.