@@ -556,7 +556,7 @@ module HeaderReader(Async: ASYNC)(Reader: READER with type 'a t = 'a Async.t) =
556
556
open Reader
557
557
558
558
559
- let read ?level (ifd : Reader.in_channel ) : (Header.t, [ `Eof ]) Result. result t =
559
+ let read ?level (ifd : Reader.in_channel ) : (Header.t, [ `Eof ]) result t =
560
560
let level = Header. get_level level in
561
561
(* We might need to read 2 headers at once if we encounter a Pax header *)
562
562
let buffer = Cstruct. create Header. length in
@@ -589,8 +589,8 @@ module HeaderReader(Async: ASYNC)(Reader: READER with type 'a t = 'a Async.t) =
589
589
begin match Header. unmarshal ~level ~extended real_header_buf with
590
590
| None ->
591
591
(* Corrupt pax headers *)
592
- return (Result. Error `Eof )
593
- | Some x -> return (Result. Ok x)
592
+ return (Error `Eof )
593
+ | Some x -> return (Ok x)
594
594
end
595
595
| Some x when x.Header. link_indicator = Header.Link. LongLink && x.Header. file_name = longlink ->
596
596
let extra_header_buf = Cstruct. create (Int64. to_int x.Header. file_size) in
@@ -601,19 +601,19 @@ module HeaderReader(Async: ASYNC)(Reader: READER with type 'a t = 'a Async.t) =
601
601
let file_name = Cstruct. (to_string @@ sub extra_header_buf 0 (len extra_header_buf - 1 )) in
602
602
begin next ()
603
603
>> = function
604
- | None -> return (Result. Error `Eof )
605
- | Some x -> return (Result. Ok { x with file_name })
604
+ | None -> return (Error `Eof )
605
+ | Some x -> return (Ok { x with file_name })
606
606
end
607
- | Some x -> return (Result. Ok x)
607
+ | Some x -> return (Ok x)
608
608
| None ->
609
609
begin
610
610
next ()
611
611
>> = function
612
- | Some x -> return (Result. Ok x)
613
- | None -> return (Result. Error `Eof )
612
+ | Some x -> return (Ok x)
613
+ | None -> return (Error `Eof )
614
614
end in
615
615
616
- let rec read_header (file_name , link_name , hdr ) : (Header.t, [`Eof]) Result. result Async.t =
616
+ let rec read_header (file_name , link_name , hdr ) : (Header.t, [`Eof]) result Async.t =
617
617
let raw_link_indicator = Header. get_hdr_link_indicator buffer in
618
618
if (raw_link_indicator = 75 || raw_link_indicator = 76 ) && level = Header. GNU then
619
619
let data = Cstruct. create (Int64. to_int hdr.Header. file_size) in
@@ -625,20 +625,20 @@ module HeaderReader(Async: ASYNC)(Reader: READER with type 'a t = 'a Async.t) =
625
625
let data = Header. unmarshal_string (Cstruct. to_string data) in
626
626
get_hdr ()
627
627
>> = function
628
- | Result. Error `Eof -> return (Result. Error `Eof )
629
- | Result. Ok hdr ->
628
+ | Error `Eof -> return (Error `Eof )
629
+ | Ok hdr ->
630
630
if raw_link_indicator = 75
631
631
then read_header (file_name, data, hdr)
632
632
else read_header (data, link_name, hdr)
633
633
else begin
634
634
let link_name = if link_name = " " then hdr.Header. link_name else link_name in
635
635
let file_name = if file_name = " " then hdr.Header. file_name else file_name in
636
- return (Result. Ok {hdr with Header. link_name; file_name })
636
+ return (Ok {hdr with Header. link_name; file_name })
637
637
end in
638
638
get_hdr ()
639
639
>> = function
640
- | Result. Error `Eof -> return (Result. Error `Eof )
641
- | Result. Ok hdr ->
640
+ | Error `Eof -> return (Error `Eof )
641
+ | Ok hdr ->
642
642
read_header (" " , " " , hdr)
643
643
644
644
end
@@ -775,11 +775,11 @@ module Make (IO : IO) = struct
775
775
skips past the zero padding to the next header *)
776
776
let with_next_file (fd : IO.in_channel ) (f : IO.in_channel -> Header.t -> 'a ) =
777
777
match HR. read fd with
778
- | Result. Ok hdr ->
778
+ | Ok hdr ->
779
779
(* NB if the function 'f' fails we're boned *)
780
780
finally (fun () -> f fd hdr)
781
781
(fun () -> Reader. skip fd (Header. compute_zero_padding_length hdr))
782
- | Result. Error `Eof -> raise Header. End_of_stream
782
+ | Error `Eof -> raise Header. End_of_stream
783
783
784
784
(* * List the contents of a tar *)
785
785
let list ?level fd =
@@ -788,11 +788,11 @@ module Make (IO : IO) = struct
788
788
try
789
789
while true do
790
790
match HR. read ~level fd with
791
- | Result. Ok hdr ->
791
+ | Ok hdr ->
792
792
list := hdr :: ! list ;
793
793
Reader. skip fd (Int64. to_int hdr.Header. file_size);
794
794
Reader. skip fd (Header. compute_zero_padding_length hdr)
795
- | Result. Error `Eof -> raise Header. End_of_stream
795
+ | Error `Eof -> raise Header. End_of_stream
796
796
done ;
797
797
List. rev ! list ;
798
798
with
@@ -821,14 +821,14 @@ module Make (IO : IO) = struct
821
821
try
822
822
while true do
823
823
match HR. read ifd with
824
- | Result. Ok hdr ->
824
+ | Ok hdr ->
825
825
let size = hdr.Header. file_size in
826
826
let padding = Header. compute_zero_padding_length hdr in
827
827
let ofd = dest hdr in
828
828
copy_n ifd ofd size;
829
829
IO. close_out ofd;
830
830
Reader. skip ifd padding
831
- | Result. Error `Eof -> raise Header. End_of_stream
831
+ | Error `Eof -> raise Header. End_of_stream
832
832
done
833
833
with
834
834
| End_of_file -> failwith " Unexpected end of file while reading stream"
@@ -850,8 +850,8 @@ module Make (IO : IO) = struct
850
850
include Header
851
851
852
852
let get_next_header ?level ic = match HR. read ?level ic with
853
- | Result. Ok hdr -> hdr
854
- | Result. Error `Eof -> raise Header. End_of_stream
853
+ | Ok hdr -> hdr
854
+ | Error `Eof -> raise Header. End_of_stream
855
855
856
856
end
857
857
end
0 commit comments