add some asserts in data_encoding
This commit is contained in:
parent
dc32decd05
commit
669a0249ca
@ -1077,10 +1077,12 @@ let rec length : type x. x t -> x -> int = fun e ->
|
|||||||
|
|
||||||
let list read buf ofs len =
|
let list read buf ofs len =
|
||||||
let rec loop acc ofs len =
|
let rec loop acc ofs len =
|
||||||
|
assert (len >= 0);
|
||||||
if len <= 0
|
if len <= 0
|
||||||
then ofs, List.rev acc
|
then ofs, List.rev acc
|
||||||
else
|
else
|
||||||
let ofs', v = read buf ofs len in
|
let ofs', v = read buf ofs len in
|
||||||
|
assert (ofs' > ofs);
|
||||||
loop (v :: acc) ofs' (len - (ofs' - ofs))
|
loop (v :: acc) ofs' (len - (ofs' - ofs))
|
||||||
in
|
in
|
||||||
loop [] ofs len
|
loop [] ofs len
|
||||||
|
Loading…
Reference in New Issue
Block a user