From a0fbecb998b153b0840d5a4910e2c7b2a8df38ab Mon Sep 17 00:00:00 2001 From: molivier Date: Mon, 9 Feb 2004 09:26:45 +0000 Subject: [PATCH] The test used in the FS_Read function to detect the end of a compressed file was incorrect, causing some big files to be truncated when unzipped. Many thanks to Fuh for poiting out this mistake to me git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3883 d7cf8633-e32d-0410-b094-e92efae38249 --- fs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs.c b/fs.c index b8fd9a61..2a5ea5a8 100644 --- a/fs.c +++ b/fs.c @@ -1344,12 +1344,13 @@ size_t FS_Read (qfile_t* file, void* buffer, size_t buffersize) // If "input" is also empty, we need to fill it if (ztk->in_ind == ztk->in_max) { - size_t remain = file->length - ztk->in_position; + size_t remain; // If we are at the end of the file - if (!remain) + if (ztk->out_position == ztk->real_length) return nb; + remain = file->length - ztk->in_position; count = (remain > sizeof (ztk->input)) ? sizeof (ztk->input) : remain; fread (ztk->input, 1, count, file->stream); -- 2.39.2