pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/net/unison2.40



Module Name:    pkgsrc
Committed By:   dholland
Date:           Wed Mar 14 11:16:15 UTC 2018

Modified Files:
        pkgsrc/net/unison2.40: distinfo
Added Files:
        pkgsrc/net/unison2.40/patches: patch-bytearray.ml patch-bytearray.mli
            patch-bytearray__stubs.c patch-external.ml patch-fileutil.ml
            patch-fingerprint.ml patch-fpcache.ml patch-fspath.ml
            patch-lwt_generic_lwt__unix__impl.ml patch-lwt_lwt__unix.mli
            patch-osx.ml patch-path.ml patch-remote.ml patch-terminal.ml
            patch-test.ml patch-transfer.ml patch-uicommon.ml patch-uitext.ml
            patch-unicode.ml

Log Message:
Fix build with ocaml 4.06.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 pkgsrc/net/unison2.40/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/net/unison2.40/patches/patch-bytearray.ml \
    pkgsrc/net/unison2.40/patches/patch-bytearray.mli \
    pkgsrc/net/unison2.40/patches/patch-bytearray__stubs.c \
    pkgsrc/net/unison2.40/patches/patch-external.ml \
    pkgsrc/net/unison2.40/patches/patch-fileutil.ml \
    pkgsrc/net/unison2.40/patches/patch-fingerprint.ml \
    pkgsrc/net/unison2.40/patches/patch-fpcache.ml \
    pkgsrc/net/unison2.40/patches/patch-fspath.ml \
    pkgsrc/net/unison2.40/patches/patch-lwt_generic_lwt__unix__impl.ml \
    pkgsrc/net/unison2.40/patches/patch-lwt_lwt__unix.mli \
    pkgsrc/net/unison2.40/patches/patch-osx.ml \
    pkgsrc/net/unison2.40/patches/patch-path.ml \
    pkgsrc/net/unison2.40/patches/patch-remote.ml \
    pkgsrc/net/unison2.40/patches/patch-terminal.ml \
    pkgsrc/net/unison2.40/patches/patch-test.ml \
    pkgsrc/net/unison2.40/patches/patch-transfer.ml \
    pkgsrc/net/unison2.40/patches/patch-uicommon.ml \
    pkgsrc/net/unison2.40/patches/patch-uitext.ml \
    pkgsrc/net/unison2.40/patches/patch-unicode.ml

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/net/unison2.40/distinfo
diff -u pkgsrc/net/unison2.40/distinfo:1.4 pkgsrc/net/unison2.40/distinfo:1.5
--- pkgsrc/net/unison2.40/distinfo:1.4  Fri Jul 14 12:59:23 2017
+++ pkgsrc/net/unison2.40/distinfo      Wed Mar 14 11:16:14 2018
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.4 2017/07/14 12:59:23 joerg Exp $
+$NetBSD: distinfo,v 1.5 2018/03/14 11:16:14 dholland Exp $
 
 SHA1 (unison-2.40.128.tar.gz) = 392a573cbf331d71cac8ccb32f5440dceec88470
 RMD160 (unison-2.40.128.tar.gz) = ad3f4191af957aef1084e3ea9b99c17777e35596
@@ -6,4 +6,23 @@ SHA512 (unison-2.40.128.tar.gz) = f33450
 Size (unison-2.40.128.tar.gz) = 2717593 bytes
 SHA1 (patch-Makefile.OCaml) = 2872f07e323f23375b0b7ea5ec17fe387fe22a0f
 SHA1 (patch-aa) = dd1a001fb7071cd9141615b42a692e6d1d812081
+SHA1 (patch-bytearray.ml) = efe1e039f9f64c204229b0d6d483a480ce13dce7
+SHA1 (patch-bytearray.mli) = a93299b6880159c66b2e3feed2db10b53a99489f
+SHA1 (patch-bytearray__stubs.c) = 6ad17f3c6a581b749f1c6d52149377f908179290
+SHA1 (patch-external.ml) = 11198c37a72ee552e15f394a7f3b005ef1b4d392
+SHA1 (patch-fileutil.ml) = cfa84095f6a3d249d483fcf6aaeb18083ee3593d
+SHA1 (patch-fingerprint.ml) = 709e0ee1fa3ccdc22ac00421d0538e37f35c31b1
+SHA1 (patch-fpcache.ml) = 595791d3f9f40f058c449a361a6439088eed3121
+SHA1 (patch-fspath.ml) = 28b8b95b993c0bc764babe56190472eccadc0269
+SHA1 (patch-lwt_generic_lwt__unix__impl.ml) = f73bbd3a9b25a0fd22b946151b4b18150ad1d5a4
+SHA1 (patch-lwt_lwt__unix.mli) = 22875429a5fb31835f7c8c0a27473ea4d3030456
+SHA1 (patch-osx.ml) = a7bd0c11c7a49ec86fa277a128c6a887ac37f0b7
+SHA1 (patch-path.ml) = f48a08d01e2bfeff405d9a882cf6a4ab30bd48f4
+SHA1 (patch-remote.ml) = e1f6126be4eb784f1b37f61dda2068821d81ff11
 SHA1 (patch-system_system__generic.ml) = 02d4d678b8868a7237b0aecc3f4add74e1011fd0
+SHA1 (patch-terminal.ml) = f3c98c01361be18c97552037dc3b703419251f46
+SHA1 (patch-test.ml) = 989c23bb359fef8e8cee7df0f6cc0614b386f954
+SHA1 (patch-transfer.ml) = 4f7f2eb1621010a05a629809bb6c543a4a6e65af
+SHA1 (patch-uicommon.ml) = 54602d200323fd1d0eb18741fb06572846d434a4
+SHA1 (patch-uitext.ml) = c90c22671b54bdb6e9dd5db32ff6367dc7d4b2b8
+SHA1 (patch-unicode.ml) = 54d1e5e6c2c0c146698f11c558a6421d60f77a0f

Added files:

Index: pkgsrc/net/unison2.40/patches/patch-bytearray.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-bytearray.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-bytearray.ml    Wed Mar 14 11:16:15 2018
@@ -0,0 +1,68 @@
+$NetBSD: patch-bytearray.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- bytearray.ml~      2009-05-29 14:00:18.000000000 +0000
++++ bytearray.ml
+@@ -36,17 +36,20 @@ let unsafe_blit_to_string a i s j l =
+ *)
+ 
+ external unsafe_blit_from_string : string -> int -> t -> int -> int -> unit
+-  = "ml_blit_string_to_bigarray" "noalloc"
++  = "ml_blit_string_to_bigarray" [@@noalloc]
+ 
+-external unsafe_blit_to_string : t -> int -> string -> int -> int -> unit
+-  = "ml_blit_bigarray_to_string" "noalloc"
++external unsafe_blit_from_bytes : bytes -> int -> t -> int -> int -> unit
++  = "ml_blit_bytes_to_bigarray" [@@noalloc]
++
++external unsafe_blit_to_bytes : t -> int -> bytes -> int -> int -> unit
++  = "ml_blit_bigarray_to_bytes" [@@noalloc]
+ 
+ let to_string a =
+   let l = length a in
+   if l > Sys.max_string_length then invalid_arg "Bytearray.to_string" else
+-  let s = String.create l in
+-  unsafe_blit_to_string a 0 s 0 l;
+-  s
++  let s = Bytes.create l in
++  unsafe_blit_to_bytes a 0 s 0 l;
++  Bytes.to_string s
+ 
+ let of_string s =
+   let l = String.length s in
+@@ -60,9 +63,9 @@ let sub a ofs len =
+   then
+     invalid_arg "Bytearray.sub"
+   else begin
+-    let s = String.create len in
+-    unsafe_blit_to_string a ofs s 0 len;
+-    s
++    let s = Bytes.create len in
++    unsafe_blit_to_bytes a ofs s 0 len;
++    Bytes.to_string s
+   end
+ 
+ let rec prefix_rec a i a' i' l =
+@@ -81,11 +84,17 @@ let blit_from_string s i a j l =
+   then invalid_arg "Bytearray.blit_from_string"
+   else unsafe_blit_from_string s i a j l
+ 
+-let blit_to_string a i s j l =
++let blit_from_bytes s i a j l =
++  if l < 0 || i < 0 || i > Bytes.length s - l
++           || j < 0 || j > length a - l
++  then invalid_arg "Bytearray.blit_from_bytes"
++  else unsafe_blit_from_bytes s i a j l
++
++let blit_to_bytes a i s j l =
+   if l < 0 || i < 0 || i > length a - l
+-           || j < 0 || j > String.length s - l
+-  then invalid_arg "Bytearray.blit_to_string"
+-  else unsafe_blit_to_string a i s j l
++           || j < 0 || j > Bytes.length s - l
++  then invalid_arg "Bytearray.blit_to_bytes"
++  else unsafe_blit_to_bytes a i s j l
+ 
+ external marshal : 'a -> Marshal.extern_flags list -> t
+   = "ml_marshal_to_bigarray"
Index: pkgsrc/net/unison2.40/patches/patch-bytearray.mli
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-bytearray.mli:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-bytearray.mli   Wed Mar 14 11:16:15 2018
@@ -0,0 +1,17 @@
+$NetBSD: patch-bytearray.mli,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- bytearray.mli~     2009-05-29 14:00:18.000000000 +0000
++++ bytearray.mli
+@@ -16,7 +16,9 @@ val sub : t -> int -> int -> string
+ 
+ val blit_from_string : string -> int -> t -> int -> int -> unit
+ 
+-val blit_to_string : t -> int -> string -> int -> int -> unit
++val blit_from_bytes : bytes -> int -> t -> int -> int -> unit
++
++val blit_to_bytes : t -> int -> bytes -> int -> int -> unit
+ 
+ val prefix : t -> t -> int -> bool
+ 
Index: pkgsrc/net/unison2.40/patches/patch-bytearray__stubs.c
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-bytearray__stubs.c:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-bytearray__stubs.c      Wed Mar 14 11:16:15 2018
@@ -0,0 +1,29 @@
+$NetBSD: patch-bytearray__stubs.c,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- bytearray_stubs.c~ 2009-05-29 14:00:18.000000000 +0000
++++ bytearray_stubs.c
+@@ -35,11 +35,20 @@ CAMLprim value ml_blit_string_to_bigarra
+   return Val_unit;
+ }
+ 
+-CAMLprim value ml_blit_bigarray_to_string
++CAMLprim value ml_blit_bytes_to_bigarray
++(value s, value i, value a, value j, value l)
++{
++  char *src = Bytes_val(s) + Int_val(i);
++  char *dest = Array_data(Bigarray_val(a), j);
++  memcpy(dest, src, Long_val(l));
++  return Val_unit;
++}
++
++CAMLprim value ml_blit_bigarray_to_bytes
+ (value a, value i, value s, value j, value l)
+ {
+   char *src = Array_data(Bigarray_val(a), i);
+-  char *dest = String_val(s) + Long_val(j);
++  char *dest = Bytes_val(s) + Long_val(j);
+   memcpy(dest, src, Long_val(l));
+   return Val_unit;
+ }
Index: pkgsrc/net/unison2.40/patches/patch-external.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-external.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-external.ml     Wed Mar 14 11:16:15 2018
@@ -0,0 +1,35 @@
+$NetBSD: patch-external.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- external.ml~       2010-04-15 17:29:31.000000000 +0000
++++ external.ml
+@@ -44,7 +44,7 @@ let readChannelTillEof_lwt c =
+       Some l -> loop (l :: lines)
+     | None   -> lines
+   in
+-  String.concat "\n" (Safelist.rev (loop []))
++  Bytes.concat (Bytes.of_string "\n") (Safelist.rev (loop []))
+ 
+ let readChannelsTillEof l =
+   let rec suckitdry lines c =
+@@ -58,7 +58,7 @@ let readChannelsTillEof l =
+   Lwt_util.map
+     (fun c ->
+        suckitdry [] c
+-       >>= (fun res -> return (String.concat "\n" (Safelist.rev res))))
++       >>= (fun res -> return (Bytes.concat (Bytes.of_string "\n") (Safelist.rev res))))
+     l
+ 
+ let runExternalProgram cmd =
+@@ -82,8 +82,8 @@ let runExternalProgram cmd =
+     readChannelsTillEof [out;err]
+     >>= (function [logOut;logErr] ->
+     let returnValue = System.close_process_full desc in
+-    let logOut = Util.trimWhitespace logOut in
+-    let logErr = Util.trimWhitespace logErr in
++    let logOut = Util.trimWhitespace (Bytes.to_string logOut) in
++    let logErr = Util.trimWhitespace (Bytes.to_string logErr) in
+     return (returnValue, (
+       (*  cmd
+       ^ "\n\n" ^ *)
Index: pkgsrc/net/unison2.40/patches/patch-fileutil.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-fileutil.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-fileutil.ml     Wed Mar 14 11:16:15 2018
@@ -0,0 +1,25 @@
+$NetBSD: patch-fileutil.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- fileutil.ml~       2009-05-02 02:31:27.000000000 +0000
++++ fileutil.ml
+@@ -21,14 +21,14 @@ let backslashes2forwardslashes s0 =
+   try
+     ignore(String.index s0 '\\'); (* avoid alloc if possible *)
+     let n = String.length s0 in
+-    let s = String.create n in
++    let s = Bytes.create n in
+     for i = 0 to n-1 do
+       let c = String.get s0 i in
+       if c = '\\'
+-      then String.set s i '/'
+-      else String.set s i c
++      then Bytes.set s i '/'
++      else Bytes.set s i c
+     done;
+-    s
++    Bytes.to_string s
+   with Not_found -> s0
+ 
+ let rec removeTrailingSlashes s =
Index: pkgsrc/net/unison2.40/patches/patch-fingerprint.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-fingerprint.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-fingerprint.ml  Wed Mar 14 11:16:15 2018
@@ -0,0 +1,24 @@
+$NetBSD: patch-fingerprint.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- fingerprint.ml~    2009-05-02 02:31:27.000000000 +0000
++++ fingerprint.ml
+@@ -66,13 +66,13 @@ let hexaCode theChar =
+ 
+ let toString md5 =
+   let length = String.length md5 in
+-  let string = String.create (length * 2) in
++  let string = Bytes.create (length * 2) in
+   for i=0 to (length - 1) do
+     let c1, c2 =  hexaCode (md5.[i]) in
+-    string.[2*i] <- c1;
+-    string.[2*i + 1] <- c2;
++    Bytes.set string (2*i) c1;
++    Bytes.set string (2*i + 1) c2;
+   done;
+-  string
++  Bytes.to_string string
+ 
+ let string = Digest.string
+ 
Index: pkgsrc/net/unison2.40/patches/patch-fpcache.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-fpcache.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-fpcache.ml      Wed Mar 14 11:16:15 2018
@@ -0,0 +1,50 @@
+$NetBSD: patch-fpcache.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- fpcache.ml~        2010-10-08 15:44:59.000000000 +0000
++++ fpcache.ml
+@@ -50,11 +50,12 @@ let state = ref None
+ 
+ let decompress st i path =
+   let l = String.length path in
+-  let s = String.create (l + i) in
++  let s = Bytes.create (l + i) in
+   String.blit !st 0 s 0 i;
+   String.blit path 0 s i l;
+-  st := s;
+-  s
++  let s' = Bytes.to_string s in
++  st := s';
++  s'
+ 
+ let compress state path =
+   let s = state.last in
+@@ -74,21 +75,21 @@ let read st ic =
+   let fp1 = Digest.input ic in
+   let fp2 = Digest.input ic in
+   let headerSize = Marshal.header_size in
+-  let header = String.create headerSize in
++  let header = Bytes.create headerSize in
+   really_input ic header 0 headerSize;
+-  if fp1 <> Digest.string header then begin
++  if fp1 <> Digest.string (Bytes.to_string header) then begin
+     debug (fun () -> Util.msg "bad header checksum\n");
+     raise End_of_file
+   end;
+   let dataSize = Marshal.data_size header 0 in
+-  let s = String.create (headerSize + dataSize) in
+-  String.blit header 0 s 0 headerSize;
++  let s = Bytes.create (headerSize + dataSize) in
++  Bytes.blit header 0 s 0 headerSize;
+   really_input ic s headerSize dataSize;
+-  if fp2 <> Digest.string s then begin
++  if fp2 <> Digest.string (Bytes.to_string s) then begin
+     debug (fun () -> Util.msg "bad chunk checksum\n");
+     raise End_of_file
+   end;
+-  let q : entry list = Marshal.from_string s 0 in
++  let q : entry list = Marshal.from_string (Bytes.to_string s) 0 in
+   debug (fun () -> Util.msg "read chunk of %d files\n" (List.length q));
+   List.iter (fun (l, p, i) -> PathTbl.add tbl (decompress st l p) i) q
+ 
Index: pkgsrc/net/unison2.40/patches/patch-fspath.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-fspath.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-fspath.ml       Wed Mar 14 11:16:15 2018
@@ -0,0 +1,47 @@
+$NetBSD: patch-fspath.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- fspath.ml.orig     2012-09-17 14:09:03.000000000 +0000
++++ fspath.ml
+@@ -55,7 +55,7 @@ let winRootFix d =
+ (* least distinguishing suffixes of two fspaths, for displaying in the user  *)
+ (* interface.                                                                *)
+ let differentSuffix (Fspath f1) (Fspath f2) =
+-  if isRootDir f1 or isRootDir f2 then (f1,f2)
++  if isRootDir f1 || isRootDir f2 then (f1,f2)
+   else begin
+     (* We use the invariant that neither f1 nor f2 ends in slash             *)
+     let len1 = String.length f1 in
+@@ -92,12 +92,12 @@ let appleDouble (Fspath f) =
+   let len = String.length f in
+   try
+     let i = 1 + String.rindex f '/' in
+-    let res = String.create (len + 2) in
++    let res = Bytes.create (len + 2) in
+     String.blit f 0 res 0 i;
+-    res.[i] <- '.';
+-    res.[i + 1] <- '_';
++    Bytes.set res i '.';
++    Bytes.set res (i + 1) '_';
+     String.blit f i res (i + 2) (len - i);
+-    Fspath res
++    Fspath (Bytes.to_string res)
+   with Not_found ->
+     assert false
+ 
+@@ -192,11 +192,11 @@ let concat fspath path =
+       let p = Path.toString path in
+       let l = String.length fspath in
+       let l' = String.length p in
+-      let s = String.create (l + l' + 1) in
++      let s = Bytes.create (l + l' + 1) in
+       String.blit fspath 0 s 0 l;
+-      s.[l] <- '/';
++      Bytes.set s l '/';
+       String.blit p 0 s (l + 1) l';
+-      Fspath s
++      Fspath (Bytes.to_string s)
+   end
+ 
+ (* Filename.dirname is screwed up in Windows so we use this function.  It    *)
Index: pkgsrc/net/unison2.40/patches/patch-lwt_generic_lwt__unix__impl.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-lwt_generic_lwt__unix__impl.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-lwt_generic_lwt__unix__impl.ml  Wed Mar 14 11:16:15 2018
@@ -0,0 +1,58 @@
+$NetBSD: patch-lwt_generic_lwt__unix__impl.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- lwt/generic/lwt_unix_impl.ml~      2010-04-15 17:29:31.000000000 +0000
++++ lwt/generic/lwt_unix_impl.ml
+@@ -173,7 +173,8 @@ let rec run thread =
+                     (fun () ->
+                        try ignore (Unix.getpeername fd) with
+                          Unix.Unix_error (Unix.ENOTCONN, _, _) ->
+-                           ignore (Unix.read fd " " 0 1))
++                           let junk = Bytes.create 1 in
++                           ignore (Unix.read fd junk 0 1))
+              | `Wait res ->
+                   wrap_syscall inputs fd res (fun () -> ())
+            with Not_found ->
+@@ -362,24 +363,24 @@ let rec unsafe_really_input ic s ofs len
+   end
+ 
+ let really_input ic s ofs len =
+-  if ofs < 0 || len < 0 || ofs > String.length s - len
++  if ofs < 0 || len < 0 || ofs > Bytes.length s - len
+   then Lwt.fail (Invalid_argument "really_input")
+   else unsafe_really_input ic s ofs len
+ 
+ let input_line ic =
+-  let buf = ref (String.create 128) in
++  let buf = ref (Bytes.create 128) in
+   let pos = ref 0 in
+   let rec loop () =
+-    if !pos = String.length !buf then begin
+-      let newbuf = String.create (2 * !pos) in
+-      String.blit !buf 0 newbuf 0 !pos;
++    if !pos = Bytes.length !buf then begin
++      let newbuf = Bytes.create (2 * !pos) in
++      Bytes.blit !buf 0 newbuf 0 !pos;
+       buf := newbuf
+     end;
+     Lwt.bind (input_char ic) (fun c ->
+     if c = '\n' then
+       Lwt.return ()
+     else begin
+-      !buf.[!pos] <- c;
++      Bytes.set !buf !pos c;
+       incr pos;
+       loop ()
+     end)
+@@ -393,8 +394,8 @@ let input_line ic =
+           | _ ->
+               Lwt.fail e))
+     (fun () ->
+-       let res = String.create !pos in
+-       String.blit !buf 0 res 0 !pos;
++       let res = Bytes.create !pos in
++       Bytes.blit !buf 0 res 0 !pos;
+        Lwt.return res)
+ 
+ (****)
Index: pkgsrc/net/unison2.40/patches/patch-lwt_lwt__unix.mli
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-lwt_lwt__unix.mli:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-lwt_lwt__unix.mli       Wed Mar 14 11:16:15 2018
@@ -0,0 +1,23 @@
+$NetBSD: patch-lwt_lwt__unix.mli,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- lwt/lwt_unix.mli~  2010-04-15 17:29:31.000000000 +0000
++++ lwt/lwt_unix.mli
+@@ -34,8 +34,8 @@ type file_descr
+ 
+ val of_unix_file_descr : Unix.file_descr -> file_descr
+ 
+-val read : file_descr -> string -> int -> int -> int Lwt.t
+-val write : file_descr -> string -> int -> int -> int Lwt.t
++val read : file_descr -> bytes -> int -> int -> int Lwt.t
++val write : file_descr -> bytes -> int -> int -> int Lwt.t
+ val wait_read : file_descr -> unit Lwt.t
+ val wait_write : file_descr -> unit Lwt.t
+ val pipe_in : unit -> file_descr * Unix.file_descr
+@@ -53,4 +53,4 @@ val set_close_on_exec : file_descr -> un
+ type lwt_in_channel
+ 
+ val intern_in_channel : in_channel -> lwt_in_channel
+-val input_line : lwt_in_channel -> string Lwt.t
++val input_line : lwt_in_channel -> bytes Lwt.t
Index: pkgsrc/net/unison2.40/patches/patch-osx.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-osx.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-osx.ml  Wed Mar 14 11:16:15 2018
@@ -0,0 +1,112 @@
+$NetBSD: patch-osx.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- osx.ml.orig        2010-10-08 15:44:59.000000000 +0000
++++ osx.ml
+@@ -60,7 +60,7 @@ let doubleVersion = "\000\002\000\000"
+ let doubleFiller = String.make 16 '\000'
+ let ressource_fork_empty_tag = "This resource fork intentionally left blank   "
+ let finfoLength = 32L
+-let emptyFinderInfo () = String.make 32 '\000'
++let emptyFinderInfo () = Bytes.make 32 '\000'
+ let empty_ressource_fork =
+   "\000\000\001\000" ^
+   "\000\000\001\000" ^
+@@ -108,13 +108,13 @@ let getID buf ofs =
+     | _ -> `UNKNOWN
+ 
+ let setInt4 v =
+-  let s = String.create 4 in
++  let s = Bytes.create 4 in
+   let set i =
+-    s.[i] <-
+-      Char.chr (Int64.to_int (Int64.logand 255L
+-                               (Int64.shift_right v (24 - 8 * i)))) in
++    Bytes.set s i
++      (Char.chr (Int64.to_int (Int64.logand 255L
++                               (Int64.shift_right v (24 - 8 * i))))) in
+   set 0; set 1; set 2; set 3;
+-  s
++  Bytes.to_string s
+ 
+ let fail dataFspath dataPath doubleFspath msg =
+   debug (fun () -> Util.msg "called 'fail'");
+@@ -126,13 +126,13 @@ let fail dataFspath dataPath doubleFspat
+               (Fspath.toPrintString (Fspath.concat dataFspath dataPath)) msg))
+ 
+ let readDouble dataFspath dataPath doubleFspath inch len =
+-  let buf = String.create len in
++  let buf = Bytes.create len in
+   begin try
+     really_input inch buf 0 len
+   with End_of_file ->
+     fail dataFspath dataPath doubleFspath "truncated"
+   end;
+-  buf
++  Bytes.to_string buf
+ 
+ let readDoubleFromOffset dataFspath dataPath doubleFspath inch offset len =
+   LargeFile.seek_in inch offset;
+@@ -223,7 +223,13 @@ let extractInfo typ info =
+   let xflags = String.sub info 24 2 in
+   let typeCreator = String.sub info 0 8 in
+   (* Ignore hasBeenInited flag *)
++
++(*
+   flags.[0] <- Char.chr (Char.code flags.[0] land 0xfe);
++*)
++  let fix i c = if i = 0 then Char.chr (Char.code c land 0xfe) else c in
++  let flags = String.mapi fix flags in
++
+   (* If the extended flags should be ignored, clear them *)
+   let xflags =
+     if Char.code xflags.[0] land 0x80 <> 0 then "\000\000" else xflags
+@@ -266,9 +272,9 @@ let getFileInfos dataFspath dataPath typ
+                    protect (fun () ->
+                      LargeFile.seek_in inch (Int64.add offset 16L);
+                      let len = String.length ressource_fork_empty_tag in
+-                     let buf = String.create len in
++                     let buf = Bytes.create len in
+                      really_input inch buf 0 len;
+-                     buf = ressource_fork_empty_tag)
++                     Bytes.to_string buf = ressource_fork_empty_tag)
+                      (fun () -> close_in_noerr inch)
+                 then
+                   (0L, 0L)
+@@ -343,7 +349,7 @@ let setFileInfos dataFspath dataPath fin
+     try
+       let p = Fspath.toSysPath (Fspath.concat dataFspath dataPath) in
+       let (fullFinfo, _) = getFileInfosInternal p false in
+-      setFileInfosInternal p (insertInfo fullFinfo finfo)
++      setFileInfosInternal p (Bytes.to_string (insertInfo (Bytes.of_string fullFinfo) finfo))
+     with Unix.Unix_error ((Unix.EOPNOTSUPP | Unix.ENOSYS), _, _) ->
+       (* Not an HFS volume.  Look for an AppleDouble file *)
+       let (workingDir, realPath) = Fspath.findWorkingDir dataFspath dataPath in
+@@ -367,7 +373,7 @@ let setFileInfos dataFspath dataPath fin
+             Fs.open_out_gen [Open_wronly; Open_binary] 0o600 doubleFspath in
+           protect
+             (fun () ->
+-               writeDoubleFromOffset outch ofs (insertInfo fullFinfo finfo);
++               writeDoubleFromOffset outch ofs (Bytes.to_string (insertInfo (Bytes.of_string fullFinfo) finfo));
+                close_out outch)
+             (fun () ->
+                close_out_noerr outch);
+@@ -406,7 +412,7 @@ let setFileInfos dataFspath dataPath fin
+             output_string outch "\000\000\000\002"; (* Ressource fork *)
+             output_string outch "\000\000\014\226"; (* offset *)
+             output_string outch "\000\000\001\030"; (* length *)
+-            output_string outch (insertInfo (emptyFinderInfo ()) finfo);
++            output_bytes outch (insertInfo (emptyFinderInfo ()) finfo);
+             output_string outch (empty_attribute_chunk ());
+                                                     (* extended attributes *)
+             output_string outch empty_ressource_fork;
+@@ -517,7 +523,7 @@ let openRessOut fspath path length =
+ (* FIX: should check for overflow! *)
+         output_string outch (setInt4 (Uutil.Filesize.toInt64 length));
+                                                 (* length *)
+-        output_string outch (emptyFinderInfo ());
++        output_bytes outch (emptyFinderInfo ());
+         output_string outch (empty_attribute_chunk ());
+                                                 (* extended attributes *)
+         flush outch)
Index: pkgsrc/net/unison2.40/patches/patch-path.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-path.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-path.ml Wed Mar 14 11:16:15 2018
@@ -0,0 +1,35 @@
+$NetBSD: patch-path.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- path.ml~   2009-05-02 02:31:27.000000000 +0000
++++ path.ml
+@@ -30,11 +30,11 @@ let concat p p' =
+   if l = 0 then p' else
+   let l' = String.length p' in
+   if l' = 0 then p else
+-  let p'' = String.create (l + l' + 1) in
++  let p'' = Bytes.create (l + l' + 1) in
+   String.blit p 0 p'' 0 l;
+-  p''.[l] <- pathSeparatorChar;
++  Bytes.set p'' l pathSeparatorChar;
+   String.blit p' 0 p'' (l + 1) l';
+-  p''
++  Bytes.to_string p''
+ 
+ let empty = ""
+ 
+@@ -182,11 +182,11 @@ let addPrefixToFinalName path prefix =
+     let i = String.rindex path pathSeparatorChar + 1 in
+     let l = String.length path in
+     let l' = String.length prefix in
+-    let p = String.create (l + l') in
++    let p = Bytes.create (l + l') in
+     String.blit path 0 p 0 i;
+     String.blit prefix 0 p i l';
+     String.blit path i p (i + l') (l - i);
+-    p
++    Bytes.to_string p
+   with Not_found ->
+     assert (not (isEmpty path));
+     prefix ^ path
Index: pkgsrc/net/unison2.40/patches/patch-remote.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-remote.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-remote.ml       Wed Mar 14 11:16:15 2018
@@ -0,0 +1,87 @@
+$NetBSD: patch-remote.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- remote.ml~ 2010-04-15 17:29:31.000000000 +0000
++++ remote.ml
+@@ -116,7 +116,7 @@ let emittedBytes = ref 0.
+ 
+ type ioBuffer =
+   { channel : Lwt_unix.file_descr;
+-    buffer : string;
++    buffer : bytes;
+     mutable length : int;
+     mutable opened : bool }
+ 
+@@ -125,7 +125,7 @@ let bufferSize = 16384
+    buffer of this size *)
+ 
+ let makeBuffer ch =
+-  { channel = ch; buffer = String.create bufferSize;
++  { channel = ch; buffer = Bytes.create bufferSize;
+     length = 0; opened = true }
+ 
+ (****)
+@@ -142,7 +142,7 @@ let fillInputBuffer conn =
+            Util.msg "grab: EOF\n"
+          else
+            Util.msg "grab: %s\n"
+-             (String.escaped (String.sub conn.buffer 0 len)));
++             (String.escaped (Bytes.to_string (Bytes.sub conn.buffer 0 len))));
+        if len = 0 then
+          lostConnection ()
+        else begin
+@@ -157,10 +157,10 @@ let rec grabRec conn s pos len =
+     grabRec conn s pos len
+   end else begin
+     let l = min (len - pos) conn.length in
+-    Bytearray.blit_from_string conn.buffer 0 s pos l;
++    Bytearray.blit_from_bytes conn.buffer 0 s pos l;
+     conn.length <- conn.length - l;
+     if conn.length > 0 then
+-      String.blit conn.buffer l conn.buffer 0 conn.length;
++      Bytes.blit conn.buffer l conn.buffer 0 conn.length;
+     if pos + l < len then
+       grabRec conn s (pos + l) len
+     else
+@@ -173,7 +173,7 @@ let grab conn s len =
+   grabRec conn s 0 len
+ 
+ let peekWithoutBlocking conn =
+-  String.sub conn.buffer 0 conn.length
++  Bytes.to_string (Bytes.sub conn.buffer 0 conn.length)
+ 
+ (****)
+ 
+@@ -189,11 +189,11 @@ let rec sendOutput conn =
+        end >>= fun len ->
+        debugV (fun() ->
+          Util.msg "dump: %s\n"
+-           (String.escaped (String.sub conn.buffer 0 len)));
++           (String.escaped (Bytes.to_string (Bytes.sub conn.buffer 0 len))));
+        emittedBytes := !emittedBytes +. float len;
+        conn.length <- conn.length - len;
+        if conn.length > 0 then
+-         String.blit
++         Bytes.blit
+            conn.buffer len conn.buffer 0 conn.length;
+        Lwt.return ())
+ 
+@@ -203,7 +203,7 @@ let rec fillBuffer2 conn s pos len =
+     fillBuffer2 conn s pos len
+   else begin
+     let l = min (len - pos) (bufferSize - conn.length) in
+-    Bytearray.blit_to_string s pos conn.buffer conn.length l;
++    Bytearray.blit_to_bytes s pos conn.buffer conn.length l;
+     conn.length <- conn.length + l;
+     if pos + l < len then
+       fillBuffer2 conn s (pos + l) len
+@@ -1340,7 +1340,7 @@ let openConnectionReply = function
+     (i1,i2,o1,o2,s,Some fdTerm,clroot,pid) ->
+     (fun response ->
+       (* FIX: should loop until everything is written... *)
+-      ignore (Lwt_unix.run (Lwt_unix.write fdTerm (response ^ "\n") 0
++      ignore (Lwt_unix.run (Lwt_unix.write fdTerm (Bytes.of_string (response ^ "\n")) 0
+                               (String.length response + 1))))
+   | _ -> (fun _ -> ())
+ 
Index: pkgsrc/net/unison2.40/patches/patch-terminal.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-terminal.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-terminal.ml     Wed Mar 14 11:16:15 2018
@@ -0,0 +1,49 @@
+$NetBSD: patch-terminal.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- terminal.ml.orig   2010-10-11 13:29:09.000000000 +0000
++++ terminal.ml
+@@ -222,14 +222,14 @@ let (>>=) = Lwt.bind
+ (* Wait until there is input. If there is terminal input s,
+    return Some s. Otherwise, return None. *)
+ let rec termInput fdTerm fdInput =
+-  let buf = String.create 10000 in
++  let buf = Bytes.create 10000 in
+   let rec readPrompt () =
+     Lwt_unix.read fdTerm buf 0 10000 >>= fun len ->
+     if len = 0 then
+       (* The remote end is dead *)
+       Lwt.return None
+     else
+-      let query = String.sub buf 0 len in
++      let query = Bytes.to_string (Bytes.sub buf 0 len) in
+       if query = "\r\n" then
+         readPrompt ()
+       else
+@@ -244,20 +244,20 @@ let rec termInput fdTerm fdInput =
+ 
+ (* Read messages from the terminal and use the callback to get an answer *)
+ let handlePasswordRequests fdTerm callback =
+-  let buf = String.create 10000 in
++  let buf = Bytes.create 10000 in
+   let rec loop () =
+     Lwt_unix.read fdTerm buf 0 10000 >>= (fun len ->
+       if len = 0 then
+         (* The remote end is dead *)
+         Lwt.return ()
+       else
+-        let query = String.sub buf 0 len in
+-        if query = "\r\n" then
++        let query = Bytes.sub buf 0 len in
++        if Bytes.to_string query = "\r\n" then
+           loop ()
+         else begin
+-          let response = callback query in
++          let response = callback (Bytes.to_string query) in
+           Lwt_unix.write fdTerm
+-            (response ^ "\n") 0 (String.length response + 1)
++            (Bytes.of_string (response ^ "\n")) 0 (String.length response + 1)
+               >>= (fun _ ->
+           loop ())
+         end)
Index: pkgsrc/net/unison2.40/patches/patch-test.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-test.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-test.ml Wed Mar 14 11:16:15 2018
@@ -0,0 +1,18 @@
+$NetBSD: patch-test.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- test.ml~   2010-04-15 17:29:31.000000000 +0000
++++ test.ml
+@@ -48,9 +48,9 @@ let rec remove_file_or_dir d =
+ 
+ let read_chan chan =
+   let nbytes = in_channel_length chan in
+-  let string = String.create nbytes in
++  let string = Bytes.create nbytes in
+   really_input chan string 0 nbytes;
+-  string
++  Bytes.to_string string
+ 
+ let read file =
+ (*
Index: pkgsrc/net/unison2.40/patches/patch-transfer.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-transfer.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-transfer.ml     Wed Mar 14 11:16:15 2018
@@ -0,0 +1,152 @@
+$NetBSD: patch-transfer.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- transfer.ml.orig   2010-04-15 17:29:31.000000000 +0000
++++ transfer.ml
+@@ -240,13 +240,13 @@ let send infd length showProgress transm
+   let timer = Trace.startTimer "Sending file using generic transmission" in
+   let bufSz = 8192 in
+   let bufSzFS = Uutil.Filesize.ofInt 8192 in
+-  let buf = String.create bufSz in
++  let buf = Bytes.create bufSz in
+   let q = makeQueue 0 in
+   let rec sendSlice length =
+     let count =
+       reallyRead infd buf 0
+         (if length > bufSzFS then bufSz else Uutil.Filesize.toInt length) in
+-    queueToken q showProgress transmit (STRING (buf, 0, count)) >>= (fun () ->
++    queueToken q showProgress transmit (STRING (Bytes.to_string buf, 0, count)) >>= (fun () ->
+     let length = Uutil.Filesize.sub length (Uutil.Filesize.ofInt count) in
+     if count = bufSz && length > Uutil.Filesize.zero then
+       sendSlice length
+@@ -266,7 +266,7 @@ let rec receiveRec outfd showProgress da
+       let length = decodeInt2 data (pos + 1) in
+       if Trace.enabled "generic" then debug (fun() -> Util.msg
+           "receiving %d bytes\n" length);
+-      reallyWrite outfd (Bytearray.sub data (pos + 3) length) 0 length;
++      reallyWrite outfd (Bytes.of_string (Bytearray.sub data (pos + 3) length)) 0 length;
+       showProgress length;
+       receiveRec outfd showProgress data (pos + length + 3) maxPos
+   | 'E' ->
+@@ -347,7 +347,7 @@ struct
+      and eventually handles the buffer update. *)
+   let blockIter infd f blockSize maxCount =
+     let bufferSize = 8192 + blockSize in
+-    let buffer = String.create bufferSize in
++    let buffer = Bytes.create bufferSize in
+     let rec iter count offset length =
+       if count = maxCount then
+         count
+@@ -358,7 +358,7 @@ struct
+           iter (count + 1) newOffset length
+         end else if offset > 0 then begin
+           let chunkSize = length - offset in
+-          String.blit buffer offset buffer 0 chunkSize;
++          Bytes.blit buffer offset buffer 0 chunkSize;
+           iter count 0 chunkSize
+         end else begin
+           let l = input infd buffer length (bufferSize - length) in
+@@ -384,6 +384,7 @@ struct
+       Bigarray.Array1.create Bigarray.int32 Bigarray.c_layout blockCount in
+     let strongCs = Bytearray.create (blockCount * csSize) in
+     let addBlock i buf offset =
++      let buf = Bytes.to_string buf in
+       weakCs.{i} <- Int32.of_int (Checksum.substring buf offset blockSize);
+       Bytearray.blit_from_string
+         (Digest.substring buf offset blockSize) 0 strongCs (i * csSize) csSize
+@@ -414,7 +415,7 @@ struct
+   (* For each transfer instruction, either output a string or copy one or
+      several blocks from the old file. *)
+   let rsyncDecompress blockSize infd outfd showProgress (data, pos, len) =
+-    let decomprBuf = String.create decomprBufSize in
++    let decomprBuf = Bytes.create decomprBufSize in
+     let progress = ref 0 in
+     let rec copy length =
+       if length > decomprBufSize then begin
+@@ -440,7 +441,7 @@ struct
+           if Trace.enabled "rsynctoken" then
+             debugToken (fun() ->
+               Util.msg "decompressing string (%d bytes)\n" length);
+-          reallyWrite outfd (Bytearray.sub data (pos + 3) length) 0 length;
++          reallyWrite outfd (Bytes.of_string (Bytearray.sub data (pos + 3) length)) 0 length;
+           progress := !progress + length;
+           decode (pos + length + 3)
+       | 'B' ->
+@@ -499,16 +500,16 @@ struct
+ 
+   let sigFilter hashTableLength signatures =
+     let len = hashTableLength lsl 2 in
+-    let filter = String.make len '\000' in
++    let filter = Bytes.make len '\000' in
+     for k = 0 to signatures.blockCount - 1 do
+       let cs = Int32.to_int signatures.weakChecksum.{k} land 0x7fffffff in
+       let h1 = cs lsr 28 in
+       assert (h1 >= 0 && h1 < 8);
+       let h2 = (cs lsr 5) land (len - 1) in
+       let mask = 1 lsl h1 in
+-      filter.[h2] <- Char.chr (Char.code filter.[h2] lor mask)
++      Bytes.set filter h2 (Char.chr (Char.code (Bytes.get filter h2) lor mask))
+     done;
+-    filter
++    Bytes.to_string filter
+ 
+   let filterMem filter hashTableLength checksum =
+     let len = hashTableLength lsl 2 in
+@@ -647,12 +648,12 @@ struct
+     in
+ 
+     (* Create the compression buffer *)
+-    let comprBuf = String.create comprBufSize in
++    let comprBuf = Bytes.create comprBufSize in
+ 
+     (* If there is data waiting to be sent, transmit it as a STRING token *)
+     let transmitString toBeSent offset =
+       if offset > toBeSent then
+-        transmit (STRING (comprBuf, toBeSent, offset - toBeSent))
++        transmit (STRING (Bytes.to_string comprBuf, toBeSent, offset - toBeSent))
+       else
+         return ()
+     in
+@@ -676,7 +677,7 @@ struct
+         let chunkSize = st.length - st.offset in
+         if chunkSize > 0 then begin
+           assert(comprBufSize >= blockSize);
+-          String.blit comprBuf st.offset comprBuf 0 chunkSize
++          Bytes.blit comprBuf st.offset comprBuf 0 chunkSize
+         end;
+         let rem = Uutil.Filesize.sub srcLength st.absolutePos in
+         let avail = comprBufSize - chunkSize in
+@@ -703,19 +704,19 @@ struct
+       if miss then
+         rollChecksum st
+       else begin
+-        let cksum = Checksum.substring comprBuf st.offset blockSize in
++        let cksum = Checksum.substring (Bytes.to_string comprBuf) st.offset blockSize in
+         st.checksum <- cksum;
+-        st.cksumOutgoing <- String.unsafe_get comprBuf st.offset;
++        st.cksumOutgoing <- Bytes.unsafe_get comprBuf st.offset;
+         processBlock st
+       end
+ 
+     and rollChecksum st =
+       let ingoingChar =
+-        String.unsafe_get comprBuf (st.offset + blockSize - 1) in
++        Bytes.unsafe_get comprBuf (st.offset + blockSize - 1) in
+       let cksum =
+         Checksum.roll cksumTable st.checksum st.cksumOutgoing ingoingChar in
+       st.checksum <- cksum;
+-      st.cksumOutgoing <- String.unsafe_get comprBuf st.offset;
++      st.cksumOutgoing <- Bytes.unsafe_get comprBuf st.offset;
+       if filterMem filter hashTableLength cksum then
+         processBlock st
+       else
+@@ -746,7 +747,7 @@ struct
+           -1
+       | (k, cs) :: tl, None
+         when cs = checksum ->
+-          let fingerprint = Digest.substring comprBuf st.offset blockSize in
++          let fingerprint = Digest.substring (Bytes.to_string comprBuf) st.offset blockSize in
+           findBlock st checksum entry (Some fingerprint)
+       | (k, cs) :: tl, Some fingerprint
+         when cs = checksum && fingerprintMatch k fingerprint ->
Index: pkgsrc/net/unison2.40/patches/patch-uicommon.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-uicommon.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-uicommon.ml     Wed Mar 14 11:16:15 2018
@@ -0,0 +1,27 @@
+$NetBSD: patch-uicommon.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- uicommon.ml~       2009-05-28 09:23:33.000000000 +0000
++++ uicommon.ml
+@@ -356,16 +356,16 @@ let dangerousPathMsg dangerousPaths =
+ 
+ let quote s =
+   let len = String.length s in
+-  let buf = String.create (2 * len) in
++  let buf = Bytes.create (2 * len) in
+   let pos = ref 0 in
+   for i = 0 to len - 1 do
+     match s.[i] with
+       '*' | '?' | '[' | '{' | '}' | ',' | '\\' as c ->
+-        buf.[!pos] <- '\\'; buf.[!pos + 1] <- c; pos := !pos + 2
++        Bytes.set buf !pos '\\'; Bytes.set buf (!pos + 1) c; pos := !pos + 2
+     | c ->
+-        buf.[!pos] <- c; pos := !pos + 1
++        Bytes.set buf !pos c; pos := !pos + 1
+   done;
+-  "{" ^ String.sub buf 0 !pos ^ "}"
++  "{" ^ Bytes.to_string (Bytes.sub buf 0 !pos) ^ "}"
+ 
+ let ignorePath path = "Path " ^ quote (Path.toString path)
+ 
Index: pkgsrc/net/unison2.40/patches/patch-uitext.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-uitext.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-uitext.ml       Wed Mar 14 11:16:15 2018
@@ -0,0 +1,22 @@
+$NetBSD: patch-uitext.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- uitext.ml~ 2010-04-15 17:29:31.000000000 +0000
++++ uitext.ml
+@@ -112,11 +112,12 @@ let getInput () =
+         (* We cannot used buffered I/Os under Windows, as character
+            '\r' is not passed through (probably due to the code that
+            turns \r\n into \n) *)
+-        let s = String.create 1 in
++        let s = Bytes.create 1 in
+         let n = Unix.read Unix.stdin s 0 1 in
+         if n = 0 then raise End_of_file;
+-        if s.[0] = '\003' then raise Sys.Break;
+-        s.[0]
++        let c = Bytes.get s 0 in
++        if c = '\003' then raise Sys.Break;
++        c
+       in
+       funs.System.startReading ();
+       let c = input_char () in
Index: pkgsrc/net/unison2.40/patches/patch-unicode.ml
diff -u /dev/null pkgsrc/net/unison2.40/patches/patch-unicode.ml:1.1
--- /dev/null   Wed Mar 14 11:16:15 2018
+++ pkgsrc/net/unison2.40/patches/patch-unicode.ml      Wed Mar 14 11:16:15 2018
@@ -0,0 +1,546 @@
+$NetBSD: patch-unicode.ml,v 1.1 2018/03/14 11:16:15 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- unicode.ml~        2010-05-20 09:08:30.000000000 +0000
++++ unicode.ml
+@@ -21,8 +21,9 @@ exception Invalid
+ 
+ let fail () = raise Invalid
+ 
+-let get s i = Char.code (String.unsafe_get s i)
+-let set s i v = String.unsafe_set s i (Char.unsafe_chr v)
++let get' s i = Char.code (String.unsafe_get s i)
++let get s i = Char.code (Bytes.unsafe_get s i)
++let set s i v = Bytes.unsafe_set s i (Char.unsafe_chr v)
+ 
+ (****)
+ 
+@@ -773,9 +774,9 @@ let combining_property_bitmap = "\
+ 
+ let combining_class c =
+   if c > 0xffff then 0 else
+-  let v = get combining_property_bitmap (c lsr 8) in
++  let v = get' combining_property_bitmap (c lsr 8) in
+   if v = 0 then 0 else
+-  get combining_property_bitmap (v lsl 8 + c land 0xff)
++  get' combining_property_bitmap (v lsl 8 + c land 0xff)
+ 
+ let rec find_loc s i l p =
+   if i = 0 then i else
+@@ -818,14 +819,14 @@ and cont s i l j p v =
+     (* move char to the right location *)
+     let k = find_loc s i l p' in
+     let d = j - i in
+-    let s' = String.sub s i d in
+-    String.blit s k s (k + d) (i - k);
+-    String.blit s' 0 s k d;
++    let s' = Bytes.sub s i d in
++    Bytes.blit s k s (k + d) (i - k);
++    Bytes.blit s' 0 s k d;
+     scan s j l p
+   end
+ 
+ let order s =
+-  scan s 0 (String.length s) 0
++  scan s 0 (Bytes.length s) 0
+ 
+ (****)
+ 
+@@ -845,42 +846,42 @@ let set_char_3 s i c =
+   set s (i + 1) ((c lsr 6) land 0x3f + 0x80);
+   set s (i + 2) (c land 0x3f + 0x80)
+ 
+-let rec norm s i l s' j =
++let rec norm (s: string) i l s' j =
+   if i < l then begin
+-    let c = get s i in
++    let c = get' s i in
+     if c < 0x80 then begin
+-      set s' j (get norm_ascii c);
++      set s' j (get' norm_ascii c);
+       norm s (i + 1) l s' (j + 1)
+     end else if c < 0xE0 then begin
+       (* 80 - 7FF *)
+       if c < 0xc2 || i + 1 >= l then raise Invalid;
+-      let c1 = get s (i + 1) in
++      let c1 = get' s (i + 1) in
+       if c1 land 0xc0 <> 0x80 then raise Invalid;
+-      let idx = get norm_prim (c - 0xc0) in
++      let idx = get' norm_prim (c - 0xc0) in
+       let idx = idx lsl 6 + c1 - 0x80 in
+-      let k = get norm_second_high idx in
++      let k = get' norm_second_high idx in
+       if k = 0 then begin
+         set s' j c;
+         set s' (j + 1) c1;
+         norm s (i + 2) l s' (j + 2)
+       end else begin
+-        let k = (k - 2) lsl 8 + get norm_second_low idx in
+-        let n = get norm_repl k in
++        let k = (k - 2) lsl 8 + get' norm_second_low idx in
++        let n = get' norm_repl k in
+         String.blit norm_repl (k + 1) s' j n;
+         norm s (i + 2) l s' (j + n)
+       end
+     end else if c < 0xF0 then begin
+       (* 800 - FFFF *)
+       if i + 2 >= l then raise Invalid;
+-      let c1 = get s (i + 1) in
++      let c1 = get' s (i + 1) in
+       if c1 land 0xc0 <> 0x80 then raise Invalid;
+       let idx = c lsl 6 + c1 - 0x3880 in
+       if idx < 0x20 then raise Invalid;
+-      let c2 = get s (i + 2) in
++      let c2 = get' s (i + 2) in
+       if c2 land 0xc0 <> 0x80 then raise Invalid;
+-      let idx = get norm_prim idx in
++      let idx = get' norm_prim idx in
+       let idx = idx lsl 6 + c2 - 0x80 in
+-      let k = get norm_second_high idx in
++      let k = get' norm_second_high idx in
+       if k = 0 then begin
+         set s' j c;
+         set s' (j + 1) c1;
+@@ -905,17 +906,17 @@ let rec norm s i l s' j =
+           end
+         end
+       end else begin
+-        let k = (k - 2) lsl 8 + get norm_second_low idx in
+-        let n = get norm_repl k in
++        let k = (k - 2) lsl 8 + get' norm_second_low idx in
++        let n = get' norm_repl k in
+         String.blit norm_repl (k + 1) s' j n;
+         norm s (i + 3) l s' (j + n)
+       end
+     end else begin
+       (* 10000 - 10FFFF *)
+       if i + 3 >= l then raise Invalid;
+-      let c1 = get s (i + 1) in
+-      let c2 = get s (i + 2) in
+-      let c3 = get s (i + 3) in
++      let c1 = get' s (i + 1) in
++      let c2 = get' s (i + 2) in
++      let c3 = get' s (i + 3) in
+       if (c1 lor c2 lor c3) land 0xc0 <> 0x80 then raise Invalid;
+       let v = c lsl 18 + c1 lsl 12 + c2 lsl 6 + c3 - 0x03c82080 in
+       if v < 0x10000 || v > 0x10ffff then raise Invalid;
+@@ -926,58 +927,58 @@ let rec norm s i l s' j =
+       norm s (i + 4) l s' (j + 4)
+     end
+   end else
+-    String.sub s' 0 j
++    Bytes.sub s' 0 j
+ 
+ let normalize s =
+   let l = String.length s in
+-  let s' = String.create (3 * l) in
++  let s' = Bytes.create (3 * l) in
+   try
+-    let s' = norm s 0 l s' 0 in order s'; s'
++    let s' = norm s 0 l s' 0 in order s'; Bytes.to_string s'
+   with Invalid ->
+     (* We need a comparison function which is coherent (transitive)
+        also with non-unicode strings.  The optimization below assumes
+        a case-insensitive comparison on ASCII characters, thus we
+        translate the string to lowercase *)
+-    String.lowercase s
++    String.lowercase_ascii s
+ 
+ (****)
+ 
+-let rec decomp s i l s' j =
++let rec decomp (s: string) i l s' j =
+   if i < l then begin
+-    let c = get s i in
++    let c = get' s i in
+     if c < 0x80 then begin
+-      set s' j (get decomp_ascii c);
++      set s' j (get' decomp_ascii c);
+       decomp s (i + 1) l s' (j + 1)
+     end else if c < 0xE0 then begin
+       (* 80 - 7FF *)
+       if c < 0xc2 || i + 1 >= l then raise Invalid;
+-      let c1 = get s (i + 1) in
++      let c1 = get' s (i + 1) in
+       if c1 land 0xc0 <> 0x80 then raise Invalid;
+-      let idx = get decomp_prim (c - 0xc0) in
++      let idx = get' decomp_prim (c - 0xc0) in
+       let idx = idx lsl 6 + c1 - 0x80 in
+-      let k = get decomp_second_high idx in
++      let k = get' decomp_second_high idx in
+       if k = 0 then begin
+         set s' j c;
+         set s' (j + 1) c1;
+         decomp s (i + 2) l s' (j + 2)
+       end else begin
+-        let k = (k - 2) lsl 8 + get decomp_second_low idx in
+-        let n = get decomp_repl k in
++        let k = (k - 2) lsl 8 + get' decomp_second_low idx in
++        let n = get' decomp_repl k in
+         String.blit decomp_repl (k + 1) s' j n;
+         decomp s (i + 2) l s' (j + n)
+       end
+     end else if c < 0xF0 then begin
+       (* 800 - FFFF *)
+       if i + 2 >= l then raise Invalid;
+-      let c1 = get s (i + 1) in
++      let c1 = get' s (i + 1) in
+       if c1 land 0xc0 <> 0x80 then raise Invalid;
+       let idx = c lsl 6 + c1 - 0x3880 in
+       if idx < 0x20 then raise Invalid;
+-      let c2 = get s (i + 2) in
++      let c2 = get' s (i + 2) in
+       if c2 land 0xc0 <> 0x80 then raise Invalid;
+-      let idx = get decomp_prim idx in
++      let idx = get' decomp_prim idx in
+       let idx = idx lsl 6 + c2 - 0x80 in
+-      let k = get decomp_second_high idx in
++      let k = get' decomp_second_high idx in
+       if k = 0 then begin
+         set s' j c;
+         set s' (j + 1) c1;
+@@ -1002,17 +1003,17 @@ let rec decomp s i l s' j =
+           end
+         end
+       end else begin
+-        let k = (k - 2) lsl 8 + get decomp_second_low idx in
+-        let n = get decomp_repl k in
++        let k = (k - 2) lsl 8 + get' decomp_second_low idx in
++        let n = get' decomp_repl k in
+         String.blit decomp_repl (k + 1) s' j n;
+         decomp s (i + 3) l s' (j + n)
+       end
+     end else begin
+       (* 10000 - 10FFFF *)
+       if i + 3 >= l then raise Invalid;
+-      let c1 = get s (i + 1) in
+-      let c2 = get s (i + 2) in
+-      let c3 = get s (i + 3) in
++      let c1 = get' s (i + 1) in
++      let c2 = get' s (i + 2) in
++      let c3 = get' s (i + 3) in
+       if (c1 lor c2 lor c3) land 0xc0 <> 0x80 then raise Invalid;
+       let v = c lsl 18 + c1 lsl 12 + c2 lsl 6 + c3 - 0x03c82080 in
+       if v < 0x10000 || v > 0x10ffff then raise Invalid;
+@@ -1023,13 +1024,13 @@ let rec decomp s i l s' j =
+       decomp s (i + 4) l s' (j + 4)
+     end
+   end else
+-    String.sub s' 0 j
++    Bytes.sub s' 0 j
+ 
+ let decompose s =
+   let l = String.length s in
+-  let s' = String.create (3 * l) in
++  let s' = Bytes.create (3 * l) in
+   try
+-    let s' = decomp s 0 l s' 0 in order s'; s'
++    let s' = decomp s 0 l s' 0 in order s'; Bytes.to_string s'
+   with Invalid ->
+     s
+ 
+@@ -1041,10 +1042,10 @@ let rec compare_rec s s' i l =
+     if l < String.length s' then -1 else
+     0
+   end else begin
+-    let c = get s i in
+-    let c' = get s' i in
++    let c = get' s i in
++    let c' = get' s' i in
+     if c < 0x80 && c' < 0x80 then begin
+-      let v = compare (get norm_ascii c) (get norm_ascii c') in
++      let v = compare (get' norm_ascii c) (get' norm_ascii c') in
+       if v <> 0 then v else compare_rec s s' (i + 1) l
+     end else
+       compare (normalize s) (normalize s')
+@@ -1061,8 +1062,8 @@ let rec compare_cs_rec s s' i l =
+     if l < String.length s' then -1 else
+     0
+   end else begin
+-    let c = get s i in
+-    let c' = get s' i in
++    let c = get' s i in
++    let c' = get' s' i in
+     if c < 0x80 && c' < 0x80 then begin
+       let v = compare c c' in
+       if v <> 0 then v else compare_cs_rec s s' (i + 1) l
+@@ -1457,12 +1458,12 @@ let uniCharCombiningBitmap = "\
+ let bitmap_test base bitmap character =
+   character >= base && character < 0x10000
+     &&
+-  (let value = get bitmap ((character lsr 8) land 0xFF) in
++  (let value = get' bitmap ((character lsr 8) land 0xFF) in
+    value = 0xFF
+       ||
+    (value <> 0
+        &&
+-    get bitmap ((value - 1) * 32 + 256 + (character land 0xFF) / 8)
++    get' bitmap ((value - 1) * 32 + 256 + (character land 0xFF) / 8)
+       land (1 lsl (character land 7)) <> 0))
+ 
+ let unicode_combinable character =
+@@ -1547,8 +1548,8 @@ let rec scan d s i l =
+     end
+   end else begin
+     let (i1, i2) = d in
+-    String.blit s i2 s i1 (l - i2);
+-    String.sub s 0 (i1 + l - i2)
++    Bytes.blit s i2 s i1 (l - i2);
++    Bytes.sub s 0 (i1 + l - i2)
+   end
+ 
+ and cont d s i l j v' =
+@@ -1560,7 +1561,7 @@ and cont d s i l j v' =
+       scan d s j l
+     else begin
+       let (i1, i2) = d in
+-      String.blit s i2 s i1 (i - i2);
++      Bytes.blit s i2 s i1 (i - i2);
+       let i1 = i1 + i - i2 in
+       let (v'', i) = compose_rec s j l v'' in
+       let i1 = encode_char s i1 l v'' in
+@@ -1584,7 +1585,10 @@ and compose_rec s i l v =
+     (v, i)
+ 
+ let compose s =
+-  try scan (0, 0) (String.copy s) 0 (String.length s) with Invalid -> s
++  try
++    let s' = scan (0, 0) (Bytes.of_string s) 0 (String.length s) in
++    Bytes.to_string s'
++  with Invalid -> s
+ 
+ (***)
+ 
+@@ -1594,23 +1598,23 @@ let set_2 s i v =
+ 
+ let get_2 s i = (get s (i + 1)) lsl 8 + get s i
+ 
+-let rec scan s' j s i l =
++let rec scan s' j (s: string) i l =
+   if i < l then begin
+-    let c = get s i in
++    let c = get' s i in
+     if c < 0x80 then
+       cont s' j s (i + 1) l c
+     else if c < 0xE0 then begin
+       (* 80 - 7FF *)
+       if c < 0xc2 || i + 1 >= l then fail () else
+-      let c1 = get s (i + 1) in
++      let c1 = get' s (i + 1) in
+       if c1 land 0xc0 <> 0x80 then fail () else
+       let v = c lsl 6 + c1 - 0x3080 in
+       cont s' j s (i + 2) l v
+     end else if c < 0xF0 then begin
+       (* 800 - FFFF *)
+       if i + 2 >= l then fail () else
+-      let c1 = get s (i + 1) in
+-      let c2 = get s (i + 2) in
++      let c1 = get' s (i + 1) in
++      let c2 = get' s (i + 2) in
+       if (c1 lor c2) land 0xc0 <> 0x80 then fail () else
+       let v = c lsl 12 + c1 lsl 6 + c2 - 0xe2080 in
+       if v < 0x800 then fail () else
+@@ -1618,9 +1622,9 @@ let rec scan s' j s i l =
+     end else begin
+       (* 10000 - 10FFFF *)
+       if i + 3 >= l then fail () else
+-      let c1 = get s (i + 1) in
+-      let c2 = get s (i + 2) in
+-      let c3 = get s (i + 3) in
++      let c1 = get' s (i + 1) in
++      let c2 = get' s (i + 2) in
++      let c3 = get' s (i + 3) in
+       if (c1 lor c2 lor c3) land 0xc0 <> 0x80 then fail () else
+       let v = c lsl 18 + c1 lsl 12 + c2 lsl 6 + c3 - 0x03c82080 in
+       if v < 0x10000 || v > 0x10ffff then fail () else
+@@ -1630,7 +1634,7 @@ let rec scan s' j s i l =
+       scan s' (j + 4) s (i + 4) l
+     end
+   end else
+-    String.sub s' 0 (j + 2)
++    Bytes.sub s' 0 (j + 2)
+ 
+ and cont s' j s i l v =
+   set_2 s' j v;
+@@ -1638,8 +1642,8 @@ and cont s' j s i l v =
+ 
+ let to_utf_16 s =
+   let l = String.length s in
+-  let s' = String.make (2 * l + 2) '\000' in
+-  scan s' 0 s 0 l
++  let s' = Bytes.make (2 * l + 2) '\000' in
++  Bytes.to_string (scan s' 0 s 0 l)
+ 
+ (***)
+ 
+@@ -1665,13 +1669,13 @@ let set_2 s i v =
+   set s i (v land 0xff);
+   set s (i + 1) (v lsr 8)
+ 
+-let get_2 s i = (get s (i + 1)) lsl 8 + get s i
++let get_2 s i = (get' s (i + 1)) lsl 8 + get' s i
+ 
+-let end_of_name s i l = let i' = i + 1 in i' = l || get s i' = 0x2f (*'/'*)
++let end_of_name s i l = let i' = i + 1 in i' = l || get' s i' = 0x2f (*'/'*)
+ 
+-let rec scan s' j s i l =
++let rec scan s' j (s: string) i l =
+   if i < l then begin
+-    let c = get s i in
++    let c = get' s i in
+     if c < 0x80 then
+       cont s' j s (i + 1) l
+         (if c = 0x20 && end_of_name s i l then 0xf028
+@@ -1680,15 +1684,15 @@ let rec scan s' j s i l =
+     else if c < 0xE0 then begin
+       (* 80 - 7FF *)
+       if c < 0xc2 || i + 1 >= l then fail () else
+-      let c1 = get s (i + 1) in
++      let c1 = get' s (i + 1) in
+       if c1 land 0xc0 <> 0x80 then fail () else
+       let v = c lsl 6 + c1 - 0x3080 in
+       cont s' j s (i + 2) l v
+     end else if c < 0xF0 then begin
+       (* 800 - FFFF *)
+       if i + 2 >= l then fail () else
+-      let c1 = get s (i + 1) in
+-      let c2 = get s (i + 2) in
++      let c1 = get' s (i + 1) in
++      let c2 = get' s (i + 2) in
+       if (c1 lor c2) land 0xc0 <> 0x80 then fail () else
+       let v = c lsl 12 + c1 lsl 6 + c2 - 0xe2080 in
+       if v < 0x800 then fail () else
+@@ -1696,9 +1700,9 @@ let rec scan s' j s i l =
+     end else begin
+       (* 10000 - 10FFFF *)
+       if i + 3 >= l then fail () else
+-      let c1 = get s (i + 1) in
+-      let c2 = get s (i + 2) in
+-      let c3 = get s (i + 3) in
++      let c1 = get' s (i + 1) in
++      let c2 = get' s (i + 2) in
++      let c3 = get' s (i + 3) in
+       if (c1 lor c2 lor c3) land 0xc0 <> 0x80 then fail () else
+       let v = c lsl 18 + c1 lsl 12 + c2 lsl 6 + c3 - 0x03c82080 in
+       if v < 0x10000 || v > 0x10ffff then fail () else
+@@ -1708,7 +1712,7 @@ let rec scan s' j s i l =
+       scan s' (j + 4) s (i + 4) l
+     end
+   end else
+-    String.sub s' 0 (j + 2)
++    Bytes.sub s' 0 (j + 2)
+ 
+ and cont s' j s i l v =
+   set_2 s' j v;
+@@ -1716,16 +1720,16 @@ and cont s' j s i l v =
+ 
+ let to_utf_16_filename s =
+   let l = String.length s in
+-  let s' = String.make (2 * l + 2) '\000' in
+-  scan s' 0 s 0 l
++  let s' = Bytes.make (2 * l + 2) '\000' in
++  Bytes.to_string (scan s' 0 s 0 l)
+ 
+ (****)
+ 
+-let rec scan s' i' l' s i l =
++let rec scan s' i' l' (s: string) i l =
+   if i + 2 <= l then begin
+     let v = get_2 s i in
+     if v = 0 then
+-      String.sub s' 0 i'  (* null *)
++      Bytes.sub s' 0 i'  (* null *)
+     else if v < 0xD800 || v > 0xDFFF then
+       let i' = encode_char s' i' l' v in
+       scan s' i' l' s (i + 2) l
+@@ -1748,13 +1752,13 @@ let rec scan s' i' l' s i l =
+   end else if i < l then
+     fail () (* Odd number of chars *)
+   else
+-    String.sub s' 0 i'
++    Bytes.sub s' 0 i'
+ 
+ let from_utf_16 s =
+   let l = String.length s in
+   let l' = 3 * l / 2 in
+-  let s' = String.create l' in
+-  scan s' 0 l' s 0 l
++  let s' = Bytes.create l' in
++  Bytes.to_string (scan s' 0 l' s 0 l)
+ 
+ (****)
+ 
+@@ -1772,7 +1776,7 @@ let rec scan s' i' l' s i l =
+   if i + 2 <= l then begin
+     let v = get_2 s i in
+     if v = 0 then
+-      String.sub s' 0 i'  (* null *)
++      Bytes.sub s' 0 i'  (* null *)
+     else if v < 0xD800 then
+       let i' = encode_char s' i' l' v in
+       scan s' i' l' s (i + 2) l
+@@ -1781,7 +1785,7 @@ let rec scan s' i' l' s i l =
+         if v > 0xf000 && v <= 0xf029 then
+           if v = 0xf028 && end_of_name s i l then 0x20
+           else if v = 0xf029 && end_of_name s i l then 0x2e
+-          else get sfm_decode (v - 0xf000)
++          else get' sfm_decode (v - 0xf000)
+         else
+           v
+       in
+@@ -1806,34 +1810,34 @@ let rec scan s' i' l' s i l =
+   end else if i < l then
+     fail () (* Odd number of chars *)
+   else
+-    String.sub s' 0 i'
++    Bytes.sub s' 0 i'
+ 
+ (* NOTE: we MUST have to_utf_16_filename (from_utf_16 s) = s for any
+    Windows valid filename s *)
+ let from_utf_16_filename s =
+   let l = String.length s in
+   let l' = 3 * l / 2 in
+-  let s' = String.create l' in
+-  scan s' 0 l' s 0 l
++  let s' = Bytes.create l' in
++  Bytes.to_string (scan s' 0 l' s 0 l)
+ 
+ (****)
+ 
+ let rec scan s i l =
+   i = l ||
+-  let c = get s i in
++  let c = get' s i in
+   if c < 0x80 then
+     c <> 0 && scan s (i + 1) l
+   else if c < 0xE0 then begin
+     (* 80 - 7FF *)
+     c >= 0xc2 && i + 1 < l &&
+-    let c1 = get s (i + 1) in
++    let c1 = get' s (i + 1) in
+     c1 land 0xc0 = 0x80 &&
+     scan s (i + 2) l
+   end else if c < 0xF0 then begin
+     (* 800 - FFFF *)
+     i + 2 < l &&
+-    let c1 = get s (i + 1) in
+-    let c2 = get s (i + 2) in
++    let c1 = get' s (i + 1) in
++    let c2 = get' s (i + 2) in
+     (c1 lor c2) land 0xc0 = 0x80 &&
+     let v = c lsl 12 + c1 lsl 6 + c2 - 0xe2080 in
+     v >= 0x800 && (v < 0xd800 || (v > 0xdfff && v <> 0xfffe && v <> 0xffff)) &&
+@@ -1841,9 +1845,9 @@ let rec scan s i l =
+   end else begin
+     (* 10000 - 10FFFF *)
+     i + 3 < l &&
+-    let c1 = get s (i + 1) in
+-    let c2 = get s (i + 2) in
+-    let c3 = get s (i + 3) in
++    let c1 = get' s (i + 1) in
++    let c2 = get' s (i + 2) in
++    let c3 = get' s (i + 3) in
+     (c1 lor c2 lor c3) land 0xc0 = 0x80 &&
+     let v = c lsl 18 + c1 lsl 12 + c2 lsl 6 + c3 - 0x03c82080 in
+     v >= 0x10000 && v <= 0x10ffff &&



Home | Main Index | Thread Index | Old Index