Removed "dvoid" typedef.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 25 Mar 2012 14:52:24 -0400
changeset 1276 f78ae02b3427
parent 1275 98f9a2a0000b
child 1277 f6996bfaec19
Removed "dvoid" typedef.
docs/TODO.txt
src/archiver_dir.c
src/archiver_iso9660.c
src/archiver_lzma.c
src/archiver_unpacked.c
src/archiver_zip.c
src/physfs_internal.h
--- a/docs/TODO.txt	Sat Mar 24 15:06:28 2012 -0400
+++ b/docs/TODO.txt	Sun Mar 25 14:52:24 2012 -0400
@@ -47,7 +47,6 @@
 - fscanf and fprintf support in extras dir.
 - Sanity check byte order at runtime.
 - Memory locking?
-- Find a better name than dvoid and fvoid.
 - General code audit.
 - Multiple write dirs with mount points?
 - Replace code from SDL...
--- a/src/archiver_dir.c	Sat Mar 24 15:06:28 2012 -0400
+++ b/src/archiver_dir.c	Sun Mar 25 14:52:24 2012 -0400
@@ -66,7 +66,7 @@
 } /* DIR_openArchive */
 
 
-static void DIR_enumerateFiles(dvoid *opaque, const char *dname,
+static void DIR_enumerateFiles(PHYSFS_Dir *opaque, const char *dname,
                                int omitSymLinks, PHYSFS_EnumFilesCallback cb,
                                const char *origdir, void *callbackdata)
 {
@@ -82,7 +82,7 @@
 } /* DIR_enumerateFiles */
 
 
-static PHYSFS_Io *doOpen(dvoid *opaque, const char *name,
+static PHYSFS_Io *doOpen(PHYSFS_Dir *opaque, const char *name,
                          const int mode, int *fileExists)
 {
     char *f;
@@ -114,25 +114,25 @@
 } /* doOpen */
 
 
-static PHYSFS_Io *DIR_openRead(dvoid *opaque, const char *fnm, int *exist)
+static PHYSFS_Io *DIR_openRead(PHYSFS_Dir *opaque, const char *fnm, int *exist)
 {
     return doOpen(opaque, fnm, 'r', exist);
 } /* DIR_openRead */
 
 
-static PHYSFS_Io *DIR_openWrite(dvoid *opaque, const char *filename)
+static PHYSFS_Io *DIR_openWrite(PHYSFS_Dir *opaque, const char *filename)
 {
     return doOpen(opaque, filename, 'w', NULL);
 } /* DIR_openWrite */
 
 
-static PHYSFS_Io *DIR_openAppend(dvoid *opaque, const char *filename)
+static PHYSFS_Io *DIR_openAppend(PHYSFS_Dir *opaque, const char *filename)
 {
     return doOpen(opaque, filename, 'a', NULL);
 } /* DIR_openAppend */
 
 
-static int DIR_remove(dvoid *opaque, const char *name)
+static int DIR_remove(PHYSFS_Dir *opaque, const char *name)
 {
     int retval;
     char *f;
@@ -145,7 +145,7 @@
 } /* DIR_remove */
 
 
-static int DIR_mkdir(dvoid *opaque, const char *name)
+static int DIR_mkdir(PHYSFS_Dir *opaque, const char *name)
 {
     int retval;
     char *f;
@@ -158,14 +158,14 @@
 } /* DIR_mkdir */
 
 
-static void DIR_closeArchive(dvoid *opaque)
+static void DIR_closeArchive(PHYSFS_Dir *opaque)
 {
     allocator.Free(opaque);
 } /* DIR_closeArchive */
 
 
-static int DIR_stat(dvoid *opaque, const char *name, int *exists,
-                    PHYSFS_Stat *stat)
+static int DIR_stat(PHYSFS_Dir *opaque, const char *name,
+                    int *exists, PHYSFS_Stat *stat)
 {
     int retval = 0;
     char *d;
--- a/src/archiver_iso9660.c	Sat Mar 24 15:06:28 2012 -0400
+++ b/src/archiver_iso9660.c	Sun Mar 25 14:52:24 2012 -0400
@@ -638,7 +638,7 @@
 } /* ISO9660_openArchive */
 
 
-static void ISO9660_closeArchive(dvoid *opaque)
+static void ISO9660_closeArchive(PHYSFS_Dir *opaque)
 {
     ISO9660Handle *handle = (ISO9660Handle*) opaque;
     handle->io->destroy(handle->io);
@@ -766,7 +766,8 @@
 } /* iso_file_open_foreign */
 
 
-static PHYSFS_Io *ISO9660_openRead(dvoid *opaque, const char *filename, int *exists)
+static PHYSFS_Io *ISO9660_openRead(PHYSFS_Dir *opaque, const char *filename,
+                                   int *exists)
 {
     PHYSFS_Io *retval = NULL;
     ISO9660Handle *handle = (ISO9660Handle*) opaque;
@@ -815,7 +816,7 @@
  * Information gathering functions
  ******************************************************************************/
 
-static void ISO9660_enumerateFiles(dvoid *opaque, const char *dname,
+static void ISO9660_enumerateFiles(PHYSFS_Dir *opaque, const char *dname,
                                    int omitSymLinks,
                                    PHYSFS_EnumFilesCallback cb,
                                    const char *origdir, void *callbackdata)
@@ -872,7 +873,7 @@
 } /* ISO9660_enumerateFiles */
 
 
-static int ISO9660_stat(dvoid *opaque, const char *name, int *exists,
+static int ISO9660_stat(PHYSFS_Dir *opaque, const char *name, int *exists,
                         PHYSFS_Stat *stat)
 {
     ISO9660Handle *handle = (ISO9660Handle*) opaque;
@@ -919,25 +920,25 @@
  * Not supported functions
  ******************************************************************************/
 
-static PHYSFS_Io *ISO9660_openWrite(dvoid *opaque, const char *name)
+static PHYSFS_Io *ISO9660_openWrite(PHYSFS_Dir *opaque, const char *name)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
 } /* ISO9660_openWrite */
 
 
-static PHYSFS_Io *ISO9660_openAppend(dvoid *opaque, const char *name)
+static PHYSFS_Io *ISO9660_openAppend(PHYSFS_Dir *opaque, const char *name)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
 } /* ISO9660_openAppend */
 
 
-static int ISO9660_remove(dvoid *opaque, const char *name)
+static int ISO9660_remove(PHYSFS_Dir *opaque, const char *name)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
 } /* ISO9660_remove */
 
 
-static int ISO9660_mkdir(dvoid *opaque, const char *name)
+static int ISO9660_mkdir(PHYSFS_Dir *opaque, const char *name)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
 } /* ISO9660_mkdir */
--- a/src/archiver_lzma.c	Sat Mar 24 15:06:28 2012 -0400
+++ b/src/archiver_lzma.c	Sun Mar 25 14:52:24 2012 -0400
@@ -531,7 +531,7 @@
 } /* doEnumCallback */
 
 
-static void LZMA_enumerateFiles(dvoid *opaque, const char *dname,
+static void LZMA_enumerateFiles(PHYSFS_Dir *opaque, const char *dname,
                                 int omitSymLinks, PHYSFS_EnumFilesCallback cb,
                                 const char *origdir, void *callbackdata)
 {
@@ -575,7 +575,8 @@
 } /* LZMA_enumerateFiles */
 
 
-static PHYSFS_Io *LZMA_openRead(dvoid *opaque, const char *name, int *fileExists)
+static PHYSFS_Io *LZMA_openRead(PHYSFS_Dir *opaque, const char *name,
+                                int *fileExists)
 {
     LZMAarchive *archive = (LZMAarchive *) opaque;
     LZMAfile *file = lzma_find_file(archive, name);
@@ -597,19 +598,19 @@
 } /* LZMA_openRead */
 
 
-static PHYSFS_Io *LZMA_openWrite(dvoid *opaque, const char *filename)
+static PHYSFS_Io *LZMA_openWrite(PHYSFS_Dir *opaque, const char *filename)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
 } /* LZMA_openWrite */
 
 
-static PHYSFS_Io *LZMA_openAppend(dvoid *opaque, const char *filename)
+static PHYSFS_Io *LZMA_openAppend(PHYSFS_Dir *opaque, const char *filename)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
 } /* LZMA_openAppend */
 
 
-static void LZMA_closeArchive(dvoid *opaque)
+static void LZMA_closeArchive(PHYSFS_Dir *opaque)
 {
     LZMAarchive *archive = (LZMAarchive *) opaque;
 
@@ -627,19 +628,19 @@
 } /* LZMA_closeArchive */
 
 
-static int LZMA_remove(dvoid *opaque, const char *name)
+static int LZMA_remove(PHYSFS_Dir *opaque, const char *name)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
 } /* LZMA_remove */
 
 
-static int LZMA_mkdir(dvoid *opaque, const char *name)
+static int LZMA_mkdir(PHYSFS_Dir *opaque, const char *name)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
 } /* LZMA_mkdir */
 
-static int LZMA_stat(dvoid *opaque, const char *filename, int *exists,
-                     PHYSFS_Stat *stat)
+static int LZMA_stat(PHYSFS_Dir *opaque, const char *filename,
+                     int *exists, PHYSFS_Stat *stat)
 {
     const LZMAarchive *archive = (const LZMAarchive *) opaque;
     const LZMAfile *file = lzma_find_file(archive, filename);
--- a/src/archiver_unpacked.c	Sat Mar 24 15:06:28 2012 -0400
+++ b/src/archiver_unpacked.c	Sun Mar 25 14:52:24 2012 -0400
@@ -34,7 +34,7 @@
 } UNPKfileinfo;
 
 
-void UNPK_closeArchive(dvoid *opaque)
+void UNPK_closeArchive(PHYSFS_Dir *opaque)
 {
     UNPKinfo *info = ((UNPKinfo *) opaque);
     info->io->destroy(info->io);
@@ -242,9 +242,9 @@
 } /* doEnumCallback */
 
 
-void UNPK_enumerateFiles(dvoid *opaque, const char *dname,
-                                int omitSymLinks, PHYSFS_EnumFilesCallback cb,
-                                const char *origdir, void *callbackdata)
+void UNPK_enumerateFiles(PHYSFS_Dir *opaque, const char *dname,
+                         int omitSymLinks, PHYSFS_EnumFilesCallback cb,
+                         const char *origdir, void *callbackdata)
 {
     UNPKinfo *info = ((UNPKinfo *) opaque);
     PHYSFS_sint32 dlen, dlen_inc, max, i;
@@ -344,7 +344,7 @@
 } /* findEntry */
 
 
-PHYSFS_Io *UNPK_openRead(dvoid *opaque, const char *fnm, int *fileExists)
+PHYSFS_Io *UNPK_openRead(PHYSFS_Dir *opaque, const char *fnm, int *fileExists)
 {
     PHYSFS_Io *retval = NULL;
     UNPKinfo *info = (UNPKinfo *) opaque;
@@ -390,32 +390,32 @@
 } /* UNPK_openRead */
 
 
-PHYSFS_Io *UNPK_openWrite(dvoid *opaque, const char *name)
+PHYSFS_Io *UNPK_openWrite(PHYSFS_Dir *opaque, const char *name)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
 } /* UNPK_openWrite */
 
 
-PHYSFS_Io *UNPK_openAppend(dvoid *opaque, const char *name)
+PHYSFS_Io *UNPK_openAppend(PHYSFS_Dir *opaque, const char *name)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
 } /* UNPK_openAppend */
 
 
-int UNPK_remove(dvoid *opaque, const char *name)
+int UNPK_remove(PHYSFS_Dir *opaque, const char *name)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
 } /* UNPK_remove */
 
 
-int UNPK_mkdir(dvoid *opaque, const char *name)
+int UNPK_mkdir(PHYSFS_Dir *opaque, const char *name)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
 } /* UNPK_mkdir */
 
 
-int UNPK_stat(dvoid *opaque, const char *filename, int *exists,
-              PHYSFS_Stat *stat)
+int UNPK_stat(PHYSFS_Dir *opaque, const char *filename,
+              int *exists, PHYSFS_Stat *stat)
 {
     int isDir = 0;
     const UNPKinfo *info = (const UNPKinfo *) opaque;
@@ -448,7 +448,8 @@
 } /* UNPK_stat */
 
 
-dvoid *UNPK_openArchive(PHYSFS_Io *io, UNPKentry *e, const PHYSFS_uint32 num)
+PHYSFS_Dir *UNPK_openArchive(PHYSFS_Io *io, UNPKentry *e,
+                             const PHYSFS_uint32 num)
 {
     UNPKinfo *info = (UNPKinfo *) allocator.Malloc(sizeof (UNPKinfo));
     if (info == NULL)
--- a/src/archiver_zip.c	Sat Mar 24 15:06:28 2012 -0400
+++ b/src/archiver_zip.c	Sun Mar 25 14:52:24 2012 -0400
@@ -1193,7 +1193,7 @@
 } /* doEnumCallback */
 
 
-static void ZIP_enumerateFiles(dvoid *opaque, const char *dname,
+static void ZIP_enumerateFiles(PHYSFS_Dir *opaque, const char *dname,
                                int omitSymLinks, PHYSFS_EnumFilesCallback cb,
                                const char *origdir, void *callbackdata)
 {
@@ -1265,7 +1265,8 @@
 } /* zip_get_io */
 
 
-static PHYSFS_Io *ZIP_openRead(dvoid *opaque, const char *fnm, int *fileExists)
+static PHYSFS_Io *ZIP_openRead(PHYSFS_Dir *opaque, const char *fnm,
+                               int *fileExists)
 {
     PHYSFS_Io *retval = NULL;
     ZIPinfo *info = (ZIPinfo *) opaque;
@@ -1323,19 +1324,19 @@
 } /* ZIP_openRead */
 
 
-static PHYSFS_Io *ZIP_openWrite(dvoid *opaque, const char *filename)
+static PHYSFS_Io *ZIP_openWrite(PHYSFS_Dir *opaque, const char *filename)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
 } /* ZIP_openWrite */
 
 
-static PHYSFS_Io *ZIP_openAppend(dvoid *opaque, const char *filename)
+static PHYSFS_Io *ZIP_openAppend(PHYSFS_Dir *opaque, const char *filename)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, NULL);
 } /* ZIP_openAppend */
 
 
-static void ZIP_closeArchive(dvoid *opaque)
+static void ZIP_closeArchive(PHYSFS_Dir *opaque)
 {
     ZIPinfo *zi = (ZIPinfo *) (opaque);
     zi->io->destroy(zi->io);
@@ -1344,19 +1345,19 @@
 } /* ZIP_closeArchive */
 
 
-static int ZIP_remove(dvoid *opaque, const char *name)
+static int ZIP_remove(PHYSFS_Dir *opaque, const char *name)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
 } /* ZIP_remove */
 
 
-static int ZIP_mkdir(dvoid *opaque, const char *name)
+static int ZIP_mkdir(PHYSFS_Dir *opaque, const char *name)
 {
     BAIL_MACRO(PHYSFS_ERR_READ_ONLY, 0);
 } /* ZIP_mkdir */
 
 
-static int ZIP_stat(dvoid *opaque, const char *filename, int *exists,
+static int ZIP_stat(PHYSFS_Dir *opaque, const char *filename, int *exists,
                     PHYSFS_Stat *stat)
 {
     int isDir = 0;
--- a/src/physfs_internal.h	Sat Mar 24 15:06:28 2012 -0400
+++ b/src/physfs_internal.h	Sun Mar 25 14:52:24 2012 -0400
@@ -119,10 +119,8 @@
 #endif
 
 
-/* !!! FIXME: find something better than "dvoid" and "fvoid" ... */
 /* Opaque data for file and dir handlers... */
-typedef void dvoid;
-
+typedef void PHYSFS_Dir;
 
 typedef struct
 {
@@ -135,7 +133,7 @@
     /*
      * DIRECTORY ROUTINES:
      * These functions are for dir handles. Generate a handle with the
-     *  openArchive() method, then pass it as the "opaque" dvoid to the
+     *  openArchive() method, then pass it as the "opaque" PHYSFS_Dir to the
      *  others.
      *
      * Symlinks should always be followed (except in stat()); PhysicsFS will
@@ -148,33 +146,30 @@
          *  (name) is a filename associated with (io), but doesn't necessarily
          *  map to anything, let alone a real filename. This possibly-
          *  meaningless name is in platform-dependent notation.
-         * (forWriting) is non-zero if this is to be used for
+         * (forWrite) is non-zero if this is to be used for
          *  the write directory, and zero if this is to be used for an
          *  element of the search path.
          * Returns NULL on failure. We ignore any error code you set here.
          *  Returns non-NULL on success. The pointer returned will be
          *  passed as the "opaque" parameter for later calls.
          */
-    dvoid *(*openArchive)(PHYSFS_Io *io, const char *name, int forWriting);
+    PHYSFS_Dir *(*openArchive)(PHYSFS_Io *io, const char *name, int forWrite);
 
         /*
-         * List all files in (dirname). Each file is passed to (callback),
+         * List all files in (dirname). Each file is passed to (cb),
          *  where a copy is made if appropriate, so you should dispose of
          *  it properly upon return from the callback.
          * You should omit symlinks if (omitSymLinks) is non-zero.
          * If you have a failure, report as much as you can.
          *  (dirname) is in platform-independent notation.
          */
-    void (*enumerateFiles)(dvoid *opaque,
-                            const char *dirname,
-                            int omitSymLinks,
-                            PHYSFS_EnumFilesCallback callback,
-                            const char *origdir,
-                            void *callbackdata);
+    void (*enumerateFiles)(PHYSFS_Dir *opaque, const char *dirname,
+                           int omitSymLinks, PHYSFS_EnumFilesCallback cb,
+                           const char *origdir, void *callbackdata);
 
         /*
          * Open file for reading.
-         *  This filename is in platform-independent notation.
+         *  This filename, (fnm), 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.
@@ -182,11 +177,11 @@
          *  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
+         * Regardless of success or failure, please set *exists to
          *  non-zero if the file existed (even if it's a broken symlink!),
          *  zero if it did not.
          */
-    PHYSFS_Io *(*openRead)(dvoid *opaque, const char *fname, int *fileExists);
+    PHYSFS_Io *(*openRead)(PHYSFS_Dir *opaque, const char *fnm, int *exists);
 
         /*
          * Open file for writing.
@@ -200,7 +195,7 @@
          *  Returns non-NULL on success. The pointer returned will be
          *  passed as the "opaque" parameter for later file calls.
          */
-    PHYSFS_Io *(*openWrite)(dvoid *opaque, const char *filename);
+    PHYSFS_Io *(*openWrite)(PHYSFS_Dir *opaque, const char *filename);
 
         /*
          * Open file for appending.
@@ -213,7 +208,7 @@
          *  Returns non-NULL on success. The pointer returned will be
          *  passed as the "opaque" parameter for later file calls.
          */
-    PHYSFS_Io *(*openAppend)(dvoid *opaque, const char *filename);
+    PHYSFS_Io *(*openAppend)(PHYSFS_Dir *opaque, const char *filename);
 
         /*
          * Delete a file in the archive/directory.
@@ -222,7 +217,7 @@
          *  This method may be NULL.
          * On failure, call __PHYSFS_setError().
          */
-    int (*remove)(dvoid *opaque, const char *filename);
+    int (*remove)(PHYSFS_Dir *opaque, const char *filename);
 
         /*
          * Create a directory in the archive/directory.
@@ -234,7 +229,7 @@
          *  This method may be NULL.
          * On failure, call __PHYSFS_setError().
          */
-    int (*mkdir)(dvoid *opaque, const char *filename);
+    int (*mkdir)(PHYSFS_Dir *opaque, const char *filename);
 
         /*
          * Close directories/archives, and free any associated memory,
@@ -242,14 +237,15 @@
          *  applicable. Implementation can assume that it won't be called if
          *  there are still files open from this archive.
          */
-    void (*closeArchive)(dvoid *opaque);
+    void (*closeArchive)(PHYSFS_Dir *opaque);
 
         /*
          * Obtain basic file metadata.
          *  Returns non-zero on success, zero on failure.
          *  On failure, call __PHYSFS_setError().
          */
-    int (*stat)(dvoid *opaque, const char *fn, int *exists, PHYSFS_Stat *stat);
+    int (*stat)(PHYSFS_Dir *opaque, const char *fn,
+                int *exists, PHYSFS_Stat *stat);
 } PHYSFS_Archiver;
 
 
@@ -424,17 +420,17 @@
     PHYSFS_uint32 size;
 } UNPKentry;
 
-void UNPK_closeArchive(dvoid *opaque);
-dvoid *UNPK_openArchive(PHYSFS_Io *io, UNPKentry *e, const PHYSFS_uint32 num);
-void UNPK_enumerateFiles(dvoid *opaque, const char *dname,
+void UNPK_closeArchive(PHYSFS_Dir *opaque);
+PHYSFS_Dir *UNPK_openArchive(PHYSFS_Io *io,UNPKentry *e,const PHYSFS_uint32 n);
+void UNPK_enumerateFiles(PHYSFS_Dir *opaque, const char *dname,
                          int omitSymLinks, PHYSFS_EnumFilesCallback cb,
                          const char *origdir, void *callbackdata);
-PHYSFS_Io *UNPK_openRead(dvoid *opaque, const char *fnm, int *fileExists);
-PHYSFS_Io *UNPK_openWrite(dvoid *opaque, const char *name);
-PHYSFS_Io *UNPK_openAppend(dvoid *opaque, const char *name);
-int UNPK_remove(dvoid *opaque, const char *name);
-int UNPK_mkdir(dvoid *opaque, const char *name);
-int UNPK_stat(dvoid *opaque, const char *fn, int *exists, PHYSFS_Stat *stat);
+PHYSFS_Io *UNPK_openRead(PHYSFS_Dir *opaque, const char *fnm, int *fileExists);
+PHYSFS_Io *UNPK_openWrite(PHYSFS_Dir *opaque, const char *name);
+PHYSFS_Io *UNPK_openAppend(PHYSFS_Dir *opaque, const char *name);
+int UNPK_remove(PHYSFS_Dir *opaque, const char *name);
+int UNPK_mkdir(PHYSFS_Dir *opaque, const char *name);
+int UNPK_stat(PHYSFS_Dir *opaque, const char *fn, int *exist, PHYSFS_Stat *st);
 
 
 /*--------------------------------------------------------------------------*/