From 0492580bda6b2c1a92601b90d843d894be63b3f1 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 29 Sep 2004 06:18:04 +0000 Subject: [PATCH] Removed all the forward declaration cruft from the archivers. --- CHANGELOG | 4 ++ archivers/dir.c | 99 ++++++++++++++++++---------------------------- archivers/grp.c | 96 +++++++++++++++++---------------------------- archivers/hog.c | 96 +++++++++++++++++---------------------------- archivers/mix.c | 94 +++++++++++++++++--------------------------- archivers/mvl.c | 96 +++++++++++++++++---------------------------- archivers/qpak.c | 96 +++++++++++++++++---------------------------- archivers/wad.c | 96 +++++++++++++++++---------------------------- archivers/zip.c | 100 ++++++++++++++++++----------------------------- 9 files changed, 288 insertions(+), 489 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b2effee8..3ba09084 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,10 @@ build the lists, too. The callback functionality goes all the way down to the archivers and platform drivers where appropriate, which cleans things up and simplifies some internal tasks very nicely. + Got rid of all the annoying forward declarations in all the + archivers and moved their PHYSFS_Archiver data to the end of the + file, since this was annoying me and I was getting sick of updating + function signatures in two places when the internal API changed. 09262004 - Did the same thing to FileHandles than I did to DirHandles, but this triggered massive tweaking in physfs.c. A lot of code got little cleanups, which was nice. Less malloc pressure, too, since diff --git a/archivers/dir.c b/archivers/dir.c index b43a029d..f9c5c985 100644 --- a/archivers/dir.c +++ b/archivers/dir.c @@ -18,68 +18,6 @@ #define __PHYSICSFS_INTERNAL__ #include "physfs_internal.h" -static PHYSFS_sint64 DIR_read(fvoid *opaque, void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static PHYSFS_sint64 DIR_write(fvoid *opaque, const void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static int DIR_eof(fvoid *opaque); -static PHYSFS_sint64 DIR_tell(fvoid *opaque); -static int DIR_seek(fvoid *opaque, PHYSFS_uint64 offset); -static PHYSFS_sint64 DIR_fileLength(fvoid *opaque); -static int DIR_fileClose(fvoid *opaque); -static int DIR_isArchive(const char *filename, int forWriting); -static void *DIR_openArchive(const char *name, int forWriting); -static void DIR_enumerateFiles(dvoid *opaque, const char *dname, - int omitSymLinks, PHYSFS_StringCallback cb, - void *callbackdata); -static int DIR_exists(dvoid *opaque, const char *name); -static int DIR_isDirectory(dvoid *opaque, const char *name, int *fileExists); -static int DIR_isSymLink(dvoid *opaque, const char *name, int *fileExists); -static fvoid *DIR_openRead(dvoid *opaque, const char *fnm, int *exist); -static PHYSFS_sint64 DIR_getLastModTime(dvoid *opaque, const char *f, int *e); -static fvoid *DIR_openWrite(dvoid *opaque, const char *filename); -static fvoid *DIR_openAppend(dvoid *opaque, const char *filename); -static int DIR_remove(dvoid *opaque, const char *name); -static int DIR_mkdir(dvoid *opaque, const char *name); -static void DIR_dirClose(dvoid *opaque); - - -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_DIR = -{ - "", - DIR_ARCHIVE_DESCRIPTION, - "Ryan C. Gordon ", - "http://icculus.org/physfs/", -}; - - - -const PHYSFS_Archiver __PHYSFS_Archiver_DIR = -{ - &__PHYSFS_ArchiveInfo_DIR, - DIR_isArchive, /* isArchive() method */ - DIR_openArchive, /* openArchive() method */ - DIR_enumerateFiles, /* enumerateFiles() method */ - DIR_exists, /* exists() method */ - DIR_isDirectory, /* isDirectory() method */ - DIR_isSymLink, /* isSymLink() method */ - DIR_getLastModTime, /* getLastModTime() method */ - DIR_openRead, /* openRead() method */ - DIR_openWrite, /* openWrite() method */ - DIR_openAppend, /* openAppend() method */ - DIR_remove, /* remove() method */ - DIR_mkdir, /* mkdir() method */ - DIR_dirClose, /* dirClose() method */ - DIR_read, /* read() method */ - DIR_write, /* write() method */ - DIR_eof, /* eof() method */ - DIR_tell, /* tell() method */ - DIR_seek, /* seek() method */ - DIR_fileLength, /* fileLength() method */ - DIR_fileClose /* fileClose() method */ -}; - - static PHYSFS_sint64 DIR_read(fvoid *opaque, void *buffer, PHYSFS_uint32 objSize, PHYSFS_uint32 objCount) { @@ -307,5 +245,42 @@ static void DIR_dirClose(dvoid *opaque) free(opaque); } /* DIR_dirClose */ + + +const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_DIR = +{ + "", + DIR_ARCHIVE_DESCRIPTION, + "Ryan C. Gordon ", + "http://icculus.org/physfs/", +}; + + + +const PHYSFS_Archiver __PHYSFS_Archiver_DIR = +{ + &__PHYSFS_ArchiveInfo_DIR, + DIR_isArchive, /* isArchive() method */ + DIR_openArchive, /* openArchive() method */ + DIR_enumerateFiles, /* enumerateFiles() method */ + DIR_exists, /* exists() method */ + DIR_isDirectory, /* isDirectory() method */ + DIR_isSymLink, /* isSymLink() method */ + DIR_getLastModTime, /* getLastModTime() method */ + DIR_openRead, /* openRead() method */ + DIR_openWrite, /* openWrite() method */ + DIR_openAppend, /* openAppend() method */ + DIR_remove, /* remove() method */ + DIR_mkdir, /* mkdir() method */ + DIR_dirClose, /* dirClose() method */ + DIR_read, /* read() method */ + DIR_write, /* write() method */ + DIR_eof, /* eof() method */ + DIR_tell, /* tell() method */ + DIR_seek, /* seek() method */ + DIR_fileLength, /* fileLength() method */ + DIR_fileClose /* fileClose() method */ +}; + /* end of dir.c ... */ diff --git a/archivers/grp.c b/archivers/grp.c index 6dee7054..e882e369 100644 --- a/archivers/grp.c +++ b/archivers/grp.c @@ -61,67 +61,6 @@ typedef struct } GRPfileinfo; -static PHYSFS_sint64 GRP_read(fvoid *opaque, void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static PHYSFS_sint64 GRP_write(fvoid *opaque, const void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static int GRP_eof(fvoid *opaque); -static PHYSFS_sint64 GRP_tell(fvoid *opaque); -static int GRP_seek(fvoid *opaque, PHYSFS_uint64 offset); -static PHYSFS_sint64 GRP_fileLength(fvoid *opaque); -static int GRP_fileClose(fvoid *opaque); -static int GRP_isArchive(const char *filename, int forWriting); -static void *GRP_openArchive(const char *name, int forWriting); -static void GRP_enumerateFiles(dvoid *opaque, const char *dname, - int omitSymLinks, PHYSFS_StringCallback cb, - void *callbackdata); -static int GRP_exists(dvoid *opaque, const char *name); -static int GRP_isDirectory(dvoid *opaque, const char *name, int *fileExists); -static int GRP_isSymLink(dvoid *opaque, const char *name, int *fileExists); -static PHYSFS_sint64 GRP_getLastModTime(dvoid *opaque, const char *n, int *e); -static fvoid *GRP_openRead(dvoid *opaque, const char *name, int *exist); -static fvoid *GRP_openWrite(dvoid *opaque, const char *name); -static fvoid *GRP_openAppend(dvoid *opaque, const char *name); -static int GRP_remove(dvoid *opaque, const char *name); -static int GRP_mkdir(dvoid *opaque, const char *name); -static void GRP_dirClose(dvoid *opaque); - -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_GRP = -{ - "GRP", - GRP_ARCHIVE_DESCRIPTION, - "Ryan C. Gordon ", - "http://icculus.org/physfs/", -}; - - -const PHYSFS_Archiver __PHYSFS_Archiver_GRP = -{ - &__PHYSFS_ArchiveInfo_GRP, - GRP_isArchive, /* isArchive() method */ - GRP_openArchive, /* openArchive() method */ - GRP_enumerateFiles, /* enumerateFiles() method */ - GRP_exists, /* exists() method */ - GRP_isDirectory, /* isDirectory() method */ - GRP_isSymLink, /* isSymLink() method */ - GRP_getLastModTime, /* getLastModTime() method */ - GRP_openRead, /* openRead() method */ - GRP_openWrite, /* openWrite() method */ - GRP_openAppend, /* openAppend() method */ - GRP_remove, /* remove() method */ - GRP_mkdir, /* mkdir() method */ - GRP_dirClose, /* dirClose() method */ - GRP_read, /* read() method */ - GRP_write, /* write() method */ - GRP_eof, /* eof() method */ - GRP_tell, /* tell() method */ - GRP_seek, /* seek() method */ - GRP_fileLength, /* fileLength() method */ - GRP_fileClose /* fileClose() method */ -}; - - - static void GRP_dirClose(dvoid *opaque) { GRPinfo *info = ((GRPinfo *) opaque); @@ -495,6 +434,41 @@ static int GRP_mkdir(dvoid *opaque, const char *name) BAIL_MACRO(ERR_NOT_SUPPORTED, 0); } /* GRP_mkdir */ + +const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_GRP = +{ + "GRP", + GRP_ARCHIVE_DESCRIPTION, + "Ryan C. Gordon ", + "http://icculus.org/physfs/", +}; + + +const PHYSFS_Archiver __PHYSFS_Archiver_GRP = +{ + &__PHYSFS_ArchiveInfo_GRP, + GRP_isArchive, /* isArchive() method */ + GRP_openArchive, /* openArchive() method */ + GRP_enumerateFiles, /* enumerateFiles() method */ + GRP_exists, /* exists() method */ + GRP_isDirectory, /* isDirectory() method */ + GRP_isSymLink, /* isSymLink() method */ + GRP_getLastModTime, /* getLastModTime() method */ + GRP_openRead, /* openRead() method */ + GRP_openWrite, /* openWrite() method */ + GRP_openAppend, /* openAppend() method */ + GRP_remove, /* remove() method */ + GRP_mkdir, /* mkdir() method */ + GRP_dirClose, /* dirClose() method */ + GRP_read, /* read() method */ + GRP_write, /* write() method */ + GRP_eof, /* eof() method */ + GRP_tell, /* tell() method */ + GRP_seek, /* seek() method */ + GRP_fileLength, /* fileLength() method */ + GRP_fileClose /* fileClose() method */ +}; + #endif /* defined PHYSFS_SUPPORTS_GRP */ /* end of grp.c ... */ diff --git a/archivers/hog.c b/archivers/hog.c index e84e81cb..c9f784a2 100644 --- a/archivers/hog.c +++ b/archivers/hog.c @@ -75,67 +75,6 @@ typedef struct } HOGfileinfo; -static PHYSFS_sint64 HOG_read(fvoid *opaque, void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static PHYSFS_sint64 HOG_write(fvoid *opaque, const void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static int HOG_eof(fvoid *opaque); -static PHYSFS_sint64 HOG_tell(fvoid *opaque); -static int HOG_seek(fvoid *opaque, PHYSFS_uint64 offset); -static PHYSFS_sint64 HOG_fileLength(fvoid *opaque); -static int HOG_fileClose(fvoid *opaque); -static int HOG_isArchive(const char *filename, int forWriting); -static void *HOG_openArchive(const char *name, int forWriting); -static void HOG_enumerateFiles(dvoid *opaque, const char *dname, - int omitSymLinks, PHYSFS_StringCallback cb, - void *callbackdata); -static int HOG_exists(dvoid *opaque, const char *name); -static int HOG_isDirectory(dvoid *opaque, const char *name, int *fileExists); -static int HOG_isSymLink(dvoid *opaque, const char *name, int *fileExists); -static PHYSFS_sint64 HOG_getLastModTime(dvoid *opaque, const char *n, int *e); -static fvoid *HOG_openRead(dvoid *opaque, const char *name, int *exist); -static fvoid *HOG_openWrite(dvoid *opaque, const char *name); -static fvoid *HOG_openAppend(dvoid *opaque, const char *name); -static int HOG_remove(dvoid *opaque, const char *name); -static int HOG_mkdir(dvoid *opaque, const char *name); -static void HOG_dirClose(dvoid *opaque); - -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_HOG = -{ - "HOG", - HOG_ARCHIVE_DESCRIPTION, - "Bradley Bell ", - "http://icculus.org/physfs/", -}; - - -const PHYSFS_Archiver __PHYSFS_Archiver_HOG = -{ - &__PHYSFS_ArchiveInfo_HOG, - HOG_isArchive, /* isArchive() method */ - HOG_openArchive, /* openArchive() method */ - HOG_enumerateFiles, /* enumerateFiles() method */ - HOG_exists, /* exists() method */ - HOG_isDirectory, /* isDirectory() method */ - HOG_isSymLink, /* isSymLink() method */ - HOG_getLastModTime, /* getLastModTime() method */ - HOG_openRead, /* openRead() method */ - HOG_openWrite, /* openWrite() method */ - HOG_openAppend, /* openAppend() method */ - HOG_remove, /* remove() method */ - HOG_mkdir, /* mkdir() method */ - HOG_dirClose, /* dirClose() method */ - HOG_read, /* read() method */ - HOG_write, /* write() method */ - HOG_eof, /* eof() method */ - HOG_tell, /* tell() method */ - HOG_seek, /* seek() method */ - HOG_fileLength, /* fileLength() method */ - HOG_fileClose /* fileClose() method */ -}; - - - static void HOG_dirClose(dvoid *opaque) { HOGinfo *info = ((HOGinfo *) opaque); @@ -534,6 +473,41 @@ static int HOG_mkdir(dvoid *opaque, const char *name) BAIL_MACRO(ERR_NOT_SUPPORTED, 0); } /* HOG_mkdir */ + +const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_HOG = +{ + "HOG", + HOG_ARCHIVE_DESCRIPTION, + "Bradley Bell ", + "http://icculus.org/physfs/", +}; + + +const PHYSFS_Archiver __PHYSFS_Archiver_HOG = +{ + &__PHYSFS_ArchiveInfo_HOG, + HOG_isArchive, /* isArchive() method */ + HOG_openArchive, /* openArchive() method */ + HOG_enumerateFiles, /* enumerateFiles() method */ + HOG_exists, /* exists() method */ + HOG_isDirectory, /* isDirectory() method */ + HOG_isSymLink, /* isSymLink() method */ + HOG_getLastModTime, /* getLastModTime() method */ + HOG_openRead, /* openRead() method */ + HOG_openWrite, /* openWrite() method */ + HOG_openAppend, /* openAppend() method */ + HOG_remove, /* remove() method */ + HOG_mkdir, /* mkdir() method */ + HOG_dirClose, /* dirClose() method */ + HOG_read, /* read() method */ + HOG_write, /* write() method */ + HOG_eof, /* eof() method */ + HOG_tell, /* tell() method */ + HOG_seek, /* seek() method */ + HOG_fileLength, /* fileLength() method */ + HOG_fileClose /* fileClose() method */ +}; + #endif /* defined PHYSFS_SUPPORTS_HOG */ /* end of hog.c ... */ diff --git a/archivers/mix.c b/archivers/mix.c index e2063c0c..7a70081e 100644 --- a/archivers/mix.c +++ b/archivers/mix.c @@ -80,65 +80,6 @@ typedef struct void *handle; /* filehandle */ } MIXfileinfo; -static PHYSFS_sint64 MIX_read(fvoid *opaque, void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static PHYSFS_sint64 MIX_write(fvoid *opaque, const void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static int MIX_eof(fvoid *opaque); -static PHYSFS_sint64 MIX_tell(fvoid *opaque); -static int MIX_seek(fvoid *opaque, PHYSFS_uint64 offset); -static PHYSFS_sint64 MIX_fileLength(fvoid *opaque); -static int MIX_fileClose(fvoid *opaque); -static int MIX_isArchive(const char *filename, int forWriting); -static void *MIX_openArchive(const char *name, int forWriting); -static void MIX_enumerateFiles(dvoid *opaque, const char *dname, - int omitSymLinks, PHYSFS_StringCallback cb, - void *callbackdata) -static int MIX_exists(dvoid *opaque, const char *name); -static int MIX_isDirectory(dvoid *opaque, const char *name, int *fileExists); -static int MIX_isSymLink(dvoid *opaque, const char *name, int *fileExists); -static PHYSFS_sint64 MIX_getLastModTime(dvoid *opaque, const char *n, int *e); -static fvoid *MIX_openRead(dvoid *opaque, const char *name, int *exist); -static fvoid *MIX_openWrite(dvoid *opaque, const char *name); -static fvoid *MIX_openAppend(dvoid *opaque, const char *name); -static int MIX_remove(dvoid *opaque, const char *name); -static int MIX_mkdir(dvoid *opaque, const char *name); -static void MIX_dirClose(dvoid *opaque); - -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_MIX = -{ - "MIX", - "Westwood archive (Tiberian Dawn / Red Alert)", - "Sebastian Steinhauer ", - "http://icculus.org/physfs/", -}; - - -const PHYSFS_Archiver __PHYSFS_Archiver_MIX = -{ - &__PHYSFS_ArchiveInfo_MIX, - MIX_isArchive, /* isArchive() method */ - MIX_openArchive, /* openArchive() method */ - MIX_enumerateFiles, /* enumerateFiles() method */ - MIX_exists, /* exists() method */ - MIX_isDirectory, /* isDirectory() method */ - MIX_isSymLink, /* isSymLink() method */ - MIX_getLastModTime, /* getLastModTime() method */ - MIX_openRead, /* openRead() method */ - MIX_openWrite, /* openWrite() method */ - MIX_openAppend, /* openAppend() method */ - MIX_remove, /* remove() method */ - MIX_mkdir, /* mkdir() method */ - MIX_dirClose, /* dirClose() method */ - MIX_read, /* read() method */ - MIX_write, /* write() method */ - MIX_eof, /* eof() method */ - MIX_tell, /* tell() method */ - MIX_seek, /* seek() method */ - MIX_fileLength, /* fileLength() method */ - MIX_fileClose /* fileClose() method */ -}; - static PHYSFS_uint32 MIX_hash(const char *name) { @@ -478,6 +419,41 @@ static int MIX_mkdir(dvoid *opaque, const char *name) BAIL_MACRO(ERR_NOT_SUPPORTED, 0); } /* MIX_mkdir */ + +const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_MIX = +{ + "MIX", + "Westwood archive (Tiberian Dawn / Red Alert)", + "Sebastian Steinhauer ", + "http://icculus.org/physfs/", +}; + + +const PHYSFS_Archiver __PHYSFS_Archiver_MIX = +{ + &__PHYSFS_ArchiveInfo_MIX, + MIX_isArchive, /* isArchive() method */ + MIX_openArchive, /* openArchive() method */ + MIX_enumerateFiles, /* enumerateFiles() method */ + MIX_exists, /* exists() method */ + MIX_isDirectory, /* isDirectory() method */ + MIX_isSymLink, /* isSymLink() method */ + MIX_getLastModTime, /* getLastModTime() method */ + MIX_openRead, /* openRead() method */ + MIX_openWrite, /* openWrite() method */ + MIX_openAppend, /* openAppend() method */ + MIX_remove, /* remove() method */ + MIX_mkdir, /* mkdir() method */ + MIX_dirClose, /* dirClose() method */ + MIX_read, /* read() method */ + MIX_write, /* write() method */ + MIX_eof, /* eof() method */ + MIX_tell, /* tell() method */ + MIX_seek, /* seek() method */ + MIX_fileLength, /* fileLength() method */ + MIX_fileClose /* fileClose() method */ +}; + #endif /* defined PHYSFS_SUPPORTS_MIX */ /* end of mix.c ... */ diff --git a/archivers/mvl.c b/archivers/mvl.c index edc9faaa..d2ece80f 100644 --- a/archivers/mvl.c +++ b/archivers/mvl.c @@ -64,67 +64,6 @@ typedef struct } MVLfileinfo; -static PHYSFS_sint64 MVL_read(fvoid *opaque, void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static PHYSFS_sint64 MVL_write(fvoid *opaque, const void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static int MVL_eof(fvoid *opaque); -static PHYSFS_sint64 MVL_tell(fvoid *opaque); -static int MVL_seek(fvoid *opaque, PHYSFS_uint64 offset); -static PHYSFS_sint64 MVL_fileLength(fvoid *opaque); -static int MVL_fileClose(fvoid *opaque); -static int MVL_isArchive(const char *filename, int forWriting); -static void *MVL_openArchive(const char *name, int forWriting); -static void MVL_enumerateFiles(dvoid *opaque, const char *dname, - int omitSymLinks, PHYSFS_StringCallback cb, - void *callbackdata); -static int MVL_exists(dvoid *opaque, const char *name); -static int MVL_isDirectory(dvoid *opaque, const char *name, int *fileExists); -static int MVL_isSymLink(dvoid *opaque, const char *name, int *fileExists); -static PHYSFS_sint64 MVL_getLastModTime(dvoid *opaque, const char *n, int *e); -static fvoid *MVL_openRead(dvoid *opaque, const char *name, int *exist); -static fvoid *MVL_openWrite(dvoid *opaque, const char *name); -static fvoid *MVL_openAppend(dvoid *opaque, const char *name); -static int MVL_remove(dvoid *opaque, const char *name); -static int MVL_mkdir(dvoid *opaque, const char *name); -static void MVL_dirClose(dvoid *opaque); - -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_MVL = -{ - "MVL", - MVL_ARCHIVE_DESCRIPTION, - "Bradley Bell ", - "http://icculus.org/physfs/", -}; - - -const PHYSFS_Archiver __PHYSFS_Archiver_MVL = -{ - &__PHYSFS_ArchiveInfo_MVL, - MVL_isArchive, /* isArchive() method */ - MVL_openArchive, /* openArchive() method */ - MVL_enumerateFiles, /* enumerateFiles() method */ - MVL_exists, /* exists() method */ - MVL_isDirectory, /* isDirectory() method */ - MVL_isSymLink, /* isSymLink() method */ - MVL_getLastModTime, /* getLastModTime() method */ - MVL_openRead, /* openRead() method */ - MVL_openWrite, /* openWrite() method */ - MVL_openAppend, /* openAppend() method */ - MVL_remove, /* remove() method */ - MVL_mkdir, /* mkdir() method */ - MVL_dirClose, /* dirClose() method */ - MVL_read, /* read() method */ - MVL_write, /* write() method */ - MVL_eof, /* eof() method */ - MVL_tell, /* tell() method */ - MVL_seek, /* seek() method */ - MVL_fileLength, /* fileLength() method */ - MVL_fileClose /* fileClose() method */ -}; - - - static void MVL_dirClose(dvoid *opaque) { MVLinfo *info = ((MVLinfo *) opaque); @@ -492,6 +431,41 @@ static int MVL_mkdir(dvoid *opaque, const char *name) BAIL_MACRO(ERR_NOT_SUPPORTED, 0); } /* MVL_mkdir */ + +const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_MVL = +{ + "MVL", + MVL_ARCHIVE_DESCRIPTION, + "Bradley Bell ", + "http://icculus.org/physfs/", +}; + + +const PHYSFS_Archiver __PHYSFS_Archiver_MVL = +{ + &__PHYSFS_ArchiveInfo_MVL, + MVL_isArchive, /* isArchive() method */ + MVL_openArchive, /* openArchive() method */ + MVL_enumerateFiles, /* enumerateFiles() method */ + MVL_exists, /* exists() method */ + MVL_isDirectory, /* isDirectory() method */ + MVL_isSymLink, /* isSymLink() method */ + MVL_getLastModTime, /* getLastModTime() method */ + MVL_openRead, /* openRead() method */ + MVL_openWrite, /* openWrite() method */ + MVL_openAppend, /* openAppend() method */ + MVL_remove, /* remove() method */ + MVL_mkdir, /* mkdir() method */ + MVL_dirClose, /* dirClose() method */ + MVL_read, /* read() method */ + MVL_write, /* write() method */ + MVL_eof, /* eof() method */ + MVL_tell, /* tell() method */ + MVL_seek, /* seek() method */ + MVL_fileLength, /* fileLength() method */ + MVL_fileClose /* fileClose() method */ +}; + #endif /* defined PHYSFS_SUPPORTS_MVL */ /* end of mvl.c ... */ diff --git a/archivers/qpak.c b/archivers/qpak.c index 8c563dd2..a59dc174 100644 --- a/archivers/qpak.c +++ b/archivers/qpak.c @@ -78,67 +78,6 @@ typedef struct #define QPAK_SIGNATURE 0x4b434150 /* "PACK" in ASCII. */ -static PHYSFS_sint64 QPAK_read(fvoid *opaque, void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static PHYSFS_sint64 QPAK_write(fvoid *opaque, const void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static int QPAK_eof(fvoid *opaque); -static PHYSFS_sint64 QPAK_tell(fvoid *opaque); -static int QPAK_seek(fvoid *opaque, PHYSFS_uint64 offset); -static PHYSFS_sint64 QPAK_fileLength(fvoid *opaque); -static int QPAK_fileClose(fvoid *opaque); -static int QPAK_isArchive(const char *filename, int forWriting); -static void *QPAK_openArchive(const char *name, int forWriting); -static void QPAK_enumerateFiles(dvoid *opaque, const char *dname, - int omitSymLinks, PHYSFS_StringCallback cb, - void *callbackdata); -static int QPAK_exists(dvoid *opaque, const char *name); -static int QPAK_isDirectory(dvoid *opaque, const char *name, int *fileExists); -static int QPAK_isSymLink(dvoid *opaque, const char *name, int *fileExists); -static PHYSFS_sint64 QPAK_getLastModTime(dvoid *opaque, const char *n, int *e); -static fvoid *QPAK_openRead(dvoid *opaque, const char *name, int *exist); -static fvoid *QPAK_openWrite(dvoid *opaque, const char *name); -static fvoid *QPAK_openAppend(dvoid *opaque, const char *name); -static int QPAK_remove(dvoid *opaque, const char *name); -static int QPAK_mkdir(dvoid *opaque, const char *name); -static void QPAK_dirClose(dvoid *opaque); - -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_QPAK = -{ - "PAK", - QPAK_ARCHIVE_DESCRIPTION, - "Ryan C. Gordon ", - "http://icculus.org/physfs/", -}; - - -const PHYSFS_Archiver __PHYSFS_Archiver_QPAK = -{ - &__PHYSFS_ArchiveInfo_QPAK, - QPAK_isArchive, /* isArchive() method */ - QPAK_openArchive, /* openArchive() method */ - QPAK_enumerateFiles, /* enumerateFiles() method */ - QPAK_exists, /* exists() method */ - QPAK_isDirectory, /* isDirectory() method */ - QPAK_isSymLink, /* isSymLink() method */ - QPAK_getLastModTime, /* getLastModTime() method */ - QPAK_openRead, /* openRead() method */ - QPAK_openWrite, /* openWrite() method */ - QPAK_openAppend, /* openAppend() method */ - QPAK_remove, /* remove() method */ - QPAK_mkdir, /* mkdir() method */ - QPAK_dirClose, /* dirClose() method */ - QPAK_read, /* read() method */ - QPAK_write, /* write() method */ - QPAK_eof, /* eof() method */ - QPAK_tell, /* tell() method */ - QPAK_seek, /* seek() method */ - QPAK_fileLength, /* fileLength() method */ - QPAK_fileClose /* fileClose() method */ -}; - - - static void QPAK_dirClose(dvoid *opaque) { QPAKinfo *info = ((QPAKinfo *) opaque); @@ -652,6 +591,41 @@ static int QPAK_mkdir(dvoid *opaque, const char *name) BAIL_MACRO(ERR_NOT_SUPPORTED, 0); } /* QPAK_mkdir */ + +const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_QPAK = +{ + "PAK", + QPAK_ARCHIVE_DESCRIPTION, + "Ryan C. Gordon ", + "http://icculus.org/physfs/", +}; + + +const PHYSFS_Archiver __PHYSFS_Archiver_QPAK = +{ + &__PHYSFS_ArchiveInfo_QPAK, + QPAK_isArchive, /* isArchive() method */ + QPAK_openArchive, /* openArchive() method */ + QPAK_enumerateFiles, /* enumerateFiles() method */ + QPAK_exists, /* exists() method */ + QPAK_isDirectory, /* isDirectory() method */ + QPAK_isSymLink, /* isSymLink() method */ + QPAK_getLastModTime, /* getLastModTime() method */ + QPAK_openRead, /* openRead() method */ + QPAK_openWrite, /* openWrite() method */ + QPAK_openAppend, /* openAppend() method */ + QPAK_remove, /* remove() method */ + QPAK_mkdir, /* mkdir() method */ + QPAK_dirClose, /* dirClose() method */ + QPAK_read, /* read() method */ + QPAK_write, /* write() method */ + QPAK_eof, /* eof() method */ + QPAK_tell, /* tell() method */ + QPAK_seek, /* seek() method */ + QPAK_fileLength, /* fileLength() method */ + QPAK_fileClose /* fileClose() method */ +}; + #endif /* defined PHYSFS_SUPPORTS_QPAK */ /* end of qpak.c ... */ diff --git a/archivers/wad.c b/archivers/wad.c index 1603ed19..f1657995 100644 --- a/archivers/wad.c +++ b/archivers/wad.c @@ -80,67 +80,6 @@ typedef struct } WADfileinfo; -static PHYSFS_sint64 WAD_read(fvoid *opaque, void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static PHYSFS_sint64 WAD_write(fvoid *opaque, const void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static int WAD_eof(fvoid *opaque); -static PHYSFS_sint64 WAD_tell(fvoid *opaque); -static int WAD_seek(fvoid *opaque, PHYSFS_uint64 offset); -static PHYSFS_sint64 WAD_fileLength(fvoid *opaque); -static int WAD_fileClose(fvoid *opaque); -static int WAD_isArchive(const char *filename, int forWriting); -static void *WAD_openArchive(const char *name, int forWriting); -static void WAD_enumerateFiles(dvoid *opaque, const char *dname, - int omitSymLinks, PHYSFS_StringCallback cb, - void *callbackdata); -static int WAD_exists(dvoid *opaque, const char *name); -static int WAD_isDirectory(dvoid *opaque, const char *name, int *fileExists); -static int WAD_isSymLink(dvoid *opaque, const char *name, int *fileExists); -static PHYSFS_sint64 WAD_getLastModTime(dvoid *opaque, const char *n, int *e); -static fvoid *WAD_openRead(dvoid *opaque, const char *name, int *exist); -static fvoid *WAD_openWrite(dvoid *opaque, const char *name); -static fvoid *WAD_openAppend(dvoid *opaque, const char *name); -static int WAD_remove(dvoid *opaque, const char *name); -static int WAD_mkdir(dvoid *opaque, const char *name); -static void WAD_dirClose(dvoid *opaque); - -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_WAD = -{ - "WAD", - /* !!! FIXME WAD_ARCHIVE_DESCRIPTION, */ "DOOM engine format", - "Travis Wells ", - "http://www.3dmm2.com/doom/", -}; - - -const PHYSFS_Archiver __PHYSFS_Archiver_WAD = -{ - &__PHYSFS_ArchiveInfo_WAD, - WAD_isArchive, /* isArchive() method */ - WAD_openArchive, /* openArchive() method */ - WAD_enumerateFiles, /* enumerateFiles() method */ - WAD_exists, /* exists() method */ - WAD_isDirectory, /* isDirectory() method */ - WAD_isSymLink, /* isSymLink() method */ - WAD_getLastModTime, /* getLastModTime() method */ - WAD_openRead, /* openRead() method */ - WAD_openWrite, /* openWrite() method */ - WAD_openAppend, /* openAppend() method */ - WAD_remove, /* remove() method */ - WAD_mkdir, /* mkdir() method */ - WAD_dirClose, /* dirClose() method */ - WAD_read, /* read() method */ - WAD_write, /* write() method */ - WAD_eof, /* eof() method */ - WAD_tell, /* tell() method */ - WAD_seek, /* seek() method */ - WAD_fileLength, /* fileLength() method */ - WAD_fileClose /* fileClose() method */ -}; - - - static void WAD_dirClose(dvoid *opaque) { WADinfo *info = ((WADinfo *) opaque); @@ -554,6 +493,41 @@ static int WAD_mkdir(dvoid *opaque, const char *name) BAIL_MACRO(ERR_NOT_SUPPORTED, 0); } /* WAD_mkdir */ + +const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_WAD = +{ + "WAD", + /* !!! FIXME WAD_ARCHIVE_DESCRIPTION, */ "DOOM engine format", + "Travis Wells ", + "http://www.3dmm2.com/doom/", +}; + + +const PHYSFS_Archiver __PHYSFS_Archiver_WAD = +{ + &__PHYSFS_ArchiveInfo_WAD, + WAD_isArchive, /* isArchive() method */ + WAD_openArchive, /* openArchive() method */ + WAD_enumerateFiles, /* enumerateFiles() method */ + WAD_exists, /* exists() method */ + WAD_isDirectory, /* isDirectory() method */ + WAD_isSymLink, /* isSymLink() method */ + WAD_getLastModTime, /* getLastModTime() method */ + WAD_openRead, /* openRead() method */ + WAD_openWrite, /* openWrite() method */ + WAD_openAppend, /* openAppend() method */ + WAD_remove, /* remove() method */ + WAD_mkdir, /* mkdir() method */ + WAD_dirClose, /* dirClose() method */ + WAD_read, /* read() method */ + WAD_write, /* write() method */ + WAD_eof, /* eof() method */ + WAD_tell, /* tell() method */ + WAD_seek, /* seek() method */ + WAD_fileLength, /* fileLength() method */ + WAD_fileClose /* fileClose() method */ +}; + #endif /* defined PHYSFS_SUPPORTS_WAD */ /* end of wad.c ... */ diff --git a/archivers/zip.c b/archivers/zip.c index 29af1079..e614db31 100644 --- a/archivers/zip.c +++ b/archivers/zip.c @@ -116,69 +116,6 @@ typedef struct #define UNIX_FILETYPE_SYMLINK 0120000 -static PHYSFS_sint64 ZIP_read(fvoid *opaque, void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static PHYSFS_sint64 ZIP_write(fvoid *opaque, const void *buffer, - PHYSFS_uint32 objSize, PHYSFS_uint32 objCount); -static int ZIP_eof(fvoid *opaque); -static PHYSFS_sint64 ZIP_tell(fvoid *opaque); -static int ZIP_seek(fvoid *opaque, PHYSFS_uint64 offset); -static PHYSFS_sint64 ZIP_fileLength(fvoid *opaque); -static int ZIP_fileClose(fvoid *opaque); -static int ZIP_isArchive(const char *filename, int forWriting); -static void *ZIP_openArchive(const char *name, int forWriting); -static void ZIP_enumerateFiles(dvoid *opaque, const char *dname, - int omitSymLinks, PHYSFS_StringCallback cb, - void *callbackdata); -static int ZIP_exists(dvoid *opaque, const char *name); -static int ZIP_isDirectory(dvoid *opaque, const char *name, int *fileExists); -static int ZIP_isSymLink(dvoid *opaque, const char *name, int *fileExists); -static PHYSFS_sint64 ZIP_getLastModTime(dvoid *opaque, const char *n, int *e); -static fvoid *ZIP_openRead(dvoid *opaque, const char *filename, int *e); -static fvoid *ZIP_openWrite(dvoid *opaque, const char *filename); -static fvoid *ZIP_openAppend(dvoid *opaque, const char *filename); -static void ZIP_dirClose(dvoid *opaque); -static int zip_resolve(void *in, ZIPinfo *info, ZIPentry *entry); -static int ZIP_remove(dvoid *opaque, const char *name); -static int ZIP_mkdir(dvoid *opaque, const char *name); - - -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP = -{ - "ZIP", - ZIP_ARCHIVE_DESCRIPTION, - "Ryan C. Gordon ", - "http://icculus.org/physfs/", -}; - - -const PHYSFS_Archiver __PHYSFS_Archiver_ZIP = -{ - &__PHYSFS_ArchiveInfo_ZIP, - ZIP_isArchive, /* isArchive() method */ - ZIP_openArchive, /* openArchive() method */ - ZIP_enumerateFiles, /* enumerateFiles() method */ - ZIP_exists, /* exists() method */ - ZIP_isDirectory, /* isDirectory() method */ - ZIP_isSymLink, /* isSymLink() method */ - ZIP_getLastModTime, /* getLastModTime() method */ - ZIP_openRead, /* openRead() method */ - ZIP_openWrite, /* openWrite() method */ - ZIP_openAppend, /* openAppend() method */ - ZIP_remove, /* remove() method */ - ZIP_mkdir, /* mkdir() method */ - ZIP_dirClose, /* dirClose() method */ - ZIP_read, /* read() method */ - ZIP_write, /* write() method */ - ZIP_eof, /* eof() method */ - ZIP_tell, /* tell() method */ - ZIP_seek, /* seek() method */ - ZIP_fileLength, /* fileLength() method */ - ZIP_fileClose /* fileClose() method */ -}; - - - /* * Bridge physfs allocation functions to zlib's format... */ @@ -694,6 +631,8 @@ static void zip_expand_symlink_path(char *path) } /* while */ } /* zip_expand_symlink_path */ +/* (forward reference: zip_follow_symlink and zip_resolve call each other.) */ +static int zip_resolve(void *in, ZIPinfo *info, ZIPentry *entry); /* * Look for the entry named by (path). If it exists, resolve it, and return @@ -1464,6 +1403,41 @@ static int ZIP_mkdir(dvoid *opaque, const char *name) BAIL_MACRO(ERR_NOT_SUPPORTED, 0); } /* ZIP_mkdir */ + +const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP = +{ + "ZIP", + ZIP_ARCHIVE_DESCRIPTION, + "Ryan C. Gordon ", + "http://icculus.org/physfs/", +}; + + +const PHYSFS_Archiver __PHYSFS_Archiver_ZIP = +{ + &__PHYSFS_ArchiveInfo_ZIP, + ZIP_isArchive, /* isArchive() method */ + ZIP_openArchive, /* openArchive() method */ + ZIP_enumerateFiles, /* enumerateFiles() method */ + ZIP_exists, /* exists() method */ + ZIP_isDirectory, /* isDirectory() method */ + ZIP_isSymLink, /* isSymLink() method */ + ZIP_getLastModTime, /* getLastModTime() method */ + ZIP_openRead, /* openRead() method */ + ZIP_openWrite, /* openWrite() method */ + ZIP_openAppend, /* openAppend() method */ + ZIP_remove, /* remove() method */ + ZIP_mkdir, /* mkdir() method */ + ZIP_dirClose, /* dirClose() method */ + ZIP_read, /* read() method */ + ZIP_write, /* write() method */ + ZIP_eof, /* eof() method */ + ZIP_tell, /* tell() method */ + ZIP_seek, /* seek() method */ + ZIP_fileLength, /* fileLength() method */ + ZIP_fileClose /* fileClose() method */ +}; + #endif /* defined PHYSFS_SUPPORTS_ZIP */ /* end of zip.c ... */