Did the same thing to FileHandles than I did to DirHandles, but this
authorRyan C. Gordon <icculus@icculus.org>
Sun, 26 Sep 2004 13:00:59 +0000
changeset 650 298b8bb26775
parent 649 85aeb90378bc
child 651 cbe4ea4c7e8e
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 opening a file used to allocate a ton of crap and mush it together...now it's basically down to one structure and the instance data in whatever archiver.
CHANGELOG
archivers/dir.c
archivers/grp.c
archivers/hog.c
archivers/mix.c
archivers/mvl.c
archivers/qpak.c
archivers/wad.c
archivers/zip.c
physfs.c
physfs.h
physfs_internal.h
--- a/CHANGELOG	Sun Sep 26 12:56:23 2004 +0000
+++ b/CHANGELOG	Sun Sep 26 13:00:59 2004 +0000
@@ -2,6 +2,12 @@
  * CHANGELOG.
  */
 
+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
+           opening a file used to allocate a ton of crap and mush it
+           together...now it's basically down to one structure and the
+           instance data in whatever archiver.
 09252004 - Cleaned up archiver interface to not deal with DirHandles anymore,
            which simplifies things, removes some responsibility and code
            duplication from the archivers, and trims some malloc pressure.
--- a/archivers/dir.c	Sun Sep 26 12:56:23 2004 +0000
+++ b/archivers/dir.c	Sun Sep 26 13:00:59 2004 +0000
@@ -18,34 +18,30 @@
 #define __PHYSICSFS_INTERNAL__
 #include "physfs_internal.h"
 
-static PHYSFS_sint64 DIR_read(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 DIR_read(fvoid *opaque, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static PHYSFS_sint64 DIR_write(FileHandle *handle, const void *buffer,
-                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static PHYSFS_sint64 DIR_dummyRead(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 DIR_write(fvoid *opaque, const void *buffer,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static PHYSFS_sint64 DIR_dummyWrite(FileHandle *handle, const void *buffer,
-                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static int DIR_eof(FileHandle *handle);
-static PHYSFS_sint64 DIR_tell(FileHandle *handle);
-static int DIR_seek(FileHandle *handle, PHYSFS_uint64 offset);
-static PHYSFS_sint64 DIR_fileLength(FileHandle *handle);
-static int DIR_fileClose(FileHandle *handle);
+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 LinkedStringList *DIR_enumerateFiles(void *opaque,
+static LinkedStringList *DIR_enumerateFiles(dvoid *opaque,
                                             const char *dname,
                                             int omitSymLinks);
-static int DIR_exists(void *opaque, const char *name);
-static int DIR_isDirectory(void *opaque, const char *name, int *fileExists);
-static int DIR_isSymLink(void *opaque, const char *name, int *fileExists);
-static FileHandle *DIR_openRead(void *opaque, const char *fnm, int *exist);
-static PHYSFS_sint64 DIR_getLastModTime(void *opaque, const char *f, int *e);
-static FileHandle *DIR_openWrite(void *opaque, const char *filename);
-static FileHandle *DIR_openAppend(void *opaque, const char *filename);
-static int DIR_remove(void *opaque, const char *name);
-static int DIR_mkdir(void *opaque, const char *name);
-static void DIR_dirClose(void *opaque);
+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 =
@@ -57,31 +53,8 @@
 };
 
 
-static const FileFunctions __PHYSFS_FileFunctions_DIR =
-{
-    DIR_read,       /* read() method       */
-    DIR_dummyWrite, /* write() method      */
-    DIR_eof,        /* eof() method        */
-    DIR_tell,       /* tell() method       */
-    DIR_seek,       /* seek() method       */
-    DIR_fileLength, /* fileLength() method */
-    DIR_fileClose   /* fileClose() method  */
-};
 
-
-static const FileFunctions __PHYSFS_FileFunctions_DIRW =
-{
-    DIR_dummyRead,  /* 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  */
-};
-
-
-const DirFunctions __PHYSFS_DirFunctions_DIR =
+const PHYSFS_Archiver __PHYSFS_Archiver_DIR =
 {
     &__PHYSFS_ArchiveInfo_DIR,
     DIR_isArchive,          /* isArchive() method      */
@@ -96,76 +69,68 @@
     DIR_openAppend,         /* openAppend() method     */
     DIR_remove,             /* remove() method         */
     DIR_mkdir,              /* mkdir() method          */
-    DIR_dirClose            /* dirClose() 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(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 DIR_read(fvoid *opaque, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
     PHYSFS_sint64 retval;
-    retval = __PHYSFS_platformRead(handle->opaque, buffer, objSize, objCount);
+    retval = __PHYSFS_platformRead(opaque, buffer, objSize, objCount);
     return(retval);
 } /* DIR_read */
 
 
-static PHYSFS_sint64 DIR_write(FileHandle *handle, const void *buffer,
+static PHYSFS_sint64 DIR_write(fvoid *opaque, const void *buffer,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
     PHYSFS_sint64 retval;
-    retval = __PHYSFS_platformWrite(handle->opaque, buffer, objSize, objCount);
+    retval = __PHYSFS_platformWrite(opaque, buffer, objSize, objCount);
     return(retval);
 } /* DIR_write */
 
 
-static PHYSFS_sint64 DIR_dummyRead(FileHandle *handle, void *buffer,
-                              PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
+static int DIR_eof(fvoid *opaque)
 {
-    BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
-} /* DIR_dummyRead */
-
-
-static PHYSFS_sint64 DIR_dummyWrite(FileHandle *handle, const void *buffer,
-                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
-{
-    BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
-} /* DIR_dummyWrite */
-
-
-static int DIR_eof(FileHandle *handle)
-{
-    return(__PHYSFS_platformEOF(handle->opaque));
+    return(__PHYSFS_platformEOF(opaque));
 } /* DIR_eof */
 
 
-static PHYSFS_sint64 DIR_tell(FileHandle *handle)
+static PHYSFS_sint64 DIR_tell(fvoid *opaque)
 {
-    return(__PHYSFS_platformTell(handle->opaque));
+    return(__PHYSFS_platformTell(opaque));
 } /* DIR_tell */
 
 
-static int DIR_seek(FileHandle *handle, PHYSFS_uint64 offset)
+static int DIR_seek(fvoid *opaque, PHYSFS_uint64 offset)
 {
-    return(__PHYSFS_platformSeek(handle->opaque, offset));
+    return(__PHYSFS_platformSeek(opaque, offset));
 } /* DIR_seek */
 
 
-static PHYSFS_sint64 DIR_fileLength(FileHandle *handle)
+static PHYSFS_sint64 DIR_fileLength(fvoid *opaque)
 {
-    return(__PHYSFS_platformFileLength(handle->opaque));
+    return(__PHYSFS_platformFileLength(opaque));
 } /* DIR_fileLength */
 
 
-static int DIR_fileClose(FileHandle *handle)
+static int DIR_fileClose(fvoid *opaque)
 {
     /*
      * we manually flush the buffer, since that's the place a close will
      *  most likely fail, but that will leave the file handle in an undefined
      *  state if it fails. Flush failures we can recover from.
      */
-    BAIL_IF_MACRO(!__PHYSFS_platformFlush(handle->opaque), NULL, 0);
-    BAIL_IF_MACRO(!__PHYSFS_platformClose(handle->opaque), NULL, 0);
-    free(handle);
+    BAIL_IF_MACRO(!__PHYSFS_platformFlush(opaque), NULL, 0);
+    BAIL_IF_MACRO(!__PHYSFS_platformClose(opaque), NULL, 0);
     return(1);
 } /* DIR_fileClose */
 
@@ -200,7 +165,7 @@
 } /* DIR_openArchive */
 
 
-static LinkedStringList *DIR_enumerateFiles(void *opaque,
+static LinkedStringList *DIR_enumerateFiles(dvoid *opaque,
                                             const char *dname,
                                             int omitSymLinks)
 {
@@ -214,7 +179,7 @@
 } /* DIR_enumerateFiles */
 
 
-static int DIR_exists(void *opaque, const char *name)
+static int DIR_exists(dvoid *opaque, const char *name)
 {
     char *f = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
     int retval;
@@ -226,7 +191,7 @@
 } /* DIR_exists */
 
 
-static int DIR_isDirectory(void *opaque, const char *name, int *fileExists)
+static int DIR_isDirectory(dvoid *opaque, const char *name, int *fileExists)
 {
     char *d = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
     int retval = 0;
@@ -240,7 +205,7 @@
 } /* DIR_isDirectory */
 
 
-static int DIR_isSymLink(void *opaque, const char *name, int *fileExists)
+static int DIR_isSymLink(dvoid *opaque, const char *name, int *fileExists)
 {
     char *f = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
     int retval = 0;
@@ -254,7 +219,7 @@
 } /* DIR_isSymLink */
 
 
-static PHYSFS_sint64 DIR_getLastModTime(void *opaque,
+static PHYSFS_sint64 DIR_getLastModTime(dvoid *opaque,
                                         const char *name,
                                         int *fileExists)
 {
@@ -270,13 +235,12 @@
 } /* DIR_getLastModTime */
 
 
-static FileHandle *doOpen(void *opaque, const char *name,
-                          void *(*openFunc)(const char *filename),
-                          int *fileExists, const FileFunctions *fileFuncs)
+static fvoid *doOpen(dvoid *opaque, const char *name,
+                     void *(*openFunc)(const char *filename),
+                     int *fileExists)
 {
     char *f = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
-    void *rc;
-    FileHandle *retval;
+    void *rc = NULL;
 
     BAIL_IF_MACRO(f == NULL, NULL, NULL);
 
@@ -290,51 +254,32 @@
         } /* if */
     } /* if */
 
-    retval = (FileHandle *) malloc(sizeof (FileHandle));
-    if (!retval)
-    {
-        free(f);
-        BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
-    } /* if */
-
     rc = openFunc(f);
     free(f);
 
-    if (!rc)
-    {
-        free(retval);
-        return(NULL);
-    } /* if */
-
-    retval->opaque = (void *) rc;
-    retval->funcs = fileFuncs;
-
-    return(retval);
+    return((fvoid *) rc);
 } /* doOpen */
 
 
-static FileHandle *DIR_openRead(void *opaque, const char *fnm, int *exist)
+static fvoid *DIR_openRead(dvoid *opaque, const char *fnm, int *exist)
 {
-    return(doOpen(opaque, fnm, __PHYSFS_platformOpenRead, exist,
-                  &__PHYSFS_FileFunctions_DIR));
+    return(doOpen(opaque, fnm, __PHYSFS_platformOpenRead, exist));
 } /* DIR_openRead */
 
 
-static FileHandle *DIR_openWrite(void *opaque, const char *filename)
+static fvoid *DIR_openWrite(dvoid *opaque, const char *filename)
 {
-    return(doOpen(opaque, filename, __PHYSFS_platformOpenWrite, NULL,
-                  &__PHYSFS_FileFunctions_DIRW));
+    return(doOpen(opaque, filename, __PHYSFS_platformOpenWrite, NULL));
 } /* DIR_openWrite */
 
 
-static FileHandle *DIR_openAppend(void *opaque, const char *filename)
+static fvoid *DIR_openAppend(dvoid *opaque, const char *filename)
 {
-    return(doOpen(opaque, filename, __PHYSFS_platformOpenAppend, NULL,
-                  &__PHYSFS_FileFunctions_DIRW));
+    return(doOpen(opaque, filename, __PHYSFS_platformOpenAppend, NULL));
 } /* DIR_openAppend */
 
 
-static int DIR_remove(void *opaque, const char *name)
+static int DIR_remove(dvoid *opaque, const char *name)
 {
     char *f = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
     int retval;
@@ -346,7 +291,7 @@
 } /* DIR_remove */
 
 
-static int DIR_mkdir(void *opaque, const char *name)
+static int DIR_mkdir(dvoid *opaque, const char *name)
 {
     char *f = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL);
     int retval;
@@ -358,7 +303,7 @@
 } /* DIR_mkdir */
 
 
-static void DIR_dirClose(void *opaque)
+static void DIR_dirClose(dvoid *opaque)
 {
     free(opaque);
 } /* DIR_dirClose */
--- a/archivers/grp.c	Sun Sep 26 12:56:23 2004 +0000
+++ b/archivers/grp.c	Sun Sep 26 13:00:59 2004 +0000
@@ -61,30 +61,30 @@
 } GRPfileinfo;
 
 
-static void GRP_dirClose(void *opaque);
-static PHYSFS_sint64 GRP_read(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 GRP_read(fvoid *opaque, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static PHYSFS_sint64 GRP_write(FileHandle *handle, const void *buffer,
+static PHYSFS_sint64 GRP_write(fvoid *opaque, const void *buffer,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static int GRP_eof(FileHandle *handle);
-static PHYSFS_sint64 GRP_tell(FileHandle *handle);
-static int GRP_seek(FileHandle *handle, PHYSFS_uint64 offset);
-static PHYSFS_sint64 GRP_fileLength(FileHandle *handle);
-static int GRP_fileClose(FileHandle *handle);
+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 LinkedStringList *GRP_enumerateFiles(void *opaque,
+static LinkedStringList *GRP_enumerateFiles(dvoid *opaque,
                                             const char *dirname,
                                             int omitSymLinks);
-static int GRP_exists(void *opaque, const char *name);
-static int GRP_isDirectory(void *opaque, const char *name, int *fileExists);
-static int GRP_isSymLink(void *opaque, const char *name, int *fileExists);
-static PHYSFS_sint64 GRP_getLastModTime(void *opaque, const char *n, int *e);
-static FileHandle *GRP_openRead(void *opaque, const char *name, int *exist);
-static FileHandle *GRP_openWrite(void *opaque, const char *name);
-static FileHandle *GRP_openAppend(void *opaque, const char *name);
-static int GRP_remove(void *opaque, const char *name);
-static int GRP_mkdir(void *opaque, const char *name);
+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 =
 {
@@ -95,19 +95,7 @@
 };
 
 
-static const FileFunctions __PHYSFS_FileFunctions_GRP =
-{
-    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  */
-};
-
-
-const DirFunctions __PHYSFS_DirFunctions_GRP =
+const PHYSFS_Archiver __PHYSFS_Archiver_GRP =
 {
     &__PHYSFS_ArchiveInfo_GRP,
     GRP_isArchive,          /* isArchive() method      */
@@ -122,12 +110,19 @@
     GRP_openAppend,         /* openAppend() method     */
     GRP_remove,             /* remove() method         */
     GRP_mkdir,              /* mkdir() method          */
-    GRP_dirClose            /* dirClose() 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(void *opaque)
+static void GRP_dirClose(dvoid *opaque)
 {
     GRPinfo *info = ((GRPinfo *) opaque);
     free(info->filename);
@@ -136,10 +131,10 @@
 } /* GRP_dirClose */
 
 
-static PHYSFS_sint64 GRP_read(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 GRP_read(fvoid *opaque, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
-    GRPfileinfo *finfo = (GRPfileinfo *) (handle->opaque);
+    GRPfileinfo *finfo = (GRPfileinfo *) opaque;
     GRPentry *entry = finfo->entry;
     PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
     PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
@@ -156,30 +151,30 @@
 } /* GRP_read */
 
 
-static PHYSFS_sint64 GRP_write(FileHandle *handle, const void *buffer,
+static PHYSFS_sint64 GRP_write(fvoid *opaque, const void *buffer,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
 } /* GRP_write */
 
 
-static int GRP_eof(FileHandle *handle)
+static int GRP_eof(fvoid *opaque)
 {
-    GRPfileinfo *finfo = (GRPfileinfo *) (handle->opaque);
+    GRPfileinfo *finfo = (GRPfileinfo *) opaque;
     GRPentry *entry = finfo->entry;
     return(finfo->curPos >= entry->size);
 } /* GRP_eof */
 
 
-static PHYSFS_sint64 GRP_tell(FileHandle *handle)
+static PHYSFS_sint64 GRP_tell(fvoid *opaque)
 {
-    return(((GRPfileinfo *) (handle->opaque))->curPos);
+    return(((GRPfileinfo *) opaque)->curPos);
 } /* GRP_tell */
 
 
-static int GRP_seek(FileHandle *handle, PHYSFS_uint64 offset)
+static int GRP_seek(fvoid *opaque, PHYSFS_uint64 offset)
 {
-    GRPfileinfo *finfo = (GRPfileinfo *) (handle->opaque);
+    GRPfileinfo *finfo = (GRPfileinfo *) opaque;
     GRPentry *entry = finfo->entry;
     int rc;
 
@@ -193,19 +188,18 @@
 } /* GRP_seek */
 
 
-static PHYSFS_sint64 GRP_fileLength(FileHandle *handle)
+static PHYSFS_sint64 GRP_fileLength(fvoid *opaque)
 {
-    GRPfileinfo *finfo = ((GRPfileinfo *) handle->opaque);
+    GRPfileinfo *finfo = (GRPfileinfo *) opaque;
     return((PHYSFS_sint64) finfo->entry->size);
 } /* GRP_fileLength */
 
 
-static int GRP_fileClose(FileHandle *handle)
+static int GRP_fileClose(fvoid *opaque)
 {
-    GRPfileinfo *finfo = ((GRPfileinfo *) handle->opaque);
+    GRPfileinfo *finfo = (GRPfileinfo *) opaque;
     BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
     free(finfo);
-    free(handle);
     return(1);
 } /* GRP_fileClose */
 
@@ -365,11 +359,11 @@
 } /* GRP_openArchive */
 
 
-static LinkedStringList *GRP_enumerateFiles(void *opaque,
+static LinkedStringList *GRP_enumerateFiles(dvoid *opaque,
                                             const char *dirname,
                                             int omitSymLinks)
 {
-    GRPinfo *info = ((GRPinfo *) opaque);
+    GRPinfo *info = (GRPinfo *) opaque;
     GRPentry *entry = info->entries;
     LinkedStringList *retval = NULL, *p = NULL;
     PHYSFS_uint32 max = info->entryCount;
@@ -418,31 +412,31 @@
 } /* grp_find_entry */
 
 
-static int GRP_exists(void *opaque, const char *name)
+static int GRP_exists(dvoid *opaque, const char *name)
 {
-    return(grp_find_entry(((GRPinfo *) opaque), name) != NULL);
+    return(grp_find_entry((GRPinfo *) opaque, name) != NULL);
 } /* GRP_exists */
 
 
-static int GRP_isDirectory(void *opaque, const char *name, int *fileExists)
+static int GRP_isDirectory(dvoid *opaque, const char *name, int *fileExists)
 {
     *fileExists = GRP_exists(opaque, name);
     return(0);  /* never directories in a groupfile. */
 } /* GRP_isDirectory */
 
 
-static int GRP_isSymLink(void *opaque, const char *name, int *fileExists)
+static int GRP_isSymLink(dvoid *opaque, const char *name, int *fileExists)
 {
     *fileExists = GRP_exists(opaque, name);
     return(0);  /* never symlinks in a groupfile. */
 } /* GRP_isSymLink */
 
 
-static PHYSFS_sint64 GRP_getLastModTime(void *opaque,
+static PHYSFS_sint64 GRP_getLastModTime(dvoid *opaque,
                                         const char *name,
                                         int *fileExists)
 {
-    GRPinfo *info = ((GRPinfo *) opaque);
+    GRPinfo *info = (GRPinfo *) opaque;
     PHYSFS_sint64 retval = -1;
 
     *fileExists = (grp_find_entry(info, name) != NULL);
@@ -453,10 +447,9 @@
 } /* GRP_getLastModTime */
 
 
-static FileHandle *GRP_openRead(void *opaque, const char *fnm, int *fileExists)
+static fvoid *GRP_openRead(dvoid *opaque, const char *fnm, int *fileExists)
 {
-    GRPinfo *info = ((GRPinfo *) opaque);
-    FileHandle *retval;
+    GRPinfo *info = (GRPinfo *) opaque;
     GRPfileinfo *finfo;
     GRPentry *entry;
 
@@ -464,51 +457,42 @@
     *fileExists = (entry != NULL);
     BAIL_IF_MACRO(entry == NULL, NULL, NULL);
 
-    retval = (FileHandle *) malloc(sizeof (FileHandle));
-    BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
     finfo = (GRPfileinfo *) malloc(sizeof (GRPfileinfo));
-    if (finfo == NULL)
-    {
-        free(retval);
-        BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
-    } /* if */
+    BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
 
     finfo->handle = __PHYSFS_platformOpenRead(info->filename);
     if ( (finfo->handle == NULL) ||
          (!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
     {
         free(finfo);
-        free(retval);
         return(NULL);
     } /* if */
 
     finfo->curPos = 0;
     finfo->entry = entry;
-    retval->opaque = (void *) finfo;
-    retval->funcs = &__PHYSFS_FileFunctions_GRP;
-    return(retval);
+    return(finfo);
 } /* GRP_openRead */
 
 
-static FileHandle *GRP_openWrite(void *opaque, const char *name)
+static fvoid *GRP_openWrite(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
 } /* GRP_openWrite */
 
 
-static FileHandle *GRP_openAppend(void *opaque, const char *name)
+static fvoid *GRP_openAppend(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
 } /* GRP_openAppend */
 
 
-static int GRP_remove(void *opaque, const char *name)
+static int GRP_remove(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
 } /* GRP_remove */
 
 
-static int GRP_mkdir(void *opaque, const char *name)
+static int GRP_mkdir(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
 } /* GRP_mkdir */
--- a/archivers/hog.c	Sun Sep 26 12:56:23 2004 +0000
+++ b/archivers/hog.c	Sun Sep 26 13:00:59 2004 +0000
@@ -75,30 +75,30 @@
 } HOGfileinfo;
 
 
-static void HOG_dirClose(void *opaque);
-static PHYSFS_sint64 HOG_read(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 HOG_read(fvoid *opaque, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static PHYSFS_sint64 HOG_write(FileHandle *handle, const void *buffer,
+static PHYSFS_sint64 HOG_write(fvoid *opaque, const void *buffer,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static int HOG_eof(FileHandle *handle);
-static PHYSFS_sint64 HOG_tell(FileHandle *handle);
-static int HOG_seek(FileHandle *handle, PHYSFS_uint64 offset);
-static PHYSFS_sint64 HOG_fileLength(FileHandle *handle);
-static int HOG_fileClose(FileHandle *handle);
+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 LinkedStringList *HOG_enumerateFiles(void *opaque,
+static LinkedStringList *HOG_enumerateFiles(dvoid *opaque,
                                             const char *dirname,
                                             int omitSymLinks);
-static int HOG_exists(void *opaque, const char *name);
-static int HOG_isDirectory(void *opaque, const char *name, int *fileExists);
-static int HOG_isSymLink(void *opaque, const char *name, int *fileExists);
-static PHYSFS_sint64 HOG_getLastModTime(void *opaque, const char *n, int *e);
-static FileHandle *HOG_openRead(void *opaque, const char *name, int *exist);
-static FileHandle *HOG_openWrite(void *opaque, const char *name);
-static FileHandle *HOG_openAppend(void *opaque, const char *name);
-static int HOG_remove(void *opaque, const char *name);
-static int HOG_mkdir(void *opaque, const char *name);
+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 =
 {
@@ -109,19 +109,7 @@
 };
 
 
-static const FileFunctions __PHYSFS_FileFunctions_HOG =
-{
-    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  */
-};
-
-
-const DirFunctions __PHYSFS_DirFunctions_HOG =
+const PHYSFS_Archiver __PHYSFS_Archiver_HOG =
 {
     &__PHYSFS_ArchiveInfo_HOG,
     HOG_isArchive,          /* isArchive() method      */
@@ -136,12 +124,19 @@
     HOG_openAppend,         /* openAppend() method     */
     HOG_remove,             /* remove() method         */
     HOG_mkdir,              /* mkdir() method          */
-    HOG_dirClose            /* dirClose() 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(void *opaque)
+static void HOG_dirClose(dvoid *opaque)
 {
     HOGinfo *info = ((HOGinfo *) opaque);
     free(info->filename);
@@ -150,10 +145,10 @@
 } /* HOG_dirClose */
 
 
-static PHYSFS_sint64 HOG_read(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 HOG_read(fvoid *opaque, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
-    HOGfileinfo *finfo = (HOGfileinfo *) (handle->opaque);
+    HOGfileinfo *finfo = (HOGfileinfo *) opaque;
     HOGentry *entry = finfo->entry;
     PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
     PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
@@ -170,30 +165,30 @@
 } /* HOG_read */
 
 
-static PHYSFS_sint64 HOG_write(FileHandle *handle, const void *buffer,
+static PHYSFS_sint64 HOG_write(fvoid *opaque, const void *buffer,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
 } /* HOG_write */
 
 
-static int HOG_eof(FileHandle *handle)
+static int HOG_eof(fvoid *opaque)
 {
-    HOGfileinfo *finfo = (HOGfileinfo *) (handle->opaque);
+    HOGfileinfo *finfo = (HOGfileinfo *) opaque;
     HOGentry *entry = finfo->entry;
     return(finfo->curPos >= entry->size);
 } /* HOG_eof */
 
 
-static PHYSFS_sint64 HOG_tell(FileHandle *handle)
+static PHYSFS_sint64 HOG_tell(fvoid *opaque)
 {
-    return(((HOGfileinfo *) (handle->opaque))->curPos);
+    return(((HOGfileinfo *) opaque)->curPos);
 } /* HOG_tell */
 
 
-static int HOG_seek(FileHandle *handle, PHYSFS_uint64 offset)
+static int HOG_seek(fvoid *opaque, PHYSFS_uint64 offset)
 {
-    HOGfileinfo *finfo = (HOGfileinfo *) (handle->opaque);
+    HOGfileinfo *finfo = (HOGfileinfo *) opaque;
     HOGentry *entry = finfo->entry;
     int rc;
 
@@ -207,19 +202,18 @@
 } /* HOG_seek */
 
 
-static PHYSFS_sint64 HOG_fileLength(FileHandle *handle)
+static PHYSFS_sint64 HOG_fileLength(fvoid *opaque)
 {
-    HOGfileinfo *finfo = ((HOGfileinfo *) handle->opaque);
+    HOGfileinfo *finfo = (HOGfileinfo *) opaque;
     return((PHYSFS_sint64) finfo->entry->size);
 } /* HOG_fileLength */
 
 
-static int HOG_fileClose(FileHandle *handle)
+static int HOG_fileClose(fvoid *opaque)
 {
-    HOGfileinfo *finfo = ((HOGfileinfo *) handle->opaque);
+    HOGfileinfo *finfo = (HOGfileinfo *) opaque;
     BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
     free(finfo);
-    free(handle);
     return(1);
 } /* HOG_fileClose */
 
@@ -404,7 +398,7 @@
 } /* HOG_openArchive */
 
 
-static LinkedStringList *HOG_enumerateFiles(void *opaque,
+static LinkedStringList *HOG_enumerateFiles(dvoid *opaque,
                                             const char *dirname,
                                             int omitSymLinks)
 {
@@ -457,27 +451,27 @@
 } /* hog_find_entry */
 
 
-static int HOG_exists(void *opaque, const char *name)
+static int HOG_exists(dvoid *opaque, const char *name)
 {
     return(hog_find_entry(((HOGinfo *) opaque), name) != NULL);
 } /* HOG_exists */
 
 
-static int HOG_isDirectory(void *opaque, const char *name, int *fileExists)
+static int HOG_isDirectory(dvoid *opaque, const char *name, int *fileExists)
 {
     *fileExists = HOG_exists(opaque, name);
     return(0);  /* never directories in a groupfile. */
 } /* HOG_isDirectory */
 
 
-static int HOG_isSymLink(void *opaque, const char *name, int *fileExists)
+static int HOG_isSymLink(dvoid *opaque, const char *name, int *fileExists)
 {
     *fileExists = HOG_exists(opaque, name);
     return(0);  /* never symlinks in a groupfile. */
 } /* HOG_isSymLink */
 
 
-static PHYSFS_sint64 HOG_getLastModTime(void *opaque,
+static PHYSFS_sint64 HOG_getLastModTime(dvoid *opaque,
                                         const char *name,
                                         int *fileExists)
 {
@@ -492,10 +486,9 @@
 } /* HOG_getLastModTime */
 
 
-static FileHandle *HOG_openRead(void *opaque, const char *fnm, int *fileExists)
+static fvoid *HOG_openRead(dvoid *opaque, const char *fnm, int *fileExists)
 {
     HOGinfo *info = ((HOGinfo *) opaque);
-    FileHandle *retval;
     HOGfileinfo *finfo;
     HOGentry *entry;
 
@@ -503,51 +496,42 @@
     *fileExists = (entry != NULL);
     BAIL_IF_MACRO(entry == NULL, NULL, NULL);
 
-    retval = (FileHandle *) malloc(sizeof (FileHandle));
-    BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
     finfo = (HOGfileinfo *) malloc(sizeof (HOGfileinfo));
-    if (finfo == NULL)
-    {
-        free(retval);
-        BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
-    } /* if */
+    BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
 
     finfo->handle = __PHYSFS_platformOpenRead(info->filename);
     if ( (finfo->handle == NULL) ||
          (!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
     {
         free(finfo);
-        free(retval);
         return(NULL);
     } /* if */
 
     finfo->curPos = 0;
     finfo->entry = entry;
-    retval->opaque = (void *) finfo;
-    retval->funcs = &__PHYSFS_FileFunctions_HOG;
-    return(retval);
+    return(finfo);
 } /* HOG_openRead */
 
 
-static FileHandle *HOG_openWrite(void *opaque, const char *name)
+static fvoid *HOG_openWrite(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
 } /* HOG_openWrite */
 
 
-static FileHandle *HOG_openAppend(void *opaque, const char *name)
+static fvoid *HOG_openAppend(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
 } /* HOG_openAppend */
 
 
-static int HOG_remove(void *opaque, const char *name)
+static int HOG_remove(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
 } /* HOG_remove */
 
 
-static int HOG_mkdir(void *opaque, const char *name)
+static int HOG_mkdir(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
 } /* HOG_mkdir */
--- a/archivers/mix.c	Sun Sep 26 12:56:23 2004 +0000
+++ b/archivers/mix.c	Sun Sep 26 13:00:59 2004 +0000
@@ -80,30 +80,30 @@
     void *handle; /* filehandle */
 } MIXfileinfo;
 
-static void MIX_dirClose(void *opaque);
-static PHYSFS_sint64 MIX_read(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 MIX_read(fvoid *opaque, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static PHYSFS_sint64 MIX_write(FileHandle *handle, const void *buffer,
+static PHYSFS_sint64 MIX_write(fvoid *opaque, const void *buffer,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static int MIX_eof(FileHandle *handle);
-static PHYSFS_sint64 MIX_tell(FileHandle *handle);
-static int MIX_seek(FileHandle *handle, PHYSFS_uint64 offset);
-static PHYSFS_sint64 MIX_fileLength(FileHandle *handle);
-static int MIX_fileClose(FileHandle *handle);
+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 LinkedStringList *MIX_enumerateFiles(void *opaque,
+static LinkedStringList *MIX_enumerateFiles(dvoid *opaque,
                                             const char *dirname,
                                             int omitSymLinks);
-static int MIX_exists(void *opaque, const char *name);
-static int MIX_isDirectory(void *opaque, const char *name, int *fileExists);
-static int MIX_isSymLink(void *opaque, const char *name, int *fileExists);
-static PHYSFS_sint64 MIX_getLastModTime(void *opaque, const char *n, int *e);
-static FileHandle *MIX_openRead(void *opaque, const char *name, int *exist);
-static FileHandle *MIX_openWrite(void *opaque, const char *name);
-static FileHandle *MIX_openAppend(void *opaque, const char *name);
-static int MIX_remove(void *opaque, const char *name);
-static int MIX_mkdir(void *opaque, const char *name);
+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 =
 {
@@ -114,19 +114,7 @@
 };
 
 
-static const FileFunctions __PHYSFS_FileFunctions_MIX =
-{
-    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  */
-};
-
-
-const DirFunctions __PHYSFS_DirFunctions_MIX =
+const PHYSFS_Archiver __PHYSFS_Archiver_MIX =
 {
     &__PHYSFS_ArchiveInfo_MIX,
     MIX_isArchive,          /* isArchive() method      */
@@ -141,9 +129,17 @@
     MIX_openAppend,         /* openAppend() method     */
     MIX_remove,             /* remove() method         */
     MIX_mkdir,              /* mkdir() method          */
-    MIX_dirClose            /* dirClose() 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)
 {
     PHYSFS_uint32 id = 0;
@@ -176,7 +172,7 @@
 } /* MIX_hash */
 
 
-static void MIX_dirClose(void *opaque)
+static void MIX_dirClose(dvoid *opaque)
 {
     MIXinfo *info = ((MIXinfo *) opaque);
     free(info->entry);
@@ -184,10 +180,10 @@
 } /* MIX_dirClose */
 
 
-static PHYSFS_sint64 MIX_read(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 MIX_read(fvoid *opaque, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
-    MIXfileinfo *finfo = (MIXfileinfo*)handle->opaque;
+    MIXfileinfo *finfo = (MIXfileinfo *) opaque;
     MIXentry *entry = finfo->entry;
     PHYSFS_uint32 read;
     
@@ -208,29 +204,29 @@
 } /* MIX_read */
 
 
-static PHYSFS_sint64 MIX_write(FileHandle *handle, const void *buffer,
+static PHYSFS_sint64 MIX_write(fvoid *opaque, const void *buffer,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
 } /* MIX_write */
 
 
-static int MIX_eof(FileHandle *handle)
+static int MIX_eof(fvoid *opaque)
 {
-    MIXfileinfo *fifo = (MIXfileinfo *) handle->opaque;
+    MIXfileinfo *fifo = (MIXfileinfo *) opaque;
     return(fifo->cur_pos >= fifo->size);
 } /* MIX_eof */
 
 
-static PHYSFS_sint64 MIX_tell(FileHandle *handle)
+static PHYSFS_sint64 MIX_tell(fvoid *opaque)
 {
-    return(((MIXfileinfo *) (handle->opaque))->cur_pos);
+    return(((MIXfileinfo *) opaque)->cur_pos);
 } /* MIX_tell */
 
 
-static int MIX_seek(FileHandle *handle, PHYSFS_uint64 offset)
+static int MIX_seek(fvoid *opaque, PHYSFS_uint64 offset)
 {
-    MIXfileinfo *h = (MIXfileinfo *) (handle->opaque);
+    MIXfileinfo *h = (MIXfileinfo *) opaque;
     
     BAIL_IF_MACRO(offset < 0, ERR_INVALID_ARGUMENT, 0);
     BAIL_IF_MACRO(offset >= h->size, ERR_PAST_EOF, 0);
@@ -239,25 +235,24 @@
 } /* MIX_seek */
 
 
-static PHYSFS_sint64 MIX_fileLength(FileHandle *handle)
+static PHYSFS_sint64 MIX_fileLength(fvoid *opaque)
 {
-    return (((MIXfileinfo *) (handle->opaque))->size);
+    return (((MIXfileinfo *) opaque)->size);
 } /* MIX_fileLength */
 
 
-static int MIX_fileClose(FileHandle *handle)
+static int MIX_fileClose(fvoid *opaque)
 {
-    MIXfileinfo *finfo = (MIXfileinfo *) handle->opaque;
+    MIXfileinfo *finfo = (MIXfileinfo *) opaque;
     __PHYSFS_platformClose(finfo->handle);
     free(finfo);
-    free(handle);
     return(1);
 } /* MIX_fileClose */
 
 
 static int MIX_isArchive(const char *filename, int forWriting)
 {
-    /* TODO:
+    /* !!! FIXME:
             write a simple detection routine for MIX files.
             Unfortunaly MIX files have no ID in the header.
     */
@@ -359,7 +354,7 @@
 } /* MIX_openArchive */
 
 
-static LinkedStringList *MIX_enumerateFiles(void *opaque,
+static LinkedStringList *MIX_enumerateFiles(dvoid *opaque,
                                             const char *dirname,
                                             int omitSymLinks)
 {
@@ -399,27 +394,27 @@
 } /* MIX_find_entry */
 
 
-static int MIX_exists(void *opaque, const char *name)
+static int MIX_exists(dvoid *opaque, const char *name)
 {
     return(MIX_find_entry(((MIXinfo *) opaque), name) != NULL);
 } /* MIX_exists */
 
 
-static int MIX_isDirectory(void *opaque, const char *name, int *fileExists)
+static int MIX_isDirectory(dvoid *opaque, const char *name, int *fileExists)
 {
     *fileExists = MIX_exists(opaque, name);
     return(0);  /* never directories in a MIX */
 } /* MIX_isDirectory */
 
 
-static int MIX_isSymLink(void *opaque, const char *name, int *fileExists)
+static int MIX_isSymLink(dvoid *opaque, const char *name, int *fileExists)
 {
     *fileExists = MIX_exists(opaque, name);
     return(0);  /* never symlinks in a MIX. */
 } /* MIX_isSymLink */
 
 
-static PHYSFS_sint64 MIX_getLastModTime(void *opaque,
+static PHYSFS_sint64 MIX_getLastModTime(dvoid *opaque,
                                         const char *name,
                                         int *fileExists)
 {
@@ -427,9 +422,8 @@
 } /* MIX_getLastModTime */
 
 
-static FileHandle *MIX_openRead(void *opaque, const char *fnm, int *fileExists)
+static fvoid *MIX_openRead(dvoid *opaque, const char *fnm, int *fileExists)
 {
-    FileHandle *retval;
     MIXinfo *info = ((MIXinfo*) opaque);
     MIXfileinfo *finfo;
     MIXentry *entry;
@@ -441,56 +435,44 @@
     /* allocate a MIX handle */
     finfo = (MIXfileinfo *) malloc(sizeof (MIXfileinfo));
     BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
-    
-    /* allocate a filehandle */
-    retval = (FileHandle*) malloc(sizeof (FileHandle));
-    if (!retval)
-    {
-        free(finfo);
-        BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
-    } /* if */
 
     /* open the archive */
     finfo->handle = __PHYSFS_platformOpenRead(info->filename);
     if(!finfo->handle)
     {
         free(finfo);
-        free(retval);
         return(NULL);
-    };
+    } /* if */
     
     /* setup structures */
     finfo->cur_pos = 0;
     finfo->info = info;
     finfo->entry = entry;
     finfo->size = entry->end_offset - entry->start_offset;
-    
-    retval->opaque = (void *) finfo;
-    retval->funcs = &__PHYSFS_FileFunctions_MIX;
 
-    return(retval);
+    return(finfo);
 } /* MIX_openRead */
 
 
-static FileHandle *MIX_openWrite(void *opaque, const char *name)
+static fvoid *MIX_openWrite(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
 } /* MIX_openWrite */
 
 
-static FileHandle *MIX_openAppend(void *opaque, const char *name)
+static fvoid *MIX_openAppend(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
 } /* MIX_openAppend */
 
 
-static int MIX_remove(void *opaque, const char *name)
+static int MIX_remove(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
 } /* MIX_remove */
 
 
-static int MIX_mkdir(void *opaque, const char *name)
+static int MIX_mkdir(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
 } /* MIX_mkdir */
--- a/archivers/mvl.c	Sun Sep 26 12:56:23 2004 +0000
+++ b/archivers/mvl.c	Sun Sep 26 13:00:59 2004 +0000
@@ -64,30 +64,30 @@
 } MVLfileinfo;
 
 
-static void MVL_dirClose(void *opaque);
-static PHYSFS_sint64 MVL_read(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 MVL_read(fvoid *opaque, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static PHYSFS_sint64 MVL_write(FileHandle *handle, const void *buffer,
+static PHYSFS_sint64 MVL_write(fvoid *opaque, const void *buffer,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static int MVL_eof(FileHandle *handle);
-static PHYSFS_sint64 MVL_tell(FileHandle *handle);
-static int MVL_seek(FileHandle *handle, PHYSFS_uint64 offset);
-static PHYSFS_sint64 MVL_fileLength(FileHandle *handle);
-static int MVL_fileClose(FileHandle *handle);
+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 LinkedStringList *MVL_enumerateFiles(void *opaque,
+static LinkedStringList *MVL_enumerateFiles(dvoid *opaque,
                                             const char *dirname,
                                             int omitSymLinks);
-static int MVL_exists(void *opaque, const char *name);
-static int MVL_isDirectory(void *opaque, const char *name, int *fileExists);
-static int MVL_isSymLink(void *opaque, const char *name, int *fileExists);
-static PHYSFS_sint64 MVL_getLastModTime(void *opaque, const char *n, int *e);
-static FileHandle *MVL_openRead(void *opaque, const char *name, int *exist);
-static FileHandle *MVL_openWrite(void *opaque, const char *name);
-static FileHandle *MVL_openAppend(void *opaque, const char *name);
-static int MVL_remove(void *opaque, const char *name);
-static int MVL_mkdir(void *opaque, const char *name);
+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 =
 {
@@ -98,19 +98,7 @@
 };
 
 
-static const FileFunctions __PHYSFS_FileFunctions_MVL =
-{
-    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  */
-};
-
-
-const DirFunctions __PHYSFS_DirFunctions_MVL =
+const PHYSFS_Archiver __PHYSFS_Archiver_MVL =
 {
     &__PHYSFS_ArchiveInfo_MVL,
     MVL_isArchive,          /* isArchive() method      */
@@ -125,12 +113,19 @@
     MVL_openAppend,         /* openAppend() method     */
     MVL_remove,             /* remove() method         */
     MVL_mkdir,              /* mkdir() method          */
-    MVL_dirClose            /* dirClose() 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(void *opaque)
+static void MVL_dirClose(dvoid *opaque)
 {
     MVLinfo *info = ((MVLinfo *) opaque);
     free(info->filename);
@@ -139,10 +134,10 @@
 } /* MVL_dirClose */
 
 
-static PHYSFS_sint64 MVL_read(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 MVL_read(fvoid *opaque, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
-    MVLfileinfo *finfo = (MVLfileinfo *) (handle->opaque);
+    MVLfileinfo *finfo = (MVLfileinfo *) opaque;
     MVLentry *entry = finfo->entry;
     PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
     PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
@@ -159,30 +154,30 @@
 } /* MVL_read */
 
 
-static PHYSFS_sint64 MVL_write(FileHandle *handle, const void *buffer,
+static PHYSFS_sint64 MVL_write(fvoid *opaque, const void *buffer,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
 } /* MVL_write */
 
 
-static int MVL_eof(FileHandle *handle)
+static int MVL_eof(fvoid *opaque)
 {
-    MVLfileinfo *finfo = (MVLfileinfo *) (handle->opaque);
+    MVLfileinfo *finfo = (MVLfileinfo *) opaque;
     MVLentry *entry = finfo->entry;
     return(finfo->curPos >= entry->size);
 } /* MVL_eof */
 
 
-static PHYSFS_sint64 MVL_tell(FileHandle *handle)
+static PHYSFS_sint64 MVL_tell(fvoid *opaque)
 {
-    return(((MVLfileinfo *) (handle->opaque))->curPos);
+    return(((MVLfileinfo *) opaque)->curPos);
 } /* MVL_tell */
 
 
-static int MVL_seek(FileHandle *handle, PHYSFS_uint64 offset)
+static int MVL_seek(fvoid *opaque, PHYSFS_uint64 offset)
 {
-    MVLfileinfo *finfo = (MVLfileinfo *) (handle->opaque);
+    MVLfileinfo *finfo = (MVLfileinfo *) opaque;
     MVLentry *entry = finfo->entry;
     int rc;
 
@@ -196,19 +191,18 @@
 } /* MVL_seek */
 
 
-static PHYSFS_sint64 MVL_fileLength(FileHandle *handle)
+static PHYSFS_sint64 MVL_fileLength(fvoid *opaque)
 {
-    MVLfileinfo *finfo = ((MVLfileinfo *) handle->opaque);
+    MVLfileinfo *finfo = (MVLfileinfo *) opaque;
     return((PHYSFS_sint64) finfo->entry->size);
 } /* MVL_fileLength */
 
 
-static int MVL_fileClose(FileHandle *handle)
+static int MVL_fileClose(fvoid *opaque)
 {
-    MVLfileinfo *finfo = ((MVLfileinfo *) handle->opaque);
+    MVLfileinfo *finfo = (MVLfileinfo *) opaque;
     BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
     free(finfo);
-    free(handle);
     return(1);
 } /* MVL_fileClose */
 
@@ -362,7 +356,7 @@
 } /* MVL_openArchive */
 
 
-static LinkedStringList *MVL_enumerateFiles(void *opaque,
+static LinkedStringList *MVL_enumerateFiles(dvoid *opaque,
                                             const char *dirname,
                                             int omitSymLinks)
 {
@@ -415,27 +409,27 @@
 } /* mvl_find_entry */
 
 
-static int MVL_exists(void *opaque, const char *name)
+static int MVL_exists(dvoid *opaque, const char *name)
 {
     return(mvl_find_entry(((MVLinfo *) opaque), name) != NULL);
 } /* MVL_exists */
 
 
-static int MVL_isDirectory(void *opaque, const char *name, int *fileExists)
+static int MVL_isDirectory(dvoid *opaque, const char *name, int *fileExists)
 {
     *fileExists = MVL_exists(opaque, name);
     return(0);  /* never directories in a groupfile. */
 } /* MVL_isDirectory */
 
 
-static int MVL_isSymLink(void *opaque, const char *name, int *fileExists)
+static int MVL_isSymLink(dvoid *opaque, const char *name, int *fileExists)
 {
     *fileExists = MVL_exists(opaque, name);
     return(0);  /* never symlinks in a groupfile. */
 } /* MVL_isSymLink */
 
 
-static PHYSFS_sint64 MVL_getLastModTime(void *opaque,
+static PHYSFS_sint64 MVL_getLastModTime(dvoid *opaque,
                                         const char *name,
                                         int *fileExists)
 {
@@ -450,10 +444,9 @@
 } /* MVL_getLastModTime */
 
 
-static FileHandle *MVL_openRead(void *opaque, const char *fnm, int *fileExists)
+static fvoid *MVL_openRead(dvoid *opaque, const char *fnm, int *fileExists)
 {
     MVLinfo *info = ((MVLinfo *) opaque);
-    FileHandle *retval;
     MVLfileinfo *finfo;
     MVLentry *entry;
 
@@ -461,51 +454,42 @@
     *fileExists = (entry != NULL);
     BAIL_IF_MACRO(entry == NULL, NULL, NULL);
 
-    retval = (FileHandle *) malloc(sizeof (FileHandle));
-    BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
     finfo = (MVLfileinfo *) malloc(sizeof (MVLfileinfo));
-    if (finfo == NULL)
-    {
-        free(retval);
-        BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
-    } /* if */
+    BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
 
     finfo->handle = __PHYSFS_platformOpenRead(info->filename);
     if ( (finfo->handle == NULL) ||
          (!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
     {
         free(finfo);
-        free(retval);
         return(NULL);
     } /* if */
 
     finfo->curPos = 0;
     finfo->entry = entry;
-    retval->opaque = (void *) finfo;
-    retval->funcs = &__PHYSFS_FileFunctions_MVL;
-    return(retval);
+    return(finfo);
 } /* MVL_openRead */
 
 
-static FileHandle *MVL_openWrite(void *opaque, const char *name)
+static fvoid *MVL_openWrite(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
 } /* MVL_openWrite */
 
 
-static FileHandle *MVL_openAppend(void *opaque, const char *name)
+static fvoid *MVL_openAppend(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
 } /* MVL_openAppend */
 
 
-static int MVL_remove(void *opaque, const char *name)
+static int MVL_remove(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
 } /* MVL_remove */
 
 
-static int MVL_mkdir(void *opaque, const char *name)
+static int MVL_mkdir(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
 } /* MVL_mkdir */
--- a/archivers/qpak.c	Sun Sep 26 12:56:23 2004 +0000
+++ b/archivers/qpak.c	Sun Sep 26 13:00:59 2004 +0000
@@ -78,30 +78,30 @@
 #define QPAK_SIGNATURE 0x4b434150   /* "PACK" in ASCII. */
 
 
-static void QPAK_dirClose(void *opaque);
-static PHYSFS_sint64 QPAK_read(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 QPAK_read(fvoid *opaque, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static PHYSFS_sint64 QPAK_write(FileHandle *handle, const void *buffer,
+static PHYSFS_sint64 QPAK_write(fvoid *opaque, const void *buffer,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static int QPAK_eof(FileHandle *handle);
-static PHYSFS_sint64 QPAK_tell(FileHandle *handle);
-static int QPAK_seek(FileHandle *handle, PHYSFS_uint64 offset);
-static PHYSFS_sint64 QPAK_fileLength(FileHandle *handle);
-static int QPAK_fileClose(FileHandle *handle);
+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 LinkedStringList *QPAK_enumerateFiles(void *opaque,
+static LinkedStringList *QPAK_enumerateFiles(dvoid *opaque,
                                             const char *dirname,
                                             int omitSymLinks);
-static int QPAK_exists(void *opaque, const char *name);
-static int QPAK_isDirectory(void *opaque, const char *name, int *fileExists);
-static int QPAK_isSymLink(void *opaque, const char *name, int *fileExists);
-static PHYSFS_sint64 QPAK_getLastModTime(void *opaque, const char *n, int *e);
-static FileHandle *QPAK_openRead(void *opaque, const char *name, int *exist);
-static FileHandle *QPAK_openWrite(void *opaque, const char *name);
-static FileHandle *QPAK_openAppend(void *opaque, const char *name);
-static int QPAK_remove(void *opaque, const char *name);
-static int QPAK_mkdir(void *opaque, const char *name);
+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 =
 {
@@ -112,19 +112,7 @@
 };
 
 
-static const FileFunctions __PHYSFS_FileFunctions_QPAK =
-{
-    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  */
-};
-
-
-const DirFunctions __PHYSFS_DirFunctions_QPAK =
+const PHYSFS_Archiver __PHYSFS_Archiver_QPAK =
 {
     &__PHYSFS_ArchiveInfo_QPAK,
     QPAK_isArchive,          /* isArchive() method      */
@@ -139,12 +127,19 @@
     QPAK_openAppend,         /* openAppend() method     */
     QPAK_remove,             /* remove() method         */
     QPAK_mkdir,              /* mkdir() method          */
-    QPAK_dirClose            /* dirClose() 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(void *opaque)
+static void QPAK_dirClose(dvoid *opaque)
 {
     QPAKinfo *info = ((QPAKinfo *) opaque);
     free(info->filename);
@@ -153,10 +148,10 @@
 } /* QPAK_dirClose */
 
 
-static PHYSFS_sint64 QPAK_read(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 QPAK_read(fvoid *opaque, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
-    QPAKfileinfo *finfo = (QPAKfileinfo *) (handle->opaque);
+    QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
     QPAKentry *entry = finfo->entry;
     PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
     PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
@@ -173,30 +168,30 @@
 } /* QPAK_read */
 
 
-static PHYSFS_sint64 QPAK_write(FileHandle *handle, const void *buffer,
+static PHYSFS_sint64 QPAK_write(fvoid *opaque, const void *buffer,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
 } /* QPAK_write */
 
 
-static int QPAK_eof(FileHandle *handle)
+static int QPAK_eof(fvoid *opaque)
 {
-    QPAKfileinfo *finfo = (QPAKfileinfo *) (handle->opaque);
+    QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
     QPAKentry *entry = finfo->entry;
     return(finfo->curPos >= entry->size);
 } /* QPAK_eof */
 
 
-static PHYSFS_sint64 QPAK_tell(FileHandle *handle)
+static PHYSFS_sint64 QPAK_tell(fvoid *opaque)
 {
-    return(((QPAKfileinfo *) (handle->opaque))->curPos);
+    return(((QPAKfileinfo *) opaque)->curPos);
 } /* QPAK_tell */
 
 
-static int QPAK_seek(FileHandle *handle, PHYSFS_uint64 offset)
+static int QPAK_seek(fvoid *opaque, PHYSFS_uint64 offset)
 {
-    QPAKfileinfo *finfo = (QPAKfileinfo *) (handle->opaque);
+    QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
     QPAKentry *entry = finfo->entry;
     int rc;
 
@@ -210,19 +205,18 @@
 } /* QPAK_seek */
 
 
-static PHYSFS_sint64 QPAK_fileLength(FileHandle *handle)
+static PHYSFS_sint64 QPAK_fileLength(fvoid *opaque)
 {
-    QPAKfileinfo *finfo = ((QPAKfileinfo *) handle->opaque);
+    QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
     return((PHYSFS_sint64) finfo->entry->size);
 } /* QPAK_fileLength */
 
 
-static int QPAK_fileClose(FileHandle *handle)
+static int QPAK_fileClose(fvoid *opaque)
 {
-    QPAKfileinfo *finfo = ((QPAKfileinfo *) handle->opaque);
+    QPAKfileinfo *finfo = (QPAKfileinfo *) opaque;
     BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
     free(finfo);
-    free(handle);
     return(1);
 } /* QPAK_fileClose */
 
@@ -449,7 +443,7 @@
 } /* qpak_find_start_of_dir */
 
 
-static LinkedStringList *QPAK_enumerateFiles(void *opaque,
+static LinkedStringList *QPAK_enumerateFiles(dvoid *opaque,
                                              const char *dirname,
                                              int omitSymLinks)
 {
@@ -544,7 +538,7 @@
 } /* qpak_find_entry */
 
 
-static int QPAK_exists(void *opaque, const char *name)
+static int QPAK_exists(dvoid *opaque, const char *name)
 {
     int isDir;    
     QPAKinfo *info = (QPAKinfo *) opaque;
@@ -553,7 +547,7 @@
 } /* QPAK_exists */
 
 
-static int QPAK_isDirectory(void *opaque, const char *name, int *fileExists)
+static int QPAK_isDirectory(dvoid *opaque, const char *name, int *fileExists)
 {
     QPAKinfo *info = (QPAKinfo *) opaque;
     int isDir;
@@ -567,14 +561,14 @@
 } /* QPAK_isDirectory */
 
 
-static int QPAK_isSymLink(void *opaque, const char *name, int *fileExists)
+static int QPAK_isSymLink(dvoid *opaque, const char *name, int *fileExists)
 {
     *fileExists = QPAK_exists(opaque, name);
     return(0);  /* never symlinks in a quake pak. */
 } /* QPAK_isSymLink */
 
 
-static PHYSFS_sint64 QPAK_getLastModTime(void *opaque,
+static PHYSFS_sint64 QPAK_getLastModTime(dvoid *opaque,
                                         const char *name,
                                         int *fileExists)
 {
@@ -591,10 +585,9 @@
 } /* QPAK_getLastModTime */
 
 
-static FileHandle *QPAK_openRead(void *opaque, const char *fnm, int *fileExists)
+static fvoid *QPAK_openRead(dvoid *opaque, const char *fnm, int *fileExists)
 {
     QPAKinfo *info = ((QPAKinfo *) opaque);
-    FileHandle *retval;
     QPAKfileinfo *finfo;
     QPAKentry *entry;
     int isDir;
@@ -604,51 +597,42 @@
     BAIL_IF_MACRO(isDir, ERR_NOT_A_FILE, NULL);
     BAIL_IF_MACRO(entry == NULL, ERR_NO_SUCH_FILE, NULL);
 
-    retval = (FileHandle *) malloc(sizeof (FileHandle));
-    BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
     finfo = (QPAKfileinfo *) malloc(sizeof (QPAKfileinfo));
-    if (finfo == NULL)
-    {
-        free(retval);
-        BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
-    } /* if */
+    BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
 
     finfo->handle = __PHYSFS_platformOpenRead(info->filename);
     if ( (finfo->handle == NULL) ||
          (!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
     {
         free(finfo);
-        free(retval);
         return(NULL);
     } /* if */
 
     finfo->curPos = 0;
     finfo->entry = entry;
-    retval->opaque = (void *) finfo;
-    retval->funcs = &__PHYSFS_FileFunctions_QPAK;
-    return(retval);
+    return(finfo);
 } /* QPAK_openRead */
 
 
-static FileHandle *QPAK_openWrite(void *opaque, const char *name)
+static fvoid *QPAK_openWrite(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
 } /* QPAK_openWrite */
 
 
-static FileHandle *QPAK_openAppend(void *opaque, const char *name)
+static fvoid *QPAK_openAppend(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
 } /* QPAK_openAppend */
 
 
-static int QPAK_remove(void *opaque, const char *name)
+static int QPAK_remove(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
 } /* QPAK_remove */
 
 
-static int QPAK_mkdir(void *opaque, const char *name)
+static int QPAK_mkdir(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
 } /* QPAK_mkdir */
--- a/archivers/wad.c	Sun Sep 26 12:56:23 2004 +0000
+++ b/archivers/wad.c	Sun Sep 26 13:00:59 2004 +0000
@@ -80,30 +80,30 @@
 } WADfileinfo;
 
 
-static void WAD_dirClose(void *opaque);
-static PHYSFS_sint64 WAD_read(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 WAD_read(fvoid *opaque, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static PHYSFS_sint64 WAD_write(FileHandle *handle, const void *buffer,
+static PHYSFS_sint64 WAD_write(fvoid *opaque, const void *buffer,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static int WAD_eof(FileHandle *handle);
-static PHYSFS_sint64 WAD_tell(FileHandle *handle);
-static int WAD_seek(FileHandle *handle, PHYSFS_uint64 offset);
-static PHYSFS_sint64 WAD_fileLength(FileHandle *handle);
-static int WAD_fileClose(FileHandle *handle);
+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 LinkedStringList *WAD_enumerateFiles(void *opaque,
+static LinkedStringList *WAD_enumerateFiles(dvoid *opaque,
                                             const char *dirname,
                                             int omitSymLinks);
-static int WAD_exists(void *opaque, const char *name);
-static int WAD_isDirectory(void *opaque, const char *name, int *fileExists);
-static int WAD_isSymLink(void *opaque, const char *name, int *fileExists);
-static PHYSFS_sint64 WAD_getLastModTime(void *opaque, const char *n, int *e);
-static FileHandle *WAD_openRead(void *opaque, const char *name, int *exist);
-static FileHandle *WAD_openWrite(void *opaque, const char *name);
-static FileHandle *WAD_openAppend(void *opaque, const char *name);
-static int WAD_remove(void *opaque, const char *name);
-static int WAD_mkdir(void *opaque, const char *name);
+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 =
 {
@@ -114,19 +114,7 @@
 };
 
 
-static const FileFunctions __PHYSFS_FileFunctions_WAD =
-{
-    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  */
-};
-
-
-const DirFunctions __PHYSFS_DirFunctions_WAD =
+const PHYSFS_Archiver __PHYSFS_Archiver_WAD =
 {
     &__PHYSFS_ArchiveInfo_WAD,
     WAD_isArchive,          /* isArchive() method      */
@@ -141,12 +129,19 @@
     WAD_openAppend,         /* openAppend() method     */
     WAD_remove,             /* remove() method         */
     WAD_mkdir,              /* mkdir() method          */
-    WAD_dirClose            /* dirClose() 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(void *opaque)
+static void WAD_dirClose(dvoid *opaque)
 {
     WADinfo *info = ((WADinfo *) opaque);
     free(info->filename);
@@ -155,10 +150,10 @@
 } /* WAD_dirClose */
 
 
-static PHYSFS_sint64 WAD_read(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 WAD_read(fvoid *opaque, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
-    WADfileinfo *finfo = (WADfileinfo *) (handle->opaque);
+    WADfileinfo *finfo = (WADfileinfo *) opaque;
     WADentry *entry = finfo->entry;
     PHYSFS_uint32 bytesLeft = entry->size - finfo->curPos;
     PHYSFS_uint32 objsLeft = (bytesLeft / objSize);
@@ -175,30 +170,30 @@
 } /* WAD_read */
 
 
-static PHYSFS_sint64 WAD_write(FileHandle *handle, const void *buffer,
+static PHYSFS_sint64 WAD_write(fvoid *opaque, const void *buffer,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
 } /* WAD_write */
 
 
-static int WAD_eof(FileHandle *handle)
+static int WAD_eof(fvoid *opaque)
 {
-    WADfileinfo *finfo = (WADfileinfo *) (handle->opaque);
+    WADfileinfo *finfo = (WADfileinfo *) opaque;
     WADentry *entry = finfo->entry;
     return(finfo->curPos >= entry->size);
 } /* WAD_eof */
 
 
-static PHYSFS_sint64 WAD_tell(FileHandle *handle)
+static PHYSFS_sint64 WAD_tell(fvoid *opaque)
 {
-    return(((WADfileinfo *) (handle->opaque))->curPos);
+    return(((WADfileinfo *) opaque)->curPos);
 } /* WAD_tell */
 
 
-static int WAD_seek(FileHandle *handle, PHYSFS_uint64 offset)
+static int WAD_seek(fvoid *opaque, PHYSFS_uint64 offset)
 {
-    WADfileinfo *finfo = (WADfileinfo *) (handle->opaque);
+    WADfileinfo *finfo = (WADfileinfo *) opaque;
     WADentry *entry = finfo->entry;
     int rc;
 
@@ -212,19 +207,18 @@
 } /* WAD_seek */
 
 
-static PHYSFS_sint64 WAD_fileLength(FileHandle *handle)
+static PHYSFS_sint64 WAD_fileLength(fvoid *opaque)
 {
-    WADfileinfo *finfo = ((WADfileinfo *) handle->opaque);
+    WADfileinfo *finfo = (WADfileinfo *) opaque;
     return((PHYSFS_sint64) finfo->entry->size);
 } /* WAD_fileLength */
 
 
-static int WAD_fileClose(FileHandle *handle)
+static int WAD_fileClose(fvoid *opaque)
 {
-    WADfileinfo *finfo = ((WADfileinfo *) handle->opaque);
+    WADfileinfo *finfo = (WADfileinfo *) opaque;
     BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
     free(finfo);
-    free(handle);
     return(1);
 } /* WAD_fileClose */
 
@@ -392,7 +386,7 @@
 } /* WAD_openArchive */
 
 
-static LinkedStringList *WAD_enumerateFiles(void *opaque,
+static LinkedStringList *WAD_enumerateFiles(dvoid *opaque,
                                             const char *dirname,
                                             int omitSymLinks)
 {
@@ -458,13 +452,13 @@
 } /* wad_find_entry */
 
 
-static int WAD_exists(void *opaque, const char *name)
+static int WAD_exists(dvoid *opaque, const char *name)
 {
     return(wad_find_entry(((WADinfo *) opaque), name) != NULL);
 } /* WAD_exists */
 
 
-static int WAD_isDirectory(void *opaque, const char *name, int *fileExists)
+static int WAD_isDirectory(dvoid *opaque, const char *name, int *fileExists)
 {
     WADentry *entry = wad_find_entry(((WADinfo *) opaque), name);
     if (entry != NULL)
@@ -494,14 +488,14 @@
 } /* WAD_isDirectory */
 
 
-static int WAD_isSymLink(void *opaque, const char *name, int *fileExists)
+static int WAD_isSymLink(dvoid *opaque, const char *name, int *fileExists)
 {
     *fileExists = WAD_exists(opaque, name);
     return(0);  /* never symlinks in a wad. */
 } /* WAD_isSymLink */
 
 
-static PHYSFS_sint64 WAD_getLastModTime(void *opaque,
+static PHYSFS_sint64 WAD_getLastModTime(dvoid *opaque,
                                         const char *name,
                                         int *fileExists)
 {
@@ -516,10 +510,9 @@
 } /* WAD_getLastModTime */
 
 
-static FileHandle *WAD_openRead(void *opaque, const char *fnm, int *fileExists)
+static fvoid *WAD_openRead(dvoid *opaque, const char *fnm, int *fileExists)
 {
     WADinfo *info = ((WADinfo *) opaque);
-    FileHandle *retval;
     WADfileinfo *finfo;
     WADentry *entry;
 
@@ -527,51 +520,42 @@
     *fileExists = (entry != NULL);
     BAIL_IF_MACRO(entry == NULL, NULL, NULL);
 
-    retval = (FileHandle *) malloc(sizeof (FileHandle));
-    BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
     finfo = (WADfileinfo *) malloc(sizeof (WADfileinfo));
-    if (finfo == NULL)
-    {
-        free(retval);
-        BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
-    } /* if */
+    BAIL_IF_MACRO(finfo == NULL, ERR_OUT_OF_MEMORY, NULL);
 
     finfo->handle = __PHYSFS_platformOpenRead(info->filename);
     if ( (finfo->handle == NULL) ||
          (!__PHYSFS_platformSeek(finfo->handle, entry->startPos)) )
     {
         free(finfo);
-        free(retval);
         return(NULL);
     } /* if */
 
     finfo->curPos = 0;
     finfo->entry = entry;
-    retval->opaque = (void *) finfo;
-    retval->funcs = &__PHYSFS_FileFunctions_WAD;
-    return(retval);
+    return(finfo);
 } /* WAD_openRead */
 
 
-static FileHandle *WAD_openWrite(void *opaque, const char *name)
+static fvoid *WAD_openWrite(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
 } /* WAD_openWrite */
 
 
-static FileHandle *WAD_openAppend(void *opaque, const char *name)
+static fvoid *WAD_openAppend(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
 } /* WAD_openAppend */
 
 
-static int WAD_remove(void *opaque, const char *name)
+static int WAD_remove(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
 } /* WAD_remove */
 
 
-static int WAD_mkdir(void *opaque, const char *name)
+static int WAD_mkdir(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
 } /* WAD_mkdir */
--- a/archivers/zip.c	Sun Sep 26 12:56:23 2004 +0000
+++ b/archivers/zip.c	Sun Sep 26 13:00:59 2004 +0000
@@ -116,31 +116,31 @@
 #define UNIX_FILETYPE_SYMLINK 0120000
 
 
-static PHYSFS_sint64 ZIP_read(FileHandle *handle, void *buffer,
+static PHYSFS_sint64 ZIP_read(fvoid *opaque, void *buffer,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static PHYSFS_sint64 ZIP_write(FileHandle *handle, const void *buffer,
+static PHYSFS_sint64 ZIP_write(fvoid *opaque, const void *buffer,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-static int ZIP_eof(FileHandle *handle);
-static PHYSFS_sint64 ZIP_tell(FileHandle *handle);
-static int ZIP_seek(FileHandle *handle, PHYSFS_uint64 offset);
-static PHYSFS_sint64 ZIP_fileLength(FileHandle *handle);
-static int ZIP_fileClose(FileHandle *handle);
+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 LinkedStringList *ZIP_enumerateFiles(void *opaque,
+static LinkedStringList *ZIP_enumerateFiles(dvoid *opaque,
                                             const char *dirname,
                                             int omitSymLinks);
-static int ZIP_exists(void *opaque, const char *name);
-static int ZIP_isDirectory(void *opaque, const char *name, int *fileExists);
-static int ZIP_isSymLink(void *opaque, const char *name, int *fileExists);
-static PHYSFS_sint64 ZIP_getLastModTime(void *opaque, const char *n, int *e);
-static FileHandle *ZIP_openRead(void *opaque, const char *filename, int *e);
-static FileHandle *ZIP_openWrite(void *opaque, const char *filename);
-static FileHandle *ZIP_openAppend(void *opaque, const char *filename);
-static void ZIP_dirClose(void *opaque);
+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(void *opaque, const char *name);
-static int ZIP_mkdir(void *opaque, const char *name);
+static int ZIP_remove(dvoid *opaque, const char *name);
+static int ZIP_mkdir(dvoid *opaque, const char *name);
 
 
 const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP =
@@ -151,19 +151,8 @@
     "http://icculus.org/physfs/",
 };
 
-static const FileFunctions __PHYSFS_FileFunctions_ZIP =
-{
-    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  */
-};
 
-
-const DirFunctions __PHYSFS_DirFunctions_ZIP =
+const PHYSFS_Archiver __PHYSFS_Archiver_ZIP =
 {
     &__PHYSFS_ArchiveInfo_ZIP,
     ZIP_isArchive,          /* isArchive() method      */
@@ -178,7 +167,14 @@
     ZIP_openAppend,         /* openAppend() method     */
     ZIP_remove,             /* remove() method         */
     ZIP_mkdir,              /* mkdir() method          */
-    ZIP_dirClose            /* dirClose() 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      */
 };
 
 
@@ -188,7 +184,7 @@
  */
 static voidpf zlibPhysfsAlloc(voidpf opaque, uInt items, uInt size)
 {
-    return(((PHYSFS_allocator *) opaque)->malloc(items * size));
+    return(((PHYSFS_Allocator *) opaque)->malloc(items * size));
 } /* zlibPhysfsAlloc */
 
 /*
@@ -196,7 +192,7 @@
  */
 static void zlibPhysfsFree(voidpf opaque, voidpf address)
 {
-    ((PHYSFS_allocator *) opaque)->free(address);
+    ((PHYSFS_Allocator *) opaque)->free(address);
 } /* zlibPhysfsFree */
 
 
@@ -269,10 +265,10 @@
 } /* readui16 */
 
 
-static PHYSFS_sint64 ZIP_read(FileHandle *handle, void *buf,
+static PHYSFS_sint64 ZIP_read(fvoid *opaque, void *buf,
                               PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
-    ZIPfileinfo *finfo = (ZIPfileinfo *) (handle->opaque);
+    ZIPfileinfo *finfo = (ZIPfileinfo *) opaque;
     ZIPentry *entry = finfo->entry;
     PHYSFS_sint64 retval = 0;
     PHYSFS_sint64 maxread = ((PHYSFS_sint64) objSize) * objCount;
@@ -343,29 +339,29 @@
 } /* ZIP_read */
 
 
-static PHYSFS_sint64 ZIP_write(FileHandle *handle, const void *buf,
+static PHYSFS_sint64 ZIP_write(fvoid *opaque, const void *buf,
                                PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, -1);
 } /* ZIP_write */
 
 
-static int ZIP_eof(FileHandle *handle)
+static int ZIP_eof(fvoid *opaque)
 {
-    ZIPfileinfo *finfo = ((ZIPfileinfo *) (handle->opaque));
+    ZIPfileinfo *finfo = (ZIPfileinfo *) opaque;
     return(finfo->uncompressed_position >= finfo->entry->uncompressed_size);
 } /* ZIP_eof */
 
 
-static PHYSFS_sint64 ZIP_tell(FileHandle *handle)
+static PHYSFS_sint64 ZIP_tell(fvoid *opaque)
 {
-    return(((ZIPfileinfo *) (handle->opaque))->uncompressed_position);
+    return(((ZIPfileinfo *) opaque)->uncompressed_position);
 } /* ZIP_tell */
 
 
-static int ZIP_seek(FileHandle *handle, PHYSFS_uint64 offset)
+static int ZIP_seek(fvoid *opaque, PHYSFS_uint64 offset)
 {
-    ZIPfileinfo *finfo = (ZIPfileinfo *) (handle->opaque);
+    ZIPfileinfo *finfo = (ZIPfileinfo *) opaque;
     ZIPentry *entry = finfo->entry;
     void *in = finfo->handle;
 
@@ -411,7 +407,7 @@
             if (maxread > sizeof (buf))
                 maxread = sizeof (buf);
 
-            if (ZIP_read(handle, buf, maxread, 1) != 1)
+            if (ZIP_read(finfo, buf, maxread, 1) != 1)
                 return(0);
         } /* while */
     } /* else */
@@ -420,16 +416,16 @@
 } /* ZIP_seek */
 
 
-static PHYSFS_sint64 ZIP_fileLength(FileHandle *handle)
+static PHYSFS_sint64 ZIP_fileLength(fvoid *opaque)
 {
-    ZIPfileinfo *finfo = (ZIPfileinfo *) (handle->opaque);
+    ZIPfileinfo *finfo = (ZIPfileinfo *) opaque;
     return(finfo->entry->uncompressed_size);
 } /* ZIP_fileLength */
 
 
-static int ZIP_fileClose(FileHandle *handle)
+static int ZIP_fileClose(fvoid *opaque)
 {
-    ZIPfileinfo *finfo = (ZIPfileinfo *) (handle->opaque);
+    ZIPfileinfo *finfo = (ZIPfileinfo *) opaque;
     BAIL_IF_MACRO(!__PHYSFS_platformClose(finfo->handle), NULL, 0);
 
     if (finfo->entry->compression_method != COMPMETH_NONE)
@@ -439,7 +435,6 @@
         free(finfo->buffer);
 
     free(finfo);
-    free(handle);
     return(1);
 } /* ZIP_fileClose */
 
@@ -1240,7 +1235,7 @@
 } /* zip_find_start_of_dir */
 
 
-static LinkedStringList *ZIP_enumerateFiles(void *opaque,
+static LinkedStringList *ZIP_enumerateFiles(dvoid *opaque,
                                             const char *dirname,
                                             int omitSymLinks)
 {
@@ -1287,7 +1282,7 @@
 } /* ZIP_enumerateFiles */
 
 
-static int ZIP_exists(void *opaque, const char *name)
+static int ZIP_exists(dvoid *opaque, const char *name)
 {
     int isDir;    
     ZIPinfo *info = (ZIPinfo *) opaque;
@@ -1296,7 +1291,7 @@
 } /* ZIP_exists */
 
 
-static PHYSFS_sint64 ZIP_getLastModTime(void *opaque,
+static PHYSFS_sint64 ZIP_getLastModTime(dvoid *opaque,
                                         const char *name,
                                         int *fileExists)
 {
@@ -1313,7 +1308,7 @@
 } /* ZIP_getLastModTime */
 
 
-static int ZIP_isDirectory(void *opaque, const char *name, int *fileExists)
+static int ZIP_isDirectory(dvoid *opaque, const char *name, int *fileExists)
 {
     ZIPinfo *info = (ZIPinfo *) opaque;
     int isDir;
@@ -1344,7 +1339,7 @@
 } /* ZIP_isDirectory */
 
 
-static int ZIP_isSymLink(void *opaque, const char *name, int *fileExists)
+static int ZIP_isSymLink(dvoid *opaque, const char *name, int *fileExists)
 {
     int isDir;
     ZIPentry *entry = zip_find_entry((ZIPinfo *) opaque, name, &isDir);
@@ -1378,11 +1373,10 @@
 } /* zip_get_file_handle */
 
 
-static FileHandle *ZIP_openRead(void *opaque, const char *fnm, int *fileExists)
+static fvoid *ZIP_openRead(dvoid *opaque, const char *fnm, int *fileExists)
 {
     ZIPinfo *info = (ZIPinfo *) opaque;
     ZIPentry *entry = zip_find_entry(info, fnm, NULL);
-    FileHandle *retval = NULL;
     ZIPfileinfo *finfo = NULL;
     void *in;
 
@@ -1392,18 +1386,13 @@
     in = zip_get_file_handle(info->archiveName, info, entry);
     BAIL_IF_MACRO(in == NULL, NULL, NULL);
 
-    if ( ((retval = (FileHandle *) malloc(sizeof (FileHandle))) == NULL) ||
-         ((finfo = (ZIPfileinfo *) malloc(sizeof (ZIPfileinfo))) == NULL) )
+    finfo = (ZIPfileinfo *) malloc(sizeof (ZIPfileinfo));
+    if (finfo == NULL)
     {
-        if (retval)
-            free(retval);
         __PHYSFS_platformClose(in);
         BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
     } /* if */
 
-    retval->opaque = (void *) finfo;
-    retval->funcs = &__PHYSFS_FileFunctions_ZIP;
-
     memset(finfo, '\0', sizeof (ZIPfileinfo));
     finfo->handle = in;
     finfo->entry = ((entry->symlink != NULL) ? entry->symlink : entry);
@@ -1412,35 +1401,35 @@
     {
         if (zlib_err(inflateInit2(&finfo->stream, -MAX_WBITS)) != Z_OK)
         {
-            ZIP_fileClose(retval);
+            ZIP_fileClose(finfo);
             return(NULL);
         } /* if */
 
         finfo->buffer = (PHYSFS_uint8 *) malloc(ZIP_READBUFSIZE);
         if (finfo->buffer == NULL)
         {
-            ZIP_fileClose(retval);
+            ZIP_fileClose(finfo);
             BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
         } /* if */
     } /* if */
 
-    return(retval);
+    return(finfo);
 } /* ZIP_openRead */
 
 
-static FileHandle *ZIP_openWrite(void *opaque, const char *filename)
+static fvoid *ZIP_openWrite(dvoid *opaque, const char *filename)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
 } /* ZIP_openWrite */
 
 
-static FileHandle *ZIP_openAppend(void *opaque, const char *filename)
+static fvoid *ZIP_openAppend(dvoid *opaque, const char *filename)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, NULL);
 } /* ZIP_openAppend */
 
 
-static void ZIP_dirClose(void *opaque)
+static void ZIP_dirClose(dvoid *opaque)
 {
     ZIPinfo *zi = (ZIPinfo *) (opaque);
     zip_free_entries(zi->entries, zi->entryCount);
@@ -1449,13 +1438,13 @@
 } /* ZIP_dirClose */
 
 
-static int ZIP_remove(void *opaque, const char *name)
+static int ZIP_remove(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
 } /* ZIP_remove */
 
 
-static int ZIP_mkdir(void *opaque, const char *name)
+static int ZIP_mkdir(dvoid *opaque, const char *name)
 {
     BAIL_MACRO(ERR_NOT_SUPPORTED, 0);
 } /* ZIP_mkdir */
--- a/physfs.c	Sun Sep 26 12:56:23 2004 +0000
+++ b/physfs.c	Sun Sep 26 13:00:59 2004 +0000
@@ -26,19 +26,27 @@
 #include "physfs_internal.h"
 
 
-/* !!! FIXME: Get rid of this. Merge it with PhysDirInfo. */
 typedef struct __PHYSFS_DIRHANDLE__
 {
-        /*
-         * This is reserved for the driver to store information.
-         */
-    void *opaque;
+    void *opaque;  /* Instance data unique to the archiver. */
+    char *dirName;  /* Path to archive in platform-dependent notation. */
+    const PHYSFS_Archiver *funcs;  /* Ptr to archiver info for this handle. */
+    struct __PHYSFS_DIRHANDLE__ *next;  /* linked list stuff. */
+} DirHandle;
+
 
-        /*
-         * Pointer to the directory i/o functions for this handle.
-         */
-    const struct __PHYSFS_DIRFUNCTIONS__ *funcs;
-} DirHandle;
+typedef struct __PHYSFS_FILEHANDLE__
+{
+    void *opaque;  /* Instance data unique to the archiver for this file. */
+    PHYSFS_uint8 forReading; /* Non-zero if reading, zero if write/append */
+    const DirHandle *dirHandle;  /* Archiver instance that created this */
+    const PHYSFS_Archiver *funcs;  /* Ptr to archiver info for this handle. */
+    PHYSFS_uint8 *buffer;  /* Buffer, if set (NULL otherwise). Don't touch! */
+    PHYSFS_uint32 bufsize;  /* Bufsize, if set (0 otherwise). Don't touch! */
+    PHYSFS_uint32 buffill;  /* Buffer fill size. Don't touch! */
+    PHYSFS_uint32 bufpos;  /* Buffer position. Don't touch! */
+    struct __PHYSFS_FILEHANDLE__ *next;  /* linked list stuff. */
+} FileHandle;
 
 
 typedef struct __PHYSFS_ERRMSGTYPE__
@@ -49,58 +57,45 @@
     struct __PHYSFS_ERRMSGTYPE__ *next;
 } ErrMsg;
 
-typedef struct __PHYSFS_DIRINFO__
-{
-    char *dirName;
-    DirHandle *dirHandle;
-    struct __PHYSFS_DIRINFO__ *next;
-} PhysDirInfo;
-
-typedef struct __PHYSFS_FILEHANDLELIST__
-{
-    PHYSFS_file handle;
-    struct __PHYSFS_FILEHANDLELIST__ *next;
-} FileHandleList;
-
 
 /* The various i/o drivers... */
 
 #if (defined PHYSFS_SUPPORTS_ZIP)
-extern const PHYSFS_ArchiveInfo   __PHYSFS_ArchiveInfo_ZIP;
-extern const DirFunctions         __PHYSFS_DirFunctions_ZIP;
+extern const PHYSFS_ArchiveInfo    __PHYSFS_ArchiveInfo_ZIP;
+extern const PHYSFS_Archiver       __PHYSFS_Archiver_ZIP;
 #endif
 
 #if (defined PHYSFS_SUPPORTS_GRP)
-extern const PHYSFS_ArchiveInfo   __PHYSFS_ArchiveInfo_GRP;
-extern const DirFunctions         __PHYSFS_DirFunctions_GRP;
+extern const PHYSFS_ArchiveInfo    __PHYSFS_ArchiveInfo_GRP;
+extern const PHYSFS_Archiver       __PHYSFS_Archiver_GRP;
 #endif
 
 #if (defined PHYSFS_SUPPORTS_QPAK)
-extern const PHYSFS_ArchiveInfo   __PHYSFS_ArchiveInfo_QPAK;
-extern const DirFunctions         __PHYSFS_DirFunctions_QPAK;
+extern const PHYSFS_ArchiveInfo    __PHYSFS_ArchiveInfo_QPAK;
+extern const PHYSFS_Archiver       __PHYSFS_Archiver_QPAK;
 #endif
 
 #if (defined PHYSFS_SUPPORTS_HOG)
-extern const PHYSFS_ArchiveInfo   __PHYSFS_ArchiveInfo_HOG;
-extern const DirFunctions         __PHYSFS_DirFunctions_HOG;
+extern const PHYSFS_ArchiveInfo    __PHYSFS_ArchiveInfo_HOG;
+extern const PHYSFS_Archiver       __PHYSFS_Archiver_HOG;
 #endif
 
 #if (defined PHYSFS_SUPPORTS_MVL)
-extern const PHYSFS_ArchiveInfo   __PHYSFS_ArchiveInfo_MVL;
-extern const DirFunctions         __PHYSFS_DirFunctions_MVL;
+extern const PHYSFS_ArchiveInfo    __PHYSFS_ArchiveInfo_MVL;
+extern const PHYSFS_Archiver       __PHYSFS_Archiver_MVL;
 #endif
 
 #if (defined PHYSFS_SUPPORTS_WAD)
-extern const PHYSFS_ArchiveInfo   __PHYSFS_ArchiveInfo_WAD;
-extern const DirFunctions         __PHYSFS_DirFunctions_WAD;
+extern const PHYSFS_ArchiveInfo    __PHYSFS_ArchiveInfo_WAD;
+extern const PHYSFS_Archiver       __PHYSFS_Archiver_WAD;
 #endif
 
 #if (defined PHYSFS_SUPPORTS_MIX)
-extern const PHYSFS_ArchiveInfo   __PHYSFS_ArchiveInfo_MIX;
-extern const DirFunctions         __PHYSFS_DirFunctions_MIX;
+extern const PHYSFS_ArchiveInfo    __PHYSFS_ArchiveInfo_MIX;
+extern const PHYSFS_Archiver       __PHYSFS_Archiver_MIX;
 #endif
 
-extern const DirFunctions  __PHYSFS_DirFunctions_DIR;
+extern const PHYSFS_Archiver  __PHYSFS_Archiver_DIR;
 
 
 static const PHYSFS_ArchiveInfo *supported_types[] =
@@ -136,37 +131,37 @@
     NULL
 };
 
-static const DirFunctions *dirFunctions[] =
+static const PHYSFS_Archiver *archivers[] =
 {
 #if (defined PHYSFS_SUPPORTS_ZIP)
-    &__PHYSFS_DirFunctions_ZIP,
+    &__PHYSFS_Archiver_ZIP,
 #endif
 
 #if (defined PHYSFS_SUPPORTS_GRP)
-    &__PHYSFS_DirFunctions_GRP,
+    &__PHYSFS_Archiver_GRP,
 #endif
 
 #if (defined PHYSFS_SUPPORTS_QPAK)
-    &__PHYSFS_DirFunctions_QPAK,
+    &__PHYSFS_Archiver_QPAK,
 #endif
 
 #if (defined PHYSFS_SUPPORTS_HOG)
-    &__PHYSFS_DirFunctions_HOG,
+    &__PHYSFS_Archiver_HOG,
 #endif
 
 #if (defined PHYSFS_SUPPORTS_MVL)
-    &__PHYSFS_DirFunctions_MVL,
+    &__PHYSFS_Archiver_MVL,
 #endif
 
 #if (defined PHYSFS_SUPPORTS_WAD)
-    &__PHYSFS_DirFunctions_WAD,
+    &__PHYSFS_Archiver_WAD,
 #endif
 
 #if (defined PHYSFS_SUPPORTS_MIX)
-    &__PHYSFS_DirFunctions_MIX,
+    &__PHYSFS_Archiver_MIX,
 #endif
 
-    &__PHYSFS_DirFunctions_DIR,
+    &__PHYSFS_Archiver_DIR,
     NULL
 };
 
@@ -175,10 +170,10 @@
 /* General PhysicsFS state ... */
 static int initialized = 0;
 static ErrMsg *errorMessages = NULL;
-static PhysDirInfo *searchPath = NULL;
-static PhysDirInfo *writeDir = NULL;
-static FileHandleList *openWriteList = NULL;
-static FileHandleList *openReadList = NULL;
+static DirHandle *searchPath = NULL;
+static DirHandle *writeDir = NULL;
+static FileHandle *openWriteList = NULL;
+static FileHandle *openReadList = NULL;
 static char *baseDir = NULL;
 static char *userDir = NULL;
 static int allowSymLinks = 0;
@@ -189,7 +184,7 @@
 
 /* allocator ... */
 static int externalAllocator = 0;
-static PHYSFS_allocator allocator;
+static PHYSFS_Allocator allocator;
 
 
 /* functions ... */
@@ -545,20 +540,22 @@
 } /* find_filename_extension */
 
 
-static DirHandle *tryOpenDir(const DirFunctions *f, const char *d, int fw)
+static DirHandle *tryOpenDir(const PHYSFS_Archiver *funcs,
+                             const char *d, int forWriting)
 {
     DirHandle *retval = NULL;
-    if (f->isArchive(d, fw))  /* fw == "for writing" */
+    if (funcs->isArchive(d, forWriting))
     {
-        void *opaque = f->openArchive(d, fw);
+        void *opaque = funcs->openArchive(d, forWriting);
         if (opaque != NULL)
         {
             retval = (DirHandle *) allocator.malloc(sizeof (DirHandle));
             if (retval == NULL)
-                f->dirClose(opaque);
+                funcs->dirClose(opaque);
             else
             {
-                retval->funcs = f;
+                memset(retval, '\0', sizeof (DirHandle));
+                retval->funcs = funcs;
                 retval->opaque = opaque;
             } /* else */
         } /* if */
@@ -571,7 +568,7 @@
 static DirHandle *openDirectory(const char *d, int forWriting)
 {
     DirHandle *retval = NULL;
-    const DirFunctions **i;
+    const PHYSFS_Archiver **i;
     const char *ext;
 
     BAIL_IF_MACRO(!__PHYSFS_platformExists(d), ERR_NO_SUCH_FILE, NULL);
@@ -580,14 +577,14 @@
     if (ext != NULL)
     {
         /* Look for archivers with matching file extensions first... */
-        for (i = dirFunctions; (*i != NULL) && (retval == NULL); i++)
+        for (i = archivers; (*i != NULL) && (retval == NULL); i++)
         {
             if (__PHYSFS_platformStricmp(ext, (*i)->info->extension) == 0)
                 retval = tryOpenDir(*i, d, forWriting);
         } /* for */
 
         /* failing an exact file extension match, try all the others... */
-        for (i = dirFunctions; (*i != NULL) && (retval == NULL); i++)
+        for (i = archivers; (*i != NULL) && (retval == NULL); i++)
         {
             if (__PHYSFS_platformStricmp(ext, (*i)->info->extension) != 0)
                 retval = tryOpenDir(*i, d, forWriting);
@@ -596,7 +593,7 @@
 
     else  /* no extension? Try them all. */
     {
-        for (i = dirFunctions; (*i != NULL) && (retval == NULL); i++)
+        for (i = archivers; (*i != NULL) && (retval == NULL); i++)
             retval = tryOpenDir(*i, d, forWriting);
     } /* else */
 
@@ -605,61 +602,44 @@
 } /* openDirectory */
 
 
-static PhysDirInfo *buildDirInfo(const char *newDir, int forWriting)
+static DirHandle *createDirHandle(const char *newDir, int forWriting)
 {
     DirHandle *dirHandle = NULL;
-    PhysDirInfo *di = NULL;
 
-    BAIL_IF_MACRO(newDir == NULL, ERR_INVALID_ARGUMENT, 0);
+    BAIL_IF_MACRO(newDir == NULL, ERR_INVALID_ARGUMENT, NULL);
 
     dirHandle = openDirectory(newDir, forWriting);
-    BAIL_IF_MACRO(dirHandle == NULL, NULL, 0);
+    BAIL_IF_MACRO(dirHandle == NULL, NULL, NULL);
 
-    /* !!! FIXME: get rid of this allocation */
-    di = (PhysDirInfo *) malloc(sizeof (PhysDirInfo));
-    if (di == NULL)
+    dirHandle->dirName = (char *) malloc(strlen(newDir) + 1);
+    if (dirHandle->dirName == NULL)
     {
         dirHandle->funcs->dirClose(dirHandle->opaque);
         free(dirHandle);
-        BAIL_IF_MACRO(di == NULL, ERR_OUT_OF_MEMORY, 0);
+        BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
     } /* if */
 
-    di->dirName = (char *) malloc(strlen(newDir) + 1);
-    if (di->dirName == NULL)
-    {
-        free(di);
-        dirHandle->funcs->dirClose(dirHandle->opaque);
-        free(dirHandle);
-        BAIL_MACRO(ERR_OUT_OF_MEMORY, 0);
-    } /* if */
-
-    di->next = NULL;
-    di->dirHandle = dirHandle;
-    strcpy(di->dirName, newDir);
-    return(di);
-} /* buildDirInfo */
+    strcpy(dirHandle->dirName, newDir);
+    return(dirHandle);
+} /* createDirHandle */
 
 
 /* MAKE SURE you've got the stateLock held before calling this! */
-static int freeDirInfo(PhysDirInfo *di, FileHandleList *openList)
+static int freeDirHandle(DirHandle *dh, FileHandle *openList)
 {
-    FileHandleList *i;
+    FileHandle *i;
 
-    if (di == NULL)
+    if (dh == NULL)
         return(1);
 
     for (i = openList; i != NULL; i = i->next)
-    {
-        const DirHandle *h = ((FileHandle *) &(i->handle.opaque))->dirHandle;
-        BAIL_IF_MACRO(h == di->dirHandle, ERR_FILES_STILL_OPEN, 0);
-    } /* for */
+        BAIL_IF_MACRO(i->dirHandle == dh, ERR_FILES_STILL_OPEN, 0);
     
-    di->dirHandle->funcs->dirClose(di->dirHandle->opaque);
-    free(di->dirHandle);
-    free(di->dirName);
-    free(di);
+    dh->funcs->dirClose(dh->opaque);
+    free(dh->dirName);
+    free(dh);
     return(1);
-} /* freeDirInfo */
+} /* freeDirHandle */
 
 
 static char *calculateUserDir(void)
@@ -752,9 +732,8 @@
      * Last ditch effort: it's the current working directory. (*shrug*)
      */
     retval = __PHYSFS_platformCurrentDir();
-    if(retval != NULL) {
-    return(retval);
-    }
+    if (retval != NULL)
+        return(retval);
 
     /*
      * Ok, current directory doesn't exist, use the root directory.
@@ -855,17 +834,16 @@
 
 
 /* MAKE SURE you hold stateLock before calling this! */
-static int closeFileHandleList(FileHandleList **list)
+static int closeFileHandleList(FileHandle **list)
 {
-    FileHandleList *i;
-    FileHandleList *next = NULL;
+    FileHandle *i;
+    FileHandle *next = NULL;
     FileHandle *h;
 
     for (i = *list; i != NULL; i = next)
     {
         next = i->next;
-        h = (FileHandle *) (i->handle.opaque);
-        if (!h->funcs->fileClose(h))
+        if (!i->funcs->fileClose(i->opaque))
         {
             *list = i;
             return(0);
@@ -882,8 +860,8 @@
 /* MAKE SURE you hold the stateLock before calling this! */
 static void freeSearchPath(void)
 {
-    PhysDirInfo *i;
-    PhysDirInfo *next = NULL;
+    DirHandle *i;
+    DirHandle *next = NULL;
 
     closeFileHandleList(&openReadList);
 
@@ -892,7 +870,7 @@
         for (i = searchPath; i != NULL; i = next)
         {
             next = i->next;
-            freeDirInfo(i, openReadList);
+            freeDirHandle(i, openReadList);
         } /* for */
         searchPath = NULL;
     } /* if */
@@ -996,14 +974,14 @@
 
     if (writeDir != NULL)
     {
-        BAIL_IF_MACRO_MUTEX(!freeDirInfo(writeDir, openWriteList), NULL, 
+        BAIL_IF_MACRO_MUTEX(!freeDirHandle(writeDir, openWriteList), NULL,
                             stateLock, 0);
         writeDir = NULL;
     } /* if */
 
     if (newDir != NULL)
     {
-        writeDir = buildDirInfo(newDir, 1);
+        writeDir = createDirHandle(newDir, 1);
         retval = (writeDir != NULL);
     } /* if */
 
@@ -1015,9 +993,9 @@
 
 int PHYSFS_addToSearchPath(const char *newDir, int appendToPath)
 {
-    PhysDirInfo *di;
-    PhysDirInfo *prev = NULL;
-    PhysDirInfo *i;
+    DirHandle *dh;
+    DirHandle *prev = NULL;
+    DirHandle *i;
 
     __PHYSFS_platformGrabMutex(stateLock);
 
@@ -1028,21 +1006,20 @@
         prev = i;
     } /* for */
 
-    di = buildDirInfo(newDir, 0);
-    BAIL_IF_MACRO_MUTEX(di == NULL, NULL, stateLock, 0);
+    dh = createDirHandle(newDir, 0);
+    BAIL_IF_MACRO_MUTEX(dh == NULL, NULL, stateLock, 0);
 
     if (appendToPath)
     {
-        di->next = NULL;
         if (prev == NULL)
-            searchPath = di;
+            searchPath = dh;
         else
-            prev->next = di;
+            prev->next = dh;
     } /* if */
     else
     {
-        di->next = searchPath;
-        searchPath = di;
+        dh->next = searchPath;
+        searchPath = dh;
     } /* else */
 
     __PHYSFS_platformReleaseMutex(stateLock);
@@ -1052,9 +1029,9 @@
 
 int PHYSFS_removeFromSearchPath(const char *oldDir)
 {
-    PhysDirInfo *i;
-    PhysDirInfo *prev = NULL;
-    PhysDirInfo *next = NULL;
+    DirHandle *i;
+    DirHandle *prev = NULL;
+    DirHandle *next = NULL;
 
     BAIL_IF_MACRO(oldDir == NULL, ERR_INVALID_ARGUMENT, 0);
 
@@ -1064,7 +1041,7 @@
         if (strcmp(i->dirName, oldDir) == 0)
         {
             next = i->next;
-            BAIL_IF_MACRO_MUTEX(!freeDirInfo(i, openReadList), NULL,
+            BAIL_IF_MACRO_MUTEX(!freeDirHandle(i, openReadList), NULL,
                                 stateLock, 0);
 
             if (prev == NULL)
@@ -1085,7 +1062,7 @@
 {
     int count = 1;
     int x;
-    PhysDirInfo *i;
+    DirHandle *i;
     char **retval;
 
     __PHYSFS_platformGrabMutex(stateLock);
@@ -1151,7 +1128,7 @@
         } /* if */
         else
         {
-                no_write = 1;
+            no_write = 1;
         } /* else */
 
         if (no_write)
@@ -1385,7 +1362,7 @@
 
     __PHYSFS_platformGrabMutex(stateLock);
     BAIL_IF_MACRO_MUTEX(writeDir == NULL, ERR_NO_WRITE_DIR, stateLock, 0);
-    h = writeDir->dirHandle;
+    h = writeDir;
     BAIL_IF_MACRO_MUTEX(!__PHYSFS_verifySecurity(h,dname,1),NULL,stateLock,0);
     start = str = malloc(strlen(dname) + 1);
     BAIL_IF_MACRO_MUTEX(str == NULL, ERR_OUT_OF_MEMORY, stateLock, 0);
@@ -1433,7 +1410,7 @@
     __PHYSFS_platformGrabMutex(stateLock);
 
     BAIL_IF_MACRO_MUTEX(writeDir == NULL, ERR_NO_WRITE_DIR, stateLock, 0);
-    h = writeDir->dirHandle;
+    h = writeDir;
     BAIL_IF_MACRO_MUTEX(!__PHYSFS_verifySecurity(h,fname,0),NULL,stateLock,0);
     retval = h->funcs->remove(h->opaque, fname);
 
@@ -1444,7 +1421,7 @@
 
 const char *PHYSFS_getRealDir(const char *filename)
 {
-    PhysDirInfo *i;
+    DirHandle *i;
     const char *retval = NULL;
 
     while (*filename == '/')
@@ -1453,10 +1430,9 @@
     __PHYSFS_platformGrabMutex(stateLock);
     for (i = searchPath; ((i != NULL) && (retval == NULL)); i = i->next)
     {
-        DirHandle *h = i->dirHandle;
-        if (__PHYSFS_verifySecurity(h, filename, 0))
+        if (__PHYSFS_verifySecurity(i, filename, 0))
         {
-            if (h->funcs->exists(h->opaque, filename))
+            if (i->funcs->exists(i->opaque, filename))
                 retval = i->dirName;
         } /* if */
     } /* for */
@@ -1557,7 +1533,7 @@
 
 char **PHYSFS_enumerateFiles(const char *path)
 {
-    PhysDirInfo *i;
+    DirHandle *i;
     char **retval = NULL;
     LinkedStringList *rc;
     LinkedStringList *finalList = NULL;
@@ -1570,10 +1546,9 @@
     __PHYSFS_platformGrabMutex(stateLock);
     for (i = searchPath; i != NULL; i = i->next)
     {
-        DirHandle *h = i->dirHandle;
-        if (__PHYSFS_verifySecurity(h, path, 0))
+        if (__PHYSFS_verifySecurity(i, path, 0))
         {
-            rc = h->funcs->enumerateFiles(h->opaque, path, omitSymLinks);
+            rc = i->funcs->enumerateFiles(i->opaque, path, omitSymLinks);
             interpolateStringLists(&finalList, rc);
         } /* if */
     } /* for */
@@ -1596,7 +1571,7 @@
 
 PHYSFS_sint64 PHYSFS_getLastModTime(const char *fname)
 {
-    PhysDirInfo *i;
+    DirHandle *i;
     PHYSFS_sint64 retval = -1;
     int fileExists = 0;
 
@@ -1610,9 +1585,8 @@
     __PHYSFS_platformGrabMutex(stateLock);
     for (i = searchPath; ((i != NULL) && (!fileExists)); i = i->next)
     {
-        DirHandle *h = i->dirHandle;
-        if (__PHYSFS_verifySecurity(h, fname, 0))
-            retval = h->funcs->getLastModTime(h->opaque, fname, &fileExists);
+        if (__PHYSFS_verifySecurity(i, fname, 0))
+            retval = i->funcs->getLastModTime(i->opaque, fname, &fileExists);
     } /* for */
     __PHYSFS_platformReleaseMutex(stateLock);
 
@@ -1622,7 +1596,7 @@
 
 int PHYSFS_isDirectory(const char *fname)
 {
-    PhysDirInfo *i;
+    DirHandle *i;
     int retval = 0;
     int fileExists = 0;
 
@@ -1635,9 +1609,8 @@
     __PHYSFS_platformGrabMutex(stateLock);
     for (i = searchPath; ((i != NULL) && (!fileExists)); i = i->next)
     {
-        DirHandle *h = i->dirHandle;
-        if (__PHYSFS_verifySecurity(h, fname, 0))
-            retval = h->funcs->isDirectory(h->opaque, fname, &fileExists);
+        if (__PHYSFS_verifySecurity(i, fname, 0))
+            retval = i->funcs->isDirectory(i->opaque, fname, &fileExists);
     } /* for */
     __PHYSFS_platformReleaseMutex(stateLock);
 
@@ -1647,7 +1620,7 @@
 
 int PHYSFS_isSymbolicLink(const char *fname)
 {
-    PhysDirInfo *i;
+    DirHandle *i;
     int retval = 0;
     int fileExists = 0;
 
@@ -1662,9 +1635,8 @@
     __PHYSFS_platformGrabMutex(stateLock);
     for (i = searchPath; ((i != NULL) && (!fileExists)); i = i->next)
     {
-        DirHandle *h = i->dirHandle;
-        if (__PHYSFS_verifySecurity(h, fname, 0))
-            retval = h->funcs->isSymLink(h->opaque, fname, &fileExists);
+        if (__PHYSFS_verifySecurity(i, fname, 0))
+            retval = i->funcs->isSymLink(i->opaque, fname, &fileExists);
     } /* for */
     __PHYSFS_platformReleaseMutex(stateLock);
 
@@ -1674,47 +1646,48 @@
 
 static PHYSFS_file *doOpenWrite(const char *fname, int appending)
 {
-    PHYSFS_file *retval = NULL;
-    FileHandle *rc = NULL;
-    DirHandle *h;
-    const DirFunctions *f;
-    FileHandleList *list;
+    void *opaque = NULL;
+    FileHandle *fh = NULL;
+    DirHandle *h = NULL;
+    const PHYSFS_Archiver *f;
 
     BAIL_IF_MACRO(fname == NULL, ERR_INVALID_ARGUMENT, NULL);
     while (*fname == '/')
         fname++;
 
     __PHYSFS_platformGrabMutex(stateLock);
-    h = (writeDir == NULL) ? NULL : writeDir->dirHandle;
-    BAIL_IF_MACRO_MUTEX(!h, ERR_NO_WRITE_DIR, stateLock, NULL);
+    BAIL_IF_MACRO_MUTEX(!writeDir, ERR_NO_WRITE_DIR, stateLock, NULL);
+
+    h = writeDir;
     BAIL_IF_MACRO_MUTEX(!__PHYSFS_verifySecurity(h, fname, 0), NULL,
                         stateLock, NULL);
 
-    list = (FileHandleList *) malloc(sizeof (FileHandleList));
-    BAIL_IF_MACRO_MUTEX(!list, ERR_OUT_OF_MEMORY, stateLock, NULL);
-
     f = h->funcs;
     if (appending)
-        rc = f->openAppend(h->opaque, fname);
+        opaque = f->openAppend(h->opaque, fname);
     else
-        rc = f->openWrite(h->opaque, fname);
+        opaque = f->openWrite(h->opaque, fname);
+
+    BAIL_IF_MACRO_MUTEX(opaque == NULL, NULL, stateLock, NULL);
 
-    if (rc == NULL)
-        free(list);
+    fh = (FileHandle *) malloc(sizeof (FileHandle));
+    if (fh == NULL)
+    {
+        f->fileClose(opaque);
+        BAIL_MACRO_MUTEX(ERR_OUT_OF_MEMORY, stateLock, NULL);
+    } /* if */
     else
     {
-        rc->dirHandle = h;
-        rc->buffer = NULL;  /* just in case. */
-        rc->buffill = rc->bufpos = rc->bufsize = 0;  /* just in case. */
-        rc->forReading = 0;
-        list->handle.opaque = (void *) rc;
-        list->next = openWriteList;
-        openWriteList = list;
-        retval = &(list->handle);
+        memset(fh, '\0', sizeof (FileHandle));
+        fh->opaque = opaque;
+        fh->dirHandle = h;
+        fh->funcs = h->funcs;
+        fh->next = openWriteList;
+        openWriteList = fh;
     } /* else */
 
     __PHYSFS_platformReleaseMutex(stateLock);
-    return(retval);
+    return((PHYSFS_file *) fh);
 } /* doOpenWrite */
 
 
@@ -1732,12 +1705,10 @@
 
 PHYSFS_file *PHYSFS_openRead(const char *fname)
 {
-    PHYSFS_file *retval = NULL;
-    FileHandle *rc = NULL;
-    FileHandleList *list;
-    DirHandle *h = NULL;
+    FileHandle *fh = NULL;
     int fileExists = 0;
-    PhysDirInfo *i = NULL;
+    DirHandle *i = NULL;
+    fvoid *opaque = NULL;
 
     BAIL_IF_MACRO(fname == NULL, ERR_INVALID_ARGUMENT, NULL);
     while (*fname == '/')
@@ -1745,47 +1716,56 @@
 
     __PHYSFS_platformGrabMutex(stateLock);
     BAIL_IF_MACRO_MUTEX(!searchPath, ERR_NOT_IN_SEARCH_PATH, stateLock, NULL);
-    for (i = searchPath; ((i != NULL) && (!fileExists)); i = i->next)
+
+    i = searchPath;
+
+    do
     {
-        h = i->dirHandle;
-        if (__PHYSFS_verifySecurity(h, fname, 0))
-            rc = h->funcs->openRead(h->opaque, fname, &fileExists);
-    } /* for */
-    BAIL_IF_MACRO_MUTEX(rc == NULL, NULL, stateLock, NULL);
+        if (__PHYSFS_verifySecurity(i, fname, 0))
+        {
+            opaque = i->funcs->openRead(i->opaque, fname, &fileExists);
+            if (opaque)
+                break;
+        } /* if */
+        i = i->next;
+    } while ((i != NULL) && (!fileExists));
 
-    rc->dirHandle = h;
+    BAIL_IF_MACRO_MUTEX(opaque == NULL, NULL, stateLock, NULL);
 
-    list = (FileHandleList *) malloc(sizeof (FileHandleList));
-    BAIL_IF_MACRO_MUTEX(!list, ERR_OUT_OF_MEMORY, stateLock, NULL);
-    list->handle.opaque = (void *) rc;
-    list->next = openReadList;
-    openReadList = list;
-    retval = &(list->handle);
+    fh = (FileHandle *) malloc(sizeof (FileHandle));
+    if (fh == NULL)
+    {
+        i->funcs->fileClose(opaque);
+        BAIL_MACRO_MUTEX(ERR_OUT_OF_MEMORY, stateLock, NULL);
+    } /* if */
+
+    memset(fh, '\0', sizeof (FileHandle));
+    fh->opaque = opaque;
+    fh->forReading = 1;
+    fh->dirHandle = i;
+    fh->funcs = i->funcs;
+    fh->next = openReadList;
+    openReadList = fh;
     __PHYSFS_platformReleaseMutex(stateLock);
 
-    rc->buffer = NULL;  /* just in case. */
-    rc->buffill = rc->bufpos = rc->bufsize = 0;  /* just in case. */
-    rc->forReading = 1;
-
-    return(retval);
+    return((PHYSFS_file *) fh);
 } /* PHYSFS_openRead */
 
 
-static int closeHandleInOpenList(FileHandleList **list, PHYSFS_file *handle)
+static int closeHandleInOpenList(FileHandle **list, FileHandle *handle)
 {
-    FileHandle *h = (FileHandle *) handle->opaque;
-    FileHandleList *prev = NULL;
-    FileHandleList *i;
+    FileHandle *prev = NULL;
+    FileHandle *i;
     int rc = 1;
 
     for (i = *list; i != NULL; i = i->next)
     {
-        if (&i->handle == handle)  /* handle is in this list? */
+        if (i == handle)  /* handle is in this list? */
         {
-            PHYSFS_uint8 *tmp = h->buffer;
-            rc = PHYSFS_flush(handle);
+            PHYSFS_uint8 *tmp = handle->buffer;
+            rc = PHYSFS_flush((PHYSFS_file *) handle);
             if (rc)
-                rc = h->funcs->fileClose(h);
+                rc = handle->funcs->fileClose(handle->opaque);
             if (!rc)
                 return(-1);
 
@@ -1793,11 +1773,11 @@
                 free(tmp);
 
             if (prev == NULL)
-                *list = i->next;
+                *list = handle->next;
             else
-                prev->next = i->next;
+                prev->next = handle->next;
 
-            free(i);
+            free(handle);
             return(1);
         } /* if */
         prev = i;
@@ -1807,8 +1787,9 @@
 } /* closeHandleInOpenList */
 
 
-int PHYSFS_close(PHYSFS_file *handle)
+int PHYSFS_close(PHYSFS_file *_handle)
 {
+    FileHandle *handle = (FileHandle *) _handle;
     int rc;
 
     __PHYSFS_platformGrabMutex(stateLock);
@@ -1828,39 +1809,39 @@
 } /* PHYSFS_close */
 
 
-static PHYSFS_sint64 doBufferedRead(PHYSFS_file *handle, void *buffer,
+static PHYSFS_sint64 doBufferedRead(FileHandle *fh, void *buffer,
                                     PHYSFS_uint32 objSize,
                                     PHYSFS_uint32 objCount)
 {
-    FileHandle *h = (FileHandle *) handle->opaque;
     PHYSFS_sint64 retval = 0;
     PHYSFS_uint32 remainder = 0;
 
     while (objCount > 0)
     {
-        PHYSFS_uint32 buffered = h->buffill - h->bufpos;
+        PHYSFS_uint32 buffered = fh->buffill - fh->bufpos;
         PHYSFS_uint64 mustread = (objSize * objCount) - remainder;
         PHYSFS_uint32 copied;
 
         if (buffered == 0) /* need to refill buffer? */
         {
-            PHYSFS_sint64 rc = h->funcs->read(h, h->buffer, 1, h->bufsize);
+            PHYSFS_sint64 rc = fh->funcs->read(fh->opaque, fh->buffer,
+                                                1, fh->bufsize);
             if (rc <= 0)
             {
-                h->bufpos -= remainder;
+                fh->bufpos -= remainder;
                 return(((rc == -1) && (retval == 0)) ? -1 : retval);
             } /* if */
 
-            buffered = h->buffill = (PHYSFS_uint32) rc;
-            h->bufpos = 0;
+            buffered = fh->buffill = (PHYSFS_uint32) rc;
+            fh->bufpos = 0;
         } /* if */
 
         if (buffered > mustread)
             buffered = (PHYSFS_uint32) mustread;
 
-        memcpy(buffer, h->buffer + h->bufpos, (size_t) buffered);
+        memcpy(buffer, fh->buffer + fh->bufpos, (size_t) buffered);
         buffer = ((PHYSFS_uint8 *) buffer) + buffered;
-        h->bufpos += buffered;
+        fh->bufpos += buffered;
         buffered += remainder;  /* take remainder into account. */
         copied = (buffered / objSize);
         remainder = (buffered % objSize);
@@ -1875,13 +1856,13 @@
 PHYSFS_sint64 PHYSFS_read(PHYSFS_file *handle, void *buffer,
                           PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
-    FileHandle *h = (FileHandle *) handle->opaque;
+    FileHandle *fh = (FileHandle *) handle;
 
-    BAIL_IF_MACRO(!h->forReading, ERR_FILE_ALREADY_OPEN_W, -1);
-    if (h->buffer != NULL)
-        return(doBufferedRead(handle, buffer, objSize, objCount));
+    BAIL_IF_MACRO(!fh->forReading, ERR_FILE_ALREADY_OPEN_W, -1);
+    if (fh->buffer != NULL)
+        return(doBufferedRead(fh, buffer, objSize, objCount));
 
-    return(h->funcs->read(h, buffer, objSize, objCount));
+    return(fh->funcs->read(fh->opaque, buffer, objSize, objCount));
 } /* PHYSFS_read */
 
 
@@ -1889,94 +1870,97 @@
                                      PHYSFS_uint32 objSize,
                                      PHYSFS_uint32 objCount)
 {
-    FileHandle *h = (FileHandle *) handle->opaque;
-
+    FileHandle *fh = (FileHandle *) handle;
+    
     /* whole thing fits in the buffer? */
-    if (h->buffill + (objSize * objCount) < h->bufsize)
+    if (fh->buffill + (objSize * objCount) < fh->bufsize)
     {
-        memcpy(h->buffer + h->buffill, buffer, objSize * objCount);
-        h->buffill += (objSize * objCount);
+        memcpy(fh->buffer + fh->buffill, buffer, objSize * objCount);
+        fh->buffill += (objSize * objCount);
         return(objCount);
     } /* if */
 
     /* would overflow buffer. Flush and then write the new objects, too. */
     BAIL_IF_MACRO(!PHYSFS_flush(handle), NULL, -1);
-    return(h->funcs->write(h, buffer, objSize, objCount));
+    return(fh->funcs->write(fh->opaque, buffer, objSize, objCount));
 } /* doBufferedWrite */
 
 
 PHYSFS_sint64 PHYSFS_write(PHYSFS_file *handle, const void *buffer,
                            PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
 {
-    FileHandle *h = (FileHandle *) handle->opaque;
+    FileHandle *fh = (FileHandle *) handle;
 
-    BAIL_IF_MACRO(h->forReading, ERR_FILE_ALREADY_OPEN_R, -1);
-    if (h->buffer != NULL)
+    BAIL_IF_MACRO(fh->forReading, ERR_FILE_ALREADY_OPEN_R, -1);
+    if (fh->buffer != NULL)
         return(doBufferedWrite(handle, buffer, objSize, objCount));
 
-    return(h->funcs->write(h, buffer, objSize, objCount));
+    return(fh->funcs->write(fh->opaque, buffer, objSize, objCount));
 } /* PHYSFS_write */
 
 
 int PHYSFS_eof(PHYSFS_file *handle)
 {
-    FileHandle *h = (FileHandle *) handle->opaque;
+    FileHandle *fh = (FileHandle *) handle;
 
-    if (!h->forReading)  /* never EOF on files opened for write/append. */
+    if (!fh->forReading)  /* never EOF on files opened for write/append. */
         return(0);
 
     /* eof if buffer is empty and archiver says so. */
-    return((h->bufpos == h->buffill) && (h->funcs->eof(h)));
+    return((fh->bufpos == fh->buffill) && (fh->funcs->eof(fh->opaque)));
 } /* PHYSFS_eof */
 
 
 PHYSFS_sint64 PHYSFS_tell(PHYSFS_file *handle)
 {
-    FileHandle *h = (FileHandle *) handle->opaque;
-    PHYSFS_sint64 retval = h->forReading ?
-                            (h->funcs->tell(h) - h->buffill) + h->bufpos :
-                            (h->funcs->tell(h) + h->buffill);
+    FileHandle *fh = (FileHandle *) handle;
+    PHYSFS_sint64 pos = fh->funcs->tell(fh->opaque);
+    PHYSFS_sint64 retval = fh->forReading ?
+                            (pos - fh->buffill) + fh->bufpos :
+                            (pos + fh->buffill);
     return(retval);
 } /* PHYSFS_tell */
 
 
 int PHYSFS_seek(PHYSFS_file *handle, PHYSFS_uint64 pos)
 {
-    FileHandle *h = (FileHandle *) handle->opaque;
+    FileHandle *fh = (FileHandle *) handle;
     BAIL_IF_MACRO(!PHYSFS_flush(handle), NULL, 0);
 
-    if (h->buffer && h->forReading)
+    if (fh->buffer && fh->forReading)
     {
         /* avoid throwing away our precious buffer if seeking within it. */
         PHYSFS_sint64 offset = pos - PHYSFS_tell(handle);
         if ( /* seeking within the already-buffered range? */
-            ((offset >= 0) && (offset <= h->buffill - h->bufpos)) /* forwards */
-            || ((offset < 0) && (-offset <= h->bufpos)) /* backwards */ )
+            ((offset >= 0) && (offset <= fh->buffill - fh->bufpos)) /* fwd */
+            || ((offset < 0) && (-offset <= fh->bufpos)) /* backward */ )
         {
-            h->bufpos += offset;
+            fh->bufpos += offset;
             return(1); /* successful seek */
         } /* if */
     } /* if */
 
     /* we have to fall back to a 'raw' seek. */
-    h->buffill = h->bufpos = 0;
-    return(h->funcs->seek(h, pos));
+    fh->buffill = fh->bufpos = 0;
+    return(fh->funcs->seek(fh->opaque, pos));
 } /* PHYSFS_seek */
 
 
 PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_file *handle)
 {
-    FileHandle *h = (FileHandle *) handle->opaque;
-    return(h->funcs->fileLength(h));
+    FileHandle *fh = (FileHandle *) handle;
+    return(fh->funcs->fileLength(fh->opaque));
 } /* PHYSFS_filelength */
 
 
 int PHYSFS_setBuffer(PHYSFS_file *handle, PHYSFS_uint64 _bufsize)
 {
-    FileHandle *h = (FileHandle *) handle->opaque;
-    PHYSFS_uint32 bufsize = (PHYSFS_uint32) _bufsize;
+    FileHandle *fh = (FileHandle *) handle;
+    PHYSFS_uint32 bufsize;
 
     BAIL_IF_MACRO(_bufsize > 0xFFFFFFFF, "buffer must fit in 32-bits", 0);
+    bufsize = (PHYSFS_uint32) _bufsize;
+
     BAIL_IF_MACRO(!PHYSFS_flush(handle), NULL, 0);
 
     /*
@@ -1984,49 +1968,50 @@
      *  if we weren't buffering, so that the next read will get the
      *  right chunk of stuff from the file. PHYSFS_flush() handles writes.
      */
-    if ((h->forReading) && (h->buffill != h->bufpos))
+    if ((fh->forReading) && (fh->buffill != fh->bufpos))
     {
         PHYSFS_uint64 pos;
-        PHYSFS_sint64 curpos = h->funcs->tell(h);
+        PHYSFS_sint64 curpos = fh->funcs->tell(fh->opaque);
         BAIL_IF_MACRO(curpos == -1, NULL, 0);
-        pos = ((curpos - h->buffill) + h->bufpos);
-        BAIL_IF_MACRO(!h->funcs->seek(h, pos), NULL, 0);
+        pos = ((curpos - fh->buffill) + fh->bufpos);
+        BAIL_IF_MACRO(!fh->funcs->seek(fh->opaque, pos), NULL, 0);
     } /* if */
 
     if (bufsize == 0)  /* delete existing buffer. */
     {
-        if (h->buffer != NULL)
+        if (fh->buffer != NULL)
         {
-            free(h->buffer);
-            h->buffer = NULL;
+            free(fh->buffer);
+            fh->buffer = NULL;
         } /* if */
     } /* if */
 
     else
     {
-        PHYSFS_uint8 *newbuf = realloc(h->buffer, bufsize);
+        PHYSFS_uint8 *newbuf = realloc(fh->buffer, bufsize);
         BAIL_IF_MACRO(newbuf == NULL, ERR_OUT_OF_MEMORY, 0);
-        h->buffer = newbuf;
+        fh->buffer = newbuf;
     } /* else */
 
-    h->bufsize = bufsize;
-    h->buffill = h->bufpos = 0;
+    fh->bufsize = bufsize;
+    fh->buffill = fh->bufpos = 0;
     return(1);
 } /* PHYSFS_setBuffer */
 
 
 int PHYSFS_flush(PHYSFS_file *handle)
 {
-    FileHandle *h = (FileHandle *) handle->opaque;
+    FileHandle *fh = (FileHandle *) handle;
     PHYSFS_sint64 rc;
 
-    if ((h->forReading) || (h->bufpos == h->buffill))
+    if ((fh->forReading) || (fh->bufpos == fh->buffill))
         return(1);  /* open for read or buffer empty are successful no-ops. */
 
     /* dump buffer to disk. */
-    rc = h->funcs->write(h, h->buffer + h->bufpos, h->buffill - h->bufpos, 1);
+    rc = fh->funcs->write(fh->opaque, fh->buffer + fh->bufpos,
+                          fh->buffill - fh->bufpos, 1);
     BAIL_IF_MACRO(rc <= 0, NULL, 0);
-    h->bufpos = h->buffill = 0;
+    fh->bufpos = fh->buffill = 0;
     return(1);
 } /* PHYSFS_flush */
 
@@ -2065,12 +2050,12 @@
 } /* __PHYSFS_addToLinkedStringList */
 
 
-int PHYSFS_setAllocator(PHYSFS_allocator *a)
+int PHYSFS_setAllocator(PHYSFS_Allocator *a)
 {
     BAIL_IF_MACRO(initialized, ERR_IS_INITIALIZED, 0);
     externalAllocator = (a != NULL);
     if (externalAllocator)
-        memcpy(&allocator, a, sizeof (PHYSFS_allocator));
+        memcpy(&allocator, a, sizeof (PHYSFS_Allocator));
 
     return(1);
 } /* PHYSFS_setAllocator */
@@ -2087,7 +2072,7 @@
 } /* setDefaultAllocator */
 
 
-PHYSFS_allocator *__PHYSFS_getAllocator(void)
+PHYSFS_Allocator *__PHYSFS_getAllocator(void)
 {
     return(&allocator);
 } /* __PHYFS_getAllocator */
--- a/physfs.h	Sun Sep 26 12:56:23 2004 +0000
+++ b/physfs.h	Sun Sep 26 13:00:59 2004 +0000
@@ -1842,11 +1842,11 @@
     void *(*malloc)(size_t);
     void *(*realloc)(void *, size_t);
     void (*free)(void *);
-} PHYSFS_allocator;
+} PHYSFS_Allocator;
 
 
 /**
- * \fn int PHYSFS_setAllocator(PHYSFS_allocator *allocator)
+ * \fn int PHYSFS_setAllocator(PHYSFS_Allocator *allocator)
  * \brief Hook your own allocation routines into PhysicsFS.
  *
  * (This is for limited, hardcore use. If you don't immediately see a need
@@ -1870,7 +1870,7 @@
  *   \return zero on failure, non-zero on success. This call only fails
  *           when used between PHYSFS_init() and PHYSFS_deinit() calls.
  */
-__EXPORT__ int PHYSFS_setAllocator(PHYSFS_allocator *allocator);
+__EXPORT__ int PHYSFS_setAllocator(PHYSFS_Allocator *allocator);
 
 
 /* Everything above this line is part of the PhysicsFS 2.0 API. */
--- a/physfs_internal.h	Sun Sep 26 12:56:23 2004 +0000
+++ b/physfs_internal.h	Sun Sep 26 13:00:59 2004 +0000
@@ -931,112 +931,31 @@
 } LinkedStringList;
 
 
-typedef struct __PHYSFS_FILEHANDLE__
-{
-        /*
-         * This is reserved for the driver to store information.
-         */
-    void *opaque;
-
-        /*
-         * Non-zero if file opened for reading, zero if write/append.
-         */
-    PHYSFS_uint8 forReading;
-
-        /*
-         * This is the buffer, if one is set (NULL otherwise). Don't touch.
-         */
-    PHYSFS_uint8 *buffer;
-
-        /*
-         * This is the buffer size, if one is set (0 otherwise). Don't touch.
-         */
-    PHYSFS_uint32 bufsize;
-
-        /*
-         * This is the buffer fill size. Don't touch.
-         */
-    PHYSFS_uint32 buffill;
-
-        /*
-         * This is the buffer position. Don't touch.
-         */
-    PHYSFS_uint32 bufpos;
-
-        /*
-         * This should be the DirHandle that created this FileHandle.
-         */
-    const struct __PHYSFS_DIRHANDLE__ *dirHandle;
-
-        /*
-         * Pointer to the file i/o functions for this filehandle.
-         */
-    const struct __PHYSFS_FILEFUNCTIONS__ *funcs;
-} FileHandle;
+/* !!! FIXME: find something better than "dvoid" and "fvoid" ... */
+/* Opaque data for file and dir handlers... */
+typedef void dvoid;
+typedef void fvoid;
 
 
-typedef struct __PHYSFS_FILEFUNCTIONS__
+typedef struct
 {
         /*
-         * Read more from the file.
-         * Returns number of objects of (objSize) bytes read from file, -1
-         *  if complete failure.
-         * On failure, call __PHYSFS_setError().
-         */
-    PHYSFS_sint64 (*read)(FileHandle *handle, void *buffer,
-                          PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-
-        /*
-         * Write more to the file. Archives don't have to implement this.
-         *  (Set it to NULL if not implemented).
-         * Returns number of objects of (objSize) bytes written to file, -1
-         *  if complete failure.
-         * On failure, call __PHYSFS_setError().
-         */
-    PHYSFS_sint64 (*write)(FileHandle *handle, const void *buffer,
-                 PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
-
-        /*
-         * Returns non-zero if at end of file.
+         * Basic info about this archiver...
          */
-    int (*eof)(FileHandle *handle);
-
-        /*
-         * Returns byte offset from start of file.
-         */
-    PHYSFS_sint64 (*tell)(FileHandle *handle);
-
-        /*
-         * Move read/write pointer to byte offset from start of file.
-         *  Returns non-zero on success, zero on error.
-         * On failure, call __PHYSFS_setError().
-         */
-    int (*seek)(FileHandle *handle, PHYSFS_uint64 offset);
-
-        /*
-         * Return number of bytes available in the file, or -1 if you
-         *  aren't able to determine.
-         * On failure, call __PHYSFS_setError().
-         */
-    PHYSFS_sint64 (*fileLength)(FileHandle *handle);
-
-        /*
-         * Close the file, and free the FileHandle structure (including "opaque").
-         *  returns non-zero on success, zero if can't close file.
-         * On failure, call __PHYSFS_setError().
-         */
-    int (*fileClose)(FileHandle *handle);
-} FileFunctions;
+    const PHYSFS_ArchiveInfo *info;
 
 
-/*
- * Symlinks should always be followed; PhysicsFS will use
- *  DirFunctions->isSymLink() and make a judgement on whether to
- *  continue to call other methods based on that.
- */
-typedef struct __PHYSFS_DIRFUNCTIONS__
-{
-    const PHYSFS_ArchiveInfo *info;
+    /*
+     * DIRECTORY ROUTINES:
+     * These functions are for dir handles. Generate a handle with the
+     *  openArchive() method, then pass it as the "opaque" dvoid to the
+     *  others.
+     *
+     * Symlinks should always be followed; PhysicsFS will use the
+     *  isSymLink() method and make a judgement on whether to
+     *  continue to call other methods based on that.
+     */
+
 
         /*
          * Returns non-zero if (filename) is a valid archive that this
@@ -1067,7 +986,7 @@
          * If you have a memory failure, return as much as you can.
          *  This dirname is in platform-independent notation.
          */
-    LinkedStringList *(*enumerateFiles)(void *opaque,
+    LinkedStringList *(*enumerateFiles)(dvoid *opaque,
                                         const char *dirname,
                                         int omitSymLinks);
 
@@ -1077,7 +996,7 @@
          *  This filename is in platform-independent notation.
          *  You should not follow symlinks.
          */
-    int (*exists)(void *opaque, const char *name);
+    int (*exists)(dvoid *opaque, const char *name);
 
         /*
          * Returns non-zero if filename is really a directory.
@@ -1089,7 +1008,7 @@
          *  non-zero if the file existed (even if it's a broken symlink!),
          *  zero if it did not.
          */
-    int (*isDirectory)(void *opaque, const char *name, int *fileExists);
+    int (*isDirectory)(dvoid *opaque, const char *name, int *fileExists);
 
         /*
          * Returns non-zero if filename is really a symlink.
@@ -1099,7 +1018,7 @@
          *  non-zero if the file existed (even if it's a broken symlink!),
          *  zero if it did not.
          */
-    int (*isSymLink)(void *opaque, const char *name, int *fileExists);
+    int (*isSymLink)(dvoid *opaque, const char *name, int *fileExists);
 
         /*
          * Retrieve the last modification time (mtime) of a file.
@@ -1111,46 +1030,50 @@
          *  non-zero if the file existed (even if it's a broken symlink!),
          *  zero if it did not.
          */
-    PHYSFS_sint64 (*getLastModTime)(void *opaque, const char *fnm, int *exist);
+    PHYSFS_sint64 (*getLastModTime)(dvoid *opaque, const char *fnm, int *exist);
 
         /*
-         * Open file for reading, and return a FileHandle.
+         * Open file for reading.
          *  This filename is in platform-independent notation.
          * If you can't handle multiple opens of the same file,
          *  you can opt to fail for the second call.
          * Fail if the file does not exist.
          * Returns NULL on failure, and calls __PHYSFS_setError().
+         *  Returns non-NULL on success. The pointer returned will be
+         *  passed as the "opaque" parameter for later file calls.
          *
          * Regardless of success or failure, please set *fileExists to
          *  non-zero if the file existed (even if it's a broken symlink!),
          *  zero if it did not.
          */
-    FileHandle *(*openRead)(void *opaque, const char *fname, int *fileExists);
+    fvoid *(*openRead)(dvoid *opaque, const char *fname, int *fileExists);
 
         /*
-         * Open file for writing, and return a FileHandle.
+         * Open file for writing.
          * If the file does not exist, it should be created. If it exists,
          *  it should be truncated to zero bytes. The writing
          *  offset should be the start of the file.
          * This filename is in platform-independent notation.
-         *  This method may be NULL.
          * If you can't handle multiple opens of the same file,
          *  you can opt to fail for the second call.
          * Returns NULL on failure, and calls __PHYSFS_setError().
+         *  Returns non-NULL on success. The pointer returned will be
+         *  passed as the "opaque" parameter for later file calls.
          */
-    FileHandle *(*openWrite)(void *opaque, const char *filename);
+    fvoid *(*openWrite)(dvoid *opaque, const char *filename);
 
         /*
-         * Open file for appending, and return a FileHandle.
+         * Open file for appending.
          * If the file does not exist, it should be created. The writing
          *  offset should be the end of the file.
          * This filename is in platform-independent notation.
-         *  This method may be NULL.
          * If you can't handle multiple opens of the same file,
          *  you can opt to fail for the second call.
          * Returns NULL on failure, and calls __PHYSFS_setError().
+         *  Returns non-NULL on success. The pointer returned will be
+         *  passed as the "opaque" parameter for later file calls.
          */
-    FileHandle *(*openAppend)(void *opaque, const char *filename);
+    fvoid *(*openAppend)(dvoid *opaque, const char *filename);
 
         /*
          * Delete a file in the archive/directory.
@@ -1159,7 +1082,7 @@
          *  This method may be NULL.
          * On failure, call __PHYSFS_setError().
          */
-    int (*remove)(void *opaque, const char *filename);
+    int (*remove)(dvoid *opaque, const char *filename);
 
         /*
          * Create a directory in the archive/directory.
@@ -1171,7 +1094,7 @@
          *  This method may be NULL.
          * On failure, call __PHYSFS_setError().
          */
-    int (*mkdir)(void *opaque, const char *filename);
+    int (*mkdir)(dvoid *opaque, const char *filename);
 
         /*
          * Close directories/archives, and free any associated memory,
@@ -1179,8 +1102,67 @@
          *  that it won't be called if there are still files open from
          *  this archive.
          */
-    void (*dirClose)(void *opaque);
-} DirFunctions;
+    void (*dirClose)(dvoid *opaque);
+
+
+
+    /*
+     * FILE ROUTINES:
+     * These functions are for file handles generated by the open*() methods.
+     *  They are distinguished by taking a "fvoid" instead of a "dvoid" for
+     *  the opaque handle.
+     */
+
+        /*
+         * Read more from the file.
+         * Returns number of objects of (objSize) bytes read from file, -1
+         *  if complete failure.
+         * On failure, call __PHYSFS_setError().
+         */
+    PHYSFS_sint64 (*read)(fvoid *opaque, void *buffer,
+                          PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
+
+        /*
+         * Write more to the file. Archives don't have to implement this.
+         *  (Set it to NULL if not implemented).
+         * Returns number of objects of (objSize) bytes written to file, -1
+         *  if complete failure.
+         * On failure, call __PHYSFS_setError().
+         */
+    PHYSFS_sint64 (*write)(fvoid *opaque, const void *buffer,
+                 PHYSFS_uint32 objSize, PHYSFS_uint32 objCount);
+
+        /*
+         * Returns non-zero if at end of file.
+         */
+    int (*eof)(fvoid *opaque);
+
+        /*
+         * Returns byte offset from start of file.
+         */
+    PHYSFS_sint64 (*tell)(fvoid *opaque);
+
+        /*
+         * Move read/write pointer to byte offset from start of file.
+         *  Returns non-zero on success, zero on error.
+         * On failure, call __PHYSFS_setError().
+         */
+    int (*seek)(fvoid *opaque, PHYSFS_uint64 offset);
+
+        /*
+         * Return number of bytes available in the file, or -1 if you
+         *  aren't able to determine.
+         * On failure, call __PHYSFS_setError().
+         */
+    PHYSFS_sint64 (*fileLength)(fvoid *opaque);
+
+        /*
+         * Close the file, and free associated resources, including (opaque)
+         *  if applicable. Returns non-zero on success, zero if can't close
+         *  file. On failure, call __PHYSFS_setError().
+         */
+    int (*fileClose)(fvoid *opaque);
+} PHYSFS_Archiver;
 
 
 /*
@@ -1272,7 +1254,7 @@
 /*
  * Get the current allocator. Not valid before PHYSFS_init is called!
  */
-PHYSFS_allocator *__PHYSFS_getAllocator(void);
+PHYSFS_Allocator *__PHYSFS_getAllocator(void);
 
 
 /*--------------------------------------------------------------------------*/
@@ -1571,9 +1553,9 @@
 
 /*
  * Enumerate a directory of files. This follows the rules for the
- *  DirFunctions->enumerateFiles() method (see above), except that the
+ *  PHYSFS_Archiver->enumerateFiles() method (see above), except that the
  *  (dirName) that is passed to this function is converted to
- *  platform-DEPENDENT notation by the caller. The DirFunctions version
+ *  platform-DEPENDENT notation by the caller. The PHYSFS_Archiver version
  *  uses platform-independent notation. Note that ".", "..", and other
  *  metaentries should always be ignored.
  */