mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- Fixed: FileReader's FilePos is relative to the start of the file, not relative to the start
of the lump, so r3496's change to FileReader::Gets() was only valid for lumps at the start of a wad. (This function was still incorrect before that, though, since it made FilePos relative to StartPos after it had been used once.) * On that note, I'm not sure GetsFromBuffer() is correct either, since it ignores StartPos, but I don't know when this is actually used so that I could check. SVN r3504 (trunk)
This commit is contained in:
parent
23cda7c685
commit
cf0d5b3151
1 changed files with 4 additions and 4 deletions
|
@ -145,15 +145,15 @@ long FileReader::Read (void *buffer, long len)
|
|||
|
||||
char *FileReader::Gets(char *strbuf, int len)
|
||||
{
|
||||
if (len <= 0 || FilePos >= Length) return NULL;
|
||||
if (len <= 0 || FilePos >= StartPos + Length) return NULL;
|
||||
char *p = fgets(strbuf, len, File);
|
||||
if (p != NULL)
|
||||
{
|
||||
int old = FilePos;
|
||||
FilePos = ftell(File) - StartPos;
|
||||
if (FilePos > Length)
|
||||
FilePos = ftell(File);
|
||||
if (FilePos - StartPos > Length)
|
||||
{
|
||||
strbuf[Length-old] = 0;
|
||||
strbuf[Length - old + StartPos] = 0;
|
||||
}
|
||||
}
|
||||
return p;
|
||||
|
|
Loading…
Reference in a new issue