121 lines
4.7 KiB
Diff
121 lines
4.7 KiB
Diff
|
diff -ur cil-1.7.3.old/ocamlutil/errormsg.ml cil-1.7.3/ocamlutil/errormsg.ml
|
||
|
--- cil-1.7.3.old/ocamlutil/errormsg.ml 2013-07-24 16:07:11.000000000 +0100
|
||
|
+++ cil-1.7.3/ocamlutil/errormsg.ml 2017-11-22 14:55:09.549734942 +0000
|
||
|
@@ -210,23 +210,24 @@
|
||
|
let str1 =
|
||
|
if str <> "" && String.get str 0 = '"' (* '"' ( *)
|
||
|
then rem_quotes str else str in
|
||
|
- let l = String.length str1 in
|
||
|
+ let str1 = Bytes.of_string str1 in
|
||
|
+ let l = Bytes.length str1 in
|
||
|
let rec loop (copyto: int) (i: int) =
|
||
|
if i >= l then
|
||
|
- String.sub str1 0 copyto
|
||
|
+ Bytes.sub str1 0 copyto
|
||
|
else
|
||
|
- let c = String.get str1 i in
|
||
|
+ let c = Bytes.get str1 i in
|
||
|
if c <> '\\' then begin
|
||
|
- String.set str1 copyto c; loop (copyto + 1) (i + 1)
|
||
|
+ Bytes.set str1 copyto c; loop (copyto + 1) (i + 1)
|
||
|
end else begin
|
||
|
- String.set str1 copyto '/';
|
||
|
- if i < l - 2 && String.get str1 (i + 1) = '\\' then
|
||
|
+ Bytes.set str1 copyto '/';
|
||
|
+ if i < l - 2 && Bytes.get str1 (i + 1) = '\\' then
|
||
|
loop (copyto + 1) (i + 2)
|
||
|
else
|
||
|
loop (copyto + 1) (i + 1)
|
||
|
end
|
||
|
in
|
||
|
- loop 0 0
|
||
|
+ Bytes.to_string (loop 0 0)
|
||
|
|
||
|
let readingFromStdin = ref false
|
||
|
|
||
|
diff -ur cil-1.7.3.old/ocamlutil/pretty.ml cil-1.7.3/ocamlutil/pretty.ml
|
||
|
--- cil-1.7.3.old/ocamlutil/pretty.ml 2017-11-22 13:17:54.112327112 +0000
|
||
|
+++ cil-1.7.3/ocamlutil/pretty.ml 2017-11-22 14:56:24.658729757 +0000
|
||
|
@@ -725,8 +725,9 @@
|
||
|
invalid_arg ("dprintf: unimplemented format "
|
||
|
^ (String.sub format i (j-i+1)));
|
||
|
let j' = succ j in (* eat the d,i,x etc. *)
|
||
|
- let format_spec = "% " in
|
||
|
- String.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *)
|
||
|
+ let format_spec = Bytes.of_string "% " in
|
||
|
+ Bytes.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *)
|
||
|
+ let format_spec = Bytes.to_string format_spec in
|
||
|
Obj.magic(fun n ->
|
||
|
collect (dctext1 acc
|
||
|
(Int64.format format_spec n))
|
||
|
@@ -735,8 +736,9 @@
|
||
|
if j != i + 1 then invalid_arg ("dprintf: unimplemented format "
|
||
|
^ (String.sub format i (j-i+1)));
|
||
|
let j' = succ j in (* eat the d,i,x etc. *)
|
||
|
- let format_spec = "% " in
|
||
|
- String.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *)
|
||
|
+ let format_spec = Bytes.of_string "% " in
|
||
|
+ Bytes.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *)
|
||
|
+ let format_spec = Bytes.to_string format_spec in
|
||
|
Obj.magic(fun n ->
|
||
|
collect (dctext1 acc
|
||
|
(Int32.format format_spec n))
|
||
|
@@ -745,8 +747,9 @@
|
||
|
if j != i + 1 then invalid_arg ("dprintf: unimplemented format "
|
||
|
^ (String.sub format i (j-i+1)));
|
||
|
let j' = succ j in (* eat the d,i,x etc. *)
|
||
|
- let format_spec = "% " in
|
||
|
- String.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *)
|
||
|
+ let format_spec = Bytes.of_string "% " in
|
||
|
+ Bytes.set format_spec 1 (fget j'); (* format_spec = "%x", etc. *)
|
||
|
+ let format_spec = Bytes.to_string format_spec in
|
||
|
Obj.magic(fun n ->
|
||
|
collect (dctext1 acc
|
||
|
(Nativeint.format format_spec n))
|
||
|
diff -ur cil-1.7.3.old/src/cil.ml cil-1.7.3/src/cil.ml
|
||
|
--- cil-1.7.3.old/src/cil.ml 2013-07-24 16:07:11.000000000 +0100
|
||
|
+++ cil-1.7.3/src/cil.ml 2017-11-22 14:53:42.922740924 +0000
|
||
|
@@ -5033,19 +5033,19 @@
|
||
|
(* Take the name of a file and make a valid symbol name out of it. There are
|
||
|
* a few characters that are not valid in symbols *)
|
||
|
let makeValidSymbolName (s: string) =
|
||
|
- let s = String.copy s in (* So that we can update in place *)
|
||
|
- let l = String.length s in
|
||
|
+ let s = Bytes.of_string s in (* So that we can update in place *)
|
||
|
+ let l = Bytes.length s in
|
||
|
for i = 0 to l - 1 do
|
||
|
- let c = String.get s i in
|
||
|
+ let c = Bytes.get s i in
|
||
|
let isinvalid =
|
||
|
match c with
|
||
|
'-' | '.' -> true
|
||
|
| _ -> false
|
||
|
in
|
||
|
if isinvalid then
|
||
|
- String.set s i '_';
|
||
|
+ Bytes.set s i '_';
|
||
|
done;
|
||
|
- s
|
||
|
+ Bytes.to_string s
|
||
|
|
||
|
let rec addOffset (toadd: offset) (off: offset) : offset =
|
||
|
match off with
|
||
|
diff -ur cil-1.7.3.old/src/formatlex.mll cil-1.7.3/src/formatlex.mll
|
||
|
--- cil-1.7.3.old/src/formatlex.mll 2013-07-24 16:07:11.000000000 +0100
|
||
|
+++ cil-1.7.3/src/formatlex.mll 2017-11-22 14:52:59.217743941 +0000
|
||
|
@@ -145,11 +145,11 @@
|
||
|
* We convert L"Hi" to "H\000i\000" *)
|
||
|
let wbtowc wstr =
|
||
|
let len = String.length wstr in
|
||
|
- let dest = String.make (len * 2) '\000' in
|
||
|
+ let dest = Bytes.make (len * 2) '\000' in
|
||
|
for i = 0 to len-1 do
|
||
|
- dest.[i*2] <- wstr.[i] ;
|
||
|
+ Bytes.set dest (i*2) wstr.[i] ;
|
||
|
done ;
|
||
|
- dest
|
||
|
+ Bytes.to_string dest
|
||
|
|
||
|
(* This function converst the "Hi" in L"Hi" to { L'H', L'i', L'\0' } *)
|
||
|
let wstr_to_warray wstr =
|