ocaml-ocamlnet/ocamlnet-4.1.4-bytes-fixes.patch
2017-11-08 16:26:54 +00:00

55 lines
2.1 KiB
Diff

--- ocamlnet-4.1.4.old/src/netzip/netgzip.ml 2017-08-14 14:16:50.000000000 +0100
+++ ocamlnet-4.1.4/src/netzip/netgzip.ml 2017-11-08 16:24:22.162165338 +0000
@@ -7,7 +7,6 @@
val mutable closed = false
method input s p l =
- let s = Bytes.unsafe_to_string s in
let n = Gzip.input gzip_ch s p l in
if n = 0 then raise End_of_file;
n
@@ -27,7 +26,6 @@
class output_gzip_rec gzip_ch : Netchannels.rec_out_channel =
object(self)
method output s p l =
- let s = Bytes.unsafe_to_string s in
Gzip.output gzip_ch s p l;
l
method close_out() =
@@ -156,8 +154,6 @@
(fun out_buf out_pos out_len ->
let (finished, used_in, used_out) =
try
- let in_buf = Bytes.unsafe_to_string in_buf in
- let out_buf = Bytes.unsafe_to_string out_buf in
Zlib.inflate
stream
in_buf in_pos in_len out_buf out_pos out_len
@@ -170,8 +166,7 @@
st.in_size <-
Int32.add st.in_size (Int32.of_int used_out);
st.in_crc <-
- ( let out_buf = Bytes.unsafe_to_string out_buf in
- Zlib.update_crc st.in_crc out_buf out_pos used_out
+ ( Zlib.update_crc st.in_crc out_buf out_pos used_out
);
k := !k + used_in;
@@ -292,8 +287,6 @@
(fun out_buf out_pos out_len ->
let (finished, used_in, used_out) =
try
- let in_buf = Bytes.unsafe_to_string in_buf in
- let out_buf = Bytes.unsafe_to_string out_buf in
Zlib.deflate
stream in_buf 0 in_len out_buf out_pos out_len
(if at_eof then Zlib.Z_FINISH else Zlib.Z_NO_FLUSH)
@@ -305,7 +298,6 @@
st.out_size <- Int32.add st.out_size (Int32.of_int used_in);
st.out_crc <- (
- let in_buf = Bytes.unsafe_to_string in_buf in
Zlib.update_crc st.out_crc in_buf 0 used_in
);