[PATCH 2/2] regedit: Re-implement convertHextToDWord() (v3)

Alexandre Julliard julliard at winehq.org
Tue Apr 11 06:47:02 CDT 2017


Hugh McMaster <hugh.mcmaster at outlook.com> writes:

>> On 11 Apr 2017, at 5:06 am, Alexandre Julliard <julliard at winehq.org> wrote:
>> 
>> Hugh McMaster <hugh.mcmaster at outlook.com> writes:
>> 
>>> +    while (*buf == ' ' || *buf == '\t') buf++;
>>> +    if (!*buf) goto exit;
>>> +
>>> +    p = buf;
>>> +    while (isxdigit(*p))
>>> +    {
>>> +        count++;
>>> +        p++;
>>>     }
>>> -    return TRUE;
>>> +    if (count > 8) goto exit;
>>> +
>>> +    end = p;
>>> +    while (*p == ' ' || *p == '\t') p++;
>>> +    if (*p && *p != ';') goto exit;
>>> +
>>> +    *end = 0;
>>> +    *dw = strtoul(buf, &end, 16);
>>> +    ret = TRUE;
>>> +
>>> +    exit:
>>> +    if (!ret) output_message(STRING_INVALID_HEX);
>>> +    HeapFree(GetProcessHeap(), 0, buf);
>> 
>> The pointer has been modified, you need to free the original one.
>> 
> Okay. While I'm looking at this again, do you want everything done in WCHARs? The conversion to char* is a holdover from the original code.

Sure, it's always better to work in Unicode if possible.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list