From 02357180601a8f09113b9faa691e73798a107596 Mon Sep 17 00:00:00 2001 From: mlarouche Date: Thu, 17 Oct 2024 08:58:49 -0400 Subject: [PATCH] Fix issue with new buffered reader from the std lib, all tests passed now --- src/buffered_stream_source.zig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/buffered_stream_source.zig b/src/buffered_stream_source.zig index 6ce12eb..6851ef4 100644 --- a/src/buffered_stream_source.zig +++ b/src/buffered_stream_source.zig @@ -31,7 +31,15 @@ pub fn BufferedStreamSourceReader(comptime BufferSize: usize) type { return switch (self.buffered_reader.unbuffered_reader.context.*) { .buffer => |*actual_reader| actual_reader.read(dest), .const_buffer => |*actual_reader| actual_reader.read(dest), - .file => self.buffered_reader.read(dest), + .file => { + var index: usize = 0; + while (index < dest.len) { + const amt = try self.buffered_reader.read(dest[index..]); + if (amt == 0) break; + index += amt; + } + return index; + }, }; }