kernelbase: Don't use towlower() on the full Unicode character range.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Alexandre Julliard 2020-03-09 15:14:44 +01:00
parent d731208602
commit 1a9ddc3759
2 changed files with 12 additions and 13 deletions

View File

@ -1652,7 +1652,7 @@ int WINAPI PathCommonPrefixW(const WCHAR *file1, const WCHAR *file2, WCHAR *path
if ((!*iter1 || *iter1 == '\\') && (!*iter2 || *iter2 == '\\'))
len = iter1 - file1; /* Common to this point */
if (!*iter1 || (towlower(*iter1) != towlower(*iter2)))
if (!*iter1 || (towupper(*iter1) != towupper(*iter2)))
break; /* Strings differ at this point */
iter1++;
@ -1813,8 +1813,6 @@ int WINAPI PathGetDriveNumberA(const char *path)
int WINAPI PathGetDriveNumberW(const WCHAR *path)
{
WCHAR drive;
TRACE("%s\n", wine_dbgstr_w(path));
if (!path)
@ -1822,11 +1820,10 @@ int WINAPI PathGetDriveNumberW(const WCHAR *path)
if (!wcsncmp(path, L"\\\\?\\", 4)) path += 4;
drive = towlower(path[0]);
if (drive < 'a' || drive > 'z' || path[1] != ':')
return -1;
return drive - 'a';
if (!path[0] || path[1] != ':') return -1;
if (path[0] >= 'A' && path[0] <= 'Z') return path[0] - 'A';
if (path[0] >= 'a' && path[0] <= 'z') return path[0] - 'a';
return -1;
}
BOOL WINAPI PathIsFileSpecA(const char *path)
@ -4733,7 +4730,7 @@ HRESULT WINAPI UrlCombineW(const WCHAR *baseW, const WCHAR *relativeW, WCHAR *co
work = (LPWSTR)base.pszProtocol;
for (i = 0; i < base.cchProtocol; ++i)
work[i] = towlower(work[i]);
work[i] = RtlDowncaseUnicodeChar(work[i]);
/* mk is a special case */
if (base.nScheme == URL_SCHEME_MK)
@ -4871,7 +4868,7 @@ HRESULT WINAPI UrlCombineW(const WCHAR *baseW, const WCHAR *relativeW, WCHAR *co
{
work = (LPWSTR)relative.pszProtocol;
for (i = 0; i < relative.cchProtocol; ++i)
work[i] = towlower(work[i]);
work[i] = RtlDowncaseUnicodeChar(work[i]);
}
/* Handle cases where relative has scheme. */

View File

@ -924,7 +924,7 @@ BOOL WINAPI StrToInt64ExW(const WCHAR *str, DWORD flags, LONGLONG *ret)
else if (*str == '+')
str++;
if (flags & STIF_SUPPORT_HEX && *str == '0' && towlower(str[1]) == 'x')
if (flags & STIF_SUPPORT_HEX && *str == '0' && (str[1] == 'x' || str[1] == 'X'))
{
/* Read hex number */
str += 2;
@ -935,10 +935,12 @@ BOOL WINAPI StrToInt64ExW(const WCHAR *str, DWORD flags, LONGLONG *ret)
while (iswxdigit(*str))
{
value *= 16;
if (iswdigit(*str))
if (*str >= '0' && *str <= '9')
value += (*str - '0');
else if (*str >= 'A' && *str <= 'Z')
value += 10 + (*str - 'A');
else
value += 10 + (towlower(*str) - 'a');
value += 10 + (*str - 'a');
str++;
}