From 2a85c34c67aeaa5bf14930118bc1e2bd8ad75dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Fri, 25 May 2018 16:46:55 +0200 Subject: [PATCH] Indentation fixes --- src/lib_data_encoding/binary_reader.ml | 12 +++--- src/lib_data_encoding/binary_stream_reader.ml | 12 +++--- src/lib_data_encoding/binary_writer.ml | 40 +++++++++---------- src/lib_stdlib/test-ocp-indent.sh | 1 + 4 files changed, 33 insertions(+), 32 deletions(-) diff --git a/src/lib_data_encoding/binary_reader.ml b/src/lib_data_encoding/binary_reader.ml index caae71eff..512439b24 100644 --- a/src/lib_data_encoding/binary_reader.ml +++ b/src/lib_data_encoding/binary_reader.ml @@ -63,12 +63,12 @@ module Atom = struct Int32.to_int (MBytes.get_int32 buffer ofs) let int = function - | `Int31 -> int31 - | `Int16 -> int16 - | `Int8 -> int8 - | `Uint30 -> uint30 - | `Uint16 -> uint16 - | `Uint8 -> uint8 + | `Int31 -> int31 + | `Int16 -> int16 + | `Int8 -> int8 + | `Uint30 -> uint30 + | `Uint16 -> uint16 + | `Uint8 -> uint8 let ranged_int ~minimum ~maximum state = let read_int = diff --git a/src/lib_data_encoding/binary_stream_reader.ml b/src/lib_data_encoding/binary_stream_reader.ml index 2e3f4bca5..0f4a604a5 100644 --- a/src/lib_data_encoding/binary_stream_reader.ml +++ b/src/lib_data_encoding/binary_stream_reader.ml @@ -110,12 +110,12 @@ module Atom = struct Int32.to_int (MBytes.get_int32 buffer ofs) let int = function - | `Int31 -> int31 - | `Int16 -> int16 - | `Int8 -> int8 - | `Uint30 -> uint30 - | `Uint16 -> uint16 - | `Uint8 -> uint8 + | `Int31 -> int31 + | `Int16 -> int16 + | `Int8 -> int8 + | `Uint30 -> uint30 + | `Uint16 -> uint16 + | `Uint8 -> uint8 let ranged_int ~minimum ~maximum resume state k = let read_int = diff --git a/src/lib_data_encoding/binary_writer.ml b/src/lib_data_encoding/binary_writer.ml index 2bf7a0ef8..446cf79bb 100644 --- a/src/lib_data_encoding/binary_writer.ml +++ b/src/lib_data_encoding/binary_writer.ml @@ -279,26 +279,26 @@ let rec write_rec : type a. a Encoding.t -> state -> a -> unit = and write_with_limit : type a. int -> a Encoding.t -> state -> a -> unit = fun limit e state value -> - (* backup the current limit *) - let old_limit = state.allowed_bytes in - (* install the new limit (only if smaller than the current limit) *) - let limit = - match state.allowed_bytes with - | None -> limit - | Some old_limit -> min old_limit limit in - state.allowed_bytes <- Some limit ; - write_rec e state value ; - (* restore the previous limit (minus the read bytes) *) - match old_limit with - | None -> - state.allowed_bytes <- None - | Some old_limit -> - let remaining = - match state.allowed_bytes with - | None -> assert false - | Some len -> len in - let read = limit - remaining in - state.allowed_bytes <- Some (old_limit - read) + (* backup the current limit *) + let old_limit = state.allowed_bytes in + (* install the new limit (only if smaller than the current limit) *) + let limit = + match state.allowed_bytes with + | None -> limit + | Some old_limit -> min old_limit limit in + state.allowed_bytes <- Some limit ; + write_rec e state value ; + (* restore the previous limit (minus the read bytes) *) + match old_limit with + | None -> + state.allowed_bytes <- None + | Some old_limit -> + let remaining = + match state.allowed_bytes with + | None -> assert false + | Some len -> len in + let read = limit - remaining in + state.allowed_bytes <- Some (old_limit - read) (** ******************** *) diff --git a/src/lib_stdlib/test-ocp-indent.sh b/src/lib_stdlib/test-ocp-indent.sh index d1e44de5a..19c6a5362 100755 --- a/src/lib_stdlib/test-ocp-indent.sh +++ b/src/lib_stdlib/test-ocp-indent.sh @@ -18,6 +18,7 @@ if [ -z "$files" ]; then files=` find \( -name _build -or \ -name .git -or \ -wholename ./src/environment/v1.ml -or \ + -name ocplib-json-typed -or \ -name registerer.ml \) -prune -or \ \( -name \*.ml -or -name \*.mli \) -print` fi