OLEAUT32: Single|Double->BSTR conversion must always use locale (try 2)

Alex Villaci­s Lasso a_villacis at palosanto.com
Wed Apr 13 12:39:24 CDT 2005


Alex Villaci­s Lasso wrote:

> Yet another patch for a problem in MP3GainGUI.exe: This VB program 
> saves its GUI state (including the column widths of a Listview 
> control) in the registry, and restores it on startup. All fine, except 
> that in a locale other than en_US, the column widths (of type Single) 
> are converted to strings using the US locale, and are later restored 
> with the current locale (in my case, es_EC). For example, a value such 
> as 123.456 (one hundred and twenty-three with four hundred and 
> fifty-six thousandths) is converted to the string "123.456", and is 
> then parsed according to the rules for the current locale. For es_EC, 
> the string "123.456" reads "one hundred and twenty-three thousand four 
> hundred and fifty-six", and the columns get set to a ridiculously 
> large width. Native oleaut32 converts to "123,456" even under Wine 
> with no special flags, so this patch changes the real->bstr conversion 
> to do the same. I know this patch breaks a couple of tests for vartype 
> (because "1" gets converted to "1.00" and such), so I will investigate 
> the issue and possibly send a more correct patch. In the meantime, 
> comments are welcome.
>
This second patch should fix the issue in a more proper way. For the 
case without LOCALE_USE_NLS, the code will now replace the period with 
whatever string happens to be the current decimal separator, and will do 
nothing else (so "1234.567" becomes "1234,567" instead of "1.234,567"). 
This patch also prevents extra zeroes from being added to integers (so 
numbers like "0" are now preserved, rather than converted to "0,00"). 
Therefore, this patch also passes the original tests on vartype. This 
patch should be used instead of the previous patch ("OLEAUT32: 
Single|Double->BSTR conversion must always use locale"). As before, any 
comments are welcome.

Changelog:
* Force Single|Double conversion to BSTR to always use current locale

-------------- next part --------------
A non-text attachment was scrubbed...
Name: wine-oleaut32-vartype-always_use_locale_try2.patch
Type: text/x-patch
Size: 1048 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20050413/95c63bf1/wine-oleaut32-vartype-always_use_locale_try2.bin


More information about the wine-patches mailing list