Piotr Caban : krnl386.exe16: Don't use strncasecmp.

Alexandre Julliard julliard at winehq.org
Tue Apr 2 16:09:59 CDT 2019


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Tue Apr  2 16:52:01 2019 +0200

krnl386.exe16: Don't use strncasecmp.

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

---

 dlls/krnl386.exe16/atom.c      | 6 +++---
 dlls/krnl386.exe16/ne_module.c | 2 +-
 dlls/krnl386.exe16/resource.c  | 8 ++++----
 dlls/krnl386.exe16/snoop.c     | 2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/dlls/krnl386.exe16/atom.c b/dlls/krnl386.exe16/atom.c
index a059561..23ef717 100644
--- a/dlls/krnl386.exe16/atom.c
+++ b/dlls/krnl386.exe16/atom.c
@@ -108,7 +108,7 @@ static WORD ATOM_Hash(
 
     TRACE("%x, %s, %x\n", entries, str, len);
 
-    for (i = 0; i < len; i++) hash ^= toupper(str[i]) + i;
+    for (i = 0; i < len; i++) hash ^= RtlUpperChar(str[i]) + i;
     return hash % entries;
 }
 
@@ -223,7 +223,7 @@ ATOM WINAPI AddAtom16( LPCSTR str )
     {
         entryPtr = ATOM_MakePtr( entry );
         if ((entryPtr->length == len) &&
-            (!strncasecmp( entryPtr->str, buffer, len )))
+            (!_strnicmp( entryPtr->str, buffer, len )))
         {
             entryPtr->refCount++;
             TRACE("-- existing 0x%x\n", entry);
@@ -310,7 +310,7 @@ ATOM WINAPI FindAtom16( LPCSTR str )
     {
         ATOMENTRY * entryPtr = ATOM_MakePtr( entry );
         if ((entryPtr->length == len) &&
-            (!strncasecmp( entryPtr->str, str, len )))
+            (!_strnicmp( entryPtr->str, str, len )))
         {
             TRACE("-- found %x\n", entry);
             return HANDLETOATOM( entry );
diff --git a/dlls/krnl386.exe16/ne_module.c b/dlls/krnl386.exe16/ne_module.c
index d494585..0d343aa 100644
--- a/dlls/krnl386.exe16/ne_module.c
+++ b/dlls/krnl386.exe16/ne_module.c
@@ -1455,7 +1455,7 @@ HMODULE16 WINAPI GetModuleHandle16( LPCSTR name )
         if (pModule->ne_flags & NE_FFLAGS_WIN32) continue;
 
         name_table = (BYTE *)pModule + pModule->ne_restab;
-	/* FIXME: the strncasecmp is WRONG. It should not be case insensitive,
+	/* FIXME: the _strnicmp is WRONG. It should not be case insensitive,
 	 * but case sensitive! (Unfortunately Winword 6 and subdlls have
 	 * lowercased module names, but try to load uppercase DLLs, so this
 	 * 'i' compare is just a quickfix until the loader handles that
diff --git a/dlls/krnl386.exe16/resource.c b/dlls/krnl386.exe16/resource.c
index 2f606fa..42a6d14 100644
--- a/dlls/krnl386.exe16/resource.c
+++ b/dlls/krnl386.exe16/resource.c
@@ -213,7 +213,7 @@ static DWORD NE_FindNameTableId( NE_MODULE *pModule, LPCSTR typeId, LPCSTR resId
                 if (p[1] & 0x8000)
                 {
                     if (!HIWORD(typeId)) continue;
-                    if (strcasecmp( typeId, (char *)(p + 3) )) continue;
+                    if (_strnicmp( typeId, (char *)(p + 3), -1 )) continue;
                 }
                 else if (HIWORD(typeId) || (((DWORD)typeId & ~0x8000)!= p[1]))
                   continue;
@@ -223,7 +223,7 @@ static DWORD NE_FindNameTableId( NE_MODULE *pModule, LPCSTR typeId, LPCSTR resId
                 if (p[2] & 0x8000)
                 {
                     if (!HIWORD(resId)) continue;
-                    if (strcasecmp( resId, (char*)(p+3)+strlen((char*)(p+3))+1 )) continue;
+                    if (_strnicmp( resId, (char*)(p+3)+strlen((char*)(p+3))+1, -1 )) continue;
 
                 }
                 else if (HIWORD(resId) || ((LOWORD(resId) & ~0x8000) != p[2]))
@@ -261,7 +261,7 @@ static NE_TYPEINFO *NE_FindTypeSection( LPBYTE pResTab, NE_TYPEINFO *pTypeInfo,
             if (!(pTypeInfo->type_id & 0x8000))
             {
                 BYTE *p = pResTab + pTypeInfo->type_id;
-                if ((*p == len) && !strncasecmp( (char*)p+1, str, len ))
+                if ((*p == len) && !_strnicmp( (char*)p+1, str, len ))
                 {
                     TRACE("  Found type '%s'\n", str );
                     return pTypeInfo;
@@ -308,7 +308,7 @@ static NE_NAMEINFO *NE_FindResourceFromType( LPBYTE pResTab, NE_TYPEINFO *pTypeI
         {
             if (pNameInfo->id & 0x8000) continue;
             p = pResTab + pNameInfo->id;
-            if ((*p == len) && !strncasecmp( (char*)p+1, str, len ))
+            if ((*p == len) && !_strnicmp( (char*)p+1, str, len ))
                 return pNameInfo;
         }
     }
diff --git a/dlls/krnl386.exe16/snoop.c b/dlls/krnl386.exe16/snoop.c
index 4496080..af06e35 100644
--- a/dlls/krnl386.exe16/snoop.c
+++ b/dlls/krnl386.exe16/snoop.c
@@ -224,7 +224,7 @@ SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) {
 	if (strchr(fun->name,'_')) {
 		char *s=strchr(fun->name,'_');
 
-		if (!strncasecmp(s,"_thunkdata",10)) {
+		if (!_strnicmp(s,"_thunkdata",10)) {
 			HeapFree(GetProcessHeap(),0,fun->name);
 			fun->name = NULL;
 			return origfun;




More information about the wine-cvs mailing list