Removed __PHYSFS_platformGetLastModTime().
This commit is contained in:
parent
8def2f8aaf
commit
b58e5f348c
|
@ -44,7 +44,6 @@ typedef struct
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
PHYSFS_sint64 last_mod_time;
|
|
||||||
PHYSFS_uint32 entryCount;
|
PHYSFS_uint32 entryCount;
|
||||||
GRPentry *entries;
|
GRPentry *entries;
|
||||||
} GRPinfo;
|
} GRPinfo;
|
||||||
|
@ -252,7 +251,6 @@ static int grp_load_entries(const char *name, int forWriting, GRPinfo *info)
|
||||||
|
|
||||||
static void *GRP_openArchive(const char *name, int forWriting)
|
static void *GRP_openArchive(const char *name, int forWriting)
|
||||||
{
|
{
|
||||||
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
|
|
||||||
GRPinfo *info = (GRPinfo *) allocator.Malloc(sizeof (GRPinfo));
|
GRPinfo *info = (GRPinfo *) allocator.Malloc(sizeof (GRPinfo));
|
||||||
|
|
||||||
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, 0);
|
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, 0);
|
||||||
|
@ -265,7 +263,6 @@ static void *GRP_openArchive(const char *name, int forWriting)
|
||||||
goto GRP_openArchive_failed;
|
goto GRP_openArchive_failed;
|
||||||
|
|
||||||
strcpy(info->filename, name);
|
strcpy(info->filename, name);
|
||||||
info->last_mod_time = modtime;
|
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
|
|
||||||
|
@ -417,8 +414,8 @@ static int GRP_stat(dvoid *opaque, const char *filename, int *exists,
|
||||||
|
|
||||||
stat->filesize = entry->size;
|
stat->filesize = entry->size;
|
||||||
stat->filetype = PHYSFS_FILETYPE_REGULAR;
|
stat->filetype = PHYSFS_FILETYPE_REGULAR;
|
||||||
stat->modtime = info->last_mod_time;
|
stat->modtime = -1;
|
||||||
stat->createtime = info->last_mod_time;
|
stat->createtime = -1;
|
||||||
stat->accesstime = -1;
|
stat->accesstime = -1;
|
||||||
stat->readonly = 1;
|
stat->readonly = 1;
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,6 @@ typedef struct
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
PHYSFS_sint64 last_mod_time;
|
|
||||||
PHYSFS_uint32 entryCount;
|
PHYSFS_uint32 entryCount;
|
||||||
HOGentry *entries;
|
HOGentry *entries;
|
||||||
} HOGinfo;
|
} HOGinfo;
|
||||||
|
@ -288,7 +287,6 @@ static int hog_load_entries(const char *name, int forWriting, HOGinfo *info)
|
||||||
|
|
||||||
static void *HOG_openArchive(const char *name, int forWriting)
|
static void *HOG_openArchive(const char *name, int forWriting)
|
||||||
{
|
{
|
||||||
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
|
|
||||||
HOGinfo *info = (HOGinfo *) allocator.Malloc(sizeof (HOGinfo));
|
HOGinfo *info = (HOGinfo *) allocator.Malloc(sizeof (HOGinfo));
|
||||||
|
|
||||||
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
|
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
|
||||||
|
@ -300,7 +298,6 @@ static void *HOG_openArchive(const char *name, int forWriting)
|
||||||
goto HOG_openArchive_failed;
|
goto HOG_openArchive_failed;
|
||||||
|
|
||||||
strcpy(info->filename, name);
|
strcpy(info->filename, name);
|
||||||
info->last_mod_time = modtime;
|
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
|
|
||||||
|
@ -452,8 +449,8 @@ static int HOG_stat(dvoid *opaque, const char *filename, int *exists,
|
||||||
|
|
||||||
stat->filesize = entry->size;
|
stat->filesize = entry->size;
|
||||||
stat->filetype = PHYSFS_FILETYPE_REGULAR;
|
stat->filetype = PHYSFS_FILETYPE_REGULAR;
|
||||||
stat->modtime = info->last_mod_time;
|
stat->modtime = -1;
|
||||||
stat->createtime = info->last_mod_time;
|
stat->createtime = -1;
|
||||||
stat->accesstime = -1;
|
stat->accesstime = -1;
|
||||||
stat->readonly = 1;
|
stat->readonly = 1;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,6 @@ typedef struct
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
PHYSFS_sint64 last_mod_time;
|
|
||||||
PHYSFS_uint32 entryCount;
|
PHYSFS_uint32 entryCount;
|
||||||
MVLentry *entries;
|
MVLentry *entries;
|
||||||
} MVLinfo;
|
} MVLinfo;
|
||||||
|
@ -249,7 +248,6 @@ static int mvl_load_entries(const char *name, int forWriting, MVLinfo *info)
|
||||||
|
|
||||||
static void *MVL_openArchive(const char *name, int forWriting)
|
static void *MVL_openArchive(const char *name, int forWriting)
|
||||||
{
|
{
|
||||||
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
|
|
||||||
MVLinfo *info = (MVLinfo *) allocator.Malloc(sizeof (MVLinfo));
|
MVLinfo *info = (MVLinfo *) allocator.Malloc(sizeof (MVLinfo));
|
||||||
|
|
||||||
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
|
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
|
||||||
|
@ -261,7 +259,6 @@ static void *MVL_openArchive(const char *name, int forWriting)
|
||||||
goto MVL_openArchive_failed;
|
goto MVL_openArchive_failed;
|
||||||
|
|
||||||
strcpy(info->filename, name);
|
strcpy(info->filename, name);
|
||||||
info->last_mod_time = modtime;
|
|
||||||
return info;
|
return info;
|
||||||
|
|
||||||
MVL_openArchive_failed:
|
MVL_openArchive_failed:
|
||||||
|
@ -412,9 +409,9 @@ static int MVL_stat(dvoid *opaque, const char *filename, int *exists,
|
||||||
|
|
||||||
stat->filesize = entry->size;
|
stat->filesize = entry->size;
|
||||||
stat->filetype = PHYSFS_FILETYPE_REGULAR;
|
stat->filetype = PHYSFS_FILETYPE_REGULAR;
|
||||||
stat->modtime = info->last_mod_time;
|
stat->modtime = -1;
|
||||||
stat->createtime = info->last_mod_time;
|
stat->createtime = -1;
|
||||||
stat->accesstime = 0;
|
stat->accesstime = -1;
|
||||||
stat->readonly = 1;
|
stat->readonly = 1;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -58,7 +58,6 @@ typedef struct
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
PHYSFS_sint64 last_mod_time;
|
|
||||||
PHYSFS_uint32 entryCount;
|
PHYSFS_uint32 entryCount;
|
||||||
QPAKentry *entries;
|
QPAKentry *entries;
|
||||||
} QPAKinfo;
|
} QPAKinfo;
|
||||||
|
@ -270,7 +269,6 @@ static int qpak_load_entries(const char *name, int forWriting, QPAKinfo *info)
|
||||||
static void *QPAK_openArchive(const char *name, int forWriting)
|
static void *QPAK_openArchive(const char *name, int forWriting)
|
||||||
{
|
{
|
||||||
QPAKinfo *info = (QPAKinfo *) allocator.Malloc(sizeof (QPAKinfo));
|
QPAKinfo *info = (QPAKinfo *) allocator.Malloc(sizeof (QPAKinfo));
|
||||||
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
|
|
||||||
|
|
||||||
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
|
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
|
||||||
memset(info, '\0', sizeof (QPAKinfo));
|
memset(info, '\0', sizeof (QPAKinfo));
|
||||||
|
@ -286,7 +284,6 @@ static void *QPAK_openArchive(const char *name, int forWriting)
|
||||||
goto QPAK_openArchive_failed;
|
goto QPAK_openArchive_failed;
|
||||||
|
|
||||||
strcpy(info->filename, name);
|
strcpy(info->filename, name);
|
||||||
info->last_mod_time = modtime;
|
|
||||||
return info;
|
return info;
|
||||||
|
|
||||||
QPAK_openArchive_failed:
|
QPAK_openArchive_failed:
|
||||||
|
@ -573,9 +570,9 @@ static int QPAK_stat(dvoid *opaque, const char *filename, int *exists,
|
||||||
stat->filesize = entry->size;
|
stat->filesize = entry->size;
|
||||||
} /* else */
|
} /* else */
|
||||||
|
|
||||||
stat->modtime = info->last_mod_time;
|
stat->modtime = -1;
|
||||||
stat->createtime = info->last_mod_time;
|
stat->createtime = -1;
|
||||||
stat->accesstime = 0;
|
stat->accesstime = -1;
|
||||||
stat->readonly = 1;
|
stat->readonly = 1;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -62,7 +62,6 @@ typedef struct
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
PHYSFS_sint64 last_mod_time;
|
|
||||||
PHYSFS_uint32 entryCount;
|
PHYSFS_uint32 entryCount;
|
||||||
PHYSFS_uint32 entryOffset;
|
PHYSFS_uint32 entryOffset;
|
||||||
WADentry *entries;
|
WADentry *entries;
|
||||||
|
@ -275,7 +274,6 @@ static int wad_load_entries(const char *name, int forWriting, WADinfo *info)
|
||||||
|
|
||||||
static void *WAD_openArchive(const char *name, int forWriting)
|
static void *WAD_openArchive(const char *name, int forWriting)
|
||||||
{
|
{
|
||||||
PHYSFS_sint64 modtime = __PHYSFS_platformGetLastModTime(name);
|
|
||||||
WADinfo *info = (WADinfo *) allocator.Malloc(sizeof (WADinfo));
|
WADinfo *info = (WADinfo *) allocator.Malloc(sizeof (WADinfo));
|
||||||
|
|
||||||
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
|
BAIL_IF_MACRO(info == NULL, ERR_OUT_OF_MEMORY, NULL);
|
||||||
|
@ -288,7 +286,6 @@ static void *WAD_openArchive(const char *name, int forWriting)
|
||||||
goto WAD_openArchive_failed;
|
goto WAD_openArchive_failed;
|
||||||
|
|
||||||
strcpy(info->filename, name);
|
strcpy(info->filename, name);
|
||||||
info->last_mod_time = modtime;
|
|
||||||
return info;
|
return info;
|
||||||
|
|
||||||
WAD_openArchive_failed:
|
WAD_openArchive_failed:
|
||||||
|
@ -471,9 +468,9 @@ static int WAD_stat(dvoid *opaque, const char *filename, int *exists,
|
||||||
|
|
||||||
stat->filesize = entry->size;
|
stat->filesize = entry->size;
|
||||||
stat->filetype = PHYSFS_FILETYPE_REGULAR;
|
stat->filetype = PHYSFS_FILETYPE_REGULAR;
|
||||||
stat->accesstime = 0;
|
stat->accesstime = -1;
|
||||||
stat->modtime = ((WADinfo *) opaque)->last_mod_time;
|
stat->modtime = -1;
|
||||||
stat->createtime = ((WADinfo *) opaque)->last_mod_time;
|
stat->createtime = -1;
|
||||||
stat->readonly = 1; /* WADs are always readonly */
|
stat->readonly = 1; /* WADs are always readonly */
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -1326,14 +1326,6 @@ void *__PHYSFS_platformGetThreadID(void);
|
||||||
*/
|
*/
|
||||||
int __PHYSFS_platformExists(const char *fname);
|
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.
|
* Return non-zero if filename (in platform-dependent notation) is a symlink.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -625,23 +625,6 @@ PHYSFS_sint64 os2TimeToUnixTime(const FDATE *date, const FTIME *time)
|
||||||
} /* os2TimeToUnixTime */
|
} /* 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,
|
static int __PHYSFS_platformStat(const char *_fname, int *exists,
|
||||||
PHYSFS_Stat *stat)
|
PHYSFS_Stat *stat)
|
||||||
{
|
{
|
||||||
|
|
|
@ -664,12 +664,6 @@ void __PHYSFS_platformReleaseMutex(void *mutex)
|
||||||
} /* __PHYSFS_platformReleaseMutex */
|
} /* __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? */
|
/* !!! FIXME: Don't use C runtime for allocators? */
|
||||||
int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a)
|
int __PHYSFS_platformSetDefaultAllocator(PHYSFS_Allocator *a)
|
||||||
{
|
{
|
||||||
|
|
|
@ -409,14 +409,6 @@ int __PHYSFS_platformDelete(const char *path)
|
||||||
} /* __PHYSFS_platformDelete */
|
} /* __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)
|
int __PHYSFS_platformStat(const char *filename, int *exists, PHYSFS_Stat *st)
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
|
@ -1305,68 +1305,6 @@ static PHYSFS_sint64 FileTimeToPhysfsTime(const FILETIME *ft)
|
||||||
} /* FileTimeToPhysfsTime */
|
} /* 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,
|
static int __PHYSFS_platformStatOldWay(const char *filename, int *exists,
|
||||||
PHYSFS_Stat *stat)
|
PHYSFS_Stat *stat)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue