Fixed bug in directory search for zip and qpak archivers (thanks, Michal!)
authorRyan C. Gordon <icculus@icculus.org>
Fri, 18 Feb 2011 12:38:05 -0500
changeset 1142 25880a820248
parent 1140 079b6bf97b23
child 1145 28f8e425ad8c
Fixed bug in directory search for zip and qpak archivers (thanks, Michal!)
src/archiver_qpak.c
src/archiver_zip.c
--- a/src/archiver_qpak.c	Thu Feb 17 15:02:20 2011 -0500
+++ b/src/archiver_qpak.c	Fri Feb 18 12:38:05 2011 -0500
@@ -434,8 +434,11 @@
 
             if (thispath[pathlen] == '\0') /* found entry? */
                 return &a[middle];
+            /* adjust search params, try again. */
+            else if (thispath[pathlen] > '/')
+                hi = middle - 1;
             else
-                hi = middle - 1;  /* adjust search params, try again. */
+                lo = middle + 1;
         } /* if */
     } /* while */
 
--- a/src/archiver_zip.c	Thu Feb 17 15:02:20 2011 -0500
+++ b/src/archiver_zip.c	Fri Feb 18 12:38:05 2011 -0500
@@ -585,8 +585,11 @@
 
             if (thispath[pathlen] == '\0') /* found entry? */
                 return &a[middle];
+            /* adjust search params, try again. */
+            else if (thispath[pathlen] > '/')
+                hi = middle - 1;
             else
-                hi = middle - 1;  /* adjust search params, try again. */
+                lo = middle + 1;
         } /* if */
     } /* while */