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 --- ivy.ml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'ivy.ml') 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