@@ -435,15 +435,15 @@ pub fn Iterator(comptime SeekableStream: type) type {
435
435
uncompressed_size : u64 ,
436
436
file_offset : u64 ,
437
437
438
- /// Extract this entry. `extractor ` must implement `createFile` and `createDir`.
438
+ /// Extract this entry. `extract_context ` must implement `createFile` and `createDir`.
439
439
/// The return type of `createFile` must implement `writer` and `close`.
440
440
/// See also `extract`.
441
441
pub fn extract_to (
442
442
self : Entry ,
443
443
stream : SeekableStream ,
444
444
options : ExtractOptions ,
445
445
filename_buf : []u8 ,
446
- extractor : anytype ,
446
+ extract_context : anytype ,
447
447
) ! u32 {
448
448
if (filename_buf .len < self .filename_len )
449
449
return error .ZipInsufficientBuffer ;
@@ -535,7 +535,7 @@ pub fn Iterator(comptime SeekableStream: type) type {
535
535
if (filename [filename .len - 1 ] == '/' ) {
536
536
if (self .uncompressed_size != 0 )
537
537
return error .ZipBadDirectorySize ;
538
- try extractor .createDir (filename [0 .. filename .len - 1 ]);
538
+ try extract_context .createDir (filename [0 .. filename .len - 1 ]);
539
539
return std .hash .Crc32 .hash (&.{});
540
540
}
541
541
@@ -545,7 +545,7 @@ pub fn Iterator(comptime SeekableStream: type) type {
545
545
local_data_header_offset ;
546
546
try stream .seekTo (local_data_file_offset );
547
547
var limited_reader = std .io .limitedReader (stream .context .reader (), self .compressed_size );
548
- var file = try extractor .createFile (filename );
548
+ var file = try extract_context .createFile (filename );
549
549
defer file .close ();
550
550
const crc = try decompress (
551
551
self .compression_method ,
@@ -566,13 +566,13 @@ pub fn Iterator(comptime SeekableStream: type) type {
566
566
filename_buf : []u8 ,
567
567
dest : std.fs.Dir ,
568
568
) ! u32 {
569
- return self .extract_to (stream , options , filename_buf , FsExtractor { .dest = dest });
569
+ return self .extract_to (stream , options , filename_buf , FsExtractContext { .dest = dest });
570
570
}
571
571
};
572
572
};
573
573
}
574
574
575
- const FsExtractor = struct {
575
+ const FsExtractContext = struct {
576
576
dest : std.fs.Dir ,
577
577
578
578
fn createDir (self : @This (), name : []u8 ) ! void {
@@ -721,14 +721,14 @@ test "zip verify filenames" {
721
721
try testZipError (error .ZipFilenameHasBackslash , .{ .name = "foo\\ bar" , .content = "" , .compression = .store }, .{});
722
722
}
723
723
724
- test "zip extract file to memory" {
724
+ test "zip extract to memory" {
725
725
const test_files = [_ ]File {
726
726
.{ .name = "a.txt" , .content = "aaa" , .compression = .store },
727
727
};
728
728
729
729
var extracted = std .ArrayList (u8 ).init (std .testing .allocator );
730
730
defer extracted .deinit ();
731
- var extractor = struct {
731
+ var ctx = struct {
732
732
writer : std .ArrayList (u8 ).Writer ,
733
733
734
734
const Extractor = @This ();
@@ -753,7 +753,7 @@ test "zip extract file to memory" {
753
753
var iter = try Iterator (@TypeOf (stream )).init (stream );
754
754
const entry = (try iter .next ()).? ;
755
755
var filename_buf : [8 ]u8 = undefined ;
756
- _ = try entry .extract_to (stream , .{}, & filename_buf , & extractor );
756
+ _ = try entry .extract_to (stream , .{}, & filename_buf , & ctx );
757
757
758
758
const content = comptime test_files [0 ].content ;
759
759
try std .testing .expectEqualSlices (u8 , content , extracted .items );
0 commit comments