More tweaks; GRP completely implemented. Everything builds clean.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 08 Jul 2001 10:58:10 +0000
changeset 22 49f6101707b4
parent 21 b1ea58d70a56
child 23 bd6ba9c8717c
More tweaks; GRP completely implemented. Everything builds clean.
Makefile
archivers/dir.c
archivers/zip.c
physfs.c
physfs_internal.h
--- a/Makefile	Sun Jul 08 05:27:05 2001 +0000
+++ b/Makefile	Sun Jul 08 10:58:10 2001 +0000
@@ -145,6 +145,11 @@
 CFLAGS += -DPHYSFS_SUPPORTS_ZIP
 endif
 
+ifeq ($(strip $(use_archive_grp)),true)
+MAINSRCS += archivers/grp.c
+CFLAGS += -DPHYSFS_SUPPORTS_GRP
+endif
+
 # Rule for getting list of objects from source
 MAINOBJS1 := $(MAINSRCS:.c=.o)
 MAINOBJS2 := $(MAINOBJS1:.cpp=.o)
--- a/archivers/dir.c	Sun Jul 08 05:27:05 2001 +0000
+++ b/archivers/dir.c	Sun Jul 08 10:58:10 2001 +0000
@@ -14,6 +14,7 @@
 #include <sys/types.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include "physfs.h"
 
 #define __PHYSICSFS_INTERNAL__
 #include "physfs_internal.h"
@@ -30,8 +31,7 @@
 
     errno = 0;
     retval = fread(buffer, objSize, objCount, h);
-    if ( (retval < objCount) && (ferror(h)) )
-        __PHYSFS_setError(strerror(errno));
+    BAIL_IF_MACRO((retval < objCount) && (ferror(h)),strerror(errno),retval);
 
     return(retval);
 } /* DIR_read */
@@ -294,7 +294,7 @@
     DIR_eof,        /* eof() method       */
     DIR_tell,       /* tell() method      */
     DIR_seek,       /* seek() method      */
-    DIR_fileClose,  /* fileClose() method */
+    DIR_fileClose   /* fileClose() method */
 };
 
 
@@ -311,13 +311,13 @@
     DIR_openAppend,         /* openAppend() method     */
     DIR_remove,             /* remove() method         */
     DIR_mkdir,              /* mkdir() method          */
-    DIR_dirClose,           /* dirClose() method       */
+    DIR_dirClose            /* dirClose() method       */
 };
 
 
 /* This doesn't get listed, since it's technically not an archive... */
 #if 0
-const __PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_DIR =
+const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_DIR =
 {
     "DIR",
     "non-archive directory I/O"
--- a/archivers/zip.c	Sun Jul 08 05:27:05 2001 +0000
+++ b/archivers/zip.c	Sun Jul 08 10:58:10 2001 +0000
@@ -8,6 +8,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include "physfs.h"
 
 #define __PHYSICSFS_INTERNAL__
 #include "physfs_internal.h"
@@ -17,7 +18,7 @@
 #endif
 
 extern const DirFunctions __PHYSFS_DirFunctions_ZIP;
-extern const FileFunctions __PHYSFS_FileHandle_ZIP;
+static const FileFunctions __PHYSFS_FileFunctions_ZIP;
 
 
 static int ZIP_read(FileHandle *handle, void *buffer,
@@ -93,7 +94,7 @@
     ZIP_eof,        /* eof() method   */
     ZIP_tell,       /* tell() method  */
     ZIP_seek,       /* seek() method  */
-    ZIP_fileClose,  /* fileClose() method */
+    ZIP_fileClose   /* fileClose() method */
 };
 
 
@@ -110,10 +111,10 @@
     NULL,                   /* openAppend() method     */
     NULL,                   /* remove() method         */
     NULL,                   /* mkdir() method          */
-    ZIP_dirClose,           /* dirClose() method       */
+    ZIP_dirClose            /* dirClose() method       */
 };
 
-const __PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP =
+const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP =
 {
     "ZIP",
     "PkZip/WinZip/Info-Zip compatible"
--- a/physfs.c	Sun Jul 08 05:27:05 2001 +0000
+++ b/physfs.c	Sun Jul 08 10:58:10 2001 +0000
@@ -46,6 +46,11 @@
 extern const DirFunctions         __PHYSFS_DirFunctions_ZIP;
 #endif
 
+#if (defined PHYSFS_SUPPORTS_GRP)
+extern const PHYSFS_ArchiveInfo   __PHYSFS_ArchiveInfo_GRP;
+extern const DirFunctions         __PHYSFS_DirFunctions_GRP;
+#endif
+
 extern const DirFunctions  __PHYSFS_DirFunctions_DIR;
 
 static const PHYSFS_ArchiveInfo *supported_types[] =
--- a/physfs_internal.h	Sun Jul 08 05:27:05 2001 +0000
+++ b/physfs_internal.h	Sun Jul 08 10:58:10 2001 +0000
@@ -240,6 +240,7 @@
 #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"
+#define ERR_ARC_IS_READ_ONLY     "Archive is read-only"
 
 /*
  * Call this to set the message returned by PHYSFS_getLastError().