diff options
author | gautier.hattenberger | 2020-03-22 11:23:12 +0000 |
---|---|---|
committer | gautier.hattenberger | 2020-03-22 11:23:12 +0000 |
commit | 9cb0e7768b7e0281a38686088cedeaee4d74790a (patch) | |
tree | c68fbc33ba603b7a7af13706d6e145a535f2c8db /ivy.ml | |
parent | 1e696cd276931081d0bfec92f45a9ac023facd98 (diff) | |
download | ivy-ocaml-master.zip ivy-ocaml-master.tar.gz ivy-ocaml-master.tar.bz2 ivy-ocaml-master.tar.xz |
fix depreciated String issue
Diffstat (limited to 'ivy.ml')
-rw-r--r-- | ivy.ml | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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 -> |