Alex Villacís Lasso
a_villacis at palosanto.com
Mon Dec 11 10:22:34 CST 2006
Alexandre Julliard escribió:
> 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.
Well, here is an attempt to fix part of the breakage in oleaut32 that
ties it to LC_NUMERIC being "C". This patch decomposes floats and
doubles into the component bitfields, then copies the values into
DECIMAL structures and manipulates them to get the corresponding DECIMAL
value. This removes the step of converting the floating-point number
into a string and therefore eliminates two uses of sprintfW on floats.
This particular patch passes all tests, but I am not really sure about
the rounding - I might be overdoing it. Please comment.
* Remove uses of sprintfW to convert floats into DECIMAL by directly
parsing the floating-point representation.
Alex Villacís Lasso
The following cryptic message was allegedly found in the inner edge of a Windows
XP installation CD:
It is rumored that only a true Unix Wizard can decypher this mysterious message,
which supposedly encodes the true nature and purpose of the software.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 13402 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20061211/1541d82d/wine-oleaut32-vartype-VarDecFromRX_remove_string_step-0001.bin
More information about the wine-devel