From 9cb0e7768b7e0281a38686088cedeaee4d74790a Mon Sep 17 00:00:00 2001 From: gautier.hattenberger Date: Sun, 22 Mar 2020 11:23:12 +0000 Subject: update to 1.3.2 fix depreciated String issue --- debian/changelog | 7 +++++++ ivy.ml | 14 +++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2b4e868..53fb75a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ivy-ocaml (1.3.2) unstable; urgency=medium + + * fix depreciated use of String create and set as they are immutable since + ocaml 4.06 + + -- Gautier Hattenberger Sun, 22 Mar 2020 12:01:08 +0100 + ivy-ocaml (1.3.1) unstable; urgency=low * maintenance on Makefiles and META files diff --git a/ivy.ml b/ivy.ml index f031252..d12ae6f 100644 --- a/ivy.ml +++ b/ivy.ml @@ -55,21 +55,21 @@ let hexa_code = fun c -> let hexa_of_string = fun s -> let n = String.length s in - let h = String.create (n*2) in + let h = Bytes.create (n*2) in for i = 0 to n - 1 do let c = Char.code s.[i] in - h.[2*i] <- hexa_char (c lsr 4); - h.[2*i+1] <- hexa_char (c land 0xf) + Bytes.set h (2*i) (hexa_char (c lsr 4)); + Bytes.set h (2*i+1) (hexa_char (c land 0xf)) done; - h + Bytes.to_string h let string_of_hexa = fun h -> let n = String.length h / 2 in - let s = String.create n in + let s = Bytes.create n in for i = 0 to n - 1 do - s.[i] <- Char.chr (hexa_code h.[2*i] lsl 4 + hexa_code h.[2*i+1]) + Bytes.set s i (Char.chr (hexa_code h.[2*i] lsl 4 + hexa_code h.[2*i+1])) done; - s + Bytes.to_string s let send_data = fun tag value -> -- cgit v1.1