From fd7dba74cd54fd943850b720f9aba0d5cc82fd21 Mon Sep 17 00:00:00 2001 From: SNMetamorph <25657591+SNMetamorph@users.noreply.github.com> Date: Mon, 1 Aug 2022 04:12:35 +0400 Subject: [PATCH] filesystem: fixed build for Windows --- filesystem/VFileSystem009.cpp | 4 ++-- filesystem/filesystem.c | 10 ++++++++-- filesystem/pak.c | 3 +++ filesystem/wad.c | 2 ++ filesystem/zip.c | 2 ++ 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/filesystem/VFileSystem009.cpp b/filesystem/VFileSystem009.cpp index adac91bc..ad2a72c0 100644 --- a/filesystem/VFileSystem009.cpp +++ b/filesystem/VFileSystem009.cpp @@ -219,8 +219,8 @@ public: void FileTimeToString( char *p, int size, long int time ) override { - char *buf = ctime( &time ); - + time_t curtime = time; + char *buf = ctime( &curtime ); Q_strncpy( p, buf, size ); } diff --git a/filesystem/filesystem.c b/filesystem/filesystem.c index 55298c6c..ebe9c87e 100644 --- a/filesystem/filesystem.c +++ b/filesystem/filesystem.c @@ -1313,7 +1313,7 @@ static qboolean FS_FindLibrary( const char *dllname, qboolean directpath, fs_dll #if XASH_WIN32 && XASH_X86 // a1ba: custom loader is non-portable (I just don't want to touch it) Con_Printf( S_WARN "%s: loading libraries from packs is deprecated " "and will be removed in the future\n", __FUNCTION__ ); - *custom_loader = true; + dllInfo->custom_loader = true; #else Con_Printf( S_WARN "%s: loading libraries from packs is unsupported on " "this platform\n", __FUNCTION__ ); @@ -1390,8 +1390,9 @@ qboolean FS_InitStdio( qboolean caseinsensitive, const char *rootdir, const char int i; FS_InitMemory(); - +#if !XASH_WIN32 fs_caseinsensitive = caseinsensitive; +#endif Q_strncpy( fs_rootdir, rootdir, sizeof( fs_rootdir )); Q_strncpy( fs_gamedir, gamedir, sizeof( fs_gamedir )); @@ -1979,8 +1980,13 @@ int FS_Flush( file_t *file ) FS_Purge( file ); // sync +#if XASH_POSIX if( fsync( file->handle ) < 0 ) return EOF; +#else + if( fflush( file->handle ) < 0 ) + return EOF; +#endif return 0; } diff --git a/filesystem/pak.c b/filesystem/pak.c index 7dac5b8f..c0a8a911 100644 --- a/filesystem/pak.c +++ b/filesystem/pak.c @@ -14,10 +14,13 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ +#include "build.h" #include #include #include +#if XASH_POSIX #include +#endif #include #include #include "port.h" diff --git a/filesystem/wad.c b/filesystem/wad.c index 9cbfa886..f741ff68 100644 --- a/filesystem/wad.c +++ b/filesystem/wad.c @@ -17,7 +17,9 @@ GNU General Public License for more details. #include #include #include +#if XASH_POSIX #include +#endif #include #include #include "port.h" diff --git a/filesystem/zip.c b/filesystem/zip.c index dcad291b..838928e0 100644 --- a/filesystem/zip.c +++ b/filesystem/zip.c @@ -17,7 +17,9 @@ GNU General Public License for more details. #include #include #include +#if XASH_POSIX #include +#endif #include #include #include STDINT_H