]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - fs.c
add Blub's r_track_sprites for SPR_LABEL*
[xonotic/darkplaces.git] / fs.c
diff --git a/fs.c b/fs.c
index 916bb960f98d21e4bfbe54f6a7f31aba0667cdf9..362b36ad71c1b5cd0093ecf5b617d66c2123b4ce 100644 (file)
--- a/fs.c
+++ b/fs.c
 # define O_NONBLOCK 0
 #endif
 
+// largefile support for Win32
+#ifdef WIN32
+# define lseek _lseeki64
+#endif
 
 /*
 
@@ -1404,6 +1408,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 +1898,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 +2115,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;