* Updated to ZDoom r3496:

- Fixed: FileReader::Gets did not check for a lump's end when reading through a WADs file object.


git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1334 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
gez 2012-03-31 19:47:46 +00:00
parent fecafc6010
commit 4dcfb79219
2 changed files with 8 additions and 3 deletions

View file

@ -145,11 +145,16 @@ long FileReader::Read (void *buffer, long len)
char *FileReader::Gets(char *strbuf, int len)
{
if (len <= 0) return 0;
if (len <= 0 || FilePos >= Length) return NULL;
char *p = fgets(strbuf, len, File);
if (p != NULL)
{
int old = FilePos;
FilePos = ftell(File) - StartPos;
if (FilePos > Length)
{
strbuf[Length-old] = 0;
}
}
return p;
}