File tree 1 file changed +3
-10
lines changed
1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -698,7 +698,7 @@ pub const File = struct {
698
698
header_count : usize = 0 ,
699
699
};
700
700
701
- pub const WriteFileError = ReadError || WriteError ;
701
+ pub const WriteFileError = ReadError || error { EndOfStream } || WriteError ;
702
702
703
703
pub fn writeFileAll (self : File , in_file : File , args : WriteFileOptions ) WriteFileError ! void {
704
704
return self .writeFileAllSendfile (in_file , args ) catch | err | switch (err ) {
@@ -722,16 +722,9 @@ pub const File = struct {
722
722
723
723
try self .writevAll (headers );
724
724
725
+ try in_file .reader ().skipBytes (args .in_offset , .{ .buf_size = 4096 });
726
+
725
727
var buffer : [4096 ]u8 = undefined ;
726
- {
727
- var index : usize = 0 ;
728
- // Skip in_offset bytes.
729
- while (index < args .in_offset ) {
730
- const ask = math .min (buffer .len , args .in_offset - index );
731
- const amt = try in_file .read (buffer [0.. ask ]);
732
- index += amt ;
733
- }
734
- }
735
728
const in_len = args .in_len orelse math .maxInt (u64 );
736
729
var index : usize = 0 ;
737
730
while (index < in_len ) {
You can’t perform that action at this time.
0 commit comments