This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch] Fix (similarly) libstdc++/9178 and 11305
- From: Martin Sebor <sebor at roguewave dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Thu, 26 Jun 2003 16:40:32 -0600
- Subject: Re: [Patch] Fix (similarly) libstdc++/9178 and 11305
- Organization: Rogue Wave Software, Inc.
- References: <3EFB6D87.2040009@unitus.it>
Paolo Carlini wrote:
...
+ // Worst-case number of external bytes.
+ int __ext_multiplier = _M_codecvt->encoding();
+ if (__ext_multiplier == -1 || __ext_multiplier == 0)
+ __ext_multiplier = _M_codecvt->max_length();
FWIW, this doesn't seem quite right when encoding() returns -1.
The number of external bytes required to produce a single internal
character could be greater than max_length() (e.g., a whole bunch
of unshift sequences, one after another, followed by a character).
I don't see how this could be done w/o a loop.
Regards
Martin