aboutsummaryrefslogtreecommitdiff
path: root/lib/util.ml
diff options
context:
space:
mode:
authorMaxime Dénès2017-03-21 15:26:17 +0100
committerMaxime Dénès2017-03-21 15:33:20 +0100
commit28d3bb3c8bddc63d038d8d55a34c928675fa9f7b (patch)
tree1eb3fd20c42622c9a1ca7f9349068f7301274038 /lib/util.ml
parentbecc6ef43a0f838d1f6388e8c7373c13f26082bc (diff)
parentd25b1431eb73a04bdfc0f1ad2922819b69bba93a (diff)
Merge PR#134: Enable `-safe-string`
Diffstat (limited to 'lib/util.ml')
-rw-r--r--lib/util.ml8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/util.ml b/lib/util.ml
index 9fb0d48ee8..0d2425f271 100644
--- a/lib/util.ml
+++ b/lib/util.ml
@@ -161,11 +161,11 @@ let iraise = Exninfo.iraise
let open_utf8_file_in fname =
let is_bom s =
- Int.equal (Char.code s.[0]) 0xEF &&
- Int.equal (Char.code s.[1]) 0xBB &&
- Int.equal (Char.code s.[2]) 0xBF
+ Int.equal (Char.code (Bytes.get s 0)) 0xEF &&
+ Int.equal (Char.code (Bytes.get s 1)) 0xBB &&
+ Int.equal (Char.code (Bytes.get s 2)) 0xBF
in
let in_chan = open_in fname in
- let s = " " in
+ let s = Bytes.make 3 ' ' in
if input in_chan s 0 3 < 3 || not (is_bom s) then seek_in in_chan 0;
in_chan