Restores code remove from commit 2a455ce049d65eeab95895b6b6d52f6e5047537b.
Always subtracting 2 means two strings could never be equal, returning 0.
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/kernelbase/string.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/dlls/kernelbase/string.c b/dlls/kernelbase/string.c index 7bea47942e..edc68ed01e 100644 --- a/dlls/kernelbase/string.c +++ b/dlls/kernelbase/string.c @@ -67,34 +67,50 @@ static BOOL char_compare(WORD ch1, WORD ch2, DWORD flags)
int WINAPI lstrcmpA( LPCSTR str1, LPCSTR str2 ) { + int ret; if (!str1 && !str2) return 0; if (!str1) return -1; if (!str2) return 1; - return CompareStringA( GetThreadLocale(), LOCALE_USE_CP_ACP, str1, -1, str2, -1 ) - 2; + ret = CompareStringA( GetThreadLocale(), LOCALE_USE_CP_ACP, str1, -1, str2, -1 ); + if (ret) ret -= 2; + + return ret; }
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2) { + int ret; if (!str1 && !str2) return 0; if (!str1) return -1; if (!str2) return 1; - return CompareStringW( GetThreadLocale(), 0, str1, -1, str2, -1 ) - 2; + ret = CompareStringW( GetThreadLocale(), 0, str1, -1, str2, -1 ); + if (ret) ret -= 2; + + return ret; }
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2) { + int ret; if (!str1 && !str2) return 0; if (!str1) return -1; if (!str2) return 1; - return CompareStringA( GetThreadLocale(), NORM_IGNORECASE|LOCALE_USE_CP_ACP, str1, -1, str2, -1 ) - 2; + ret = CompareStringA( GetThreadLocale(), NORM_IGNORECASE|LOCALE_USE_CP_ACP, str1, -1, str2, -1 ); + if (ret) ret -= 2; + + return ret; }
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2) { + int ret; if (!str1 && !str2) return 0; if (!str1) return -1; if (!str2) return 1; - return CompareStringW( GetThreadLocale(), NORM_IGNORECASE, str1, -1, str2, -1 ) - 2; + ret = CompareStringW( GetThreadLocale(), NORM_IGNORECASE, str1, -1, str2, -1 ); + if (ret) ret -= 2; + + return ret; }
LPSTR WINAPI KERNELBASE_lstrcpynA( LPSTR dst, LPCSTR src, INT n )