From 764ef939843b6bf6d3b5c09d5bfcf18b7484c80e Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 23 Dec 2021 01:21:33 +0300 Subject: [PATCH] common: add fs_size_t typedef, for read()/write() return value --- common/port.h | 1 + common/xash3d_types.h | 5 +++++ engine/common/filesystem.c | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/common/port.h b/common/port.h index 183f1fe7..9b6317ce 100644 --- a/common/port.h +++ b/common/port.h @@ -137,6 +137,7 @@ GNU General Public License for more details. #define HAVE_DUP #endif //WIN32 + #ifndef XASH_LOW_MEMORY #define XASH_LOW_MEMORY 0 #endif diff --git a/common/xash3d_types.h b/common/xash3d_types.h index e1d1a0ae..809da0ad 100644 --- a/common/xash3d_types.h +++ b/common/xash3d_types.h @@ -117,6 +117,11 @@ typedef struct file_s file_t; // normal file typedef struct wfile_s wfile_t; // wad file typedef struct stream_s stream_t; // sound stream for background music playing typedef off_t fs_offset_t; +#if XASH_WIN32 +typedef int fs_size_t; // return type of _read, _write funcs +#else /* !XASH_WIN32 */ +typedef ssize_t fs_size_t; +#endif /* !XASH_WIN32 */ typedef struct dllfunc_s { diff --git a/engine/common/filesystem.c b/engine/common/filesystem.c index 51e03f04..ff1139c3 100644 --- a/engine/common/filesystem.c +++ b/engine/common/filesystem.c @@ -606,7 +606,7 @@ pack_t *FS_LoadPackPAK( const char *packfile, int *error ) int i, numpackfiles; pack_t *pack; dpackfile_t *info; - ssize_t c; + fs_size_t c; packhandle = open( packfile, O_RDONLY|O_BINARY ); @@ -722,7 +722,7 @@ static zip_t *FS_LoadZip( const char *zipfile, int *error ) zipfile_t *info = NULL; char filename_buffer[MAX_SYSPATH]; zip_t *zip = (zip_t *)Mem_Calloc( fs_mempool, sizeof( *zip )); - ssize_t c; + fs_size_t c; zip->handle = open( zipfile, O_RDONLY|O_BINARY );