Archive implementation (Build Groupfiles), other tweaks.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 08 Jul 2001 05:27:05 +0000
changeset 21 b1ea58d70a56
parent 20 efdde0d21521
child 22 49f6101707b4
Archive implementation (Build Groupfiles), other tweaks.
Makefile
archivers/dir.c
archivers/zip.c
physfs.c
physfs_internal.h
--- a/Makefile	Sun Jul 08 03:25:12 2001 +0000
+++ b/Makefile	Sun Jul 08 05:27:05 2001 +0000
@@ -38,6 +38,7 @@
 #  Note that various archives may need external libraries.
 #-----------------------------------------------------------------------------#
 use_archive_zip := false
+use_archive_grp := true
 
 #-----------------------------------------------------------------------------#
 # Set to "true" if you'd like to build a DLL. Set to "false" otherwise.
@@ -45,7 +46,6 @@
 #build_dll := false
 build_dll := true
 
-
 #-----------------------------------------------------------------------------#
 # Set one of the below. Currently, none of these are used.
 #-----------------------------------------------------------------------------#
--- a/archivers/dir.c	Sun Jul 08 03:25:12 2001 +0000
+++ b/archivers/dir.c	Sun Jul 08 05:27:05 2001 +0000
@@ -19,8 +19,8 @@
 #include "physfs_internal.h"
 
 extern const DirFunctions __PHYSFS_DirFunctions_DIR;
-static const FileFunctions __PHYSFS_FileHandle_DIR;
-static const FileFunctions __PHYSFS_FileHandle_DIRW;
+static const FileFunctions __PHYSFS_FileFunctions_DIR;
+static const FileFunctions __PHYSFS_FileFunctions_DIRW;
 
 static int DIR_read(FileHandle *handle, void *buffer,
                     unsigned int objSize, unsigned int objCount)
@@ -112,7 +112,8 @@
     int namelen = strlen(name);
     int seplen = strlen(dirsep);
 
-    BAIL_IF_MACRO(!DIR_isArchive(name, 0), ERR_UNSUPPORTED_ARCHIVE, NULL);
+    BAIL_IF_MACRO(!DIR_isArchive(name, forWriting),
+                    ERR_UNSUPPORTED_ARCHIVE, NULL);
 
     retval = malloc(sizeof (DirHandle));
     BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
@@ -210,7 +211,7 @@
 
     retval->opaque = (void *) rc;
     retval->dirHandle = h;
-    retval->funcs = &__PHYSFS_FileHandle_DIR;
+    retval->funcs = &__PHYSFS_FileFunctions_DIR;
     return(retval);
 } /* doOpen */
 
@@ -275,7 +276,7 @@
 
 
 
-static const FileFunctions __PHYSFS_FileHandle_DIR =
+static const FileFunctions __PHYSFS_FileFunctions_DIR =
 {
     DIR_read,       /* read() method      */
     NULL,           /* write() method     */
@@ -286,7 +287,7 @@
 };
 
 
-static const FileFunctions __PHYSFS_FileHandle_DIRW =
+static const FileFunctions __PHYSFS_FileFunctions_DIRW =
 {
     NULL,           /* read() method      */
     DIR_write,      /* write() method     */
--- a/archivers/zip.c	Sun Jul 08 03:25:12 2001 +0000
+++ b/archivers/zip.c	Sun Jul 08 05:27:05 2001 +0000
@@ -56,37 +56,37 @@
 } /* ZIP_openArchive */
 
 
-static LinkedStringList *ZIP_enumerateFiles(DirHandle *r, const char *dirname)
+static LinkedStringList *ZIP_enumerateFiles(DirHandle *h, const char *dirname)
 {
 } /* ZIP_enumerateFiles */
 
 
-static int ZIP_exists(DirHandle *r, const char *name)
+static int ZIP_exists(DirHandle *h, const char *name)
 {
 } /* ZIP_exists */
 
 
-static int ZIP_isDirectory(DirHandle *r, const char *name)
+static int ZIP_isDirectory(DirHandle *h, const char *name)
 {
 } /* ZIP_isDirectory */
 
 
-static int ZIP_isSymLink(DirHandle *r, const char *name)
+static int ZIP_isSymLink(DirHandle *h, const char *name)
 {
 } /* ZIP_isSymLink */
 
 
-static FileHandle *ZIP_openRead(DirHandle *r, const char *filename)
+static FileHandle *ZIP_openRead(DirHandle *h, const char *filename)
 {
 } /* ZIP_openRead */
 
 
-static void ZIP_dirClose(DirHandle *r)
+static void ZIP_dirClose(DirHandle *h)
 {
 } /* ZIP_dirClose */
 
 
-static const FileFunctions __PHYSFS_FileHandle_ZIP =
+static const FileFunctions __PHYSFS_FileFunctions_ZIP =
 {
     ZIP_read,       /* read() method  */
     NULL,           /* write() method */
--- a/physfs.c	Sun Jul 08 03:25:12 2001 +0000
+++ b/physfs.c	Sun Jul 08 05:27:05 2001 +0000
@@ -54,6 +54,10 @@
     &__PHYSFS_ArchiveInfo_ZIP,
 #endif
 
+#if (defined PHYSFS_SUPPORTS_GRP)
+    &__PHYSFS_ArchiveInfo_GRP,
+#endif
+
     NULL
 };
 
@@ -63,6 +67,10 @@
     &__PHYSFS_DirFunctions_ZIP,
 #endif
 
+#if (defined PHYSFS_SUPPORTS_GRP)
+    &__PHYSFS_DirFunctions_GRP,
+#endif
+
     &__PHYSFS_DirFunctions_DIR,
     NULL
 };
--- a/physfs_internal.h	Sun Jul 08 03:25:12 2001 +0000
+++ b/physfs_internal.h	Sun Jul 08 05:27:05 2001 +0000
@@ -239,7 +239,7 @@
 #define ERR_SYMLINK_DISALLOWED   "Symbolic links are disabled"
 #define ERR_NO_WRITE_DIR         "Write directory is not set"
 #define ERR_NO_SUCH_FILE         "No such file"
-
+#define ERR_PAST_EOF             "Past end of file"
 
 /*
  * Call this to set the message returned by PHYSFS_getLastError().