Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix compilation with OCaml 4.03.0
  • Loading branch information
baskerville authored and ygrek committed Jan 23, 2017
1 parent 05d5be4 commit 30e77e2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 43 deletions.
1 change: 0 additions & 1 deletion src/networks/donkey/donkeyGlobals.ml
Expand Up @@ -781,7 +781,6 @@ let set_client_name c name md4 =
c.client_md4 <- md4;
end

exception ClientFound of client
let find_client_by_name name =
try
H.iter (fun c ->
Expand Down
2 changes: 0 additions & 2 deletions src/utils/cdk/zip.ml
Expand Up @@ -72,8 +72,6 @@ type out_file =
mutable of_entries: entry list;
of_comment: string }

exception Error of string * string * string

(* Return the position of the last occurrence of s1 in s2, or -1 if not
found. *)

Expand Down
41 changes: 1 addition & 40 deletions src/utils/lib/options.ml4
Expand Up @@ -330,45 +330,6 @@ the last defined one ("defined" in the order of the program execution).

let exit_exn = Exit


let unsafe_get = String.unsafe_get
external is_printable : char -> bool = "caml_is_printable"
let unsafe_set = String.unsafe_set

let escaped s =
let n = ref 0 in
for i = 0 to String.length s - 1 do
n :=
!n +
(match unsafe_get s i with
'"' | '\\' -> 2
| '\n' | '\t' -> 1
| c -> if is_printable c then 1 else 4)
done;
if !n = String.length s then s
else
let s' = String.create !n in
n := 0;
for i = 0 to String.length s - 1 do
begin match unsafe_get s i with
'"' | '\\' as c -> unsafe_set s' !n '\\'; incr n; unsafe_set s' !n c
| '\n' | '\t' as c -> unsafe_set s' !n c
| c ->
if is_printable c then unsafe_set s' !n c
else
let a = int_of_char c in
unsafe_set s' !n '\\';
incr n;
unsafe_set s' !n (char_of_int (48 + a / 100));
incr n;
unsafe_set s' !n (char_of_int (48 + a / 10 mod 10));
incr n;
unsafe_set s' !n (char_of_int (48 + a mod 10))
end;
incr n
done;
s'

let safe_string s =
if s = "" then "\"\""
else
Expand All @@ -388,7 +349,7 @@ let safe_string s =
s
else raise exit_exn
with
_ -> Printf.sprintf "\"%s\"" (escaped s)
_ -> Printf.sprintf "\"%s\"" (String.escaped s)

let with_help = ref false
let save_private = ref false
Expand Down

0 comments on commit 30e77e2

Please sign in to comment.