mirror of
https://github.com/ZDoom/gzdoom-last-svn.git
synced 2025-06-02 10:11:31 +00:00
* 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:
parent
fecafc6010
commit
4dcfb79219
2 changed files with 8 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue