[PATCH 1/2] jscript: Use wide-char string literals.

Jacek Caban jacek at codeweavers.com
Wed Dec 2 12:14:27 CST 2020


Hi Jeff,

For some reason, the patch status page shows Testbot status OK, while 
tests failed.

On 01.12.2020 23:02, Jeff Smith wrote:
> @@ -510,8 +508,8 @@ static HRESULT str_to_number(jsstr_t *str, double *ret)
>           ptr++;
>       }
>   
> -    if(!wcsncmp(ptr, infinityW, ARRAY_SIZE(infinityW))) {
> -        ptr += ARRAY_SIZE(infinityW);
> +    if(!wcscmp(ptr, L"Infinity")) {
> +        ptr += lstrlenW(L"Infinity");
>           while(*ptr && iswspace(*ptr))
>               ptr++;


There is a reason wcsncmp is used in current code: we want to check only 
a prefix of ptr. Also lstrlenW() has runtime cost, which should be 
avoided in places like this. ARRAY_SIZE()-1 will give you that in 
compile time. The same applies to other places.


Thanks,

Jacek




More information about the wine-devel mailing list