From 758e5beedb097545d71498d4a8caa9dcc2be8b40 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 25 Mar 2012 17:17:56 -0400 Subject: [PATCH] Moved PHYSFS_ArchiveInfo into PHYSFS_Archiver. --- src/archiver_dir.c | 16 ++++++---------- src/archiver_grp.c | 16 ++++++---------- src/archiver_hog.c | 16 ++++++---------- src/archiver_iso9660.c | 16 ++++++---------- src/archiver_lzma.c | 16 ++++++---------- src/archiver_mvl.c | 16 ++++++---------- src/archiver_qpak.c | 15 ++++++--------- src/archiver_wad.c | 16 ++++++---------- src/archiver_zip.c | 16 ++++++---------- src/physfs.c | 6 +++--- src/physfs_internal.h | 8 ++++---- 11 files changed, 61 insertions(+), 96 deletions(-) diff --git a/src/archiver_dir.c b/src/archiver_dir.c index d84e67fe..4fe74b33 100644 --- a/src/archiver_dir.c +++ b/src/archiver_dir.c @@ -178,18 +178,14 @@ static int DIR_stat(PHYSFS_Dir *opaque, const char *name, } /* DIR_stat */ -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_DIR = -{ - "", - "Non-archive, direct filesystem I/O", - "Ryan C. Gordon ", - "http://icculus.org/physfs/", -}; - - const PHYSFS_Archiver __PHYSFS_Archiver_DIR = { - &__PHYSFS_ArchiveInfo_DIR, + { + "", + "Non-archive, direct filesystem I/O", + "Ryan C. Gordon ", + "http://icculus.org/physfs/", + }, DIR_openArchive, /* openArchive() method */ DIR_enumerateFiles, /* enumerateFiles() method */ DIR_openRead, /* openRead() method */ diff --git a/src/archiver_grp.c b/src/archiver_grp.c index 863d7c4e..63199d51 100644 --- a/src/archiver_grp.c +++ b/src/archiver_grp.c @@ -85,18 +85,14 @@ static void *GRP_openArchive(PHYSFS_Io *io, const char *name, int forWriting) } /* GRP_openArchive */ -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_GRP = -{ - "GRP", - "Build engine Groupfile format", - "Ryan C. Gordon ", - "http://icculus.org/physfs/", -}; - - const PHYSFS_Archiver __PHYSFS_Archiver_GRP = { - &__PHYSFS_ArchiveInfo_GRP, + { + "GRP", + "Build engine Groupfile format", + "Ryan C. Gordon ", + "http://icculus.org/physfs/", + }, GRP_openArchive, /* openArchive() method */ UNPK_enumerateFiles, /* enumerateFiles() method */ UNPK_openRead, /* openRead() method */ diff --git a/src/archiver_hog.c b/src/archiver_hog.c index 5a2f7e4c..aca9fd5a 100644 --- a/src/archiver_hog.c +++ b/src/archiver_hog.c @@ -91,18 +91,14 @@ static void *HOG_openArchive(PHYSFS_Io *io, const char *name, int forWriting) } /* HOG_openArchive */ -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_HOG = -{ - "HOG", - "Descent I/II HOG file format", - "Bradley Bell ", - "http://icculus.org/physfs/", -}; - - const PHYSFS_Archiver __PHYSFS_Archiver_HOG = { - &__PHYSFS_ArchiveInfo_HOG, + { + "HOG", + "Descent I/II HOG file format", + "Bradley Bell ", + "http://icculus.org/physfs/", + }, HOG_openArchive, /* openArchive() method */ UNPK_enumerateFiles, /* enumerateFiles() method */ UNPK_openRead, /* openRead() method */ diff --git a/src/archiver_iso9660.c b/src/archiver_iso9660.c index 1d0bfe84..9c832d13 100644 --- a/src/archiver_iso9660.c +++ b/src/archiver_iso9660.c @@ -944,18 +944,14 @@ static int ISO9660_mkdir(PHYSFS_Dir *opaque, const char *name) } /* ISO9660_mkdir */ - -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ISO9660 = -{ - "ISO", - "ISO9660 image file", - "Christoph Nelles ", - "http://www.evilazrael.de", -}; - const PHYSFS_Archiver __PHYSFS_Archiver_ISO9660 = { - &__PHYSFS_ArchiveInfo_ISO9660, + { + "ISO", + "ISO9660 image file", + "Christoph Nelles ", + "http://www.evilazrael.de/", + }, ISO9660_openArchive, /* openArchive() method */ ISO9660_enumerateFiles, /* enumerateFiles() method */ ISO9660_openRead, /* openRead() method */ diff --git a/src/archiver_lzma.c b/src/archiver_lzma.c index 837fd24f..660acda9 100644 --- a/src/archiver_lzma.c +++ b/src/archiver_lzma.c @@ -676,18 +676,14 @@ static int LZMA_stat(PHYSFS_Dir *opaque, const char *filename, } /* LZMA_stat */ -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_LZMA = -{ - "7Z", - "LZMA (7zip) format", - "Dennis Schridde ", - "http://icculus.org/physfs/", -}; - - const PHYSFS_Archiver __PHYSFS_Archiver_LZMA = { - &__PHYSFS_ArchiveInfo_LZMA, + { + "7Z", + "LZMA (7zip) format", + "Dennis Schridde ", + "http://icculus.org/physfs/", + }, LZMA_openArchive, /* openArchive() method */ LZMA_enumerateFiles, /* enumerateFiles() method */ LZMA_openRead, /* openRead() method */ diff --git a/src/archiver_mvl.c b/src/archiver_mvl.c index 2b130af3..f33dbe18 100644 --- a/src/archiver_mvl.c +++ b/src/archiver_mvl.c @@ -78,18 +78,14 @@ static void *MVL_openArchive(PHYSFS_Io *io, const char *name, int forWriting) } /* MVL_openArchive */ -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_MVL = -{ - "MVL", - "Descent II Movielib format", - "Bradley Bell ", - "http://icculus.org/physfs/", -}; - - const PHYSFS_Archiver __PHYSFS_Archiver_MVL = { - &__PHYSFS_ArchiveInfo_MVL, + { + "MVL", + "Descent II Movielib format", + "Bradley Bell ", + "http://icculus.org/physfs/", + }, MVL_openArchive, /* openArchive() method */ UNPK_enumerateFiles, /* enumerateFiles() method */ UNPK_openRead, /* openRead() method */ diff --git a/src/archiver_qpak.c b/src/archiver_qpak.c index 0ad035e7..67927e57 100644 --- a/src/archiver_qpak.c +++ b/src/archiver_qpak.c @@ -94,17 +94,14 @@ static void *QPAK_openArchive(PHYSFS_Io *io, const char *name, int forWriting) } /* QPAK_openArchive */ -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_QPAK = -{ - "PAK", - "Quake I/II format", - "Ryan C. Gordon ", - "http://icculus.org/physfs/", -}; - const PHYSFS_Archiver __PHYSFS_Archiver_QPAK = { - &__PHYSFS_ArchiveInfo_QPAK, + { + "PAK", + "Quake I/II format", + "Ryan C. Gordon ", + "http://icculus.org/physfs/", + }, QPAK_openArchive, /* openArchive() method */ UNPK_enumerateFiles, /* enumerateFiles() method */ UNPK_openRead, /* openRead() method */ diff --git a/src/archiver_wad.c b/src/archiver_wad.c index 74da6689..7d3db546 100644 --- a/src/archiver_wad.c +++ b/src/archiver_wad.c @@ -102,18 +102,14 @@ static void *WAD_openArchive(PHYSFS_Io *io, const char *name, int forWriting) } /* WAD_openArchive */ -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_WAD = -{ - "WAD", - "DOOM engine format", - "Travis Wells ", - "http://www.3dmm2.com/doom/", -}; - - const PHYSFS_Archiver __PHYSFS_Archiver_WAD = { - &__PHYSFS_ArchiveInfo_WAD, + { + "WAD", + "DOOM engine format", + "Travis Wells ", + "http://www.3dmm2.com/doom/", + }, WAD_openArchive, /* openArchive() method */ UNPK_enumerateFiles, /* enumerateFiles() method */ UNPK_openRead, /* openRead() method */ diff --git a/src/archiver_zip.c b/src/archiver_zip.c index 6c3904c7..0746d060 100644 --- a/src/archiver_zip.c +++ b/src/archiver_zip.c @@ -1397,18 +1397,14 @@ static int ZIP_stat(PHYSFS_Dir *opaque, const char *filename, int *exists, } /* ZIP_stat */ -const PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP = -{ - "ZIP", - "PkZip/WinZip/Info-Zip compatible", - "Ryan C. Gordon ", - "http://icculus.org/physfs/", -}; - - const PHYSFS_Archiver __PHYSFS_Archiver_ZIP = { - &__PHYSFS_ArchiveInfo_ZIP, + { + "ZIP", + "PkZip/WinZip/Info-Zip compatible", + "Ryan C. Gordon ", + "http://icculus.org/physfs/", + }, ZIP_openArchive, /* openArchive() method */ ZIP_enumerateFiles, /* enumerateFiles() method */ ZIP_openRead, /* openRead() method */ diff --git a/src/physfs.c b/src/physfs.c index c3c1be4f..1c210f75 100644 --- a/src/physfs.c +++ b/src/physfs.c @@ -885,14 +885,14 @@ static DirHandle *openDirectory(PHYSFS_Io *io, const char *d, int forWriting) /* Look for archivers with matching file extensions first... */ for (i = archivers; (*i != NULL) && (retval == NULL); i++) { - if (__PHYSFS_stricmpASCII(ext, (*i)->info->extension) == 0) + if (__PHYSFS_stricmpASCII(ext, (*i)->info.extension) == 0) retval = tryOpenDir(io, *i, d, forWriting); } /* for */ /* failing an exact file extension match, try all the others... */ for (i = archivers; (*i != NULL) && (retval == NULL); i++) { - if (__PHYSFS_stricmpASCII(ext, (*i)->info->extension) != 0) + if (__PHYSFS_stricmpASCII(ext, (*i)->info.extension) != 0) retval = tryOpenDir(io, *i, d, forWriting); } /* for */ } /* if */ @@ -1137,7 +1137,7 @@ static int initStaticArchivers(void) BAIL_IF_MACRO(!archivers, PHYSFS_ERR_OUT_OF_MEMORY, 0); for (i = 0; i < numStaticArchivers - 1; i++) - archiveInfo[i] = staticArchivers[i]->info; + archiveInfo[i] = &staticArchivers[i]->info; archiveInfo[numStaticArchivers - 1] = NULL; memcpy(archivers, staticArchivers, len); diff --git a/src/physfs_internal.h b/src/physfs_internal.h index 0943c24c..98560fe8 100644 --- a/src/physfs_internal.h +++ b/src/physfs_internal.h @@ -126,10 +126,10 @@ typedef void PHYSFS_Dir; typedef struct { - /* - * Basic info about this archiver... - */ - const PHYSFS_ArchiveInfo *info; + /* + * Basic info about this archiver... + */ + const PHYSFS_ArchiveInfo info; /*