summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane Glondu <steph@glondu.net>2019-09-12 09:14:27 +0200
committerStéphane Glondu <glondu@debian.org>2019-09-12 09:17:11 +0200
commitd9118632ae71657ab666bd5435d28992431c7fb0 (patch)
treee23ad835cf5d72602123778625917920a8cd3d9e
parent6cd8af6872251cdc60d77f4342fe26c6ee24cc06 (diff)
Fix compilation with OCaml 4.08.0
Gbp-Pq: Name 0004-Fix-compilation-with-OCaml-4.08.0.patch
-rw-r--r--XmlRpc.ml14
1 files changed, 8 insertions, 6 deletions
diff --git a/XmlRpc.ml b/XmlRpc.ml
index 9d81a79..d5c1f83 100644
--- a/XmlRpc.ml
+++ b/XmlRpc.ml
@@ -254,14 +254,16 @@ let message_of_xml_element
(* Workaround for Xml-Light, which doesn't like dots in tag names. *)
let fix_dotted_tags s =
let len = String.length s in
+ let s = Bytes.of_string s in
let in_tag = ref false in
for i = 0 to len - 1 do
- match s.[i] with
+ match Bytes.get s i with
| '<' -> in_tag := true
| '>' -> in_tag := false
| '.' when !in_tag -> s.[i] <- ':'
| _ -> ()
- done
+ done;
+ Bytes.to_string s
let pipe_process command data =
let (in_channel, out_channel) = Unix.open_process command in
@@ -274,7 +276,7 @@ let pipe_process command data =
let chars_read = ref 1 in
while !chars_read <> 0 do
chars_read := input in_channel string 0 buffer_size;
- Buffer.add_substring buffer string 0 !chars_read
+ Buffer.add_subbytes buffer string 0 !chars_read
done;
let status = Unix.close_process (in_channel, out_channel) in
(status, Buffer.contents buffer)
@@ -383,7 +385,7 @@ object (self)
match status with
| Unix.WEXITED 0 ->
if debug then prerr_endline contents;
- fix_dotted_tags contents;
+ let contents = fix_dotted_tags contents in
(match (message_of_xml_element
~base64_decoder
~datetime_decoder
@@ -457,7 +459,7 @@ object (self)
match call#status with
| `Successful ->
let contents = call#get_resp_body () in
- fix_dotted_tags contents;
+ let contents = fix_dotted_tags contents in
(match (message_of_xml_element
~base64_decoder
~datetime_decoder
@@ -553,7 +555,7 @@ let serve
?(datetime_decoder=XmlRpcDateTime.of_string)
?(error_handler=default_error_handler)
f s =
- fix_dotted_tags s;
+ let s = fix_dotted_tags s in
try
begin
try