Skip to content

Commit

Permalink
Moved supportsSymlinks into PHYSFS_ArchiveInfo.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Nov 30, 2012
1 parent 1ed8bc0 commit ada24e9
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/archiver_dir.c
Expand Up @@ -185,8 +185,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_DIR =
"Non-archive, direct filesystem I/O",
"Ryan C. Gordon <icculus@icculus.org>",
"http://icculus.org/physfs/",
1, /* supportsSymlinks */
},
1, /* supportsSymlinks */
DIR_openArchive, /* openArchive() method */
DIR_enumerateFiles, /* enumerateFiles() method */
DIR_openRead, /* openRead() method */
Expand Down
2 changes: 1 addition & 1 deletion src/archiver_grp.c
Expand Up @@ -93,8 +93,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_GRP =
"Build engine Groupfile format",
"Ryan C. Gordon <icculus@icculus.org>",
"http://icculus.org/physfs/",
0, /* supportsSymlinks */
},
0, /* supportsSymlinks */
GRP_openArchive, /* openArchive() method */
UNPK_enumerateFiles, /* enumerateFiles() method */
UNPK_openRead, /* openRead() method */
Expand Down
2 changes: 1 addition & 1 deletion src/archiver_hog.c
Expand Up @@ -99,8 +99,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_HOG =
"Descent I/II HOG file format",
"Bradley Bell <btb@icculus.org>",
"http://icculus.org/physfs/",
0, /* supportsSymlinks */
},
0, /* supportsSymlinks */
HOG_openArchive, /* openArchive() method */
UNPK_enumerateFiles, /* enumerateFiles() method */
UNPK_openRead, /* openRead() method */
Expand Down
2 changes: 1 addition & 1 deletion src/archiver_iso9660.c
Expand Up @@ -951,8 +951,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_ISO9660 =
"ISO9660 image file",
"Christoph Nelles <evilazrael@evilazrael.de>",
"http://www.evilazrael.de/",
0, /* supportsSymlinks */
},
0, /* supportsSymlinks */
ISO9660_openArchive, /* openArchive() method */
ISO9660_enumerateFiles, /* enumerateFiles() method */
ISO9660_openRead, /* openRead() method */
Expand Down
2 changes: 1 addition & 1 deletion src/archiver_lzma.c
Expand Up @@ -684,8 +684,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_LZMA =
"LZMA (7zip) format",
"Dennis Schridde <devurandom@gmx.net>",
"http://icculus.org/physfs/",
0, /* supportsSymlinks */
},
0, /* supportsSymlinks */
LZMA_openArchive, /* openArchive() method */
LZMA_enumerateFiles, /* enumerateFiles() method */
LZMA_openRead, /* openRead() method */
Expand Down
2 changes: 1 addition & 1 deletion src/archiver_mvl.c
Expand Up @@ -86,8 +86,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_MVL =
"Descent II Movielib format",
"Bradley Bell <btb@icculus.org>",
"http://icculus.org/physfs/",
0, /* supportsSymlinks */
},
0, /* supportsSymlinks */
MVL_openArchive, /* openArchive() method */
UNPK_enumerateFiles, /* enumerateFiles() method */
UNPK_openRead, /* openRead() method */
Expand Down
2 changes: 1 addition & 1 deletion src/archiver_qpak.c
Expand Up @@ -102,8 +102,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_QPAK =
"Quake I/II format",
"Ryan C. Gordon <icculus@icculus.org>",
"http://icculus.org/physfs/",
0, /* supportsSymlinks */
},
0, /* supportsSymlinks */
QPAK_openArchive, /* openArchive() method */
UNPK_enumerateFiles, /* enumerateFiles() method */
UNPK_openRead, /* openRead() method */
Expand Down
2 changes: 1 addition & 1 deletion src/archiver_slb.c
Expand Up @@ -107,8 +107,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_SLB =
"I-War / Independence War Slab file",
"Aleksi Nurmi <aleksi.nurmi@gmail.com>",
"http://bitbucket.org/ahnurmi/",
0, /* supportsSymlinks */
},
0, /* supportsSymlinks */
SLB_openArchive, /* openArchive() method */
UNPK_enumerateFiles, /* enumerateFiles() method */
UNPK_openRead, /* openRead() method */
Expand Down
2 changes: 1 addition & 1 deletion src/archiver_wad.c
Expand Up @@ -110,8 +110,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_WAD =
"DOOM engine format",
"Travis Wells <traviswells@mchsi.com>",
"http://www.3dmm2.com/doom/",
0, /* supportsSymlinks */
},
0, /* supportsSymlinks */
WAD_openArchive, /* openArchive() method */
UNPK_enumerateFiles, /* enumerateFiles() method */
UNPK_openRead, /* openRead() method */
Expand Down
2 changes: 1 addition & 1 deletion src/archiver_zip.c
Expand Up @@ -1697,8 +1697,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_ZIP =
"PkZip/WinZip/Info-Zip compatible",
"Ryan C. Gordon <icculus@icculus.org>",
"http://icculus.org/physfs/",
1, /* supportsSymlinks */
},
1, /* supportsSymlinks */
ZIP_openArchive, /* openArchive() method */
ZIP_enumerateFiles, /* enumerateFiles() method */
ZIP_openRead, /* openRead() method */
Expand Down
3 changes: 2 additions & 1 deletion src/physfs.c
Expand Up @@ -1423,6 +1423,7 @@ static int doRegisterArchiver(const PHYSFS_Archiver *_archiver)
CPYSTR(description);
CPYSTR(author);
CPYSTR(url);
info->supportsSymlinks = _archiver->info.supportsSymlinks;
#undef CPYSTR

ptr = allocator.Realloc(archiveInfo, len);
Expand Down Expand Up @@ -2316,7 +2317,7 @@ void PHYSFS_enumerateFilesCallback(const char *_fname,

else if (verifyPath(i, &arcfname, 0))
{
if ((!allowSymLinks) && (i->funcs->supportsSymlinks))
if ((!allowSymLinks) && (i->funcs->info.supportsSymlinks))
{
filterdata.dirhandle = i;
i->funcs->enumerateFiles(i->opaque, arcfname,
Expand Down
9 changes: 2 additions & 7 deletions src/physfs.h
Expand Up @@ -408,6 +408,7 @@ typedef struct PHYSFS_ArchiveInfo
const char *description; /**< Human-readable archive description. */
const char *author; /**< Person who did support for this archive. */
const char *url; /**< URL related to this archive */
int supportsSymlinks; /**< non-zero if archive offers symbolic links. */
} PHYSFS_ArchiveInfo;


Expand Down Expand Up @@ -3384,13 +3385,7 @@ typedef struct PHYSFS_Archiver
* This is used to identify your archive, and is returned in
* PHYSFS_supportedArchiveTypes().
*/
// !! FIXME: should this be const?
const PHYSFS_ArchiveInfo info;

/**
* !!! FIXME: document me.
*/
int supportsSymlinks;
PHYSFS_ArchiveInfo info;

// !!! FIXME: documentation: \brief?
/**
Expand Down
2 changes: 2 additions & 0 deletions test/test_physfs.c
Expand Up @@ -67,6 +67,8 @@ static void output_archivers(void)
printf(" * %s: %s\n Written by %s.\n %s\n",
(*i)->extension, (*i)->description,
(*i)->author, (*i)->url);
printf(" %s symbolic links.\n",
(*i)->supportsSymlinks ? "Supports" : "Does not support");
} /* for */
} /* else */

Expand Down

0 comments on commit ada24e9

Please sign in to comment.