Changed DirFunctions struct a little.
authorRyan C. Gordon <icculus@icculus.org>
Fri, 26 Jul 2002 06:19:09 +0000
changeset 399 02dd53688315
parent 398 aa1e763b09ae
child 400 b00247f9e38d
Changed DirFunctions struct a little.
archivers/dir.c
archivers/grp.c
archivers/zip.c
physfs_internal.h
--- a/archivers/dir.c	Fri Jul 26 06:18:30 2002 +0000
+++ b/archivers/dir.c	Fri Jul 26 06:19:09 2002 +0000
@@ -46,6 +46,15 @@
 static void DIR_dirClose(DirHandle *h);
 
 
+const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_DIR =
+{
+    "",
+    "non-archive directory I/O",
+    "Ryan C. Gordon <icculus@clutteredmind.org>",
+    "http://icculus.org/physfs/",
+};
+
+
 static const FileFunctions __PHYSFS_FileFunctions_DIR =
 {
     DIR_read,       /* read() method       */
@@ -72,6 +81,7 @@
 
 const DirFunctions __PHYSFS_DirFunctions_DIR =
 {
+    &__PHYSFS_ArchiveInfo_DIR,
     DIR_isArchive,          /* isArchive() method      */
     DIR_openArchive,        /* openArchive() method    */
     DIR_enumerateFiles,     /* enumerateFiles() method */
@@ -88,18 +98,6 @@
 };
 
 
-/* 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 <icculus@clutteredmind.org>",
-    "http://www.icculus.org/physfs/",
-};
-#endif
-
-
 static PHYSFS_sint64 DIR_read(FileHandle *handle, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
--- a/archivers/grp.c	Fri Jul 26 06:18:30 2002 +0000
+++ b/archivers/grp.c	Fri Jul 26 06:19:09 2002 +0000
@@ -90,6 +90,15 @@
 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 <icculus@clutteredmind.org>",
+    "http://icculus.org/physfs/",
+};
+
+
 static const FileFunctions __PHYSFS_FileFunctions_GRP =
 {
     GRP_read,       /* read() method       */
@@ -104,6 +113,7 @@
 
 const DirFunctions __PHYSFS_DirFunctions_GRP =
 {
+    &__PHYSFS_ArchiveInfo_GRP,
     GRP_isArchive,          /* isArchive() method      */
     GRP_openArchive,        /* openArchive() method    */
     GRP_enumerateFiles,     /* enumerateFiles() method */
@@ -119,14 +129,6 @@
     GRP_dirClose            /* dirClose() method       */
 };
 
-const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_GRP =
-{
-    "GRP",
-    "Build engine Groupfile format",
-    "Ryan C. Gordon <icculus@clutteredmind.org>",
-    "http://www.icculus.org/physfs/",
-};
-
 
 
 static void GRP_dirClose(DirHandle *h)
--- a/archivers/zip.c	Fri Jul 26 06:18:30 2002 +0000
+++ b/archivers/zip.c	Fri Jul 26 06:19:09 2002 +0000
@@ -141,10 +141,17 @@
 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 <icculus@clutteredmind.org>",
+    "http://icculus.org/physfs/",
+};
+
 static const FileFunctions __PHYSFS_FileFunctions_ZIP =
 {
     ZIP_read,       /* read() method       */
@@ -159,6 +166,7 @@
 
 const DirFunctions __PHYSFS_DirFunctions_ZIP =
 {
+    &__PHYSFS_ArchiveInfo_ZIP,
     ZIP_isArchive,          /* isArchive() method      */
     ZIP_openArchive,        /* openArchive() method    */
     ZIP_enumerateFiles,     /* enumerateFiles() method */
@@ -174,15 +182,6 @@
     ZIP_dirClose            /* dirClose() method       */
 };
 
-const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP =
-{
-    "ZIP",
-    "PkZip/WinZip/Info-Zip compatible",
-    "Ryan C. Gordon <icculus@clutteredmind.org>",
-    "http://www.icculus.org/physfs/",
-};
-
-
 
 /*
  * Wrap all zlib calls in this, so the physfs error state is set appropriately.
--- a/physfs_internal.h	Fri Jul 26 06:18:30 2002 +0000
+++ b/physfs_internal.h	Fri Jul 26 06:19:09 2002 +0000
@@ -125,6 +125,8 @@
  */
 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