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.
Created attachment 4660 [details] Test case
... so, shall I add to stdio_sync_filebuf a non-trivial imbue and tweak showmanyc consistently, similarly to basic_filebuf?!? Thanks.
> ... 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.
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
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
Fixed for 3.4.1.