fixed BufferingReader

This commit is contained in:
Christoph Oelckers 2023-12-13 16:58:12 +01:00
parent 292705ddc3
commit f3c7e01195
3 changed files with 5 additions and 3 deletions

View file

@ -334,7 +334,7 @@ int BufferingReader::FillBuffer(ptrdiff_t newpos)
// we have read the entire file, so delete our data provider.
baseReader.reset();
}
return read == newpos - bufferpos ? 0 : -1;
return newpos == bufferpos ? 0 : -1;
}
ptrdiff_t BufferingReader::Seek(ptrdiff_t offset, int origin)

View file

@ -181,7 +181,7 @@ public:
inflateEnd (&Stream);
}
ptrdiff_t Read (void *buffer, ptrdiff_t len) override
ptrdiff_t Read (void *buffer, ptrdiff_t olen) override
{
int err = 0;
@ -190,6 +190,7 @@ public:
DecompressionError("File not open");
return 0;
}
auto len = olen;
if (len == 0) return 0;
while (len > 0)
@ -222,7 +223,7 @@ public:
return 0;
}
return len - Stream.avail_out;
return olen - Stream.avail_out;
}
void FillBuffer ()

View file

@ -42,6 +42,7 @@ public:
{
Length = base->Length;
buf.resize(Length);
bufptr = (const char*)buf.data();
}
ptrdiff_t Seek(ptrdiff_t offset, int origin) override;