|
rpm-build |
0f2925 |
open ExtBytes
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
module Buffer = struct
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
include Buffer
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
#if OCAML < 402
|
|
rpm-build |
0f2925 |
(* The uses of unsafe_{of,to}_string above are not semantically
|
|
rpm-build |
0f2925 |
justified, as the Buffer implementation may very well capture and
|
|
rpm-build |
0f2925 |
share parts of its internal buffer, or of input string given as
|
|
rpm-build |
0f2925 |
input.
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
They are however correct with respect to the implementation being
|
|
rpm-build |
0f2925 |
used in OCaml 4.02.0; this implementation must be revisited if
|
|
rpm-build |
0f2925 |
the string representation changes. *)
|
|
rpm-build |
0f2925 |
let to_bytes b =
|
|
rpm-build |
0f2925 |
Bytes.unsafe_of_string (contents b)
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
let add_subbytes b s offset len =
|
|
rpm-build |
0f2925 |
add_substring b (Bytes.unsafe_to_string s) offset len
|
|
rpm-build |
0f2925 |
|
|
rpm-build |
0f2925 |
let add_bytes b s = add_string b (Bytes.unsafe_to_string s)
|
|
rpm-build |
0f2925 |
#endif
|
|
rpm-build |
0f2925 |
end
|