From 2beafa790d0db2fc0c1c626e09f286c4984cb68a Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 22 Aug 2010 20:20:04 -0400 Subject: [PATCH] Removed getLastModTime() interface from the archivers; it's not used anymore. --- src/archiver_dir.c | 17 ----------------- src/archiver_grp.c | 16 ---------------- src/archiver_hog.c | 16 ---------------- src/archiver_iso9660.c | 11 ----------- src/archiver_lzma.c | 17 ----------------- src/archiver_mvl.c | 16 ---------------- src/archiver_qpak.c | 18 ------------------ src/archiver_wad.c | 16 ---------------- src/archiver_zip.c | 18 ------------------ src/physfs.h | 7 +++++-- src/physfs_internal.h | 12 ------------ 11 files changed, 5 insertions(+), 159 deletions(-) diff --git a/src/archiver_dir.c b/src/archiver_dir.c index 01605103..9dd4e785 100644 --- a/src/archiver_dir.c +++ b/src/archiver_dir.c @@ -147,22 +147,6 @@ static int DIR_isSymLink(dvoid *opaque, const char *name, int *fileExists) } /* DIR_isSymLink */ -static PHYSFS_sint64 DIR_getLastModTime(dvoid *opaque, - const char *name, - int *fileExists) -{ - char *d = __PHYSFS_platformCvtToDependent((char *) opaque, name, NULL); - PHYSFS_sint64 retval = -1; - - BAIL_IF_MACRO(d == NULL, NULL, 0); - *fileExists = __PHYSFS_platformExists(d); - if (*fileExists) - retval = __PHYSFS_platformGetLastModTime(d); - allocator.Free(d); - return retval; -} /* DIR_getLastModTime */ - - static fvoid *doOpen(dvoid *opaque, const char *name, void *(*openFunc)(const char *filename), int *fileExists) @@ -268,7 +252,6 @@ const PHYSFS_Archiver __PHYSFS_Archiver_DIR = DIR_exists, /* exists() method */ DIR_isDirectory, /* isDirectory() method */ DIR_isSymLink, /* isSymLink() method */ - DIR_getLastModTime, /* getLastModTime() method */ DIR_openRead, /* openRead() method */ DIR_openWrite, /* openWrite() method */ DIR_openAppend, /* openAppend() method */ diff --git a/src/archiver_grp.c b/src/archiver_grp.c index d1407713..706080be 100644 --- a/src/archiver_grp.c +++ b/src/archiver_grp.c @@ -367,21 +367,6 @@ static int GRP_isSymLink(dvoid *opaque, const char *name, int *fileExists) } /* GRP_isSymLink */ -static PHYSFS_sint64 GRP_getLastModTime(dvoid *opaque, - const char *name, - int *fileExists) -{ - GRPinfo *info = (GRPinfo *) opaque; - PHYSFS_sint64 retval = -1; - - *fileExists = (grp_find_entry(info, name) != NULL); - if (*fileExists) /* use time of GRP itself in the physical filesystem. */ - retval = info->last_mod_time; - - return retval; -} /* GRP_getLastModTime */ - - static fvoid *GRP_openRead(dvoid *opaque, const char *fnm, int *fileExists) { GRPinfo *info = (GRPinfo *) opaque; @@ -472,7 +457,6 @@ const PHYSFS_Archiver __PHYSFS_Archiver_GRP = GRP_exists, /* exists() method */ GRP_isDirectory, /* isDirectory() method */ GRP_isSymLink, /* isSymLink() method */ - GRP_getLastModTime, /* getLastModTime() method */ GRP_openRead, /* openRead() method */ GRP_openWrite, /* openWrite() method */ GRP_openAppend, /* openAppend() method */ diff --git a/src/archiver_hog.c b/src/archiver_hog.c index 5533c7fb..285305dc 100644 --- a/src/archiver_hog.c +++ b/src/archiver_hog.c @@ -402,21 +402,6 @@ static int HOG_isSymLink(dvoid *opaque, const char *name, int *fileExists) } /* HOG_isSymLink */ -static PHYSFS_sint64 HOG_getLastModTime(dvoid *opaque, - const char *name, - int *fileExists) -{ - HOGinfo *info = ((HOGinfo *) opaque); - PHYSFS_sint64 retval = -1; - - *fileExists = (hog_find_entry(info, name) != NULL); - if (*fileExists) /* use time of HOG itself in the physical filesystem. */ - retval = info->last_mod_time; - - return retval; -} /* HOG_getLastModTime */ - - static fvoid *HOG_openRead(dvoid *opaque, const char *fnm, int *fileExists) { HOGinfo *info = ((HOGinfo *) opaque); @@ -507,7 +492,6 @@ const PHYSFS_Archiver __PHYSFS_Archiver_HOG = HOG_exists, /* exists() method */ HOG_isDirectory, /* isDirectory() method */ HOG_isSymLink, /* isSymLink() method */ - HOG_getLastModTime, /* getLastModTime() method */ HOG_openRead, /* openRead() method */ HOG_openWrite, /* openWrite() method */ HOG_openAppend, /* openAppend() method */ diff --git a/src/archiver_iso9660.c b/src/archiver_iso9660.c index 34f09f9f..25892539 100644 --- a/src/archiver_iso9660.c +++ b/src/archiver_iso9660.c @@ -940,16 +940,6 @@ static int ISO9660_isSymLink(dvoid *opaque, const char *name, int *fileExists) } /* ISO9660_isSymLink */ -static PHYSFS_sint64 ISO9660_getLastModTime(dvoid *opaque, const char *name, - int *fileExists) -{ - ISO9660Handle *handle = (ISO9660Handle*) opaque; - ISO9660FileDescriptor descriptor; - BAIL_IF_MACRO(iso_find_dir_entry(handle, name, &descriptor, fileExists), NULL, -1); - return iso_mktime(&descriptor.recordtime); -} /* ISO9660_getLastModTime */ - - /******************************************************************************* * Not supported functions ******************************************************************************/ @@ -1001,7 +991,6 @@ const PHYSFS_Archiver __PHYSFS_Archiver_ISO9660 = ISO9660_exists, /* exists() method */ ISO9660_isDirectory, /* isDirectory() method */ ISO9660_isSymLink, /* isSymLink() method */ - ISO9660_getLastModTime, /* getLastModTime() method */ ISO9660_openRead, /* openRead() method */ ISO9660_openWrite, /* openWrite() method */ ISO9660_openAppend, /* openAppend() method */ diff --git a/src/archiver_lzma.c b/src/archiver_lzma.c index 8e9701ef..f6553980 100644 --- a/src/archiver_lzma.c +++ b/src/archiver_lzma.c @@ -600,22 +600,6 @@ static int LZMA_exists(dvoid *opaque, const char *name) } /* LZMA_exists */ -static PHYSFS_sint64 LZMA_getLastModTime(dvoid *opaque, - const char *name, - int *fileExists) -{ - LZMAarchive *archive = (LZMAarchive *) opaque; - LZMAfile *file = lzma_find_file(archive, name); - - *fileExists = (file != NULL); - - BAIL_IF_MACRO(file == NULL, NULL, -1); - BAIL_IF_MACRO(!file->item->IsLastWriteTimeDefined, NULL, -1); /* write-time may not be defined for every file */ - - return lzma_filetime_to_unix_timestamp(&file->item->LastWriteTime); -} /* LZMA_getLastModTime */ - - static int LZMA_isDirectory(dvoid *opaque, const char *name, int *fileExists) { LZMAarchive *archive = (LZMAarchive *) opaque; @@ -743,7 +727,6 @@ const PHYSFS_Archiver __PHYSFS_Archiver_LZMA = LZMA_exists, /* exists() method */ LZMA_isDirectory, /* isDirectory() method */ LZMA_isSymLink, /* isSymLink() method */ - LZMA_getLastModTime, /* getLastModTime() method */ LZMA_openRead, /* openRead() method */ LZMA_openWrite, /* openWrite() method */ LZMA_openAppend, /* openAppend() method */ diff --git a/src/archiver_mvl.c b/src/archiver_mvl.c index e77db54e..adfb5369 100644 --- a/src/archiver_mvl.c +++ b/src/archiver_mvl.c @@ -362,21 +362,6 @@ static int MVL_isSymLink(dvoid *opaque, const char *name, int *fileExists) } /* MVL_isSymLink */ -static PHYSFS_sint64 MVL_getLastModTime(dvoid *opaque, - const char *name, - int *fileExists) -{ - MVLinfo *info = ((MVLinfo *) opaque); - PHYSFS_sint64 retval = -1; - - *fileExists = (mvl_find_entry(info, name) != NULL); - if (*fileExists) /* use time of MVL itself in the physical filesystem. */ - retval = info->last_mod_time; - - return retval; -} /* MVL_getLastModTime */ - - static fvoid *MVL_openRead(dvoid *opaque, const char *fnm, int *fileExists) { MVLinfo *info = ((MVLinfo *) opaque); @@ -467,7 +452,6 @@ const PHYSFS_Archiver __PHYSFS_Archiver_MVL = MVL_exists, /* exists() method */ MVL_isDirectory, /* isDirectory() method */ MVL_isSymLink, /* isSymLink() method */ - MVL_getLastModTime, /* getLastModTime() method */ MVL_openRead, /* openRead() method */ MVL_openWrite, /* openWrite() method */ MVL_openAppend, /* openAppend() method */ diff --git a/src/archiver_qpak.c b/src/archiver_qpak.c index 032a1e5b..6eed9d91 100644 --- a/src/archiver_qpak.c +++ b/src/archiver_qpak.c @@ -511,23 +511,6 @@ static int QPAK_isSymLink(dvoid *opaque, const char *name, int *fileExists) } /* QPAK_isSymLink */ -static PHYSFS_sint64 QPAK_getLastModTime(dvoid *opaque, - const char *name, - int *fileExists) -{ - int isDir; - QPAKinfo *info = ((QPAKinfo *) opaque); - PHYSFS_sint64 retval = -1; - QPAKentry *entry = qpak_find_entry(info, name, &isDir); - - *fileExists = ((isDir) || (entry != NULL)); - if (*fileExists) /* use time of QPAK itself in the physical filesystem. */ - retval = info->last_mod_time; - - return retval; -} /* QPAK_getLastModTime */ - - static fvoid *QPAK_openRead(dvoid *opaque, const char *fnm, int *fileExists) { QPAKinfo *info = ((QPAKinfo *) opaque); @@ -630,7 +613,6 @@ const PHYSFS_Archiver __PHYSFS_Archiver_QPAK = QPAK_exists, /* exists() method */ QPAK_isDirectory, /* isDirectory() method */ QPAK_isSymLink, /* isSymLink() method */ - QPAK_getLastModTime, /* getLastModTime() method */ QPAK_openRead, /* openRead() method */ QPAK_openWrite, /* openWrite() method */ QPAK_openAppend, /* openAppend() method */ diff --git a/src/archiver_wad.c b/src/archiver_wad.c index 4d84a00a..419596a8 100644 --- a/src/archiver_wad.c +++ b/src/archiver_wad.c @@ -421,21 +421,6 @@ static int WAD_isSymLink(dvoid *opaque, const char *name, int *fileExists) } /* WAD_isSymLink */ -static PHYSFS_sint64 WAD_getLastModTime(dvoid *opaque, - const char *name, - int *fileExists) -{ - WADinfo *info = ((WADinfo *) opaque); - PHYSFS_sint64 retval = -1; - - *fileExists = (wad_find_entry(info, name) != NULL); - if (*fileExists) /* use time of WAD itself in the physical filesystem. */ - retval = info->last_mod_time; - - return retval; -} /* WAD_getLastModTime */ - - static fvoid *WAD_openRead(dvoid *opaque, const char *fnm, int *fileExists) { WADinfo *info = ((WADinfo *) opaque); @@ -526,7 +511,6 @@ const PHYSFS_Archiver __PHYSFS_Archiver_WAD = WAD_exists, /* exists() method */ WAD_isDirectory, /* isDirectory() method */ WAD_isSymLink, /* isSymLink() method */ - WAD_getLastModTime, /* getLastModTime() method */ WAD_openRead, /* openRead() method */ WAD_openWrite, /* openWrite() method */ WAD_openAppend, /* openAppend() method */ diff --git a/src/archiver_zip.c b/src/archiver_zip.c index 016c1160..44646a81 100644 --- a/src/archiver_zip.c +++ b/src/archiver_zip.c @@ -1240,23 +1240,6 @@ static int ZIP_exists(dvoid *opaque, const char *name) } /* ZIP_exists */ -static PHYSFS_sint64 ZIP_getLastModTime(dvoid *opaque, - const char *name, - int *fileExists) -{ - int isDir; - ZIPinfo *info = (ZIPinfo *) opaque; - ZIPentry *entry = zip_find_entry(info, name, &isDir); - - *fileExists = ((isDir) || (entry != NULL)); - if (isDir) - return 1; /* Best I can do for a dir... */ - - BAIL_IF_MACRO(entry == NULL, NULL, -1); - return entry->last_mod_time; -} /* ZIP_getLastModTime */ - - static int ZIP_isDirectory(dvoid *opaque, const char *name, int *fileExists) { ZIPinfo *info = (ZIPinfo *) opaque; @@ -1455,7 +1438,6 @@ const PHYSFS_Archiver __PHYSFS_Archiver_ZIP = ZIP_exists, /* exists() method */ ZIP_isDirectory, /* isDirectory() method */ ZIP_isSymLink, /* isSymLink() method */ - ZIP_getLastModTime, /* getLastModTime() method */ ZIP_openRead, /* openRead() method */ ZIP_openWrite, /* openWrite() method */ ZIP_openAppend, /* openAppend() method */ diff --git a/src/physfs.h b/src/physfs.h index 28d25b3a..fea19f2e 100644 --- a/src/physfs.h +++ b/src/physfs.h @@ -1132,14 +1132,17 @@ PHYSFS_DECL int PHYSFS_isSymbolicLink(const char *fname); * \fn PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename) * \brief Get the last modification time of a file. * + * \deprecated As of PhysicsFS 2.1, use PHYSFS_stat() instead. This + * function just wraps it anyhow. + * * The modtime is returned as a number of seconds since the Unix epoch * (midnight, Jan 1, 1970). The exact derivation and accuracy of this time * depends on the particular archiver. If there is no reasonable way to * obtain this information for a particular archiver, or there was some sort * of error, this function returns (-1). * - * \deprecated As of PhysicsFS 2.1, use PHYSFS_stat() instead. This - * function just wraps it anyhow. + * You must use this and not PHYSFS_stat() if binary compatibility with + * PhysicsFS 2.0 is important (which it may not be for many people). * * \param filename filename to check, in platform-independent notation. * \return last modified time of the file. -1 if it can't be determined. diff --git a/src/physfs_internal.h b/src/physfs_internal.h index 48ae1b2c..f4dc28e6 100644 --- a/src/physfs_internal.h +++ b/src/physfs_internal.h @@ -806,18 +806,6 @@ typedef struct */ int (*isSymLink)(dvoid *opaque, const char *name, int *fileExists); - /* - * Retrieve the last modification time (mtime) of a file. - * Returns -1 on failure, or the file's mtime in seconds since - * the epoch (Jan 1, 1970) on success. - * This filename is in platform-independent notation. - * - * 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_sint64 (*getLastModTime)(dvoid *opaque, const char *fnm, int *exist); - /* * Open file for reading. * This filename is in platform-independent notation.