Piotr Caban : msvcrt: Don't use strncmpiW in _wcsnicoll_l.

Alexandre Julliard julliard at winehq.org
Tue Jul 14 16:23:39 CDT 2020


Module: wine
Branch: master
Commit: 97095766ab42498e5202c99168cfe99814e113de
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=97095766ab42498e5202c99168cfe99814e113de

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Tue Jul 14 20:23:20 2020 +0200

msvcrt: Don't use strncmpiW in _wcsnicoll_l.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/wcs.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c
index 961a680ab8..cb355a0d13 100644
--- a/dlls/msvcrt/wcs.c
+++ b/dlls/msvcrt/wcs.c
@@ -209,7 +209,25 @@ int CDECL MSVCRT__wcsnicoll_l(const MSVCRT_wchar_t* str1, const MSVCRT_wchar_t*
         locinfo = locale->locinfo;
 
     if(!locinfo->lc_handle[MSVCRT_LC_COLLATE])
-        return strncmpiW(str1, str2, count);
+    {
+        MSVCRT_wchar_t c1, c2;
+
+        if (!count)
+            return 0;
+
+        do
+        {
+            c1 = *str1++;
+            if (c1 >= 'A' && c1 <= 'Z')
+                c1 += 'a' - 'A';
+
+            c2 = *str2++;
+            if (c2 >= 'A' && c2 <= 'Z')
+                c2 += 'a' - 'A';
+        } while(--count && c1 && (c1 == c2));
+        return c1 - c2;
+    }
+
     return CompareStringW(locinfo->lc_handle[MSVCRT_LC_COLLATE], NORM_IGNORECASE,
 			  str1, MSVCRT_wcsnlen(str1, count),
                           str2, MSVCRT_wcsnlen(str2, count))-CSTR_EQUAL;




More information about the wine-cvs mailing list