-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
std.Io.Reader: use readVec for fill functions #24706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I believe the panic.z and fail_read.z cases both still fail, but with this error trace: const std = @import("std");
const flate = std.compress.flate;
pub fn main() !void {
const input_file = try std.fs.cwd().openFile("panic.z", .{});
var input_buffer: [4096]u8 = undefined;
var input_reader = input_file.reader(&input_buffer);
var buffer: [flate.max_window_len]u8 = undefined;
var decompress: flate.Decompress = .init(&input_reader.interface, .zlib, &buffer);
// should decompress to 4160 bytes
var out_buffer: [4160]u8 = undefined;
var out_writer: std.Io.Writer = .fixed(&out_buffer);
const written = try decompress.reader.streamRemaining(&out_writer);
std.debug.print("decompressed {} bytes\n", .{written});
} fails with
|
readVec has two updated responsibilities: 1. it must respect any existing already buffered data. 2. it must write to the buffer if data is empty
@mrjbq7 I believe you ran that before I had this branch even working locally. I tried your example after latest push and it prints
|
Sorry, I didn't realize it was WIP. Can confirm this branch fixes both panic.z and fail_read.z! |
Thanks for checking! |
addresses #24695, as well as just being a better, simpler implementation for these functions now that readVec is back in the vtable.