[ITSS] Sync with Wine Staging 4.18. CORE-16441
[reactos.git] / dll / win32 / itss / chm_lib.c
index 829f758..f550176 100644 (file)
@@ -54,8 +54,6 @@
  *                                                                         *
  ***************************************************************************/
 
-#include "config.h"
-#include "wine/port.h"
 
 #include <stdarg.h>
 #include <stdio.h>
@@ -64,7 +62,7 @@
 
 #include "windef.h"
 #include "winbase.h"
-#include "wine/unicode.h"
+#include "winnls.h"
 
 #include "chm_lib.h"
 #include "lzx.h"
@@ -995,7 +993,7 @@ static UChar *_chm_find_in_PMGL(UChar *page_buf,
             return NULL;
 
         /* check if it is the right name */
-        if (! strcmpiW(buffer, objPath))
+        if (! wcsicmp(buffer, objPath))
             return temp;
 
         _chm_skip_PMGL_entry_data(&cur);
@@ -1036,7 +1034,7 @@ static Int32 _chm_find_in_PMGI(UChar *page_buf,
             return -1;
 
         /* check if it is the right name */
-        if (strcmpiW(buffer, objPath) > 0)
+        if (wcsicmp(buffer, objPath) > 0)
             return page;
 
         /* load next value for path */
@@ -1327,9 +1325,8 @@ static Int64 _chm_decompress_region(struct chmFile *h,
     /* data request not satisfied, so... start up the decompressor machine */
     if (! h->lzx_state)
     {
-        int window_size = ffs(h->window_size) - 1;
         h->lzx_last_block = -1;
-        h->lzx_state = LZXinit(window_size);
+        h->lzx_state = LZXinit(h->window_size);
     }
 
     /* decompress some data */
@@ -1438,7 +1435,7 @@ BOOL chm_enumerate_dir(struct chmFile *h,
 
     /* initialize pathname state */
     lstrcpynW(prefixRectified, prefix, CHM_MAX_PATHLEN);
-    prefixLen = strlenW(prefixRectified);
+    prefixLen = lstrlenW(prefixRectified);
     if (prefixLen != 0)
     {
         if (prefixRectified[prefixLen-1] != '/')
@@ -1487,7 +1484,7 @@ BOOL chm_enumerate_dir(struct chmFile *h,
             /* check if we should start */
             if (! it_has_begun)
             {
-                if (ui.length == 0  &&  strncmpiW(ui.path, prefixRectified, prefixLen) == 0)
+                if (ui.length == 0  &&  _wcsnicmp(ui.path, prefixRectified, prefixLen) == 0)
                     it_has_begun = TRUE;
                 else
                     continue;
@@ -1499,7 +1496,7 @@ BOOL chm_enumerate_dir(struct chmFile *h,
             /* check if we should stop */
             else
             {
-                if (strncmpiW(ui.path, prefixRectified, prefixLen) != 0)
+                if (_wcsnicmp(ui.path, prefixRectified, prefixLen) != 0)
                 {
                     HeapFree(GetProcessHeap(), 0, page_buf);
                     return TRUE;
@@ -1509,14 +1506,14 @@ BOOL chm_enumerate_dir(struct chmFile *h,
             /* check if we should include this path */
             if (lastPathLen != -1)
             {
-                if (strncmpiW(ui.path, lastPath, lastPathLen) == 0)
+                if (_wcsnicmp(ui.path, lastPath, lastPathLen) == 0)
                     continue;
             }
-            strcpyW(lastPath, ui.path);
-            lastPathLen = strlenW(lastPath);
+            lstrcpyW(lastPath, ui.path);
+            lastPathLen = lstrlenW(lastPath);
 
             /* get the length of the path */
-            ui_path_len = strlenW(ui.path)-1;
+            ui_path_len = lstrlenW(ui.path)-1;
 
             /* check for DIRS */
             if (ui.path[ui_path_len] == '/'  &&  !(what & CHM_ENUMERATE_DIRS))