[PATCH 2/2] ucrtbase: Make the strtod implementation C99 compatible
Martin Storsjö
martin at martin.st
Mon Sep 21 08:08:38 CDT 2015
On Mon, 31 Aug 2015, Piotr Caban wrote:
> On 08/30/15 22:47, Martin Storsjo wrote:
>> @@ -339,6 +341,38 @@ static double strtod_helper(const char *str, char
>> **end, MSVCRT__locale_t locale
>> } else if(*p == '+')
>> p++;
>>
>> +#if _MSVCR_VER >= 140
>> + if(p[0] == '0' && tolower(p[1]) == 'x') {
>> + char *e;
>> + MSVCRT_long val = sign*MSVCRT_strtol(p, &e, 16);
> This will not work for doubles > LONG_MAX.
>
> It will also not work if specified hexadecimal value has dot, e.g.:
> strtod("0x1.1p+1") = 2.125
Thanks. It turned out to be pretty straightforward to integrate this into
the existing base-10 parsing loop, which made sure all such cases should
be handled, at least as well as the rest.
// Martin
More information about the wine-devel
mailing list