Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fmt #51

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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