mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 22:51:57 +00:00
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
This commit is contained in:
parent
bda148a084
commit
e00f927c48
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue