Navigation Menu

Skip to content

Commit

Permalink
Removed getLastModTime() interface from the archivers; it's not used …
Browse files Browse the repository at this point in the history
…anymore.
  • Loading branch information
icculus committed Aug 23, 2010
1 parent c1969d0 commit 2beafa7
Show file tree
Hide file tree
Showing 11 changed files with 5 additions and 159 deletions.
17 changes: 0 additions & 17 deletions src/archiver_dir.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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 */
Expand Down
16 changes: 0 additions & 16 deletions src/archiver_grp.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down
16 changes: 0 additions & 16 deletions src/archiver_hog.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down
11 changes: 0 additions & 11 deletions src/archiver_iso9660.c
Expand Up @@ -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
******************************************************************************/
Expand Down Expand Up @@ -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 */
Expand Down
17 changes: 0 additions & 17 deletions src/archiver_lzma.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down
16 changes: 0 additions & 16 deletions src/archiver_mvl.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down
18 changes: 0 additions & 18 deletions src/archiver_qpak.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down
16 changes: 0 additions & 16 deletions src/archiver_wad.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
Expand Down
18 changes: 0 additions & 18 deletions src/archiver_zip.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down
7 changes: 5 additions & 2 deletions src/physfs.h
Expand Up @@ -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.
Expand Down
12 changes: 0 additions & 12 deletions src/physfs_internal.h
Expand Up @@ -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.
Expand Down

0 comments on commit 2beafa7

Please sign in to comment.