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 )
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=54314
Your paranoid android.
=== debian9 (build log) ===
Task: WineTest did not produce the wow32 report
Alistair Leslie-Hughes leslie_alistair@hotmail.com writes:
Restores code remove from commit 2a455ce049d65eeab95895b6b6d52f6e5047537b.
Always subtracting 2 means two strings could never be equal, returning 0.
CompareString() only returns 0 on error. Where do you see such an error?
Hi Alexandre,
CompareString() only returns 0 on error. Where do you see such an error?
I cant at the moment, so just ignore it.
Regards Alistair.