msvcrt: Fix locale creation for multibyte encoding

Alexandre Julliard julliard at winehq.org
Thu Mar 31 05:41:00 CDT 2011


Piotr Caban <piotr at codeweavers.com> writes:

> @@ -787,13 +787,15 @@ MSVCRT__locale_t MSVCRT__create_locale(int category, const char *locale)
>          loc->locinfo->lc_category[MSVCRT_LC_CTYPE].locale = _strdup("C");
>      }
>  
> -    for(i=0; i<256; i++)
> -        buf[i] = i;
> -
> -    LCMapStringA(lcid[MSVCRT_LC_CTYPE], LCMAP_LOWERCASE, buf, 256,
> -            (char*)loc->locinfo->pclmap, 256);
> -    LCMapStringA(lcid[MSVCRT_LC_CTYPE], LCMAP_UPPERCASE, buf, 256,
> -            (char*)loc->locinfo->pcumap, 256);
> +    for(i=0; i<256; i++) {
> +        buf[0] = i;
> +        if(!LCMapStringA(lcid[MSVCRT_LC_CTYPE], LCMAP_LOWERCASE, buf, 1,
> +                    (char*)loc->locinfo->pclmap+i, 1))
> +            loc->locinfo->pclmap[i] = ' ';
> +        if(!LCMapStringA(lcid[MSVCRT_LC_CTYPE], LCMAP_UPPERCASE, buf, 1,
> +                    (char*)loc->locinfo->pcumap+i, 1))
> +            loc->locinfo->pcumap[i] = ' ';
> +    }

It would probably be better to replace the DBCS lead chars in the input
buffer first and then still do the whole mapping in one step.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list