glocalfileinfo: Fix GLocalFileStat getters on MinGW x86

For some reason, `time_t` is defined as being 32 bits wide on that
platform, which causes truncation of the timestamps from `struct stat`.

Avoid that problem by consistently using a 64-bit return value from the
`struct stat` accessors.

Helps: #3039
This commit is contained in:
Luca Bacci 2023-06-29 17:36:40 +02:00 committed by Philip Withnall
parent 9845f880ca
commit 2dc0a43bc0

View File

@ -316,13 +316,13 @@ inline static blkcnt_t _g_stat_blocks (const GLocalFileStat *buf) { return b
#endif
#ifndef G_OS_WIN32
inline static time_t _g_stat_atime (const GLocalFileStat *buf) { return buf->st_atime; }
inline static time_t _g_stat_ctime (const GLocalFileStat *buf) { return buf->st_ctime; }
inline static time_t _g_stat_mtime (const GLocalFileStat *buf) { return buf->st_mtime; }
inline static guint64 _g_stat_atime (const GLocalFileStat *buf) { return buf->st_atime; }
inline static guint64 _g_stat_ctime (const GLocalFileStat *buf) { return buf->st_ctime; }
inline static guint64 _g_stat_mtime (const GLocalFileStat *buf) { return buf->st_mtime; }
#else
inline static time_t _g_stat_atime (const GLocalFileStat *buf) { return buf->st_atim.tv_sec; }
inline static time_t _g_stat_ctime (const GLocalFileStat *buf) { return buf->st_ctim.tv_sec; }
inline static time_t _g_stat_mtime (const GLocalFileStat *buf) { return buf->st_mtim.tv_sec; }
inline static guint64 _g_stat_atime (const GLocalFileStat *buf) { return buf->st_atim.tv_sec; }
inline static guint64 _g_stat_ctime (const GLocalFileStat *buf) { return buf->st_ctim.tv_sec; }
inline static guint64 _g_stat_mtime (const GLocalFileStat *buf) { return buf->st_mtim.tv_sec; }
#endif
#if defined(HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) || defined(G_OS_WIN32)
inline static guint32 _g_stat_atim_nsec (const GLocalFileStat *buf) { return buf->st_atim.tv_nsec; }