[PATCH v3] kernel32: Implement FindNLSStringEx.
Huw Davies
huw at codeweavers.com
Tue Mar 13 03:37:18 CDT 2018
On Mon, Mar 12, 2018 at 01:15:49PM -0500, Sergio Gómez Del Real wrote:
> + j = flags & (FIND_FROMSTART | FIND_STARTSWITH) ? 0 : src_size;
> + inc_or_dec = flags & (FIND_FROMSTART | FIND_STARTSWITH) ? 1 : -1;
> + for (; j <= src_size && j >= 0; j += inc_or_dec)
> + {
> + if (CompareStringEx(localename, mask, src + j, value_size, value, value_size, NULL, NULL, 0) == CSTR_EQUAL)
> + {
> + if (found)
> + *found = value_size;
> + return j;
> + }
> + if (flags & (FIND_STARTSWITH | FIND_ENDSWITH))
> + break;
> + }
This loop is still not as clean as it could be. Because of the
bi-directionality it would be better to introduce a 'count' variable.
If set correctly it would also avoid needing the break check at the
bottom. Also, consider renaming 'j' to 'offset' and 'inc_or_dec' to
just 'inc'.
Huw.
More information about the wine-devel
mailing list