From e00f927c4859770c983c358fe7541e141658ea8f Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 9 Jan 2008 00:33:06 +0000 Subject: [PATCH] Report EOF only on eof, rather than if the user requested to fill a buffer that was already empty. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2849 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/common/fs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/common/fs.c b/engine/common/fs.c index 85b918ae8..508931e2f 100644 --- a/engine/common/fs.c +++ b/engine/common/fs.c @@ -580,10 +580,15 @@ int VFSPAK_ReadBytes (struct vfsfile_s *vfs, void *buffer, int bytestoread) vfspack_t *vfsp = (vfspack_t*)vfs; int read; + if (bytestoread == 0) + return 0; + if (vfsp->currentpos - vfsp->startpos + bytestoread > vfsp->length) bytestoread = vfsp->length - (vfsp->currentpos - vfsp->startpos); if (bytestoread <= 0) + { return -1; + } if (vfsp->parentpak->filepos != vfsp->currentpos) VFS_SEEK(vfsp->parentpak->handle, vfsp->currentpos);