breaking: change type of CCString.blit so it writes into Bytes.t

This commit is contained in:
Simon Cruanes 2015-06-26 13:59:57 +02:00
parent d6b1a62201
commit 0fcc736032
2 changed files with 11 additions and 7 deletions

View file

@ -35,8 +35,10 @@ module type S = sig
val length : t -> int val length : t -> int
val blit : t -> int -> t -> int -> int -> unit val blit : t -> int -> Bytes.t -> int -> int -> unit
(** See {!String.blit} *) (** Similar to {!String.blit}.
Compatible with the [-safe-string] option.
@raise Invalid_argument if indices are not valid *)
val fold : ('a -> char -> 'a) -> 'a -> t -> 'a val fold : ('a -> char -> 'a) -> 'a -> t -> 'a
@ -411,9 +413,9 @@ module Sub = struct
let length (_,_,l) = l let length (_,_,l) = l
let blit (a1,i1,len1) o1 (a2,i2,len2) o2 len = let blit (a1,i1,len1) o1 a2 o2 len =
if o1+len>len1 || o2+len>len2 then invalid_arg "CCString.Sub.blit"; if o1+len>len1 then invalid_arg "CCString.Sub.blit";
String.blit a1 (i1+o1) a2 (i2+o2) len blit a1 (i1+o1) a2 o2 len
let fold f acc (s,i,len) = let fold f acc (s,i,len) =
let rec fold_rec f acc s i j = let rec fold_rec f acc s i j =

View file

@ -40,8 +40,10 @@ module type S = sig
val length : t -> int val length : t -> int
val blit : t -> int -> t -> int -> int -> unit val blit : t -> int -> Bytes.t -> int -> int -> unit
(** See {!String.blit} *) (** Similar to {!String.blit}.
Compatible with the [-safe-string] option.
@raise Invalid_argument if indices are not valid *)
val fold : ('a -> char -> 'a) -> 'a -> t -> 'a val fold : ('a -> char -> 'a) -> 'a -> t -> 'a
(** Fold on chars by increasing index. (** Fold on chars by increasing index.