Seeking backwards in ZIP_seek() works now.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 17 Jul 2002 16:05:39 +0000
changeset 345 cbcb27547864
parent 344 015662f3761d
child 346 504cd139c52a
Seeking backwards in ZIP_seek() works now.
archivers/zip.c
--- a/archivers/zip.c	Wed Jul 17 16:05:12 2002 +0000
+++ b/archivers/zip.c	Wed Jul 17 16:05:39 2002 +0000
@@ -351,6 +351,9 @@
             if (zlib_err(inflateInit2(&str, -MAX_WBITS)) != Z_OK)
                 return(0);
 
+            if (!__PHYSFS_platformSeek(in, entry->offset))
+                return(0);
+
             inflateEnd(&finfo->stream);
             memcpy(&finfo->stream, &str, sizeof (z_stream));
             finfo->uncompressed_position = finfo->compressed_position = 0;
@@ -1086,7 +1089,7 @@
 
     /* if it's a symlink, then we ran into a possible symlink loop. */
     is_sym = ( ((ZIPinfo *)(h->opaque))->entries[pos].symlink != NULL );
-    BAIL_IF_MACRO(is_sym, ERR_TOO_MANY_SYMLINKS, 0);
+    BAIL_IF_MACRO(is_sym, ERR_SYMLINK_LOOP, 0);
 
     return(1);
 } /* ZIP_exists */
@@ -1103,7 +1106,7 @@
     entry = &zi->entries[pos];
 
     /* if it's a symlink, then we ran into a possible symlink loop. */
-    BAIL_IF_MACRO(entry->symlink != NULL, ERR_TOO_MANY_SYMLINKS, 0);
+    BAIL_IF_MACRO(entry->symlink != NULL, ERR_SYMLINK_LOOP, 0);
 
     return(entry->last_mod_time);
 } /* ZIP_getLastModTime */
@@ -1119,7 +1122,7 @@
 
     /* if it's a symlink, then we ran into a possible symlink loop. */
     is_sym = ( ((ZIPinfo *)(h->opaque))->entries[pos].symlink != NULL );
-    BAIL_IF_MACRO(is_sym, ERR_TOO_MANY_SYMLINKS, 0);
+    BAIL_IF_MACRO(is_sym, ERR_SYMLINK_LOOP, 0);
 
     dlen = strlen(name);
 
@@ -1147,7 +1150,7 @@
     BAIL_IF_MACRO(pos == -1, ERR_NO_SUCH_FILE, NULL);
 
     /* if it's a symlink, then we ran into a possible symlink loop. */
-    BAIL_IF_MACRO(zi->entries[pos].symlink != NULL, ERR_TOO_MANY_SYMLINKS, 0);
+    BAIL_IF_MACRO(zi->entries[pos].symlink != NULL, ERR_SYMLINK_LOOP, 0);
 
     in = __PHYSFS_platformOpenRead(zi->archiveName);
     BAIL_IF_MACRO(in == NULL, ERR_IO_ERROR, NULL);