[PATCH 3/3] msvcrt: Make wcstoi64 support various Unicode digits.

Nikolay Sivov nsivov at codeweavers.com
Wed Dec 14 08:54:26 CST 2016



On 12/14/2016 05:45 PM, Lauri Kenttä wrote:
> On 2016-12-14 12:23, Henri Verbeet wrote:
>> On 13 December 2016 at 19:48, Lauri Kenttä <lauri.kentta at gmail.com> 
>> wrote:
>>> @@ -2027,6 +2027,19 @@ static int wctoint(WCHAR c, int base)
>>>          v = c - 'A' + 10;
>>>      else if ('a' <= c && c <= 'z')
>>>          v = c - 'a' + 10;
>>> +    else {
>>> +        /* Unicode points that contain digits 0-9; keep this 
>>> sorted! */
>>> +        static const WCHAR zeros[] = {
>>> +            0x660, 0x6f0, 0x966, 0x9e6, 0xa66, 0xae6, 0xb66, 0xc66, 
>>> 0xce6,
>>> +            0xd66, 0xe50, 0xed0, 0x1040, 0x17e0, 0x1810, 0xff10
>>> +        };
>>> +        int i;
>>> +        for (i = 0; i < sizeof(zeros)/sizeof(zeros[0]) && c >= 
>>> zeros[i]; ++i) {
>>> +            if (zeros[i] <= c && c < zeros[i] + base) {
>> Using "base" here seems questionable. That would imply that e.g. with
>> base 16, "\x6f2\x6fa"/"۲ۺ" would return "42". Is that really the case?
>
> My bad, I've "optimized out" the missing c < zeros[i] + 10.
>
>> For what it's worth, note also that Wine has wine_fold_string(), which
>> should be consistent with FoldString().
>
> I don't see what FoldString could do here.
MAP_FOLDDIGITS looks relevant to what you're doing.




More information about the wine-devel mailing list