[Bug libstdc++/11389] New: Unbuffered wfilebuf fails to read single-byte UTF-8 characters.
peturr02 at ru dot is
gcc-bugzilla@gcc.gnu.org
Tue Jul 1 09:20:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11389
Summary: Unbuffered wfilebuf fails to read single-byte UTF-8
characters.
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: peturr02 at ru dot is
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
When using a variable-width character set, but reading a file that contains only
single-byte characters from that character set, basic_filebuf::underflow reads
more bytes than can be converted and placed in the internal buffer:
const streamsize __blen = __buflen * _M_codecvt->max_length();
char* __buf = static_cast<char*>(__builtin_alloca(__blen));
__elen = _M_file.xsgetn(__buf, __blen);
If the file contains only single byte characters, only __buflen bytes need to be
read to fill the internal buffer. It seems that the extra characters read are
discarded.
More information about the Gcc-bugs
mailing list