zip-zig

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 3fb260c67ed2812f24cadb154fa10cfc5d1a84f8
parent a8456d6e83a49ce8cb3ad9a7733cd98dcf26c280
Author: Martin Ashby <martin@ashbysoft.com>
Date:   Fri, 15 Sep 2023 22:13:08 +0100

Public functions where appropriate

Diffstat:
Msrc/main.zig | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main.zig b/src/main.zig @@ -58,7 +58,7 @@ allocator: std.mem.Allocator, end_of_central_directory_record: EndOfCentralDirectoryRecord, central_directory_headers: []CentralDirectoryHeader, -fn from(allocator: std.mem.Allocator, file_or_stream: anytype) !@This() { +pub fn from(allocator: std.mem.Allocator, file_or_stream: anytype) !@This() { // Find the EndOfCentralDirectoryRecord. It must be in the last 64k of the file const eocdr_search_width_max: usize = 64_000; const epos = try file_or_stream.getEndPos(); @@ -97,7 +97,7 @@ fn from(allocator: std.mem.Allocator, file_or_stream: anytype) !@This() { .central_directory_headers = central_directory_headers, }; } -fn deinit(self: *@This()) void { +pub fn deinit(self: *@This()) void { self.end_of_central_directory_record.deinit(self.allocator); for (0..self.central_directory_headers.len) |i| { self.central_directory_headers[i].deinit(self.allocator); @@ -105,16 +105,16 @@ fn deinit(self: *@This()) void { self.allocator.free(self.central_directory_headers); } -fn count_files(self: @This()) u16 { +pub fn count_files(self: @This()) u16 { return self.end_of_central_directory_record.total_central_dir_entries; } -fn file_name(self: @This(), index: u16) []const u8 { +pub fn file_name(self: @This(), index: u16) []const u8 { return self.central_directory_headers[index].file_name; } -fn file_comment(self: @This(), index: u16) []const u8 { +pub fn file_comment(self: @This(), index: u16) []const u8 { return self.central_directory_headers[index].file_comment; } -fn extract(self: @This(), index: u16, stream_or_file_in: anytype, stream_or_file_out: anytype) !void { +pub fn extract(self: @This(), index: u16, stream_or_file_in: anytype, stream_or_file_out: anytype) !void { const cdh = self.central_directory_headers[index]; try stream_or_file_in.seekTo(cdh.relative_offset_of_local_header); var lfh = try LocalFileHeader.read(self.allocator, stream_or_file_in);