oleaut32: bypass conversion to string in R4/R8 -> DECIMAL conversion (RESEND)

Alex Villací­s Lasso a_villacis at palosanto.com
Thu Dec 14 11:32:42 CST 2006


Alex Villací­s Lasso escribió:
> 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.
>
> Changelog:
> * Remove uses of sprintfW to convert floats into DECIMAL by directly 
> parsing the floating-point representation.
>
> Alex Villacís Lasso
Resending since there was no response since Monday.

-- 
The following cryptic message was allegedly found in the inner edge of a Windows
XP installation CD:

4F6E65204F5320746F2072756C65207468656D20616C6C2C204F6E65204F5320746F2066696E6420
7468656D2C0D0A4F6E65204F5320746F206272696E67207468656D20616C6C20616E6420696E2074
6865206461726B6E6573732062696E64207468656D2E0A

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...
Name: wine-oleaut32-vartype-VarDecFromRX_remove_string_step.patch
Type: text/x-patch
Size: 13402 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20061214/6e6c6759/wine-oleaut32-vartype-VarDecFromRX_remove_string_step-0001.bin


More information about the wine-devel mailing list