Removed __PHYSFS_platformGetLastModTime().
authorRyan C. Gordon <icculus@icculus.org>
Wed, 25 Aug 2010 01:28:28 -0400
changeset 1115 bc7257f4f8da
parent 1114 db75213cb4b5
child 1116 20dfca1e8a27
Removed __PHYSFS_platformGetLastModTime().
src/archiver_grp.c
src/archiver_hog.c
src/archiver_mvl.c
src/archiver_qpak.c
src/archiver_wad.c
src/physfs_internal.h
src/platform_os2.c
src/platform_pocketpc.c
src/platform_posix.c
src/platform_windows.c
--- a/src/archiver_grp.c	Tue Aug 24 14:17:07 2010 -0400
+++ b/src/archiver_grp.c	Wed Aug 25 01:28:28 2010 -0400
@@ -44,7 +44,6 @@
 typedef struct
 {
     char *filename;
-    PHYSFS_sint64 last_mod_time;
     PHYSFS_uint32 entryCount;
     GRPentry *entries;
 } GRPinfo;
@@ -252,7 +251,6 @@
 
 static void *GRP_openArchive(const char *name, int forWriting)
 {
-    PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
     GRPinfo *info = (GRPinfo *) allocator.Malloc(sizeof (GRPinfo));
 
     BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, 0);
@@ -265,7 +263,6 @@
         goto GRP_openArchive_failed;
 
     strcpy(info->filename, name);
-    info->last_mod_time = modtime;
 
     return info;
 
@@ -417,8 +414,8 @@
 
     stat->filesize = entry->size;
     stat->filetype = PHYSFS_FILETYPE_REGULAR;
-    stat->modtime = info->last_mod_time;
-    stat->createtime = info->last_mod_time;
+    stat->modtime = -1;
+    stat->createtime = -1;
     stat->accesstime = -1;
     stat->readonly = 1;
 
--- a/src/archiver_hog.c	Tue Aug 24 14:17:07 2010 -0400
+++ b/src/archiver_hog.c	Wed Aug 25 01:28:28 2010 -0400
@@ -55,7 +55,6 @@
 typedef struct
 {
     char *filename;
-    PHYSFS_sint64 last_mod_time;
     PHYSFS_uint32 entryCount;
     HOGentry *entries;
 } HOGinfo;
@@ -288,7 +287,6 @@
 
 static void *HOG_openArchive(const char *name, int forWriting)
 {
-    PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
     HOGinfo *info = (HOGinfo *) allocator.Malloc(sizeof (HOGinfo));
 
     BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
@@ -300,7 +298,6 @@
         goto HOG_openArchive_failed;
 
     strcpy(info->filename, name);
-    info->last_mod_time = modtime;
 
     return info;
 
@@ -452,8 +449,8 @@
 
     stat->filesize = entry->size;
     stat->filetype = PHYSFS_FILETYPE_REGULAR;
-    stat->modtime = info->last_mod_time;
-    stat->createtime = info->last_mod_time;
+    stat->modtime = -1;
+    stat->createtime = -1;
     stat->accesstime = -1;
     stat->readonly = 1;
 
--- a/src/archiver_mvl.c	Tue Aug 24 14:17:07 2010 -0400
+++ b/src/archiver_mvl.c	Wed Aug 25 01:28:28 2010 -0400
@@ -47,7 +47,6 @@
 typedef struct
 {
     char *filename;
-    PHYSFS_sint64 last_mod_time;
     PHYSFS_uint32 entryCount;
     MVLentry *entries;
 } MVLinfo;
@@ -249,7 +248,6 @@
 
 static void *MVL_openArchive(const char *name, int forWriting)
 {
-    PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
     MVLinfo *info = (MVLinfo *) allocator.Malloc(sizeof (MVLinfo));
 
     BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
@@ -261,7 +259,6 @@
         goto MVL_openArchive_failed;
 
     strcpy(info->filename, name);
-    info->last_mod_time = modtime;
     return info;
 
 MVL_openArchive_failed:
@@ -412,9 +409,9 @@
 
     stat->filesize = entry->size;
     stat->filetype = PHYSFS_FILETYPE_REGULAR;
-    stat->modtime = info->last_mod_time;
-    stat->createtime = info->last_mod_time;
-    stat->accesstime = 0;
+    stat->modtime = -1;
+    stat->createtime = -1;
+    stat->accesstime = -1;
     stat->readonly = 1;
 
     return 1;
--- a/src/archiver_qpak.c	Tue Aug 24 14:17:07 2010 -0400
+++ b/src/archiver_qpak.c	Wed Aug 25 01:28:28 2010 -0400
@@ -58,7 +58,6 @@
 typedef struct
 {
     char *filename;
-    PHYSFS_sint64 last_mod_time;
     PHYSFS_uint32 entryCount;
     QPAKentry *entries;
 } QPAKinfo;
@@ -270,7 +269,6 @@
 static void *QPAK_openArchive(const char *name, int forWriting)
 {
     QPAKinfo *info = (QPAKinfo *) allocator.Malloc(sizeof (QPAKinfo));
-    PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
 
     BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
     memset(info, '\0', sizeof (QPAKinfo));
@@ -286,7 +284,6 @@
         goto QPAK_openArchive_failed;
 
     strcpy(info->filename, name);
-    info->last_mod_time = modtime;
     return info;
 
 QPAK_openArchive_failed:
@@ -573,9 +570,9 @@
         stat->filesize = entry->size;
     } /* else */
 
-    stat->modtime = info->last_mod_time;
-    stat->createtime = info->last_mod_time;
-    stat->accesstime = 0;
+    stat->modtime = -1;
+    stat->createtime = -1;
+    stat->accesstime = -1;
     stat->readonly = 1;
 
     return 1;
--- a/src/archiver_wad.c	Tue Aug 24 14:17:07 2010 -0400
+++ b/src/archiver_wad.c	Wed Aug 25 01:28:28 2010 -0400
@@ -62,7 +62,6 @@
 typedef struct
 {
     char *filename;
-    PHYSFS_sint64 last_mod_time;
     PHYSFS_uint32 entryCount;
     PHYSFS_uint32 entryOffset;
     WADentry *entries;
@@ -275,7 +274,6 @@
 
 static void *WAD_openArchive(const char *name, int forWriting)
 {
-    PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
     WADinfo *info = (WADinfo *) allocator.Malloc(sizeof (WADinfo));
 
     BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
@@ -288,7 +286,6 @@
         goto WAD_openArchive_failed;
 
     strcpy(info->filename, name);
-    info->last_mod_time = modtime;
     return info;
 
 WAD_openArchive_failed:
@@ -471,9 +468,9 @@
 
     stat->filesize = entry->size;
     stat->filetype = PHYSFS_FILETYPE_REGULAR;
-    stat->accesstime = 0;
-    stat->modtime = ((WADinfo *) opaque)->last_mod_time;
-    stat->createtime = ((WADinfo *) opaque)->last_mod_time;
+    stat->accesstime = -1;
+    stat->modtime = -1;
+    stat->createtime = -1;
     stat->readonly = 1; /* WADs are always readonly */
 
     return 1;
--- a/src/physfs_internal.h	Tue Aug 24 14:17:07 2010 -0400
+++ b/src/physfs_internal.h	Wed Aug 25 01:28:28 2010 -0400
@@ -1327,14 +1327,6 @@
 int __PHYSFS_platformExists(const char *fname);
 
 /*
- * Return the last modified time (in seconds since the epoch) of a file.
- *  Returns -1 on failure. (fname) is in platform-dependent notation.
- *  Symlinks should be followed; if what the symlink points to is missing,
- *  then the retval is -1.
- */
-PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname);
-
-/*
  * Return non-zero if filename (in platform-dependent notation) is a symlink.
  */
 int __PHYSFS_platformIsSymLink(const char *fname);
--- a/src/platform_os2.c	Tue Aug 24 14:17:07 2010 -0400
+++ b/src/platform_os2.c	Wed Aug 25 01:28:28 2010 -0400
@@ -625,23 +625,6 @@
 } /* os2TimeToUnixTime */
 
 
-PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *_fname)
-{
-    const unsigned char *fname = (const unsigned char *) _fname;
-    PHYSFS_sint64 retval;
-    struct tm tm;
-    FILESTATUS3 fs;
-    APIRET rc = DosQueryPathInfo(fname, FIL_STANDARD, &fs, sizeof (fs));
-    BAIL_IF_MACRO(os2err(rc) != NO_ERROR, NULL, -1);
-
-    /* Convert to a format PhysicsFS can grok... */
-    retval = os2TimeToUnixTime(&fs.fdateLastWrite, &fs.ftimeLastWrite);
-
-    BAIL_IF_MACRO(retval == -1, strerror(errno), -1);
-    return retval;
-} /* __PHYSFS_platformGetLastModTime */
-
-
 static int __PHYSFS_platformStat(const char *_fname, int *exists,
                                  PHYSFS_Stat *stat)
 {
--- a/src/platform_pocketpc.c	Tue Aug 24 14:17:07 2010 -0400
+++ b/src/platform_pocketpc.c	Wed Aug 25 01:28:28 2010 -0400
@@ -664,12 +664,6 @@
 } /* __PHYSFS_platformReleaseMutex */
 
 
-PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname)
-{
-    BAIL_MACRO(ERR_NOT_IMPLEMENTED, -1);
-} /* __PHYSFS_platformGetLastModTime */
-
-
 /* !!! FIXME: Don't use C runtime for allocators? */
 int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a)
 {
--- a/src/platform_posix.c	Tue Aug 24 14:17:07 2010 -0400
+++ b/src/platform_posix.c	Wed Aug 25 01:28:28 2010 -0400
@@ -409,14 +409,6 @@
 } /* __PHYSFS_platformDelete */
 
 
-PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname)
-{
-    struct stat statbuf;
-    BAIL_IF_MACRO(stat(fname, &statbuf) < 0, strerror(errno), -1);
-    return statbuf.st_mtime;
-} /* __PHYSFS_platformGetLastModTime */
-
-
 int __PHYSFS_platformStat(const char *filename, int *exists, PHYSFS_Stat *st)
 {
     struct stat statbuf;
--- a/src/platform_windows.c	Tue Aug 24 14:17:07 2010 -0400
+++ b/src/platform_windows.c	Wed Aug 25 01:28:28 2010 -0400
@@ -1305,68 +1305,6 @@
 } /* FileTimeToPhysfsTime */
 
 
-PHYSFS_sint64 __PHYSFS_platformGetLastModTime(const char *fname)
-{
-    PHYSFS_sint64 retval = -1;
-    WIN32_FILE_ATTRIBUTE_DATA attr;
-    int rc = 0;
-
-    memset(&attr, '\0', sizeof (attr));
-
-    /* GetFileAttributesEx didn't show up until Win98 and NT4. */
-    if ((pGetFileAttributesExW != NULL) || (pGetFileAttributesExA != NULL))
-    {
-        WCHAR *wstr;
-        UTF8_TO_UNICODE_STACK_MACRO(wstr, fname);
-        if (wstr != NULL) /* if NULL, maybe the fallback will work. */
-        {
-            if (pGetFileAttributesExW != NULL)  /* NT/XP/Vista/etc system. */
-                rc = pGetFileAttributesExW(wstr, GetFileExInfoStandard, &attr);
-            else  /* Win98/ME system */
-            {
-                const int len = (int) (wStrLen(wstr) + 1);
-                char *cp = (char *) __PHYSFS_smallAlloc(len);
-                if (cp != NULL)
-                {
-                    WideCharToMultiByte(CP_ACP, 0, wstr, len, cp, len, 0, 0);
-                    rc = pGetFileAttributesExA(cp, GetFileExInfoStandard, &attr);
-                    __PHYSFS_smallFree(cp);
-                } /* if */
-            } /* else */
-            __PHYSFS_smallFree(wstr);
-        } /* if */
-    } /* if */
-
-    if (rc)  /* had API entry point and it worked. */
-    {
-        /* 0 return value indicates an error or not supported */
-        if ( (attr.ftLastWriteTime.dwHighDateTime != 0) ||
-             (attr.ftLastWriteTime.dwLowDateTime != 0) )
-        {
-            retval = FileTimeToPhysfsTime(&attr.ftLastWriteTime);
-        } /* if */
-    } /* if */
-
-    /* GetFileTime() has been in the Win32 API since the start. */
-    if (retval == -1)  /* try a fallback... */
-    {
-        FILETIME ft;
-        BOOL rc;
-        const char *err;
-        WinApiFile *f = (WinApiFile *) __PHYSFS_platformOpenRead(fname);
-        BAIL_IF_MACRO(f == NULL, NULL, -1)
-        rc = GetFileTime(f->handle, NULL, NULL, &ft);
-        err = winApiStrError();
-        CloseHandle(f->handle);
-        allocator.Free(f);
-        BAIL_IF_MACRO(!rc, err, -1);
-        retval = FileTimeToPhysfsTime(&ft);
-    } /* if */
-
-    return retval;
-} /* __PHYSFS_platformGetLastModTime */
-
-
 static int __PHYSFS_platformStatOldWay(const char *filename, int *exists,
                                        PHYSFS_Stat *stat)
 {