Finished up some errors

Kinda finished extraction
This commit is contained in:
Caleb Gardner
2026-05-13 06:21:01 -05:00
parent 78d1ee2937
commit 700993b0e3
9 changed files with 190 additions and 61 deletions
+4 -4
View File
@@ -19,7 +19,7 @@ alloc: std.mem.Allocator,
block_size: u32,
buffers: std.ArrayList(Buffer),
buffer_queue: std.SinglyLinkedList,
buffer_queue: std.SinglyLinkedList = .{},
pub fn init(alloc: std.mem.Allocator, block_size: u32) !Self {
return .{
@@ -41,15 +41,15 @@ fn decomp(d: ?*const Decompressor, alloc: std.mem.Allocator, in: []u8, out: []u8
defer alloc.free(buf);
return zlibDecomp(buf, in, out);
}
var self: Self = @fieldParentPtr("interface", d.?);
var self: *Self = @fieldParentPtr("interface", @constCast(d.?));
const buf_node = self.buffer_queue.popFirst();
var buf: *Buffer = undefined;
if (buf_node == null) {
const new_buf = try self.buffers.addOne(self.alloc);
new_buf.* = .{ .{}, try self.alloc.alloc(u8, self.block_size) };
new_buf.* = .{ .node = .{}, .buf = try self.alloc.alloc(u8, self.block_size) };
buf = new_buf;
} else {
buf = @fieldParentPtr("node", buf_node);
buf = @fieldParentPtr("node", buf_node.?);
}
defer self.buffer_queue.prepend(&buf.node);
return zlibDecomp(buf.buf, in, out);