1
0
Эх сурвалжийг харах

Archive implementation (Build Groupfiles), other tweaks.

Ryan C. Gordon 25 жил өмнө
parent
commit
ee508bb2e0
5 өөрчлөгдсөн 24 нэмэгдсэн , 15 устгасан
  1. 1 1
      Makefile
  2. 7 6
      archivers/dir.c
  3. 7 7
      archivers/zip.c
  4. 8 0
      physfs.c
  5. 1 1
      physfs_internal.h

+ 1 - 1
Makefile

@@ -38,6 +38,7 @@ debugging := true
 #  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 @@ use_archive_zip := false
 #build_dll := false
 build_dll := true
 
-
 #-----------------------------------------------------------------------------#
 # Set one of the below. Currently, none of these are used.
 #-----------------------------------------------------------------------------#

+ 7 - 6
archivers/dir.c

@@ -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 @@ static DirHandle *DIR_openArchive(const char *name, int forWriting)
     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 @@ static FileHandle *doOpen(DirHandle *h, const char *name, const char *mode)
 
     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 void DIR_dirClose(DirHandle *h)
 
 
 
-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_DIR =
 };
 
 
-static const FileFunctions __PHYSFS_FileHandle_DIRW =
+static const FileFunctions __PHYSFS_FileFunctions_DIRW =
 {
     NULL,           /* read() method      */
     DIR_write,      /* write() method     */

+ 7 - 7
archivers/zip.c

@@ -56,37 +56,37 @@ static DirHandle *ZIP_openArchive(const char *name, int forWriting)
 } /* 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 */

+ 8 - 0
physfs.c

@@ -54,6 +54,10 @@ static const PHYSFS_ArchiveInfo *supported_types[] =
     &__PHYSFS_ArchiveInfo_ZIP,
 #endif
 
+#if (defined PHYSFS_SUPPORTS_GRP)
+    &__PHYSFS_ArchiveInfo_GRP,
+#endif
+
     NULL
 };
 
@@ -63,6 +67,10 @@ static const DirFunctions *dirFunctions[] =
     &__PHYSFS_DirFunctions_ZIP,
 #endif
 
+#if (defined PHYSFS_SUPPORTS_GRP)
+    &__PHYSFS_DirFunctions_GRP,
+#endif
+
     &__PHYSFS_DirFunctions_DIR,
     NULL
 };

+ 1 - 1
physfs_internal.h

@@ -239,7 +239,7 @@ typedef struct __PHYSFS_DIRFUNCTIONS__
 #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().