kernel32: Short circuit required length calculation.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2016-09-23 00:06:15 +09:00 committed by Alexandre Julliard
parent a901b68f59
commit 5d907050e2
1 changed files with 14 additions and 9 deletions

View File

@ -3207,17 +3207,22 @@ INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, LPCWSTR src, INT srclen, LPW
{
INT len;
for (len = 0; srclen; src++, srclen--)
if (flags & NORM_IGNORESYMBOLS)
{
WCHAR wch = *src;
/* tests show that win2k just ignores NORM_IGNORENONSPACE,
* and skips white space and punctuation characters for
* NORM_IGNORESYMBOLS.
*/
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
continue;
len++;
for (len = 0; srclen; src++, srclen--)
{
WCHAR wch = *src;
/* tests show that win2k just ignores NORM_IGNORENONSPACE,
* and skips white space and punctuation characters for
* NORM_IGNORESYMBOLS.
*/
if (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE))
continue;
len++;
}
}
else
len = srclen;
return len;
}