aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2017-02-23 13:34:17 +0100
committerEmilio Jesus Gallego Arias2017-03-14 20:50:38 +0100
commitb47bd5617018145332deaa75e42ddad0728d9638 (patch)
treea21a21680e8b5c83d4dd879d3a7521068bdedffa /lib
parentfea15b446444e522d405e97b9e18d84baabfc633 (diff)
[safe-string] lib/miscelanea
No functional change.js
Diffstat (limited to 'lib')
-rw-r--r--lib/pp_control.ml2
-rw-r--r--lib/util.ml8
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/pp_control.ml b/lib/pp_control.ml
index 890ffe0a18..ab8dc0798c 100644
--- a/lib/pp_control.ml
+++ b/lib/pp_control.ml
@@ -58,7 +58,7 @@ let with_fp chan out_function flush_function =
(* Output on a channel ch *)
let with_output_to ch =
- let ft = with_fp ch (output ch) (fun () -> flush ch) in
+ let ft = with_fp ch (output_substring ch) (fun () -> flush ch) in
set_gp ft deep_gp;
ft
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