Commit dda35157 authored by Gerd Stolpmann's avatar Gerd Stolpmann

keep support for OCaml-4.01

parent 6063afcf
......@@ -94,11 +94,11 @@ tag:
echo "Error: not on master branch"; \
exit 1; \
fi
@status="$$(git status -uno -s)"; \
@status="$$(git status -uno -s)"; \
if [ -n "$$status" ]; then echo "Error: git status not clean"; exit 1; fi
git tag -a -m "netamqp-$(version)" netamqp-$(version)
git push origin master
@echo "New tag: netamqp-$(version)"
git tag -a -m "netamqp-$(version)" netamqp-$(version)
git push origin master
@echo "New tag: netamqp-$(version)"
.PHONY: _oasis
_oasis: _oasis.in
......
......@@ -91,6 +91,18 @@ let mem_dummy() =
let mk_mstring s =
Netxdr_mstring.bytes_based_mstrings # create_from_bytes
s 0 (Bytes.length s) false
let buffer_add_subbytes buf by pos len =
(* emulation of Buffer.add_subbytes *)
(* TODO: for OCaml>=4.02 use Buffer.add_subbytes directly *)
Buffer.add_string buf (Bytes.unsafe_to_string (Bytes.sub by pos len))
let buffer_to_bytes buf =
(* emulation of Buffer.to_bytes *)
(* TODO: for OCaml>=4.02 use Buffer.to_bytes directly *)
Bytes.unsafe_of_string (Buffer.contents buf)
exception Continue of (unit -> unit)
......@@ -335,8 +347,8 @@ object(self)
| (`Bytes(s1,p1,l1) as i1) :: (`Bytes(s2,p2,l2) as i2) :: items' ->
if l1 < 256 && l2 < 256 then (
let b = Buffer.create (l1+l2) in
Buffer.add_subbytes b s1 p1 l1;
Buffer.add_subbytes b s2 p2 l2;
buffer_add_subbytes b s1 p1 l1;
buffer_add_subbytes b s2 p2 l2;
gather_items b items'
)
else
......@@ -349,10 +361,10 @@ object(self)
and gather_items b items =
match items with
| `Bytes(s,p,l) :: items' when l < 256 ->
Buffer.add_subbytes b s p l;
buffer_add_subbytes b s p l;
gather_items b items'
| _ ->
`Bytes(Buffer.to_bytes b, 0, Buffer.length b) ::
`Bytes(buffer_to_bytes b, 0, Buffer.length b) ::
optimize_items items in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment