Fixed flags handling in StrIsIntlEqualA/W (spotted by James Hawkins).

This commit is contained in:
Alexandre Julliard 2004-07-21 03:12:16 +00:00
parent f3b7cadf8d
commit 400b34493c
2 changed files with 13 additions and 31 deletions

View File

@ -2051,24 +2051,18 @@ INT WINAPI StrFromTimeIntervalW(LPWSTR lpszStr, UINT cchMax, DWORD dwMS,
BOOL WINAPI StrIsIntlEqualA(BOOL bCase, LPCSTR lpszStr, LPCSTR lpszComp,
int iLen)
{
DWORD dwFlags = LOCALE_USE_CP_ACP;
int iRet;
DWORD dwFlags;
TRACE("(%d,%s,%s,%d)\n", bCase,
debugstr_a(lpszStr), debugstr_a(lpszComp), iLen);
/* FIXME: These flags are undocumented and unknown by our CompareString.
* We need defines for them.
/* FIXME: This flag is undocumented and unknown by our CompareString.
* We need a define for it.
*/
dwFlags |= bCase ? 0x10000000 : 0x10000001;
dwFlags = 0x10000000;
if (!bCase) dwFlags |= NORM_IGNORECASE;
iRet = CompareStringA(GetThreadLocale(),
dwFlags, lpszStr, iLen, lpszComp, iLen);
if (!iRet)
iRet = CompareStringA(2048, dwFlags, lpszStr, iLen, lpszComp, iLen);
return iRet == 2 ? TRUE : FALSE;
return (CompareStringA(GetThreadLocale(), dwFlags, lpszStr, iLen, lpszComp, iLen) == CSTR_EQUAL);
}
/*************************************************************************
@ -2080,23 +2074,17 @@ BOOL WINAPI StrIsIntlEqualW(BOOL bCase, LPCWSTR lpszStr, LPCWSTR lpszComp,
int iLen)
{
DWORD dwFlags;
int iRet;
TRACE("(%d,%s,%s,%d)\n", bCase,
debugstr_w(lpszStr),debugstr_w(lpszComp), iLen);
/* FIXME: These flags are undocumented and unknown by our CompareString.
* We need defines for them.
/* FIXME: This flag is undocumented and unknown by our CompareString.
* We need a define for it.
*/
dwFlags = bCase ? 0x10000000 : 0x10000001;
dwFlags = 0x10000000;
if (!bCase) dwFlags |= NORM_IGNORECASE;
iRet = CompareStringW(GetThreadLocale(),
dwFlags, lpszStr, iLen, lpszComp, iLen);
if (!iRet)
iRet = CompareStringW(2048, dwFlags, lpszStr, iLen, lpszComp, iLen);
return iRet == 2 ? TRUE : FALSE;
return (CompareStringW(GetThreadLocale(), dwFlags, lpszStr, iLen, lpszComp, iLen) == CSTR_EQUAL);
}
/*************************************************************************

View File

@ -558,16 +558,10 @@ void test_StrCmpA(void)
ok(!ChrCmpIA('b', 'B'), "ChrCmpIA is not case-insensitive\n");
ok(ChrCmpIA('a', 'z'), "ChrCmpIA believes that a == z!\n");
todo_wine
{
ok(StrIsIntlEqualA(FALSE, str1, str2, 5), "StrIsIntlEqualA(FALSE,...) isn't case-insensitive\n");
}
ok(StrIsIntlEqualA(FALSE, str1, str2, 5), "StrIsIntlEqualA(FALSE,...) isn't case-insensitive\n");
ok(!StrIsIntlEqualA(TRUE, str1, str2, 5), "StrIsIntlEqualA(TRUE,...) isn't case-sensitive\n");
todo_wine
{
ok(IntlStrEqWorkerA(FALSE, str1, str2, 5), "IntlStrEqWorkerA(FALSE,...) isn't case-insensitive\n");
}
ok(IntlStrEqWorkerA(FALSE, str1, str2, 5), "IntlStrEqWorkerA(FALSE,...) isn't case-insensitive\n");
ok(!IntlStrEqWorkerA(TRUE, str1, str2, 5), "IntlStrEqWorkerA(TRUE,...) isn't case-sensitive\n");
}