What was happening is that we set the stream EOF flag to true when we
could not read any more input data, and that made us early out before
fully finishing the processing of the compressed data.
Now the only EOF flag is set to true is if zlib's inflate() has actually
finished processing the data.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=44994#c2.
Assert.AreEqual(81942, unZipped.Length);
}
+
+ [Test]
+ public void Bug44994_InflateByteByByte()
+ {
+ int byteCount = 0;
+ using (var fileStream = File.OpenRead(Path.Combine("Test", "compressed.bin")))
+ {
+ using (var deflateStream = new DeflateStream(fileStream, CompressionMode.Decompress, false))
+ {
+ while (deflateStream.ReadByte() != -1)
+ {
+ byteCount++;
+ }
+ }
+ }
+
+ Assert.AreEqual(125387, byteCount);
+ }
}
}
if (zs->avail_in == 0) {
n = stream->func (stream->buffer, BUFFER_SIZE, stream->gchandle);
stream->total_in += n;
- if (n <= 0) {
- stream->eof = TRUE;
- }
zs->next_in = stream->buffer;
zs->avail_in = n < 0 ? 0 : n;
}