More enumeration fixes. I still hate this code.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 23 Jul 2002 22:09:35 +0000
changeset 372 2f438fcb9a94
parent 371 56c3a7233f11
child 373 94aeb37c012e
More enumeration fixes. I still hate this code.
archivers/zip.c
--- a/archivers/zip.c	Tue Jul 23 21:26:51 2002 +0000
+++ b/archivers/zip.c	Tue Jul 23 22:09:35 2002 +0000
@@ -1258,7 +1258,7 @@
     LinkedStringList *retval = NULL, *p = NULL;
     PHYSFS_uint32 dlen = strlen(dirname);
 
-    if (dirname[dlen - 1] == '/')
+    if ((dlen > 0) && (dirname[dlen - 1] == '/'))
         dlen--;
 
     i = zip_find_start_of_dir(info, dirname, 0);
@@ -1275,8 +1275,7 @@
         if ( ((omitSymLinks) && (zip_entry_is_symlink(entry))) ||
              (*add_file == '\0') ) /* skip links and the dir entry itself. */
         {
-            i++;
-            continue;
+            if (++i >= max) break; else continue;
         } /* if */
 
         slash = strchr(add_file, '/'); /* handle subdirs under dirname... */
@@ -1297,8 +1296,7 @@
             {
                 if (info->entries[i].name[dlen] == '/')
                 {
-                    i++;  /* skip it. */
-                    continue;
+                    if (++i >= max) break; else continue;
                 } /* if */
             } /* if */
             slash = NULL;