Skip to content

Commit

Permalink
Moved PHYSFS_ArchiveInfo into PHYSFS_Archiver.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Mar 25, 2012
1 parent 6222a4a commit 758e5be
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 96 deletions.
16 changes: 6 additions & 10 deletions src/archiver_dir.c
Expand Up @@ -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 <icculus@icculus.org>",
"http://icculus.org/physfs/",
};


const PHYSFS_Archiver __PHYSFS_Archiver_DIR =
{
&__PHYSFS_ArchiveInfo_DIR,
{
"",
"Non-archive, direct filesystem I/O",
"Ryan C. Gordon <icculus@icculus.org>",
"http://icculus.org/physfs/",
},
DIR_openArchive, /* openArchive() method */
DIR_enumerateFiles, /* enumerateFiles() method */
DIR_openRead, /* openRead() method */
Expand Down
16 changes: 6 additions & 10 deletions src/archiver_grp.c
Expand Up @@ -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 <icculus@icculus.org>",
"http://icculus.org/physfs/",
};


const PHYSFS_Archiver __PHYSFS_Archiver_GRP =
{
&__PHYSFS_ArchiveInfo_GRP,
{
"GRP",
"Build engine Groupfile format",
"Ryan C. Gordon <icculus@icculus.org>",
"http://icculus.org/physfs/",
},
GRP_openArchive, /* openArchive() method */
UNPK_enumerateFiles, /* enumerateFiles() method */
UNPK_openRead, /* openRead() method */
Expand Down
16 changes: 6 additions & 10 deletions src/archiver_hog.c
Expand Up @@ -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 <btb@icculus.org>",
"http://icculus.org/physfs/",
};


const PHYSFS_Archiver __PHYSFS_Archiver_HOG =
{
&__PHYSFS_ArchiveInfo_HOG,
{
"HOG",
"Descent I/II HOG file format",
"Bradley Bell <btb@icculus.org>",
"http://icculus.org/physfs/",
},
HOG_openArchive, /* openArchive() method */
UNPK_enumerateFiles, /* enumerateFiles() method */
UNPK_openRead, /* openRead() method */
Expand Down
16 changes: 6 additions & 10 deletions src/archiver_iso9660.c
Expand Up @@ -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 <evilazrael@evilazrael.de>",
"http://www.evilazrael.de",
};

const PHYSFS_Archiver __PHYSFS_Archiver_ISO9660 =
{
&__PHYSFS_ArchiveInfo_ISO9660,
{
"ISO",
"ISO9660 image file",
"Christoph Nelles <evilazrael@evilazrael.de>",
"http://www.evilazrael.de/",
},
ISO9660_openArchive, /* openArchive() method */
ISO9660_enumerateFiles, /* enumerateFiles() method */
ISO9660_openRead, /* openRead() method */
Expand Down
16 changes: 6 additions & 10 deletions src/archiver_lzma.c
Expand Up @@ -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 <devurandom@gmx.net>",
"http://icculus.org/physfs/",
};


const PHYSFS_Archiver __PHYSFS_Archiver_LZMA =
{
&__PHYSFS_ArchiveInfo_LZMA,
{
"7Z",
"LZMA (7zip) format",
"Dennis Schridde <devurandom@gmx.net>",
"http://icculus.org/physfs/",
},
LZMA_openArchive, /* openArchive() method */
LZMA_enumerateFiles, /* enumerateFiles() method */
LZMA_openRead, /* openRead() method */
Expand Down
16 changes: 6 additions & 10 deletions src/archiver_mvl.c
Expand Up @@ -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 <btb@icculus.org>",
"http://icculus.org/physfs/",
};


const PHYSFS_Archiver __PHYSFS_Archiver_MVL =
{
&__PHYSFS_ArchiveInfo_MVL,
{
"MVL",
"Descent II Movielib format",
"Bradley Bell <btb@icculus.org>",
"http://icculus.org/physfs/",
},
MVL_openArchive, /* openArchive() method */
UNPK_enumerateFiles, /* enumerateFiles() method */
UNPK_openRead, /* openRead() method */
Expand Down
15 changes: 6 additions & 9 deletions src/archiver_qpak.c
Expand Up @@ -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 <icculus@icculus.org>",
"http://icculus.org/physfs/",
};

const PHYSFS_Archiver __PHYSFS_Archiver_QPAK =
{
&__PHYSFS_ArchiveInfo_QPAK,
{
"PAK",
"Quake I/II format",
"Ryan C. Gordon <icculus@icculus.org>",
"http://icculus.org/physfs/",
},
QPAK_openArchive, /* openArchive() method */
UNPK_enumerateFiles, /* enumerateFiles() method */
UNPK_openRead, /* openRead() method */
Expand Down
16 changes: 6 additions & 10 deletions src/archiver_wad.c
Expand Up @@ -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 <traviswells@mchsi.com>",
"http://www.3dmm2.com/doom/",
};


const PHYSFS_Archiver __PHYSFS_Archiver_WAD =
{
&__PHYSFS_ArchiveInfo_WAD,
{
"WAD",
"DOOM engine format",
"Travis Wells <traviswells@mchsi.com>",
"http://www.3dmm2.com/doom/",
},
WAD_openArchive, /* openArchive() method */
UNPK_enumerateFiles, /* enumerateFiles() method */
UNPK_openRead, /* openRead() method */
Expand Down
16 changes: 6 additions & 10 deletions src/archiver_zip.c
Expand Up @@ -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 <icculus@icculus.org>",
"http://icculus.org/physfs/",
};


const PHYSFS_Archiver __PHYSFS_Archiver_ZIP =
{
&__PHYSFS_ArchiveInfo_ZIP,
{
"ZIP",
"PkZip/WinZip/Info-Zip compatible",
"Ryan C. Gordon <icculus@icculus.org>",
"http://icculus.org/physfs/",
},
ZIP_openArchive, /* openArchive() method */
ZIP_enumerateFiles, /* enumerateFiles() method */
ZIP_openRead, /* openRead() method */
Expand Down
6 changes: 3 additions & 3 deletions src/physfs.c
Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/physfs_internal.h
Expand Up @@ -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;


/*
Expand Down

0 comments on commit 758e5be

Please sign in to comment.