mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Fix strict aliasing/alignment violation in FiosIsValidFile
This commit is contained in:
parent
99f8989f0c
commit
631e546914
@ -223,7 +223,10 @@ bool FiosIsValidFile(const char *path, const struct dirent *ent, struct stat *sb
|
||||
* http://www.gamedev.net/community/forums/topic.asp?topic_id=294070&whichpage=1�
|
||||
* XXX - not entirely correct, since filetimes on FAT aren't UTC but local,
|
||||
* this won't entirely be correct, but we use the time only for comparison. */
|
||||
sb->st_mtime = (time_t)((*(const uint64_t*)&fd->ftLastWriteTime - posix_epoch_hns) / 1E7);
|
||||
uint64_t lastWriteTime = fd->ftLastWriteTime.dwHighDateTime;
|
||||
lastWriteTime <<= 32;
|
||||
lastWriteTime |= fd->ftLastWriteTime.dwLowDateTime;
|
||||
sb->st_mtime = (time_t)((lastWriteTime - posix_epoch_hns) / 1E7);
|
||||
sb->st_mode = (fd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)? S_IFDIR : S_IFREG;
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user