authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-28 20:14:21-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-28 20:14:21-07:00
logb3ad45f267f4402855613f100c82b12f950b8143
tree17e5acffe5bc9843059d7362d032dbfafc8d197c
parentf5aad472873a37eba2f15d0ece9d1e813fa93d06

std.tar: avoid dependency on file system

In the iterator function which is the low-level API, don't depend on `std.fs.MAX_PATH_BYTES` because this is not defined on all operating systems, such as freestanding. However in such environments it still makes sense to be able to extract from a tar file. An even more flexible solution would be to accept the buffers as arguments to iterator() which I think is a good idea, but for now let's just set the same upper limmit across all operating systems.

1 files changed, 2 insertions(+), 2 deletions(-)

lib/std/tar.zig+2-2
...@@ -247,8 +247,8 @@ fn Iterator(comptime ReaderType: type) type {...@@ -247,8 +247,8 @@ fn Iterator(comptime ReaderType: type) type {
247247
248 // buffers for heeader and file attributes248 // buffers for heeader and file attributes
249 header_buffer: [Header.SIZE]u8 = undefined,249 header_buffer: [Header.SIZE]u8 = undefined,
250 file_name_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined,250 file_name_buffer: [1024]u8 = undefined,
251 link_name_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined,251 link_name_buffer: [1024]u8 = undefined,
252252
253 // bytes of padding to the end of the block253 // bytes of padding to the end of the block
254 padding: usize = 0,254 padding: usize = 0,