Piotr Caban : hhctrl.ocx: Don't use strncasecmp.

Alexandre Julliard julliard at winehq.org
Wed Apr 3 15:26:20 CDT 2019


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Apr  3 18:20:14 2019 +0200

hhctrl.ocx: Don't use strncasecmp.

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

---

 dlls/hhctrl.ocx/chm.c     |  2 +-
 dlls/hhctrl.ocx/content.c | 18 +++++++++---------
 dlls/hhctrl.ocx/hhctrl.h  |  1 +
 dlls/hhctrl.ocx/index.c   | 22 +++++++++++-----------
 dlls/hhctrl.ocx/search.c  |  2 +-
 5 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/dlls/hhctrl.ocx/chm.c b/dlls/hhctrl.ocx/chm.c
index 0140336..48500ca 100644
--- a/dlls/hhctrl.ocx/chm.c
+++ b/dlls/hhctrl.ocx/chm.c
@@ -595,7 +595,7 @@ WCHAR *GetDocumentTitle(CHMInfo *info, LPCWSTR document)
 
         TRACE("%s\n", node.buf);
 
-        if(!strcasecmp(node_name.buf, "title")) {
+        if(!_strnicmp(node_name.buf, "title", -1)) {
             if(next_content(&stream, &content) && content.len > 1)
             {
                 document_title = strdupnAtoW(&content.buf[1], content.len-1);
diff --git a/dlls/hhctrl.ocx/content.c b/dlls/hhctrl.ocx/content.c
index 6a7c8f8..a20d486 100644
--- a/dlls/hhctrl.ocx/content.c
+++ b/dlls/hhctrl.ocx/content.c
@@ -62,11 +62,11 @@ static void parse_obj_node_param(ContentItem *item, ContentItem *hhc_root, const
         return;
     }
 
-    if(!strncasecmp("name", ptr, len)) {
+    if(!_strnicmp("name", ptr, len)) {
         param = &item->name;
-    }else if(!strncasecmp("merge", ptr, len)) {
+    }else if(!_strnicmp("merge", ptr, len)) {
         param = &merge;
-    }else if(!strncasecmp("local", ptr, len)) {
+    }else if(!_strnicmp("local", ptr, len)) {
         param = &item->local;
     }else {
         WARN("unhandled param %s\n", debugstr_an(ptr, len));
@@ -148,9 +148,9 @@ static ContentItem *parse_sitemap_object(HHInfo *info, stream_t *stream, Content
 
         TRACE("%s\n", node.buf);
 
-        if(!strcasecmp(node_name.buf, "/object"))
+        if(!_strnicmp(node_name.buf, "/object", -1))
             break;
-        if(!strcasecmp(node_name.buf, "param"))
+        if(!_strnicmp(node_name.buf, "param", -1))
             parse_obj_node_param(item, hhc_root, node.buf, info->pCHMInfo->codePage);
 
         strbuf_zero(&node);
@@ -195,7 +195,7 @@ static ContentItem *parse_ul(HHInfo *info, stream_t *stream, ContentItem *hhc_ro
 
         TRACE("%s\n", node.buf);
 
-        if(!strcasecmp(node_name.buf, "object")) {
+        if(!_strnicmp(node_name.buf, "object", -1)) {
             const char *ptr;
             int len;
 
@@ -210,10 +210,10 @@ static ContentItem *parse_ul(HHInfo *info, stream_t *stream, ContentItem *hhc_ro
                 if(!ret)
                     ret = prev;
             }
-        }else if(!strcasecmp(node_name.buf, "ul")) {
+        }else if(!_strnicmp(node_name.buf, "ul", -1)) {
             new_item = parse_ul(info, stream, hhc_root);
             insert_item(prev, new_item, INSERT_CHILD);
-        }else if(!strcasecmp(node_name.buf, "/ul")) {
+        }else if(!_strnicmp(node_name.buf, "/ul", -1)) {
             break;
         }
 
@@ -245,7 +245,7 @@ static ContentItem *parse_hhc(HHInfo *info, IStream *str, ContentItem *hhc_root,
 
         TRACE("%s\n", node.buf);
 
-        if(!strcasecmp(node_name.buf, "ul")) {
+        if(!_strnicmp(node_name.buf, "ul", -1)) {
             ContentItem *item = parse_ul(info, &stream, hhc_root);
             prev = insert_item(prev, item, INSERT_CHILD);
             if(!ret)
diff --git a/dlls/hhctrl.ocx/hhctrl.h b/dlls/hhctrl.ocx/hhctrl.h
index b358f54..ae525cf 100644
--- a/dlls/hhctrl.ocx/hhctrl.h
+++ b/dlls/hhctrl.ocx/hhctrl.h
@@ -26,6 +26,7 @@
 
 #include "windef.h"
 #include "winbase.h"
+#include "winternl.h"
 #include "winuser.h"
 #include "winnls.h"
 #include "htmlhelp.h"
diff --git a/dlls/hhctrl.ocx/index.c b/dlls/hhctrl.ocx/index.c
index 8b80ce2..375f3e4 100644
--- a/dlls/hhctrl.ocx/index.c
+++ b/dlls/hhctrl.ocx/index.c
@@ -83,20 +83,20 @@ static void parse_index_obj_node_param(IndexItem *item, const char *text, UINT c
     /* Allocate a new sub-item, either on the first run or whenever a
      * sub-topic has filled out both the "name" and "local" params.
      */
-    if(item->itemFlags == 0x11 && (!strncasecmp("name", ptr, len) || !strncasecmp("local", ptr, len)))
+    if(item->itemFlags == 0x11 && (!_strnicmp("name", ptr, len) || !_strnicmp("local", ptr, len)))
         item_realloc(item, item->nItems+1);
-    if(!strncasecmp("keyword", ptr, len)) {
+    if(!_strnicmp("keyword", ptr, len)) {
         param = &item->keyword;
-    }else if(!item->keyword && !strncasecmp("name", ptr, len)) {
+    }else if(!item->keyword && !_strnicmp("name", ptr, len)) {
         /* Some HTML Help index files use an additional "name" parameter
          * rather than the "keyword" parameter.  In this case, the first
          * occurrence of the "name" parameter is the keyword.
          */
         param = &item->keyword;
-    }else if(!strncasecmp("name", ptr, len)) {
+    }else if(!_strnicmp("name", ptr, len)) {
         item->itemFlags |= 0x01;
         param = &item->items[item->nItems-1].name;
-    }else if(!strncasecmp("local", ptr, len)) {
+    }else if(!_strnicmp("local", ptr, len)) {
         item->itemFlags |= 0x10;
         param = &item->items[item->nItems-1].local;
     }else {
@@ -137,9 +137,9 @@ static IndexItem *parse_index_sitemap_object(HHInfo *info, stream_t *stream)
 
         TRACE("%s\n", node.buf);
 
-        if(!strcasecmp(node_name.buf, "param")) {
+        if(!_strnicmp(node_name.buf, "param", -1)) {
             parse_index_obj_node_param(item, node.buf, info->pCHMInfo->codePage);
-        }else if(!strcasecmp(node_name.buf, "/object")) {
+        }else if(!_strnicmp(node_name.buf, "/object", -1)) {
             break;
         }else {
             WARN("Unhandled tag! %s\n", node_name.buf);
@@ -173,7 +173,7 @@ static IndexItem *parse_li(HHInfo *info, stream_t *stream)
 
         TRACE("%s\n", node.buf);
 
-        if(!strcasecmp(node_name.buf, "object")) {
+        if(!_strnicmp(node_name.buf, "object", -1)) {
             const char *ptr;
             int len;
 
@@ -228,7 +228,7 @@ static void parse_hhindex(HHInfo *info, IStream *str, IndexItem *item)
 
         TRACE("%s\n", node.buf);
 
-        if(!strcasecmp(node_name.buf, "li")) {
+        if(!_strnicmp(node_name.buf, "li", -1)) {
             IndexItem *new_item;
 
             new_item = parse_li(info, &stream);
@@ -246,9 +246,9 @@ static void parse_hhindex(HHInfo *info, IStream *str, IndexItem *item)
                 item = item->next;
                 item->indentLevel = indent_level;
             }
-        }else if(!strcasecmp(node_name.buf, "ul")) {
+        }else if(!_strnicmp(node_name.buf, "ul", -1)) {
             indent_level++;
-        }else if(!strcasecmp(node_name.buf, "/ul")) {
+        }else if(!_strnicmp(node_name.buf, "/ul", -1)) {
             indent_level--;
         }else {
             WARN("Unhandled tag! %s\n", node_name.buf);
diff --git a/dlls/hhctrl.ocx/search.c b/dlls/hhctrl.ocx/search.c
index 0e198b8..0c38f1d 100644
--- a/dlls/hhctrl.ocx/search.c
+++ b/dlls/hhctrl.ocx/search.c
@@ -102,7 +102,7 @@ static WCHAR *SearchCHM_File(IStorage *pStorage, const WCHAR *file, const char *
             char *text = &content.buf[1];
             int textlen = content.len-1;
 
-            if(!strcasecmp(node_name.buf, "title"))
+            if(!_strnicmp(node_name.buf, "title", -1))
             {
                 int wlen = MultiByteToWideChar(CP_ACP, 0, text, textlen, NULL, 0);
                 title = heap_alloc((wlen+1)*sizeof(WCHAR));




More information about the wine-cvs mailing list