X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=fs.c;h=8f66fe884efe43babe3c4fa69d18fe18d0506c22;hb=d1a66b1504773e5da10463fd15d524697b0c2ba2;hp=916bb960f98d21e4bfbe54f6a7f31aba0667cdf9;hpb=7857d388ddfb0152d67d0e808d630f515e523740;p=xonotic%2Fdarkplaces.git diff --git a/fs.c b/fs.c index 916bb960..8f66fe88 100644 --- a/fs.c +++ b/fs.c @@ -22,9 +22,6 @@ Boston, MA 02111-1307, USA */ -// on UNIX platforms we need to define this so that video saving does not cause a SIGFSZ (file size) signal when a video clip exceeds 2GB -#define _FILE_OFFSET_BITS 64 - #include "quakedef.h" #include @@ -52,6 +49,10 @@ # define O_NONBLOCK 0 #endif +// largefile support for Win32 +#ifdef WIN32 +# define lseek _lseeki64 +#endif /* @@ -1404,6 +1405,10 @@ FS_Shutdown */ void FS_Shutdown (void) { + // close all pack files and such + // (hopefully there aren't any other open files, but they'll be cleaned up + // by the OS anyway) + FS_ClearSearchPath(); Mem_FreePool (&fs_mempool); } @@ -1890,12 +1895,12 @@ fs_offset_t FS_Read (qfile_t* file, void* buffer, size_t buffersize) if (file->buff_ind < file->buff_len) { count = file->buff_len - file->buff_ind; + count = ((fs_offset_t)buffersize > count) ? count : (fs_offset_t)buffersize; + done += count; + memcpy (buffer, &file->buff[file->buff_ind], count); + file->buff_ind += count; - done += ((fs_offset_t)buffersize > count) ? count : (fs_offset_t)buffersize; - memcpy (buffer, &file->buff[file->buff_ind], done); - file->buff_ind += done; - - buffersize -= done; + buffersize -= count; if (buffersize == 0) return done; } @@ -2107,7 +2112,7 @@ Get the next character of a file */ int FS_Getc (qfile_t* file) { - char c; + unsigned char c; if (FS_Read (file, &c, 1) != 1) return EOF;