From 619944cf58ae738ed984b9ab7dfb42ae1653edd9 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Thu, 23 Jan 2014 15:10:14 +0100 Subject: [PATCH] msvcrt: Fix str*coll functions behavior in C locale. --- dlls/msvcrt/string.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c index 10fb35f2cc9..446c1199359 100644 --- a/dlls/msvcrt/string.c +++ b/dlls/msvcrt/string.c @@ -489,6 +489,8 @@ int CDECL MSVCRT_strcoll_l( const char* str1, const char* str2, MSVCRT__locale_t else locinfo = locale->locinfo; + if(!locinfo->lc_handle[MSVCRT_LC_COLLATE]) + return strcmp(str1, str2); return CompareStringA(locinfo->lc_handle[MSVCRT_LC_COLLATE], 0, str1, -1, str2, -1)-CSTR_EQUAL; } @@ -512,6 +514,8 @@ int CDECL MSVCRT__stricoll_l( const char* str1, const char* str2, MSVCRT__locale else locinfo = locale->locinfo; + if(!locinfo->lc_handle[MSVCRT_LC_COLLATE]) + return strcasecmp(str1, str2); return CompareStringA(locinfo->lc_handle[MSVCRT_LC_COLLATE], NORM_IGNORECASE, str1, -1, str2, -1)-CSTR_EQUAL; } @@ -536,6 +540,8 @@ int CDECL MSVCRT__strncoll_l( const char* str1, const char* str2, MSVCRT_size_t else locinfo = locale->locinfo; + if(!locinfo->lc_handle[MSVCRT_LC_COLLATE]) + return strncmp(str1, str2, count); return CompareStringA(locinfo->lc_handle[MSVCRT_LC_COLLATE], 0, str1, count, str2, count)-CSTR_EQUAL; } @@ -559,6 +565,8 @@ int CDECL MSVCRT__strnicoll_l( const char* str1, const char* str2, MSVCRT_size_t else locinfo = locale->locinfo; + if(!locinfo->lc_handle[MSVCRT_LC_COLLATE]) + return strncasecmp(str1, str2, count); return CompareStringA(locinfo->lc_handle[MSVCRT_LC_COLLATE], NORM_IGNORECASE, str1, count, str2, count)-CSTR_EQUAL; }