From ada24e9c5d4e02272acec6aaeab4acd9fab85125 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 30 Nov 2012 00:04:52 -0500 Subject: [PATCH] Moved supportsSymlinks into PHYSFS_ArchiveInfo. --- src/archiver_dir.c | 2 +- src/archiver_grp.c | 2 +- src/archiver_hog.c | 2 +- src/archiver_iso9660.c | 2 +- src/archiver_lzma.c | 2 +- src/archiver_mvl.c | 2 +- src/archiver_qpak.c | 2 +- src/archiver_slb.c | 2 +- src/archiver_wad.c | 2 +- src/archiver_zip.c | 2 +- src/physfs.c | 3 ++- src/physfs.h | 9 ++------- test/test_physfs.c | 2 ++ 13 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/archiver_dir.c b/src/archiver_dir.c index 056c3c26..e65681a6 100644 --- a/src/archiver_dir.c +++ b/src/archiver_dir.c @@ -185,8 +185,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_DIR = "Non-archive, direct filesystem I/O", "Ryan C. Gordon ", "http://icculus.org/physfs/", + 1, /* supportsSymlinks */ }, - 1, /* supportsSymlinks */ 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 ec6552f9..28a70817 100644 --- a/src/archiver_grp.c +++ b/src/archiver_grp.c @@ -93,8 +93,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_GRP = "Build engine Groupfile format", "Ryan C. Gordon ", "http://icculus.org/physfs/", + 0, /* supportsSymlinks */ }, - 0, /* supportsSymlinks */ 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 b5b88578..d4cb083e 100644 --- a/src/archiver_hog.c +++ b/src/archiver_hog.c @@ -99,8 +99,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_HOG = "Descent I/II HOG file format", "Bradley Bell ", "http://icculus.org/physfs/", + 0, /* supportsSymlinks */ }, - 0, /* supportsSymlinks */ 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 f6719313..b4b1e5f8 100644 --- a/src/archiver_iso9660.c +++ b/src/archiver_iso9660.c @@ -951,8 +951,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_ISO9660 = "ISO9660 image file", "Christoph Nelles ", "http://www.evilazrael.de/", + 0, /* supportsSymlinks */ }, - 0, /* supportsSymlinks */ 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 266720c2..8a008085 100644 --- a/src/archiver_lzma.c +++ b/src/archiver_lzma.c @@ -684,8 +684,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_LZMA = "LZMA (7zip) format", "Dennis Schridde ", "http://icculus.org/physfs/", + 0, /* supportsSymlinks */ }, - 0, /* supportsSymlinks */ 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 42d5e091..03b234e0 100644 --- a/src/archiver_mvl.c +++ b/src/archiver_mvl.c @@ -86,8 +86,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_MVL = "Descent II Movielib format", "Bradley Bell ", "http://icculus.org/physfs/", + 0, /* supportsSymlinks */ }, - 0, /* supportsSymlinks */ 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 c2edfe06..2bdb7510 100644 --- a/src/archiver_qpak.c +++ b/src/archiver_qpak.c @@ -102,8 +102,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_QPAK = "Quake I/II format", "Ryan C. Gordon ", "http://icculus.org/physfs/", + 0, /* supportsSymlinks */ }, - 0, /* supportsSymlinks */ QPAK_openArchive, /* openArchive() method */ UNPK_enumerateFiles, /* enumerateFiles() method */ UNPK_openRead, /* openRead() method */ diff --git a/src/archiver_slb.c b/src/archiver_slb.c index 00e05e6d..1b2d5caa 100644 --- a/src/archiver_slb.c +++ b/src/archiver_slb.c @@ -107,8 +107,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_SLB = "I-War / Independence War Slab file", "Aleksi Nurmi ", "http://bitbucket.org/ahnurmi/", + 0, /* supportsSymlinks */ }, - 0, /* supportsSymlinks */ SLB_openArchive, /* openArchive() method */ UNPK_enumerateFiles, /* enumerateFiles() method */ UNPK_openRead, /* openRead() method */ diff --git a/src/archiver_wad.c b/src/archiver_wad.c index ac8230f4..20faff50 100644 --- a/src/archiver_wad.c +++ b/src/archiver_wad.c @@ -110,8 +110,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_WAD = "DOOM engine format", "Travis Wells ", "http://www.3dmm2.com/doom/", + 0, /* supportsSymlinks */ }, - 0, /* supportsSymlinks */ 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 e0dd371d..a579a347 100644 --- a/src/archiver_zip.c +++ b/src/archiver_zip.c @@ -1697,8 +1697,8 @@ const PHYSFS_Archiver __PHYSFS_Archiver_ZIP = "PkZip/WinZip/Info-Zip compatible", "Ryan C. Gordon ", "http://icculus.org/physfs/", + 1, /* supportsSymlinks */ }, - 1, /* supportsSymlinks */ ZIP_openArchive, /* openArchive() method */ ZIP_enumerateFiles, /* enumerateFiles() method */ ZIP_openRead, /* openRead() method */ diff --git a/src/physfs.c b/src/physfs.c index 3de96dce..4cac7ef6 100644 --- a/src/physfs.c +++ b/src/physfs.c @@ -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); @@ -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, diff --git a/src/physfs.h b/src/physfs.h index 9b274b69..07628a3b 100644 --- a/src/physfs.h +++ b/src/physfs.h @@ -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; @@ -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? /** diff --git a/test/test_physfs.c b/test/test_physfs.c index 68346e05..b569d714 100644 --- a/test/test_physfs.c +++ b/test/test_physfs.c @@ -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 */