fix reading input stream during decompression
By using read instead of readAll decompression reader could get bytes then available in the stream and then later wrongly failed with end of stream.
This commit is contained in:
@@ -55,7 +55,7 @@ pub fn BitReader(comptime ReaderType: type) type {
|
||||
(self.nbits >> 3); // 0 for 0-7, 1 for 8-16, ... same as / 8
|
||||
|
||||
var buf: [8]u8 = [_]u8{0} ** 8;
|
||||
const bytes_read = self.forward_reader.read(buf[0..empty_bytes]) catch 0;
|
||||
const bytes_read = self.forward_reader.readAll(buf[0..empty_bytes]) catch 0;
|
||||
if (bytes_read > 0) {
|
||||
const u: u64 = std.mem.readInt(u64, buf[0..8], .little);
|
||||
self.bits |= u << @as(u6, @intCast(self.nbits));
|
||||
|
||||
Reference in New Issue
Block a user