From 12dd7431bc6aa32a4ae1cf95003523d5b878dffc Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 10 Mar 2016 18:07:26 +0100 Subject: Upgrade ocaml version needed and enable more warnings. Since the menhir version we use requires ocaml>4.02 we can also upgrade the required ocaml version to >4.02 and remove the deprecate String functions. Also we now activate all warnings except for 4,9 und 27 for regular code plus a bunch of warnings for the generated code. 4 and 9 are not really usefull and 27 is deactivated since until the usage string is printed in a way that requires no newline. Bug 18394. --- lib/Printlines.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/Printlines.ml') diff --git a/lib/Printlines.ml b/lib/Printlines.ml index e0805f15..453096bc 100644 --- a/lib/Printlines.ml +++ b/lib/Printlines.ml @@ -48,7 +48,7 @@ let forward b dest = (* Position [b] to the beginning of line [dest], which must be less than the current line. *) -let backward_buf = lazy (String.create 65536) +let backward_buf = lazy (Bytes.create 65536) (* 65536 to match [IO_BUFFER_SIZE] in the OCaml runtime. lazy to allocate on demand. *) @@ -65,13 +65,13 @@ let backward b dest = seek_in b.chan 0; b.lineno <- 1 end else begin - let pos' = max 0 (pos - String.length buf) in + let pos' = max 0 (pos - Bytes.length buf) in let len = pos - pos' in seek_in b.chan pos'; really_input b.chan buf 0 len; backward pos' (pos - pos') end - end else if buf.[idx-1] = '\n' then begin + end else if Bytes.get buf (idx-1) = '\n' then begin (* Reached beginning of current line *) if b.lineno = dest then begin (* Found line number dest *) -- cgit