diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-07-25 22:10:29 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-07-31 22:10:11 -0700 |
| commit | 83513ade3591de673e9ac4824fe974cd8f90c847 (patch) | |
| tree | 5a581e31b4b004061673ac1e44e669e1808be3bd /lib/std/debug/Dwarf.zig | |
| parent | a2d21d63270ebb5eec0d437f7726c261455da66b (diff) | |
| download | zig-83513ade3591de673e9ac4824fe974cd8f90c847.tar.gz zig-83513ade3591de673e9ac4824fe974cd8f90c847.zip | |
std.compress: rework flate to new I/O API
Diffstat (limited to 'lib/std/debug/Dwarf.zig')
| -rw-r--r-- | lib/std/debug/Dwarf.zig | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/std/debug/Dwarf.zig b/lib/std/debug/Dwarf.zig index 3f1fc41feb..5fa5dd002a 100644 --- a/lib/std/debug/Dwarf.zig +++ b/lib/std/debug/Dwarf.zig @@ -2235,18 +2235,14 @@ pub const ElfModule = struct { const section_bytes = try chopSlice(mapped_mem, shdr.sh_offset, shdr.sh_size); sections[section_index.?] = if ((shdr.sh_flags & elf.SHF_COMPRESSED) > 0) blk: { - var section_stream = std.io.fixedBufferStream(section_bytes); - const section_reader = section_stream.reader(); - const chdr = section_reader.readStruct(elf.Chdr) catch continue; + var section_reader: std.Io.Reader = .fixed(section_bytes); + const chdr = section_reader.takeStruct(elf.Chdr, endian) catch continue; if (chdr.ch_type != .ZLIB) continue; - var zlib_stream = std.compress.zlib.decompressor(section_reader); - - const decompressed_section = try gpa.alloc(u8, chdr.ch_size); + var zlib_stream: std.compress.flate.Decompress = .init(§ion_reader, .zlib, &.{}); + const decompressed_section = zlib_stream.reader.allocRemaining(gpa, .unlimited) catch continue; errdefer gpa.free(decompressed_section); - - const read = zlib_stream.reader().readAll(decompressed_section) catch continue; - assert(read == decompressed_section.len); + assert(chdr.ch_size == decompressed_section.len); break :blk .{ .data = decompressed_section, |
