More tweaks; GRP completely implemented. Everything builds clean.

This commit is contained in:
Ryan C. Gordon 2001-07-08 10:58:10 +00:00
parent ee508bb2e0
commit 59185346dd
5 changed files with 21 additions and 9 deletions

View File

@ -145,6 +145,11 @@ MAINSRCS += archivers/zip.c
CFLAGS += -DPHYSFS_SUPPORTS_ZIP CFLAGS += -DPHYSFS_SUPPORTS_ZIP
endif endif
ifeq ($(strip $(use_archive_grp)),true)
MAINSRCS += archivers/grp.c
CFLAGS += -DPHYSFS_SUPPORTS_GRP
endif
# Rule for getting list of objects from source # Rule for getting list of objects from source
MAINOBJS1 := $(MAINSRCS:.c=.o) MAINOBJS1 := $(MAINSRCS:.c=.o)
MAINOBJS2 := $(MAINOBJS1:.cpp=.o) MAINOBJS2 := $(MAINOBJS1:.cpp=.o)

View File

@ -14,6 +14,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include "physfs.h"
#define __PHYSICSFS_INTERNAL__ #define __PHYSICSFS_INTERNAL__
#include "physfs_internal.h" #include "physfs_internal.h"
@ -30,8 +31,7 @@ static int DIR_read(FileHandle *handle, void *buffer,
errno = 0; errno = 0;
retval = fread(buffer, objSize, objCount, h); retval = fread(buffer, objSize, objCount, h);
if ( (retval < objCount) && (ferror(h)) ) BAIL_IF_MACRO((retval < objCount) && (ferror(h)),strerror(errno),retval);
__PHYSFS_setError(strerror(errno));
return(retval); return(retval);
} /* DIR_read */ } /* DIR_read */
@ -294,7 +294,7 @@ static const FileFunctions __PHYSFS_FileFunctions_DIRW =
DIR_eof, /* eof() method */ DIR_eof, /* eof() method */
DIR_tell, /* tell() method */ DIR_tell, /* tell() method */
DIR_seek, /* seek() 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_openAppend, /* openAppend() method */
DIR_remove, /* remove() method */ DIR_remove, /* remove() method */
DIR_mkdir, /* mkdir() 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... */ /* This doesn't get listed, since it's technically not an archive... */
#if 0 #if 0
const __PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_DIR = const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_DIR =
{ {
"DIR", "DIR",
"non-archive directory I/O" "non-archive directory I/O"

View File

@ -8,6 +8,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "physfs.h"
#define __PHYSICSFS_INTERNAL__ #define __PHYSICSFS_INTERNAL__
#include "physfs_internal.h" #include "physfs_internal.h"
@ -17,7 +18,7 @@
#endif #endif
extern const DirFunctions __PHYSFS_DirFunctions_ZIP; 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, static int ZIP_read(FileHandle *handle, void *buffer,
@ -93,7 +94,7 @@ static const FileFunctions __PHYSFS_FileFunctions_ZIP =
ZIP_eof, /* eof() method */ ZIP_eof, /* eof() method */
ZIP_tell, /* tell() method */ ZIP_tell, /* tell() method */
ZIP_seek, /* seek() 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, /* openAppend() method */
NULL, /* remove() method */ NULL, /* remove() method */
NULL, /* mkdir() 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", "ZIP",
"PkZip/WinZip/Info-Zip compatible" "PkZip/WinZip/Info-Zip compatible"

View File

@ -46,6 +46,11 @@ extern const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP;
extern const DirFunctions __PHYSFS_DirFunctions_ZIP; extern const DirFunctions __PHYSFS_DirFunctions_ZIP;
#endif #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; extern const DirFunctions __PHYSFS_DirFunctions_DIR;
static const PHYSFS_ArchiveInfo *supported_types[] = static const PHYSFS_ArchiveInfo *supported_types[] =

View File

@ -240,6 +240,7 @@ typedef struct __PHYSFS_DIRFUNCTIONS__
#define ERR_NO_WRITE_DIR "Write directory is not set" #define ERR_NO_WRITE_DIR "Write directory is not set"
#define ERR_NO_SUCH_FILE "No such file" #define ERR_NO_SUCH_FILE "No such file"
#define ERR_PAST_EOF "Past end of 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(). * Call this to set the message returned by PHYSFS_getLastError().