This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH/RFA] Revamp wctomb/mbtowc conversion, add more charset support
On Mar 20 18:35, Howland Craig D (Craig) wrote:
> +int
> +__cp_index (const char *charset_ext)
> +{
> + int cp_idx = atoi (__locale_charset () + 2);
> + switch (cp_idx)
> + {
> ...
>
> The charset_ext argument appears to be unused. In the two places in
> which __cp_index() is actually called, both use
> "int cp_idx = __cp_index (__locale_charset () + 2);" , so I think that
> probably:
> int
> __cp_index (const char *charset_ext)
> {
> - int cp_idx = atoi (__locale_charset () + 2);
> + int cp_idx = atoi (charset_ext);
> switch (cp_idx)
> {
> is in order.
Thanks! I missed that.
> I've only taken a cursory glance, but I'm also wondering about the
> "(__locale_charset () + 2)" bit. It appears as if that is a
> leftover from the "Old newlib style" mentioned in locale.c, where a
No, the codepages are given like this, for instance:
$LANG="de_DE.CP1252"
setlocale generates a charset of "CP1252", so __locale_charset () + 2
points to "1252".
> Of lesser importance, the ChangeLog entry fails to mention __cp_index
> as a new function.
Uh, thanks, I'll fix that.
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat