Просмотр исходного кода

More tweaks; GRP completely implemented. Everything builds clean.

Ryan C. Gordon 25 лет назад
Родитель
Сommit
59185346dd
5 измененных файлов с 21 добавлено и 9 удалено
  1. 5 0
      Makefile
  2. 5 5
      archivers/dir.c
  3. 5 4
      archivers/zip.c
  4. 5 0
      physfs.c
  5. 1 0
      physfs_internal.h

+ 5 - 0
Makefile

@@ -145,6 +145,11 @@ MAINSRCS += archivers/zip.c
 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)

+ 5 - 5
archivers/dir.c

@@ -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 @@ static int DIR_read(FileHandle *handle, void *buffer,
 
     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 @@ static const FileFunctions __PHYSFS_FileFunctions_DIRW =
     DIR_eof,        /* eof() method       */
     DIR_tell,       /* tell() method      */
     DIR_seek,       /* seek() method      */
-    DIR_fileClose,  /* fileClose() method */
+    DIR_fileClose   /* fileClose() method */
 };
 
 
@@ -311,13 +311,13 @@ const DirFunctions __PHYSFS_DirFunctions_DIR =
     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"

+ 5 - 4
archivers/zip.c

@@ -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 @@ static const FileFunctions __PHYSFS_FileFunctions_ZIP =
     ZIP_eof,        /* eof() method   */
     ZIP_tell,       /* tell() method  */
     ZIP_seek,       /* seek() method  */
-    ZIP_fileClose,  /* fileClose() method */
+    ZIP_fileClose   /* fileClose() method */
 };
 
 
@@ -110,10 +111,10 @@ const DirFunctions __PHYSFS_DirFunctions_ZIP =
     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"

+ 5 - 0
physfs.c

@@ -46,6 +46,11 @@ extern const PHYSFS_ArchiveInfo   __PHYSFS_ArchiveInfo_ZIP;
 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[] =

+ 1 - 0
physfs_internal.h

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