Skip to content

Commit

Permalink
Merge pull request #51 from mbarbin/fix-fmt
Browse files Browse the repository at this point in the history
Fix fmt
  • Loading branch information
dinosaure authored Jan 6, 2025
2 parents 01b7521 + 96cdd16 commit 089eec9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
4 changes: 4 additions & 0 deletions lib/.ocamlformat-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ocamlformat is disabled in this file, but `dune build @fmt` still fails.
# Disabling ocamlformat here is a temporary workaround.
# Issue reported: https://github.com/ocaml-ppx/ocamlformat/issues/2641
miou_vector.mli
15 changes: 4 additions & 11 deletions lib/miou_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@ let rec unsafe_read ({ fd; non_blocking } as file_descr) off len buf =
blocking_read fd; go ()

let read file_descr ?(off = 0) ?len buf =
let len = match len with
| None -> Bytes.length buf - off
| Some len -> len
in
let len = match len with None -> Bytes.length buf - off | Some len -> len in
if off < 0 || len < 0 || off > Bytes.length buf - len then
invalid_arg "Miou_unix.read";
unsafe_read file_descr off len buf
Expand All @@ -169,10 +166,7 @@ let rec really_read_go file_descr off len buf =
really_read_go file_descr (off + len') (len - len') buf

let really_read file_descr ?(off = 0) ?len buf =
let len = match len with
| None -> Bytes.length buf - off
| Some len -> len
in
let len = match len with None -> Bytes.length buf - off | Some len -> len in
if off < 0 || len < 0 || off > Bytes.length buf - len then
invalid_arg "Miou_unix.really_read";
if len > 0 then really_read_go file_descr off len buf
Expand All @@ -199,9 +193,8 @@ let rec unsafe_write ({ fd; non_blocking } as file_descr) off len str =
blocking_write fd; go ()

let write file_descr ?(off = 0) ?len str =
let len = match len with
| None -> String.length str - off
| Some len -> len
let len =
match len with None -> String.length str - off | Some len -> len
in
if off < 0 || len < 0 || off > String.length str - len then
invalid_arg "Miou_unix.write";
Expand Down

0 comments on commit 089eec9

Please sign in to comment.