Skip to content

Commit 1462be3

Browse files
sim642raphael-proust
authored andcommitted
Fix Lwt_io.read_value on OCaml 5.1
The Marshal header size was changed in ocaml/ocaml#12006.
1 parent e0ebd72 commit 1462be3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/unix/lwt_io.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -842,12 +842,12 @@ struct
842842
Lwt.return (Bytes.unsafe_to_string buf)
843843

844844
let read_value ic =
845-
let header = Bytes.create 20 in
846-
unsafe_read_into_exactly ic header 0 20 >>= fun () ->
845+
let header = Bytes.create Marshal.header_size in
846+
unsafe_read_into_exactly ic header 0 Marshal.header_size >>= fun () ->
847847
let bsize = Marshal.data_size header 0 in
848-
let buffer = Bytes.create (20 + bsize) in
849-
Bytes.unsafe_blit header 0 buffer 0 20;
850-
unsafe_read_into_exactly ic buffer 20 bsize >>= fun () ->
848+
let buffer = Bytes.create (Marshal.header_size + bsize) in
849+
Bytes.unsafe_blit header 0 buffer 0 Marshal.header_size;
850+
unsafe_read_into_exactly ic buffer Marshal.header_size bsize >>= fun () ->
851851
Lwt.return (Marshal.from_bytes buffer 0)
852852

853853
(* +---------------------------------------------------------------+

0 commit comments

Comments
 (0)