| Attached Files | buffer-blit.patch [^] (700 bytes) 2008-11-16 19:47 [Show Content] [Hide Content]50a51,58
> val blit : t -> int -> string -> int -> int -> unit
> (** [Buffer.blit b srcoff dst dstoff len] copies [len] characters from
> the current contents of the buffer [b] starting at offset [off],
> starting at character number [srcoff], to string [dst], starting at
> character number [dstoff]. Raise [Invalid_argument] if [srcoff]
> and [len] do not designate a valid substring of the buffer, or if
> [dstoff] and [len] do not designate a valid substring of [dst]. *)
>
41a42,48
> let blit b srcoff dst dstoff len =
> if srcoff < 0 || len < 0 || srcoff > b.position - len
> then invalid_arg "Buffer.blit"
> else
> String.blit b.buffer srcoff dst dstoff len
> ;;
>
buffer-blit2.patch [^] (1,576 bytes) 2008-11-16 19:55 [Show Content] [Hide Content]Common subdirectories: stdlib-orig/CVS and stdlib/CVS
diff -c stdlib-orig/buffer.ml stdlib/buffer.ml
*** stdlib-orig/buffer.ml Sun Nov 16 10:52:50 2008
--- stdlib/buffer.ml Sun Nov 16 10:38:14 2008
***************
*** 39,44 ****
--- 39,51 ----
end
;;
+ let blit b srcoff dst dstoff len =
+ if srcoff < 0 || len < 0 || srcoff > b.position - len
+ then invalid_arg "Buffer.blit"
+ else
+ String.blit b.buffer srcoff dst dstoff len
+ ;;
+
let nth b ofs =
if ofs < 0 || ofs >= b.position then
invalid_arg "Buffer.nth"
diff -c stdlib-orig/buffer.mli stdlib/buffer.mli
*** stdlib-orig/buffer.mli Sun Nov 16 10:52:50 2008
--- stdlib/buffer.mli Sun Nov 16 10:38:14 2008
***************
*** 48,53 ****
--- 48,61 ----
[len] bytes. May raise [Invalid_argument] if out of bounds request. The
buffer itself is unaffected. *)
+ val blit : t -> int -> string -> int -> int -> unit
+ (** [Buffer.blit b srcoff dst dstoff len] copies [len] characters from
+ the current contents of the buffer [b] starting at offset [off],
+ starting at character number [srcoff], to string [dst], starting at
+ character number [dstoff]. Raise [Invalid_argument] if [srcoff]
+ and [len] do not designate a valid substring of the buffer, or if
+ [dstoff] and [len] do not designate a valid substring of [dst]. *)
+
val nth : t -> int -> char
(** get the n-th character of the buffer. Raise [Invalid_argument] if
index out of bounds *)
Common subdirectories: stdlib-orig/caml and stdlib/caml
Common subdirectories: stdlib-orig/cduce and stdlib/cduce
|