Made QPAK archiver case insensitive again.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 09 Nov 2003 21:06:15 +0000
changeset 597 e84664806f86
parent 596 381b6ca0dd85
child 598 c3f267dbbbb6
Made QPAK archiver case insensitive again.
archivers/qpak.c
--- a/archivers/qpak.c	Sun Nov 09 20:59:07 2003 +0000
+++ b/archivers/qpak.c	Sun Nov 09 21:06:15 2003 +0000
@@ -43,6 +43,15 @@
 #define __PHYSICSFS_INTERNAL__
 #include "physfs_internal.h"
 
+#if 1  /* Make this case insensitive? */
+#define QPAK_strcmp(x, y) __PHYSFS_platformStricmp(x, y)
+#define QPAK_strncmp(x, y, z) __PHYSFS_platformStrnicmp(x, y, z)
+#else
+#define QPAK_strcmp(x, y) strcmp(x, y)
+#define QPAK_strncmp(x, y, z) strncmp(x, y, z)
+#endif
+
+
 typedef struct
 {
     char name[56];
@@ -288,7 +297,7 @@
 static int qpak_entry_cmp(void *_a, PHYSFS_uint32 one, PHYSFS_uint32 two)
 {
     QPAKentry *a = (QPAKentry *) _a;
-    return(strcmp(a[one].name, a[two].name));
+    return(QPAK_strcmp(a[one].name, a[two].name));
 } /* qpak_entry_cmp */
 
 
@@ -422,7 +431,7 @@
     {
         middle = lo + ((hi - lo) / 2);
         name = info->entries[middle].name;
-        rc = strncmp(path, name, dlen);
+        rc = QPAK_strncmp(path, name, dlen);
         if (rc == 0)
         {
             char ch = name[dlen];
@@ -477,7 +486,7 @@
         char *ptr;
         PHYSFS_sint32 ln;
         char *e = info->entries[i].name;
-        if ((dlen) && ((strncmp(e, dirname, dlen) != 0) || (e[dlen] != '/')))
+        if ((dlen) && ((QPAK_strncmp(e, dirname, dlen)) || (e[dlen] != '/')))
             break;  /* past end of this dir; we're done. */
 
         add = e + dlen_inc;
@@ -490,7 +499,7 @@
         while ((++i < max) && (ptr != NULL))
         {
             char *e_new = info->entries[i].name;
-            if ((strncmp(e, e_new, ln) != 0) || (e_new[ln] != '/'))
+            if ((QPAK_strncmp(e, e_new, ln) != 0) || (e_new[ln] != '/'))
                 break;
         } /* while */
     } /* while */
@@ -518,7 +527,7 @@
     {
         middle = lo + ((hi - lo) / 2);
         thispath = a[middle].name;
-        rc = strncmp(path, thispath, pathlen);
+        rc = QPAK_strncmp(path, thispath, pathlen);
 
         if (rc > 0)
             lo = middle + 1;