mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 05:21:16 +00:00
fixed BufferingReader
This commit is contained in:
parent
292705ddc3
commit
f3c7e01195
3 changed files with 5 additions and 3 deletions
|
@ -334,7 +334,7 @@ int BufferingReader::FillBuffer(ptrdiff_t newpos)
|
||||||
// we have read the entire file, so delete our data provider.
|
// we have read the entire file, so delete our data provider.
|
||||||
baseReader.reset();
|
baseReader.reset();
|
||||||
}
|
}
|
||||||
return read == newpos - bufferpos ? 0 : -1;
|
return newpos == bufferpos ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptrdiff_t BufferingReader::Seek(ptrdiff_t offset, int origin)
|
ptrdiff_t BufferingReader::Seek(ptrdiff_t offset, int origin)
|
||||||
|
|
|
@ -181,7 +181,7 @@ public:
|
||||||
inflateEnd (&Stream);
|
inflateEnd (&Stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
ptrdiff_t Read (void *buffer, ptrdiff_t len) override
|
ptrdiff_t Read (void *buffer, ptrdiff_t olen) override
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
@ -190,6 +190,7 @@ public:
|
||||||
DecompressionError("File not open");
|
DecompressionError("File not open");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
auto len = olen;
|
||||||
if (len == 0) return 0;
|
if (len == 0) return 0;
|
||||||
|
|
||||||
while (len > 0)
|
while (len > 0)
|
||||||
|
@ -222,7 +223,7 @@ public:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return len - Stream.avail_out;
|
return olen - Stream.avail_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FillBuffer ()
|
void FillBuffer ()
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
{
|
{
|
||||||
Length = base->Length;
|
Length = base->Length;
|
||||||
buf.resize(Length);
|
buf.resize(Length);
|
||||||
|
bufptr = (const char*)buf.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
ptrdiff_t Seek(ptrdiff_t offset, int origin) override;
|
ptrdiff_t Seek(ptrdiff_t offset, int origin) override;
|
||||||
|
|
Loading…
Reference in a new issue