From 3ae1f1fa80089ae82887b00416e4c17e0ef5d2aa Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 26 Jul 2002 06:19:09 +0000 Subject: [PATCH] Changed DirFunctions struct a little. --- archivers/dir.c | 22 ++++++++++------------ archivers/grp.c | 18 ++++++++++-------- archivers/zip.c | 19 +++++++++---------- physfs_internal.h | 2 ++ 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/archivers/dir.c b/archivers/dir.c index 1d8b1ae8..be98bd8b 100644 --- a/archivers/dir.c +++ b/archivers/dir.c @@ -46,6 +46,15 @@ static int DIR_mkdir(DirHandle *h, const char *name); static void DIR_dirClose(DirHandle *h); +const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_DIR = +{ + "", + "non-archive directory I/O", + "Ryan C. Gordon ", + "http://icculus.org/physfs/", +}; + + static const FileFunctions __PHYSFS_FileFunctions_DIR = { DIR_read, /* read() method */ @@ -72,6 +81,7 @@ static const FileFunctions __PHYSFS_FileFunctions_DIRW = const DirFunctions __PHYSFS_DirFunctions_DIR = { + &__PHYSFS_ArchiveInfo_DIR, DIR_isArchive, /* isArchive() method */ DIR_openArchive, /* openArchive() method */ DIR_enumerateFiles, /* enumerateFiles() method */ @@ -88,18 +98,6 @@ const DirFunctions __PHYSFS_DirFunctions_DIR = }; -/* This doesn't get listed, since it's technically not an archive... */ -#if 0 -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_DIR = -{ - "DIR", - "non-archive directory I/O", - "Ryan C. Gordon ", - "http://www.icculus.org/physfs/", -}; -#endif - - static PHYSFS_sint64 DIR_read(FileHandle *handle, void *buffer, PHYSFS_uint32 objSize, PHYSFS_uint32 objCount) { diff --git a/archivers/grp.c b/archivers/grp.c index 1eb2ac7b..4bb0dd8a 100644 --- a/archivers/grp.c +++ b/archivers/grp.c @@ -90,6 +90,15 @@ static int GRP_isSymLink(DirHandle *h, const char *name); static PHYSFS_sint64 GRP_getLastModTime(DirHandle *h, const char *name); static FileHandle *GRP_openRead(DirHandle *h, const char *name); +const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_GRP = +{ + "GRP", + "Build engine Groupfile format", + "Ryan C. Gordon ", + "http://icculus.org/physfs/", +}; + + static const FileFunctions __PHYSFS_FileFunctions_GRP = { GRP_read, /* read() method */ @@ -104,6 +113,7 @@ static const FileFunctions __PHYSFS_FileFunctions_GRP = const DirFunctions __PHYSFS_DirFunctions_GRP = { + &__PHYSFS_ArchiveInfo_GRP, GRP_isArchive, /* isArchive() method */ GRP_openArchive, /* openArchive() method */ GRP_enumerateFiles, /* enumerateFiles() method */ @@ -119,14 +129,6 @@ const DirFunctions __PHYSFS_DirFunctions_GRP = GRP_dirClose /* dirClose() method */ }; -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_GRP = -{ - "GRP", - "Build engine Groupfile format", - "Ryan C. Gordon ", - "http://www.icculus.org/physfs/", -}; - static void GRP_dirClose(DirHandle *h) diff --git a/archivers/zip.c b/archivers/zip.c index 97745a08..e38c38cd 100644 --- a/archivers/zip.c +++ b/archivers/zip.c @@ -141,10 +141,17 @@ static int ZIP_isSymLink(DirHandle *h, const char *name); static PHYSFS_sint64 ZIP_getLastModTime(DirHandle *h, const char *name); static FileHandle *ZIP_openRead(DirHandle *h, const char *filename); static void ZIP_dirClose(DirHandle *h); - static int zip_resolve(void *in, ZIPinfo *info, ZIPentry *entry); +const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP = +{ + "ZIP", + "PkZip/WinZip/Info-Zip compatible", + "Ryan C. Gordon ", + "http://icculus.org/physfs/", +}; + static const FileFunctions __PHYSFS_FileFunctions_ZIP = { ZIP_read, /* read() method */ @@ -159,6 +166,7 @@ static const FileFunctions __PHYSFS_FileFunctions_ZIP = const DirFunctions __PHYSFS_DirFunctions_ZIP = { + &__PHYSFS_ArchiveInfo_ZIP, ZIP_isArchive, /* isArchive() method */ ZIP_openArchive, /* openArchive() method */ ZIP_enumerateFiles, /* enumerateFiles() method */ @@ -174,15 +182,6 @@ const DirFunctions __PHYSFS_DirFunctions_ZIP = ZIP_dirClose /* dirClose() method */ }; -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP = -{ - "ZIP", - "PkZip/WinZip/Info-Zip compatible", - "Ryan C. Gordon ", - "http://www.icculus.org/physfs/", -}; - - /* * Wrap all zlib calls in this, so the physfs error state is set appropriately. diff --git a/physfs_internal.h b/physfs_internal.h index 944b5f24..f86fddbb 100644 --- a/physfs_internal.h +++ b/physfs_internal.h @@ -125,6 +125,8 @@ typedef struct __PHYSFS_DIRHANDLE__ */ typedef struct __PHYSFS_DIRFUNCTIONS__ { + const PHYSFS_ArchiveInfo *info; + /* * Returns non-zero if (filename) is a valid archive that this * driver can handle. This filename is in platform-dependent