kernel32: (locale) Restore C locale for LC_NUMERIC (was: Re: oleaut32: use setlocale() around sprintfW to force use of period as decimal separator)

Alexandre Julliard julliard at winehq.org
Wed Nov 22 05:21:00 CST 2006


Alex Villací­s Lasso <a_villacis at palosanto.com> writes:

> This patch added the setlocale(LC_ALL,  "") line to
> dlls/kernel32/locale.c . The oleaut32 tests for vartype.c have been
> failing since that time on non-English locales. I see now that setting
> the locale around calls of sprintfW() is not thread-safe. However, I
> think there is no big problem on going through a string in order to
> convert a floating-point number into a DECIMAL, since otherwise, we
> would need to implement our own bit-splicer for floating-point
> numbers. As long as the starting locale for sprintfW() is known to be
> the LC_NUMERIC="C", all other parsing should work as before the MacOS
> patch. Therefore I propose the attached patch. This patch simply sets
> setlocale(LC_NUMERIC, "C") at the end of LOCALE_Init() in
> dlls/kernel32/locale.c in order to guarantee that sprintfW will always
> use periods as decimal separators.

I put this in for now, but oleaut32 should really be fixed, we can't
force the whole process to format number in English just because
oleaut32 is broken. It doesn't matter too much for Wine itself, but
any Unix library that we load should be able to behave properly
according to the locale that the user has selected.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list