Skip to content

Commit 7eb7cbf

Browse files
authored
fixes copy and blitting implementations in regular (#1550)
Some definitions of the write type class were generating incorrect code due to a missing parameter.
1 parent 36d8dfd commit 7eb7cbf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/regular/regular_data_write.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ let bigstring_to_bigstring ~dst ~src dst_pos =
3030

3131
let copy_via_blit size blit ~dst x pos =
3232
let buf = Bigstring.create (size x) in
33-
blit buf x;
33+
blit buf x 0;
3434
bigstring_to_bytes ~dst ~src:buf pos
3535

3636
let blit_via_copy size copy ~dst x pos =
3737
let str = Bytes.create (size x) in
38-
copy str x;
38+
copy str x 0;
3939
bytes_to_bigstring ~dst ~src:str pos
4040

4141
let bytes_via_copy size copy x =
4242
let buf = Bytes.create (size x) in
43-
copy buf x;
43+
copy buf x 0;
4444
buf
4545

4646
let bigstring_via_blit size blit x =
@@ -53,7 +53,7 @@ let pp_bytes f x = Format.asprintf "%a" f x |> Bytes.of_string
5353
let create
5454
?to_bytes ?to_bigstring
5555
?dump ?pp ?size
56-
?blit_to_string:copy ?blit_to_bigstring:blit () =
56+
?blit_to_string:copy ?blit_to_bigstring:(blit:('a,bigstring) copy option) () =
5757
let to_bytes = match to_bytes,to_bigstring,pp with
5858
| Some f,_,_ -> Some f
5959
| None,Some f,_ -> Some (fun x -> Bigstring.to_bytes (f x))
@@ -70,7 +70,7 @@ let create
7070
| _,Some f,_,_ -> fun dst x -> bytes_to_bytes ~dst ~src:(f x)
7171
| _,_,Some f,_ -> fun dst x -> copy_via_blit size f ~dst x
7272
| _,_,_,Some f -> fun dst x -> bigstring_to_bytes ~dst ~src:(f x) in
73-
let blit = match blit,to_bytes,to_bigstring with
73+
let blit : ('a,bigstring) copy = match blit,to_bytes,to_bigstring with
7474
| Some f,_,_ -> f
7575
| _,Some f,_ -> fun dst x -> bytes_to_bigstring ~dst ~src:(f x)
7676
| _,_,Some f -> fun dst x -> bigstring_to_bigstring ~dst ~src:(f x)

0 commit comments

Comments
 (0)