pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/net/mldonkey
Module Name: pkgsrc
Committed By: dholland
Date: Wed Mar 14 14:05:37 UTC 2018
Modified Files:
pkgsrc/net/mldonkey: distinfo
pkgsrc/net/mldonkey/patches: patch-config_Makefile.in
patch-config_configure.in patch-src_config_unix_os_stubs.c.c
patch-src_networks_donkey_donkeyGlobals.ml
patch-src_utils_cdk_gdstubs.c patch-src_utils_cdk_zip.ml
patch-src_utils_cdk_zlibstubs.c patch-src_utils_lib_fst_hash.c
patch-src_utils_lib_options.ml4 patch-src_utils_lib_os_stubs.h
patch-src_utils_net_terminal.ml
Added Files:
pkgsrc/net/mldonkey/patches: patch-src_utils_cdk_bzip2.ml
patch-src_utils_cdk_bzip2.mli patch-src_utils_cdk_bzlib.ml
patch-src_utils_cdk_bzlib.mli patch-src_utils_cdk_filename2.ml
patch-src_utils_cdk_genlex2.ml patch-src_utils_cdk_gzip.ml
patch-src_utils_cdk_gzip.mli patch-src_utils_cdk_string2.ml
patch-src_utils_cdk_string2.mli patch-src_utils_cdk_tar.mlcpp
patch-src_utils_cdk_unix2.ml patch-src_utils_cdk_zlib.ml
patch-src_utils_cdk_zlib.mli patch-src_utils_extlib_IO.ml
patch-src_utils_extlib_IO.mli patch-src_utils_lib_md4.ml
patch-src_utils_lib_md4.mli patch-src_utils_lib_misc.ml
patch-src_utils_lib_misc2.mlcpp patch-src_utils_lib_syslog.ml
patch-src_utils_lib_tiger.c patch-src_utils_lib_unix32.ml
patch-src_utils_lib_unix32.mli patch-src_utils_lib_url.ml
patch-src_utils_lib_verificationBitmap.ml
Log Message:
Partial build fixes for ocaml 4.06.
not at all clear this thing is worth the trouble...
To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 pkgsrc/net/mldonkey/distinfo
cvs rdiff -u -r1.1 -r1.2 pkgsrc/net/mldonkey/patches/patch-config_Makefile.in \
pkgsrc/net/mldonkey/patches/patch-src_config_unix_os_stubs.c.c \
pkgsrc/net/mldonkey/patches/patch-src_networks_donkey_donkeyGlobals.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_gdstubs.c \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zip.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zlibstubs.c \
pkgsrc/net/mldonkey/patches/patch-src_utils_lib_fst_hash.c \
pkgsrc/net/mldonkey/patches/patch-src_utils_lib_options.ml4 \
pkgsrc/net/mldonkey/patches/patch-src_utils_lib_os_stubs.h \
pkgsrc/net/mldonkey/patches/patch-src_utils_net_terminal.ml
cvs rdiff -u -r1.6 -r1.7 \
pkgsrc/net/mldonkey/patches/patch-config_configure.in
cvs rdiff -u -r0 -r1.1 \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzip2.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzip2.mli \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzlib.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzlib.mli \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_filename2.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_genlex2.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_gzip.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_gzip.mli \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_string2.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_string2.mli \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_tar.mlcpp \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_unix2.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zlib.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zlib.mli \
pkgsrc/net/mldonkey/patches/patch-src_utils_extlib_IO.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_extlib_IO.mli \
pkgsrc/net/mldonkey/patches/patch-src_utils_lib_md4.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_lib_md4.mli \
pkgsrc/net/mldonkey/patches/patch-src_utils_lib_misc.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_lib_misc2.mlcpp \
pkgsrc/net/mldonkey/patches/patch-src_utils_lib_syslog.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_lib_tiger.c \
pkgsrc/net/mldonkey/patches/patch-src_utils_lib_unix32.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_lib_unix32.mli \
pkgsrc/net/mldonkey/patches/patch-src_utils_lib_url.ml \
pkgsrc/net/mldonkey/patches/patch-src_utils_lib_verificationBitmap.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/mldonkey/distinfo
diff -u pkgsrc/net/mldonkey/distinfo:1.64 pkgsrc/net/mldonkey/distinfo:1.65
--- pkgsrc/net/mldonkey/distinfo:1.64 Mon Aug 15 15:48:19 2016
+++ pkgsrc/net/mldonkey/distinfo Wed Mar 14 14:05:37 2018
@@ -1,17 +1,43 @@
-$NetBSD: distinfo,v 1.64 2016/08/15 15:48:19 jaapb Exp $
+$NetBSD: distinfo,v 1.65 2018/03/14 14:05:37 dholland Exp $
SHA1 (mldonkey-3.1.5.tar.bz2) = 7bc4f9272ecfe6403eef7062766b26bf321e3015
RMD160 (mldonkey-3.1.5.tar.bz2) = 63a21aef47a7510b7f9867544345c8f03edc89c3
SHA512 (mldonkey-3.1.5.tar.bz2) = 96e75acf91d7ecc41490f898e06d284da27404c7e567f173936d8113885a3b4b6bc93341358f92a30d3f699eef681d97ce56414a37bb02a535ad2da4d4ad13a3
Size (mldonkey-3.1.5.tar.bz2) = 2847382 bytes
-SHA1 (patch-config_Makefile.in) = a575c505c1f736bc3940790b43a6cf2083f29112
-SHA1 (patch-config_configure.in) = f9c3887e04a9727e13fecd47d763462a413913f3
-SHA1 (patch-src_config_unix_os_stubs.c.c) = 4cc60c1019a93212157d526e15269079c1e84e20
-SHA1 (patch-src_networks_donkey_donkeyGlobals.ml) = a9734496b883e4ced2a6a744d0b2fcf331b56ba1
-SHA1 (patch-src_utils_cdk_gdstubs.c) = 52717da3310492d3d737b5332e295573e5142f8a
-SHA1 (patch-src_utils_cdk_zip.ml) = 3a511187821445040a7d53b80fb3f9682f905463
-SHA1 (patch-src_utils_cdk_zlibstubs.c) = 14d61998e620b27afbecbe5e058c8ef466a68ecb
-SHA1 (patch-src_utils_lib_fst_hash.c) = f5b69a13d8ab7f3149e82b6f0f37425fdd62a945
-SHA1 (patch-src_utils_lib_options.ml4) = 9e47644d41606a2fb29f5e3c2609d2d36d97b745
-SHA1 (patch-src_utils_lib_os_stubs.h) = 4128c7507cff2f70708ab38684f7fd60af6f6bca
-SHA1 (patch-src_utils_net_terminal.ml) = 8745d3d6f605c9609febfea4e84c5c6619be0d14
+SHA1 (patch-config_Makefile.in) = 84f235f7ad4e6a9cdec807a24d3f11f769a01399
+SHA1 (patch-config_configure.in) = 0f187754d590a565b22ef402351dbe18c456a8c5
+SHA1 (patch-src_config_unix_os_stubs.c.c) = 6abe8ef9a040be0716e3d6c88b48764b6dd7ed55
+SHA1 (patch-src_networks_donkey_donkeyGlobals.ml) = 5f0b36213b6e6185077cd5c8d82b314b1c50c8c2
+SHA1 (patch-src_utils_cdk_bzip2.ml) = 77f7b96a12930df3843c38baa69a90ad73a26f8d
+SHA1 (patch-src_utils_cdk_bzip2.mli) = c54fcf33541ada525d33d6485a9362bb1cb5c8cf
+SHA1 (patch-src_utils_cdk_bzlib.ml) = fd13e153d484ed6d07dfeaaf5e19560cac92e0a2
+SHA1 (patch-src_utils_cdk_bzlib.mli) = 2057ae8479851ad49b5fd5630e51c63f5c3d08f3
+SHA1 (patch-src_utils_cdk_filename2.ml) = 08c1da16ee18c32b2efe4342030054a8e396960b
+SHA1 (patch-src_utils_cdk_gdstubs.c) = 9d8ef81fcf3515ab5337769aef12c6aacbb4eb81
+SHA1 (patch-src_utils_cdk_genlex2.ml) = 679554178ef641ae573523599ecb0587c4cefb78
+SHA1 (patch-src_utils_cdk_gzip.ml) = c044e15df645f3262664ca136fddabf7e5e2a0d1
+SHA1 (patch-src_utils_cdk_gzip.mli) = 9eaef0cfae3844742ca14a1aca3c900ae22e813c
+SHA1 (patch-src_utils_cdk_string2.ml) = 8f73f9be699dfa92e2360c1ce94b26d4d5e1e62c
+SHA1 (patch-src_utils_cdk_string2.mli) = 5ed5cdc6fb12b964bb65d861a33901e9ec68d504
+SHA1 (patch-src_utils_cdk_tar.mlcpp) = 75e2cab5d1e3d1e880a13bd0f7b2e29f7c0ca2be
+SHA1 (patch-src_utils_cdk_unix2.ml) = 3893de3d70704fc625b6cb2e2e405911b92a32ab
+SHA1 (patch-src_utils_cdk_zip.ml) = a875053a90c911e2f07fcfc75aa307e6ba7cd5b4
+SHA1 (patch-src_utils_cdk_zlib.ml) = a2ad3cdde37fe9ee329c1e9193e7744bda167a4a
+SHA1 (patch-src_utils_cdk_zlib.mli) = bf6125e1812ece75d48ee3a7fda88ef9f172bd26
+SHA1 (patch-src_utils_cdk_zlibstubs.c) = cd005903f050e2c9fee1f745ada40f5dad2e3985
+SHA1 (patch-src_utils_extlib_IO.ml) = 8d889c88345ba5e622200558760b221abde4ab7a
+SHA1 (patch-src_utils_extlib_IO.mli) = 8f41b20aa762f7ba22fec958862015f81adc2952
+SHA1 (patch-src_utils_lib_fst_hash.c) = c96999a09d392293fc6dc997f3a2d5465bd2e8d8
+SHA1 (patch-src_utils_lib_md4.ml) = 3d283d01ff1a95cb2893b52bccefd63d1c28f6c6
+SHA1 (patch-src_utils_lib_md4.mli) = ad6c4085f6ef803e0e97be15ad7380bc6f24555e
+SHA1 (patch-src_utils_lib_misc.ml) = 947a8f24d1ea2a05b8a83d2d7da84c7f9d991602
+SHA1 (patch-src_utils_lib_misc2.mlcpp) = 077de6829a0d7367352c5b6ea5562c42e441a396
+SHA1 (patch-src_utils_lib_options.ml4) = aa7a752f894a09d2a1fe3f69e1796d560f241e24
+SHA1 (patch-src_utils_lib_os_stubs.h) = a6707829311c46dd598d269c465a02f0fa8fc701
+SHA1 (patch-src_utils_lib_syslog.ml) = e3993e6a3a008bc7e52eb414e980afb41658dafb
+SHA1 (patch-src_utils_lib_tiger.c) = d4b3b9a3de0a64dee442911a4d9b30d075091a7e
+SHA1 (patch-src_utils_lib_unix32.ml) = 81f4b15ece553bb7a46a046026bb3d2f74d5d2b2
+SHA1 (patch-src_utils_lib_unix32.mli) = 39ae8385f2b43bcb961476c639acfbace4774197
+SHA1 (patch-src_utils_lib_url.ml) = aa1194997f44e7437ada3012058455964c4573f2
+SHA1 (patch-src_utils_lib_verificationBitmap.ml) = f8d7af0eff1674ca83a98a800e53e2a41da9922a
+SHA1 (patch-src_utils_net_terminal.ml) = f601ea7facc3f31f9f288567a094fbd3e1bda70c
Index: pkgsrc/net/mldonkey/patches/patch-config_Makefile.in
diff -u pkgsrc/net/mldonkey/patches/patch-config_Makefile.in:1.1 pkgsrc/net/mldonkey/patches/patch-config_Makefile.in:1.2
--- pkgsrc/net/mldonkey/patches/patch-config_Makefile.in:1.1 Fri Sep 14 19:23:31 2012
+++ pkgsrc/net/mldonkey/patches/patch-config_Makefile.in Wed Mar 14 14:05:37 2018
@@ -1,6 +1,7 @@
-$NetBSD: patch-config_Makefile.in,v 1.1 2012/09/14 19:23:31 jaapb Exp $
+$NetBSD: patch-config_Makefile.in,v 1.2 2018/03/14 14:05:37 dholland Exp $
Correct include paths for lablgtk 2.16
+
--- config/Makefile.in.orig 2012-07-01 17:47:41.000000000 +0000
+++ config/Makefile.in
@@ -655,15 +655,18 @@ install:: opt
Index: pkgsrc/net/mldonkey/patches/patch-src_config_unix_os_stubs.c.c
diff -u pkgsrc/net/mldonkey/patches/patch-src_config_unix_os_stubs.c.c:1.1 pkgsrc/net/mldonkey/patches/patch-src_config_unix_os_stubs.c.c:1.2
--- pkgsrc/net/mldonkey/patches/patch-src_config_unix_os_stubs.c.c:1.1 Mon Aug 15 15:48:19 2016
+++ pkgsrc/net/mldonkey/patches/patch-src_config_unix_os_stubs.c.c Wed Mar 14 14:05:37 2018
@@ -1,6 +1,7 @@
-$NetBSD: patch-src_config_unix_os_stubs.c.c,v 1.1 2016/08/15 15:48:19 jaapb Exp $
+$NetBSD: patch-src_config_unix_os_stubs.c.c,v 1.2 2018/03/14 14:05:37 dholland Exp $
Compile with OCaml 4.03
+
--- src/config/unix/os_stubs_c.c.orig 2010-07-16 13:56:35.000000000 +0000
+++ src/config/unix/os_stubs_c.c
@@ -66,7 +66,7 @@ ssize_t os_read(OS_FD fd, char *buf, siz
Index: pkgsrc/net/mldonkey/patches/patch-src_networks_donkey_donkeyGlobals.ml
diff -u pkgsrc/net/mldonkey/patches/patch-src_networks_donkey_donkeyGlobals.ml:1.1 pkgsrc/net/mldonkey/patches/patch-src_networks_donkey_donkeyGlobals.ml:1.2
--- pkgsrc/net/mldonkey/patches/patch-src_networks_donkey_donkeyGlobals.ml:1.1 Mon Aug 15 15:48:19 2016
+++ pkgsrc/net/mldonkey/patches/patch-src_networks_donkey_donkeyGlobals.ml Wed Mar 14 14:05:37 2018
@@ -1,6 +1,7 @@
-$NetBSD: patch-src_networks_donkey_donkeyGlobals.ml,v 1.1 2016/08/15 15:48:19 jaapb Exp $
+$NetBSD: patch-src_networks_donkey_donkeyGlobals.ml,v 1.2 2018/03/14 14:05:37 dholland Exp $
Compile with OCaml 4.03
+
--- src/networks/donkey/donkeyGlobals.ml.orig 2011-10-25 17:33:21.000000000 +0000
+++ src/networks/donkey/donkeyGlobals.ml
@@ -781,7 +781,6 @@ let set_client_name c name md4 =
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_gdstubs.c
diff -u pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_gdstubs.c:1.1 pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_gdstubs.c:1.2
--- pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_gdstubs.c:1.1 Mon Aug 15 15:48:19 2016
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_gdstubs.c Wed Mar 14 14:05:37 2018
@@ -1,6 +1,7 @@
-$NetBSD: patch-src_utils_cdk_gdstubs.c,v 1.1 2016/08/15 15:48:19 jaapb Exp $
+$NetBSD: patch-src_utils_cdk_gdstubs.c,v 1.2 2018/03/14 14:05:37 dholland Exp $
Compile with OCaml 4.03
+
--- src/utils/cdk/gdstubs.c.orig 2012-06-24 07:59:41.000000000 +0000
+++ src/utils/cdk/gdstubs.c
@@ -489,7 +489,7 @@ int ml_image_pngversion(void)
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zip.ml
diff -u pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zip.ml:1.1 pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zip.ml:1.2
--- pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zip.ml:1.1 Mon Aug 15 15:48:19 2016
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zip.ml Wed Mar 14 14:05:37 2018
@@ -1,8 +1,30 @@
-$NetBSD: patch-src_utils_cdk_zip.ml,v 1.1 2016/08/15 15:48:19 jaapb Exp $
+$NetBSD: patch-src_utils_cdk_zip.ml,v 1.2 2018/03/14 14:05:37 dholland Exp $
+
+Compile with OCaml 4.03 (the exception Error block)
+and again with 4.06 (the rest)
-Compile with OCaml 4.03
--- src/utils/cdk/zip.ml.orig 2007-02-06 22:26:59.000000000 +0000
+++ src/utils/cdk/zip.ml
+@@ -27,8 +27,8 @@ let read4_int ic =
+ if hw > max_int lsr 16 then raise (Error("", "", "32-bit data too large"));
+ lw lor (hw lsl 16)
+ let readstring ic n =
+- let s = String.create n in
+- really_input ic s 0 n; s
++ let s = Bytes.create n in
++ really_input ic s 0 n; Bytes.to_string s
+
+ let write1 = output_byte
+ let write2 oc n =
+@@ -40,7 +40,7 @@ let write4_int oc n =
+ write2 oc n;
+ write2 oc (n lsr 16)
+ let writestring oc s =
+- output oc s 0 (String.length s)
++ output oc (Bytes.of_string s) 0 (String.length s)
+
+ type compression_method = Stored | Deflated
+
@@ -72,8 +72,6 @@ type out_file =
mutable of_entries: entry list;
of_comment: string }
@@ -12,3 +34,160 @@ Compile with OCaml 4.03
(* Return the position of the last occurrence of s1 in s2, or -1 if not
found. *)
+@@ -81,7 +79,7 @@ let strrstr pattern buf ofs len =
+ let rec search i j =
+ if i < ofs then -1
+ else if j >= String.length pattern then i
+- else if pattern.[j] = buf.[i + j] then search i (j+1)
++ else if pattern.[j] = Bytes.get buf (i + j) then search i (j+1)
+ else search (i-1) 0
+ in search (ofs + len - String.length pattern) 0
+
+@@ -116,7 +114,7 @@ let dostime_of_unixtime t =
+ (* Read end of central directory record *)
+
+ let read_ecd filename ic =
+- let buf = String.create 256 in
++ let buf = Bytes.create 256 in
+ let filelen = in_channel_length ic in
+ let rec find_ecd pos len =
+ (* On input, bytes 0 ... len - 1 of buf reflect what is at pos in ic *)
+@@ -125,7 +123,7 @@ let read_ecd filename ic =
+ "end of central directory not found, not a ZIP file"));
+ let toread = min pos 128 in
+ (* Make room for "toread" extra bytes, and read them *)
+- String.blit buf 0 buf toread (256 - toread);
++ Bytes.blit buf 0 buf toread (256 - toread);
+ let newpos = pos - toread in
+ seek_in ic newpos;
+ really_input ic buf 0 toread;
+@@ -134,7 +132,7 @@ let read_ecd filename ic =
+ let ofs = strrstr "PK\005\006" buf 0 newlen in
+ if ofs < 0 || newlen < 22 ||
+ (let comment_len =
+- Char.code buf.[ofs + 20] lor (Char.code buf.[ofs + 21] lsl 8) in
++ Char.code (Bytes.get buf (ofs + 20)) lor (Char.code (Bytes.get buf (ofs + 21)) lsl 8) in
+ newpos + ofs + 22 + comment_len <> filelen) then
+ find_ecd newpos newlen
+ else
+@@ -268,14 +266,14 @@ let goto_entry ifile e =
+ let read_entry ifile e =
+ try
+ goto_entry ifile e;
+- let res = String.create e.uncompressed_size in
++ let res = Bytes.create e.uncompressed_size in
+ match e.methd with
+ Stored ->
+ if e.compressed_size <> e.uncompressed_size then
+ raise (Error(ifile.if_filename, e.filename,
+ "wrong size for stored entry"));
+ really_input ifile.if_channel res 0 e.uncompressed_size;
+- res
++ Bytes.to_string res
+ | Deflated ->
+ let in_avail = ref e.compressed_size in
+ let out_pos = ref 0 in
+@@ -283,25 +281,25 @@ let read_entry ifile e =
+ Zlib.uncompress ~header:false
+ (fun buf ->
+ let read = input ifile.if_channel buf 0
+- (min !in_avail (String.length buf)) in
++ (min !in_avail (Bytes.length buf)) in
+ in_avail := !in_avail - read;
+ read)
+ (fun buf len ->
+- if !out_pos + len > String.length res then
++ if !out_pos + len > Bytes.length res then
+ raise (Error(ifile.if_filename, e.filename,
+ "wrong size for deflated entry (too much data)"));
+- String.blit buf 0 res !out_pos len;
++ Bytes.blit buf 0 res !out_pos len;
+ out_pos := !out_pos + len)
+ with Zlib.Error(_, _) ->
+ raise (Error(ifile.if_filename, e.filename, "decompression error"))
+ end;
+- if !out_pos <> String.length res then
++ if !out_pos <> Bytes.length res then
+ raise (Error(ifile.if_filename, e.filename,
+ "wrong size for deflated entry (not enough data)"));
+- let crc = Zlib.update_crc Int32.zero res 0 (String.length res) in
++ let crc = Zlib.update_crc Int32.zero (Bytes.to_string res) 0 (Bytes.length res) in
+ if crc <> e.crc then
+ raise (Error(ifile.if_filename, e.filename, "CRC mismatch"));
+- res
++ Bytes.to_string res
+ with End_of_file ->
+ raise (Error(ifile.if_filename, e.filename, "truncated data"))
+
+@@ -315,10 +313,10 @@ let copy_entry_to_channel ifile e oc =
+ if e.compressed_size <> e.uncompressed_size then
+ raise (Error(ifile.if_filename, e.filename,
+ "wrong size for stored entry"));
+- let buf = String.create 4096 in
++ let buf = Bytes.create 4096 in
+ let rec copy n =
+ if n > 0 then begin
+- let r = input ifile.if_channel buf 0 (min n (String.length buf)) in
++ let r = input ifile.if_channel buf 0 (min n (Bytes.length buf)) in
+ output oc buf 0 r;
+ copy (n - r)
+ end in
+@@ -330,12 +328,12 @@ let copy_entry_to_channel ifile e oc =
+ Zlib.uncompress ~header:false
+ (fun buf ->
+ let read = input ifile.if_channel buf 0
+- (min !in_avail (String.length buf)) in
++ (min !in_avail (Bytes.length buf)) in
+ in_avail := !in_avail - read;
+ read)
+ (fun buf len ->
+ output oc buf 0 len;
+- crc := Zlib.update_crc !crc buf 0 len)
++ crc := Zlib.update_crc !crc (Bytes.to_string buf) 0 len)
+ with Zlib.Error(_, _) ->
+ raise (Error(ifile.if_filename, e.filename, "decompression error"))
+ end;
+@@ -475,7 +473,7 @@ let add_entry data ofile ?(extra = "") ?
+ let compr_size =
+ match level with
+ 0 ->
+- output ofile.of_channel data 0 (String.length data);
++ output ofile.of_channel (Bytes.of_string data) 0 (String.length data);
+ String.length data
+ | _ ->
+ let in_pos = ref 0 in
+@@ -484,7 +482,7 @@ let add_entry data ofile ?(extra = "") ?
+ Zlib.compress ~header:false
+ (fun buf ->
+ let n = min (String.length data - !in_pos)
+- (String.length buf) in
++ (Bytes.length buf) in
+ String.blit data !in_pos buf 0 n;
+ in_pos := !in_pos + n;
+ n)
+@@ -506,11 +504,11 @@ let copy_channel_to_entry ic ofile ?(ext
+ let (compr_size, uncompr_size) =
+ match level with
+ 0 ->
+- let buf = String.create 4096 in
++ let buf = Bytes.create 4096 in
+ let rec copy sz =
+- let r = input ic buf 0 (String.length buf) in
++ let r = input ic buf 0 (Bytes.length buf) in
+ if r = 0 then sz else begin
+- crc := Zlib.update_crc !crc buf 0 r;
++ crc := Zlib.update_crc !crc (Bytes.to_string buf) 0 r;
+ output ofile.of_channel buf 0 r;
+ copy (sz + r)
+ end in
+@@ -522,8 +520,8 @@ let copy_channel_to_entry ic ofile ?(ext
+ try
+ Zlib.compress ~header:false
+ (fun buf ->
+- let r = input ic buf 0 (String.length buf) in
+- crc := Zlib.update_crc !crc buf 0 r;
++ let r = input ic buf 0 (Bytes.length buf) in
++ crc := Zlib.update_crc !crc (Bytes.to_string buf) 0 r;
+ in_pos := !in_pos + r;
+ r)
+ (fun buf n ->
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zlibstubs.c
diff -u pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zlibstubs.c:1.1 pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zlibstubs.c:1.2
--- pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zlibstubs.c:1.1 Mon Aug 15 15:48:19 2016
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zlibstubs.c Wed Mar 14 14:05:37 2018
@@ -1,6 +1,7 @@
-$NetBSD: patch-src_utils_cdk_zlibstubs.c,v 1.1 2016/08/15 15:48:19 jaapb Exp $
+$NetBSD: patch-src_utils_cdk_zlibstubs.c,v 1.2 2018/03/14 14:05:37 dholland Exp $
Compile with OCaml 4.03
+
--- src/utils/cdk/zlibstubs.c.orig 2009-02-24 18:34:31.000000000 +0000
+++ src/utils/cdk/zlibstubs.c
@@ -191,7 +191,7 @@ value camlzip_inflateEnd(value vzs)
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_lib_fst_hash.c
diff -u pkgsrc/net/mldonkey/patches/patch-src_utils_lib_fst_hash.c:1.1 pkgsrc/net/mldonkey/patches/patch-src_utils_lib_fst_hash.c:1.2
--- pkgsrc/net/mldonkey/patches/patch-src_utils_lib_fst_hash.c:1.1 Mon Aug 15 15:48:19 2016
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_lib_fst_hash.c Wed Mar 14 14:05:37 2018
@@ -1,6 +1,8 @@
-$NetBSD: patch-src_utils_lib_fst_hash.c,v 1.1 2016/08/15 15:48:19 jaapb Exp $
+$NetBSD: patch-src_utils_lib_fst_hash.c,v 1.2 2018/03/14 14:05:37 dholland Exp $
+
+Compile with OCaml 4.03 (int64 -> int64_t)
+and with 4.06 (string -> bytes)
-Compile with OCaml 4.03
--- src/utils/lib/fst_hash.c.orig 2005-12-10 19:44:28.000000000 +0000
+++ src/utils/lib/fst_hash.c
@@ -197,7 +197,7 @@ unsigned short fst_hash_checksum (unsign
@@ -21,3 +23,20 @@ Compile with OCaml 4.03
{
unsigned char * buf = file;
size_t len = filesize;
+@@ -323,14 +323,14 @@ void fst_hash_string (unsigned char *fth
+
+ value fst_hash_file_ml(value digest, value filename, value filesize)
+ {
+- if(fst_hash_file(String_val(digest), String_val(filename),
++ if(fst_hash_file(bytes_val(digest), String_val(filename),
+ Int64_val(filesize))) return Val_unit;
+ failwith("Exception during FST computation");
+ }
+
+ value fst_hash_string_ml(value digest, value s, value size)
+ {
+- fst_hash_string(String_val(digest), String_val(s), Int_val(size));
++ fst_hash_string(Bytes_val(digest), String_val(s), Int_val(size));
+ return Val_unit;
+ }
+
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_lib_options.ml4
diff -u pkgsrc/net/mldonkey/patches/patch-src_utils_lib_options.ml4:1.1 pkgsrc/net/mldonkey/patches/patch-src_utils_lib_options.ml4:1.2
--- pkgsrc/net/mldonkey/patches/patch-src_utils_lib_options.ml4:1.1 Mon Aug 15 15:48:19 2016
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_lib_options.ml4 Wed Mar 14 14:05:37 2018
@@ -1,17 +1,30 @@
-$NetBSD: patch-src_utils_lib_options.ml4,v 1.1 2016/08/15 15:48:19 jaapb Exp $
+$NetBSD: patch-src_utils_lib_options.ml4,v 1.2 2018/03/14 14:05:37 dholland Exp $
-Compile with OCaml 4.03
---- src/utils/lib/options.ml4.orig 2013-07-07 10:56:43.000000000 +0000
+Compile with OCaml 4.03 (is_printable changes)
+and 4.06 (string/bytes changes)
+
+--- src/utils/lib/options.ml4.dist 2013-07-07 10:56:43.000000000 +0000
+++ src/utils/lib/options.ml4
-@@ -332,7 +332,6 @@ let exit_exn = Exit
+@@ -208,7 +208,7 @@ and parse_option = parser
+ | [< 'Int i >] -> IntValue i
+ | [< 'Float f >] -> FloatValue f
+ | [< 'Kwd "@"; 'Int i; v = parse_once_value i >] -> OnceValue v
+-| [< 'Char c >] -> StringValue (let s = String.create 1 in s.[0] <- c; s)
++| [< 'Char c >] -> StringValue (String.make 1 c)
+ | [< 'Kwd "["; v = parse_list [] >] -> List v
+ | [< 'Kwd "("; v = parse_list [] >] -> List v
+
+@@ -332,8 +332,7 @@ let exit_exn = Exit
let unsafe_get = String.unsafe_get
-external is_printable : char -> bool = "caml_is_printable"
- let unsafe_set = String.unsafe_set
+-let unsafe_set = String.unsafe_set
++let unsafe_set = Bytes.unsafe_set
let escaped s =
-@@ -343,7 +342,7 @@ let escaped s =
+ let n = ref 0 in
+@@ -343,31 +342,22 @@ let escaped s =
(match unsafe_get s i with
'"' | '\\' -> 2
| '\n' | '\t' -> 1
@@ -20,7 +33,11 @@ Compile with OCaml 4.03
done;
if !n = String.length s then s
else
-@@ -354,16 +353,7 @@ let escaped s =
+- let s' = String.create !n in
++ let s' = Bytes.create !n in
+ n := 0;
+ for i = 0 to String.length s - 1 do
+ begin match unsafe_get s i with
'"' | '\\' as c -> unsafe_set s' !n '\\'; incr n; unsafe_set s' !n c
| '\n' | '\t' as c -> unsafe_set s' !n c
| c ->
@@ -38,3 +55,8 @@ Compile with OCaml 4.03
end;
incr n
done;
+- s'
++ Bytes.to_string s'
+
+ let safe_string s =
+ if s = "" then "\"\""
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_lib_os_stubs.h
diff -u pkgsrc/net/mldonkey/patches/patch-src_utils_lib_os_stubs.h:1.1 pkgsrc/net/mldonkey/patches/patch-src_utils_lib_os_stubs.h:1.2
--- pkgsrc/net/mldonkey/patches/patch-src_utils_lib_os_stubs.h:1.1 Mon Aug 15 15:48:19 2016
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_lib_os_stubs.h Wed Mar 14 14:05:37 2018
@@ -1,6 +1,7 @@
-$NetBSD: patch-src_utils_lib_os_stubs.h,v 1.1 2016/08/15 15:48:19 jaapb Exp $
+$NetBSD: patch-src_utils_lib_os_stubs.h,v 1.2 2018/03/14 14:05:37 dholland Exp $
Compile with OCaml 4.03
+
--- src/utils/lib/os_stubs.h.orig 2010-08-01 14:05:29.000000000 +0000
+++ src/utils/lib/os_stubs.h
@@ -155,8 +155,8 @@ extern OFF_T os_lseek(OS_FD fd, OFF_T po
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_net_terminal.ml
diff -u pkgsrc/net/mldonkey/patches/patch-src_utils_net_terminal.ml:1.1 pkgsrc/net/mldonkey/patches/patch-src_utils_net_terminal.ml:1.2
--- pkgsrc/net/mldonkey/patches/patch-src_utils_net_terminal.ml:1.1 Mon Oct 20 10:12:51 2014
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_net_terminal.ml Wed Mar 14 14:05:37 2018
@@ -1,6 +1,7 @@
-$NetBSD: patch-src_utils_net_terminal.ml,v 1.1 2014/10/20 10:12:51 jaapb Exp $
+$NetBSD: patch-src_utils_net_terminal.ml,v 1.2 2018/03/14 14:05:37 dholland Exp $
Unterminated string constant cleaned up
+
--- src/utils/net/terminal.ml.orig 2005-11-19 17:19:45.000000000 +0000
+++ src/utils/net/terminal.ml
@@ -185,7 +185,7 @@ module Output = struct
Index: pkgsrc/net/mldonkey/patches/patch-config_configure.in
diff -u pkgsrc/net/mldonkey/patches/patch-config_configure.in:1.6 pkgsrc/net/mldonkey/patches/patch-config_configure.in:1.7
--- pkgsrc/net/mldonkey/patches/patch-config_configure.in:1.6 Mon Aug 15 15:48:19 2016
+++ pkgsrc/net/mldonkey/patches/patch-config_configure.in Wed Mar 14 14:05:37 2018
@@ -1,6 +1,7 @@
-$NetBSD: patch-config_configure.in,v 1.6 2016/08/15 15:48:19 jaapb Exp $
+$NetBSD: patch-config_configure.in,v 1.7 2018/03/14 14:05:37 dholland Exp $
Correct include paths for lablgtk 2.16
+
--- config/configure.in.orig 2012-08-05 15:49:02.000000000 +0000
+++ config/configure.in
@@ -1347,15 +1364,15 @@ if test "$GTK_CONFIG" = "no"; then
Added files:
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzip2.ml
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzip2.ml:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzip2.ml Wed Mar 14 14:05:37 2018
@@ -0,0 +1,126 @@
+$NetBSD: patch-src_utils_cdk_bzip2.ml,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/cdk/bzip2.ml~ 2006-03-05 10:41:06.000000000 +0000
++++ src/utils/cdk/bzip2.ml
+@@ -7,7 +7,7 @@ let buffer_size = 1024
+
+ type in_channel =
+ { in_chan: Pervasives.in_channel;
+- in_buffer: string;
++ in_buffer: bytes;
+ mutable in_pos: int;
+ mutable in_avail: int;
+ mutable in_eof: bool;
+@@ -16,7 +16,7 @@ type in_channel =
+
+ let open_in_chan ic =
+ { in_chan = ic;
+- in_buffer = String.create buffer_size;
++ in_buffer = Bytes.create buffer_size;
+ in_pos = 0;
+ in_avail = 0;
+ in_eof = false;
+@@ -32,12 +32,12 @@ let open_in filename =
+ let read_byte iz =
+ if iz.in_avail = 0 then begin
+ let n = Pervasives.input iz.in_chan iz.in_buffer 0
+- (String.length iz.in_buffer) in
++ (Bytes.length iz.in_buffer) in
+ if n = 0 then raise End_of_file;
+ iz.in_pos <- 0;
+ iz.in_avail <- n
+ end;
+- let c = iz.in_buffer.[iz.in_pos] in
++ let c = Bytes.get iz.in_buffer iz.in_pos in
+ iz.in_pos <- iz.in_pos + 1;
+ iz.in_avail <- iz.in_avail - 1;
+ Char.code c
+@@ -53,19 +53,19 @@ let read_int32 iz =
+ (Int32.shift_left (Int32.of_int b4) 24)))
+
+ let rec input iz buf pos len =
+- if pos < 0 || len < 0 || pos + len > String.length buf then
++ if pos < 0 || len < 0 || pos + len > Bytes.length buf then
+ invalid_arg "Bzip2.input";
+ if iz.in_eof then 0 else begin
+ if iz.in_avail = 0 then begin
+ let n = Pervasives.input iz.in_chan iz.in_buffer 0
+- (String.length iz.in_buffer) in
++ (Bytes.length iz.in_buffer) in
+ if n = 0 then raise(Error("truncated file"));
+ iz.in_pos <- 0;
+ iz.in_avail <- n
+ end;
+ let (finished, used_in, used_out) =
+ try
+- Bzlib.decompress iz.in_stream iz.in_buffer iz.in_pos iz.in_avail
++ Bzlib.decompress iz.in_stream (Bytes.to_string iz.in_buffer) iz.in_pos iz.in_avail
+ buf pos len
+ with Bzlib.Error(_, e) ->
+ raise(Error(Bzlib.string_of_error e)) in
+@@ -88,10 +88,10 @@ let rec really_input iz buf pos len =
+ really_input iz buf (pos + n) (len - n)
+ end
+
+-let char_buffer = String.create 1
++let char_buffer = Bytes.create 1
+
+ let input_char iz =
+- if input iz char_buffer 0 1 = 0 then raise End_of_file else char_buffer.[0]
++ if input iz char_buffer 0 1 = 0 then raise End_of_file else Bytes.get char_buffer 0
+
+ let input_byte iz =
+ Char.code (input_char iz)
+@@ -106,7 +106,7 @@ let close_in iz =
+
+ type out_channel =
+ { out_chan: Pervasives.out_channel;
+- out_buffer: string;
++ out_buffer: bytes;
+ mutable out_pos: int;
+ mutable out_avail: int;
+ out_stream: Bzlib.stream;
+@@ -115,7 +115,7 @@ type out_channel =
+ let open_out_chan ?(level = 6) oc =
+ if level < 1 || level > 9 then invalid_arg "Bzip2.open_out: bad level";
+ { out_chan = oc;
+- out_buffer = String.create buffer_size;
++ out_buffer = Bytes.create buffer_size;
+ out_pos = 0;
+ out_avail = buffer_size;
+ out_stream = Bzlib.compress_init level 0 0;
+@@ -132,7 +132,7 @@ let rec output oz buf pos len =
+ (* Printf.printf "Flushing out_avail\n"; *)
+ Pervasives.output oz.out_chan oz.out_buffer 0 oz.out_pos;
+ oz.out_pos <- 0;
+- oz.out_avail <- String.length oz.out_buffer
++ oz.out_avail <- Bytes.length oz.out_buffer
+ end;
+ let (_, used_in, used_out) =
+ try
+@@ -147,8 +147,8 @@ let rec output oz buf pos len =
+ if used_in < len then output oz buf (pos + used_in) (len - used_in)
+
+ let output_char oz c =
+- char_buffer.[0] <- c;
+- output oz char_buffer 0 1
++ let s = String.make 1 c in
++ output oz s 0 1
+
+ let output_byte oz b =
+ output_char oz (Char.unsafe_chr b)
+@@ -159,10 +159,10 @@ let flush oz =
+ if oz.out_avail = 0 then begin
+ Pervasives.output oz.out_chan oz.out_buffer 0 oz.out_pos;
+ oz.out_pos <- 0;
+- oz.out_avail <- String.length oz.out_buffer
++ oz.out_avail <- Bytes.length oz.out_buffer
+ end;
+ let (finished, _, used_out) =
+- Bzlib.compress oz.out_stream oz.out_buffer 0 0
++ Bzlib.compress oz.out_stream (Bytes.to_string oz.out_buffer) 0 0
+ oz.out_buffer oz.out_pos oz.out_avail
+ Bzlib.BZ_FINISH in
+ oz.out_pos <- oz.out_pos + used_out;
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzip2.mli
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzip2.mli:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzip2.mli Wed Mar 14 14:05:37 2018
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_utils_cdk_bzip2.mli,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/cdk/bzip2.mli~ 2005-09-13 09:49:40.000000000 +0000
++++ src/utils/cdk/bzip2.mli
+@@ -22,7 +22,7 @@ val input_byte: in_channel -> int
+ (* Same as [Bzip2.input_char], but return the 8-bit integer representing
+ the character.
+ Raise [End_of_file] if no more compressed data is available. *)
+-val input: in_channel -> string -> int -> int -> int
++val input: in_channel -> bytes -> int -> int -> int
+ (* [input ic buf pos len] uncompresses up to [len] characters
+ from the given channel [ic],
+ storing them in string [buf], starting at character number [pos].
+@@ -38,7 +38,7 @@ val input: in_channel -> string -> int -
+ exactly [len] characters.)
+ Exception [Invalid_argument "Bzip2.input"] is raised if
+ [pos] and [len] do not designate a valid substring of [buf]. *)
+-val really_input: in_channel -> string -> int -> int -> unit
++val really_input: in_channel -> bytes -> int -> int -> unit
+ (* [really_input ic buf pos len] uncompresses [len] characters
+ from the given channel, storing them in
+ string [buf], starting at character number [pos].
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzlib.ml
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzlib.ml:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzlib.ml Wed Mar 14 14:05:37 2018
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_utils_cdk_bzlib.ml,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/cdk/bzlib.ml~ 2005-08-01 20:09:13.000000000 +0000
++++ src/utils/cdk/bzlib.ml
+@@ -23,7 +23,7 @@ type action = BZ_RUN | BZ_FLUSH | BZ_FIN
+
+ external compress_init: int -> int -> int -> stream = "camlzip_bzCompressInit"
+ external compress:
+- stream -> string -> int -> int -> string -> int -> int -> action
++ stream -> string -> int -> int -> bytes -> int -> int -> action
+ -> bool * int * int
+ = "camlzip_bzCompress_bytecode" "camlzip_bzCompress"
+ external compress_end: stream -> unit = "camlzip_bzCompressEnd"
+@@ -31,7 +31,7 @@ external compress_end: stream -> unit =
+
+ external decompress_init: int -> bool -> stream = "camlzip_bzDecompressInit"
+ external decompress:
+- stream -> string -> int -> int -> string -> int -> int -> bool * int * int
++ stream -> string -> int -> int -> bytes -> int -> int -> bool * int * int
+ = "camlzip_bzDecompress_bytecode" "camlzip_bzDecompress"
+ external decompress_end: stream -> unit = "camlzip_bzDecompressEnd"
+
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzlib.mli
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzlib.mli:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_bzlib.mli Wed Mar 14 14:05:37 2018
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_utils_cdk_bzlib.mli,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/cdk/bzlib.mli~ 2005-08-01 20:09:13.000000000 +0000
++++ src/utils/cdk/bzlib.mli
+@@ -10,7 +10,7 @@ type action = BZ_RUN | BZ_FLUSH | BZ_FIN
+
+ external compress_init: int -> int -> int -> stream = "camlzip_bzCompressInit"
+ external compress:
+- stream -> string -> int -> int -> string -> int -> int -> action
++ stream -> string -> int -> int -> bytes -> int -> int -> action
+ -> bool * int * int
+ = "camlzip_bzCompress_bytecode" "camlzip_bzCompress"
+ external compress_end: stream -> unit = "camlzip_bzCompressEnd"
+@@ -18,7 +18,7 @@ external compress_end: stream -> unit =
+
+ external decompress_init: int -> bool -> stream = "camlzip_bzDecompressInit"
+ external decompress:
+- stream -> string -> int -> int -> string -> int -> int -> bool * int * int
++ stream -> string -> int -> int -> bytes -> int -> int -> bool * int * int
+ = "camlzip_bzDecompress_bytecode" "camlzip_bzDecompress"
+ external decompress_end: stream -> unit = "camlzip_bzDecompressEnd"
+
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_filename2.ml
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_filename2.ml:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_filename2.ml Wed Mar 14 14:05:37 2018
@@ -0,0 +1,39 @@
+$NetBSD: patch-src_utils_cdk_filename2.ml,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/cdk/filename2.ml~ 2012-06-24 07:59:41.000000000 +0000
++++ src/utils/cdk/filename2.ml
+@@ -116,11 +116,11 @@ let to_string filename =
+ List.fold_left (fun file f -> f file) filename !to_strings
+
+ let path_of_filename filename =
+- let filename = String.copy filename in
++ let change c =
++ if c = '\\' then '/' else c
++ in
++ let filename = String.map change filename in
+ let len = String.length filename in
+- for i = 0 to len - 1 do
+- if filename.[i] = '\\' then filename.[i] <- '/';
+- done;
+ let filename =
+ if len > 2 && filename.[1] = ':' &&
+ match filename.[0] with
+@@ -142,11 +142,11 @@ let filesystem_compliant name fs namemax
+ (* replace all illegal characters with a valid one.
+ assumes all filesystems accept '_'s in filenames *)
+ let escape_chars p filename =
+- let s = String.copy filename in
+- for i = 0 to String.length filename - 1 do
+- if p s.[i] then s.[i] <- '_'
+- done;
+- s in
++ let change c =
++ if p c then '_' else c
++ in
++ String.map change filename
++ in
+
+ (* remove all illegal characters at the beginning of filename *)
+ let trim_left p filename =
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_genlex2.ml
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_genlex2.ml:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_genlex2.ml Wed Mar 14 14:05:37 2018
@@ -0,0 +1,39 @@
+$NetBSD: patch-src_utils_cdk_genlex2.ml,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/cdk/genlex2.ml~ 2003-04-22 22:33:39.000000000 +0000
++++ src/utils/cdk/genlex2.ml
+@@ -28,7 +28,7 @@ type token =
+
+ (* The string buffering machinery *)
+
+-let initial_buffer = String.create 32
++let initial_buffer = Bytes.create 32
+
+ let buffer = ref initial_buffer
+ let bufpos = ref 0
+@@ -36,16 +36,18 @@ let bufpos = ref 0
+ let reset_buffer () = buffer := initial_buffer; bufpos := 0
+
+ let store c =
+- if !bufpos >= String.length !buffer then
++ if !bufpos >= Bytes.length !buffer then
+ begin
+- let newbuffer = String.create (2 * !bufpos) in
+- String.blit !buffer 0 newbuffer 0 !bufpos; buffer := newbuffer
++ let newbuffer = Bytes.create (2 * !bufpos) in
++ Bytes.blit !buffer 0 newbuffer 0 !bufpos; buffer := newbuffer
+ end;
+- String.set !buffer !bufpos c;
++ Bytes.set !buffer !bufpos c;
+ incr bufpos
+
+ let get_string () =
+- let s = String.sub !buffer 0 !bufpos in buffer := initial_buffer; s
++ let s = Bytes.to_string (Bytes.sub !buffer 0 !bufpos) in
++ buffer := initial_buffer;
++ s
+
+ (* The lexer *)
+
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_gzip.ml
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_gzip.ml:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_gzip.ml Wed Mar 14 14:05:37 2018
@@ -0,0 +1,180 @@
+$NetBSD: patch-src_utils_cdk_gzip.ml,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/cdk/gzip.ml~ 2010-11-07 15:01:40.000000000 +0000
++++ src/utils/cdk/gzip.ml
+@@ -21,14 +21,14 @@ let buffer_size = 1024
+
+ type in_channel =
+ { in_chan: IO.input;
+- in_buffer: string;
++ in_buffer: bytes;
+ mutable in_pos: int;
+ mutable in_avail: int;
+ mutable in_eof: bool;
+ in_stream: Zlib.stream;
+ mutable in_size: int32;
+ mutable in_crc: int32;
+- char_buffer: string }
++ char_buffer: bytes }
+
+ let open_in ic =
+ (* Superficial parsing of header *)
+@@ -66,14 +66,14 @@ let open_in ic =
+ raise(Error("premature end of input, not a gzip stream"))
+ end;
+ { in_chan = ic;
+- in_buffer = String.create buffer_size;
++ in_buffer = Bytes.create buffer_size;
+ in_pos = 0;
+ in_avail = 0;
+ in_eof = false;
+ in_stream = Zlib.inflate_init false;
+ in_size = Int32.zero;
+ in_crc = Int32.zero;
+- char_buffer = String.create 1 }
++ char_buffer = Bytes.create 1 }
+
+ let open_in_file filename =
+ let ic = Pervasives.open_in_bin filename in
+@@ -84,11 +84,11 @@ let open_in_file filename =
+ let read_byte iz =
+ if iz.in_avail = 0 then begin
+ let n = IO.input iz.in_chan iz.in_buffer 0
+- (String.length iz.in_buffer) in
++ (Bytes.length iz.in_buffer) in
+ iz.in_pos <- 0;
+ iz.in_avail <- n
+ end;
+- let c = iz.in_buffer.[iz.in_pos] in
++ let c = Bytes.get iz.in_buffer iz.in_pos in
+ iz.in_pos <- iz.in_pos + 1;
+ iz.in_avail <- iz.in_avail - 1;
+ Char.code c
+@@ -104,12 +104,12 @@ let read_int32 iz =
+ (Int32.shift_left (Int32.of_int b4) 24)))
+
+ let rec input iz buf pos len =
+- if pos < 0 || len < 0 || pos + len > String.length buf then
++ if pos < 0 || len < 0 || pos + len > Bytes.length buf then
+ invalid_arg "Gzip_stream.input";
+ if iz.in_eof then 0 else begin
+ if iz.in_avail = 0 then begin
+ let n = try IO.input iz.in_chan iz.in_buffer 0
+- (String.length iz.in_buffer)
++ (Bytes.length iz.in_buffer)
+ with IO.No_more_input -> raise(Error("truncated stream"))
+ in
+ iz.in_pos <- 0;
+@@ -123,7 +123,7 @@ let rec input iz buf pos len =
+ raise(Error("error during decompression")) in
+ iz.in_pos <- iz.in_pos + used_in;
+ iz.in_avail <- iz.in_avail - used_in;
+- iz.in_crc <- Zlib.update_crc iz.in_crc buf pos used_out;
++ iz.in_crc <- Zlib.update_crc iz.in_crc (Bytes.to_string buf) pos used_out;
+ iz.in_size <- Int32.add iz.in_size (Int32.of_int used_out);
+ if finished then begin
+ try
+@@ -152,7 +152,7 @@ let rec really_input iz buf pos len =
+ end
+
+ let input_char iz =
+- if input iz iz.char_buffer 0 1 = 0 then raise End_of_file else iz.char_buffer.[0]
++ if input iz iz.char_buffer 0 1 = 0 then raise End_of_file else Bytes.get iz.char_buffer 0
+
+ let input_byte iz =
+ Char.code (input_char iz)
+@@ -167,13 +167,13 @@ let close_in iz =
+
+ type 'a out_channel =
+ { out_chan: 'a IO.output;
+- out_buffer: string;
++ out_buffer: bytes;
+ mutable out_pos: int;
+ mutable out_avail: int;
+ out_stream: Zlib.stream;
+ mutable out_size: int32;
+ mutable out_crc: int32;
+- char_buffer: string }
++ char_buffer: bytes }
+
+ let open_out ?(level = 6) oc =
+ if level < 1 || level > 9 then invalid_arg "Gzip_stream.open_output: bad level";
+@@ -186,13 +186,13 @@ let open_out ?(level = 6) oc =
+ IO.write_byte oc 0; (* xflags *)
+ IO.write_byte oc 0xFF; (* OS (unknown) *)
+ { out_chan = oc;
+- out_buffer = String.create buffer_size;
++ out_buffer = Bytes.create buffer_size;
+ out_pos = 0;
+ out_avail = buffer_size;
+ out_stream = Zlib.deflate_init level false;
+ out_size = Int32.zero;
+ out_crc = Int32.zero;
+- char_buffer = String.create 1 }
++ char_buffer = Bytes.create 1 }
+
+ let open_out_file ?level filename =
+ let oc = Pervasives.open_out_bin filename in
+@@ -202,13 +202,13 @@ let open_out_file ?level filename =
+ exn -> Pervasives.close_out oc; raise exn
+
+ let rec output oz buf pos len =
+- if pos < 0 || len < 0 || pos + len > String.length buf then
++ if pos < 0 || len < 0 || pos + len > Bytes.length buf then
+ invalid_arg "Gzip_stream.output";
+ (* If output buffer is full, flush it *)
+ if oz.out_avail = 0 then begin
+- ignore (IO.really_output oz.out_chan oz.out_buffer 0 oz.out_pos);
++ ignore (IO.really_output oz.out_chan (Bytes.to_string oz.out_buffer) 0 oz.out_pos);
+ oz.out_pos <- 0;
+- oz.out_avail <- String.length oz.out_buffer
++ oz.out_avail <- Bytes.length oz.out_buffer
+ end;
+ let (_, used_in, used_out) =
+ try
+@@ -220,11 +220,11 @@ let rec output oz buf pos len =
+ oz.out_pos <- oz.out_pos + used_out;
+ oz.out_avail <- oz.out_avail - used_out;
+ oz.out_size <- Int32.add oz.out_size (Int32.of_int used_in);
+- oz.out_crc <- Zlib.update_crc oz.out_crc buf pos used_in;
++ oz.out_crc <- Zlib.update_crc oz.out_crc (Bytes.to_string buf) pos used_in;
+ if used_in < len then output oz buf (pos + used_in) (len - used_in)
+
+ let output_char oz c =
+- oz.char_buffer.[0] <- c;
++ Bytes.set oz.char_buffer 0 c;
+ output oz oz.char_buffer 0 1
+
+ let output_byte oz b =
+@@ -241,9 +241,9 @@ let flush oz =
+ let rec do_flush () =
+ (* If output buffer is full, flush it *)
+ if oz.out_avail = 0 then begin
+- ignore (IO.really_output oz.out_chan oz.out_buffer 0 oz.out_pos);
++ ignore (IO.really_output oz.out_chan (Bytes.to_string oz.out_buffer) 0 oz.out_pos);
+ oz.out_pos <- 0;
+- oz.out_avail <- String.length oz.out_buffer
++ oz.out_avail <- Bytes.length oz.out_buffer
+ end;
+ let (finished, _, used_out) =
+ Zlib.deflate oz.out_stream oz.out_buffer 0 0
+@@ -255,7 +255,7 @@ let flush oz =
+ do_flush();
+ (* Final data flush *)
+ if oz.out_pos > 0 then
+- ignore (IO.really_output oz.out_chan oz.out_buffer 0 oz.out_pos);
++ ignore (IO.really_output oz.out_chan (Bytes.to_string oz.out_buffer) 0 oz.out_pos);
+ (* Write CRC and size *)
+ write_int32 oz.out_chan oz.out_crc;
+ write_int32 oz.out_chan oz.out_size;
+@@ -277,7 +277,7 @@ let output_io io =
+ let oz = open_out io in
+ IO.create_out
+ ~write:(output_char oz)
+- ~output:(fun s o l -> output oz s o l; l)
++ ~output:(fun s o l -> output oz (Bytes.of_string s) o l; l)
+ ~flush:(fun () -> IO.flush io)
+ ~close:(fun () -> close_out oz)
+
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_gzip.mli
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_gzip.mli:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_gzip.mli Wed Mar 14 14:05:37 2018
@@ -0,0 +1,33 @@
+$NetBSD: patch-src_utils_cdk_gzip.mli,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/cdk/gzip.mli~ 2010-11-07 15:01:40.000000000 +0000
++++ src/utils/cdk/gzip.mli
+@@ -35,7 +35,7 @@ val input_byte: in_channel -> int
+ (* Same as [Gzip.input_char], but return the 8-bit integer representing
+ the character.
+ Raise [End_of_file] if no more compressed data is available. *)
+-val input: in_channel -> string -> int -> int -> int
++val input: in_channel -> bytes -> int -> int -> int
+ (* [input ic buf pos len] uncompresses up to [len] characters
+ from the given channel [ic],
+ storing them in string [buf], starting at character number [pos].
+@@ -51,7 +51,7 @@ val input: in_channel -> string -> int -
+ exactly [len] characters.)
+ Exception [Invalid_argument "Gzip.input"] is raised if
+ [pos] and [len] do not designate a valid substring of [buf]. *)
+-val really_input: in_channel -> string -> int -> int -> unit
++val really_input: in_channel -> bytes -> int -> int -> unit
+ (* [really_input ic buf pos len] uncompresses [len] characters
+ from the given channel, storing them in
+ string [buf], starting at character number [pos].
+@@ -95,7 +95,7 @@ val output_char: 'a out_channel -> char
+ val output_byte: 'a out_channel -> int -> unit
+ (* Same as [Gzip.output_char], but the output character is given
+ by its code. The given integer is taken modulo 256. *)
+-val output: 'a out_channel -> string -> int -> int -> unit
++val output: 'a out_channel -> bytes -> int -> int -> unit
+ (* [output oc buf pos len] compresses and writes [len] characters
+ from string [buf], starting at offset [pos], and writes the
+ compressed data to the channel [oc].
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_string2.ml
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_string2.ml:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_string2.ml Wed Mar 14 14:05:37 2018
@@ -0,0 +1,102 @@
+$NetBSD: patch-src_utils_cdk_string2.ml,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/cdk/string2.ml~ 2007-01-28 20:39:59.000000000 +0000
++++ src/utils/cdk/string2.ml
+@@ -163,11 +163,10 @@ let check_suffix s suffix =
+ len >= slen && String.sub s (len - slen) slen = suffix
+
+ let upp_initial s =
+- if String.length s > 0 then
+- let s = String.copy s in
+- s.[0] <- Char.uppercase s.[0]; s
+- else
+- s
++ let change i c =
++ if i = 0 then Char.uppercase_ascii c else c
++ in
++ String.mapi change s
+
+ (* not optimal !*)
+ let rec subequal s1 pos1 s2 pos2 len =
+@@ -195,7 +194,7 @@ let subcontains s sub =
+
+ let of_char c = String.make 1 c
+
+-
++(* problematic with immutable strings
+ let resize s newlen =
+ let len = String.length s in
+ if len > newlen then String.sub s 0 newlen
+@@ -203,13 +202,10 @@ let resize s newlen =
+ let str = String.create newlen in
+ String.blit s 0 str 0 len;
+ str
++*)
+
+ let init len f =
+- let s = String.create len in
+- for i = 0 to len - 1 do
+- s.[i] <- f i
+- done;
+- s
++ String.init len f
+
+ let is_space c = c = ' ' || c = '\n' || c = '\r' || c = '\t'
+
+@@ -266,30 +262,24 @@ let starts_with s1 s2 =
+ let len2 = String.length s2 in
+ len2 <= len1 && strneql s1 s2 len2
+
+-let replace_char s c1 c2 =
+- for i = 0 to String.length s - 1 do
+- if s.[i] == c1 then s.[i] <- c2
+- done
++let replace_char' s c1 c2 =
++ let change i c =
++ if c = c1 then c2 else c
++ in
++ String.mapi change s
+
+ let stem s =
+- let s = String.lowercase (String.copy s) in
+- for i = 0 to String.length s - 1 do
+- let c = s.[i] in
++ let munge i c =
+ match c with
+- 'a'..'z' | '0' .. '9' -> ()
+- | _ -> s.[i] <- ' ';
+- done;
++ 'a'..'z' | '0' .. '9' -> c
++ | _ -> ' '
++ in
++ let s = String.mapi munge (String.lowercase_ascii s) in
+ split_simplify s ' '
+
+ let map f s =
+ let len = String.length s in
+- if len = 0 then [||] else
+- let v = f s.[0] in
+- let array = Array.create len v in
+- for i = 1 to len -1 do
+- array.(i) <- f s.[i]
+- done;
+- array
++ Array.init len (fun i -> f s.[i])
+
+ let iteri f s =
+ let len = String.length s in
+@@ -298,11 +288,7 @@ let iteri f s =
+ done
+
+ let init n f =
+- let s = String.create n in
+- for i = 0 to n - 1 do
+- s.[i] <- f i
+- done;
+- s
++ String.init n f
+
+ let exists p s =
+ let l = String.length s in
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_string2.mli
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_string2.mli:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_string2.mli Wed Mar 14 14:05:37 2018
@@ -0,0 +1,28 @@
+$NetBSD: patch-src_utils_cdk_string2.mli,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/cdk/string2.mli~ 2007-01-28 20:39:59.000000000 +0000
++++ src/utils/cdk/string2.mli
+@@ -79,7 +79,9 @@ val subcontains : string -> string -> bo
+ val of_char : char -> string
+ (*d [of_char c] returns the string containing one [c]. *)
+
++(* problematic with immutable strings
+ val resize : string -> int -> string
++*)
+ (*d [resize s len] returns a string of length [len] starting with [s]. *)
+
+ val init : int -> (int -> char) -> string
+@@ -93,7 +95,11 @@ external contains : string -> string ->
+ val starts_with : (* string *) string -> (* start *) string -> bool
+
+ (* [replace_char s c1 c2] replaces char [c1] by char [c2] in [s] *)
++(* problematic with immutable strings
+ val replace_char : string -> char -> char -> unit
++*)
++(* [replace_char' s c1 c2] makes a new string with [c1] replaced with [c2] *)
++val replace_char' : string -> char -> char -> string
+
+ (* [stem s] cuts the string [s] in small words, for indexation eg *)
+ val stem : string -> string list
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_tar.mlcpp
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_tar.mlcpp:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_tar.mlcpp Wed Mar 14 14:05:37 2018
@@ -0,0 +1,112 @@
+$NetBSD: patch-src_utils_cdk_tar.mlcpp,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/cdk/tar.mlcpp.orig 2010-12-19 10:10:24.000000000 +0000
++++ src/utils/cdk/tar.mlcpp
+@@ -169,7 +169,7 @@ let align_at_header t =
+ | None -> ()
+ | Some h ->
+ let entry_size = ((h.t_size/blocksize) + 1) * blocksize
+- and buf = String.create blocksize
++ and buf = Bytes.create blocksize
+ and discarded = ref 0 in
+ while !discarded < entry_size do
+ let read = t.chan#input buf 0 blocksize in
+@@ -177,7 +177,7 @@ let align_at_header t =
+ done;
+ t.last_header <- None
+
+-let empty_block = String.make blocksize '\000'
++let empty_block = Bytes.make blocksize '\000'
+
+ let compute_chksum buf =
+ let chksum = ref 256 in (* 256 is the sum of 8 ' ' characters for the chksum field *)
+@@ -206,8 +206,9 @@ let read_oldgnu_header header =
+ }
+
+ let read_gnu_header t =
+- let buf = String.create blocksize in
++ let buf = Bytes.create blocksize in
+ t.chan#really_input buf 0 blocksize;
++ let buf = Bytes.to_string buf in
+ { t_atime = extract_int32 buf 0 12;
+ t_ctime = extract_int32 buf 12 12;
+ t_offset = extract_int32 buf 24 12;
+@@ -216,9 +217,10 @@ let read_gnu_header t =
+
+ let read_header t =
+ align_at_header t;
+- let buf = String.create blocksize in
++ let buf = Bytes.create blocksize in
+ t.chan#really_input buf 0 blocksize;
+ if buf = empty_block then raise End_of_file;
++ let buf = Bytes.to_string buf in
+ let head1 = { t_name = c_string buf 0;
+ t_mode = extract_num buf 100 8;
+ t_uid = extract_num buf 108 8;
+@@ -264,14 +266,14 @@ let read_body t =
+ let header = get_header t in
+ t.last_header <- None;
+ if header.t_size = 0 then ""
+- else let buf = String.create header.t_size in
++ else let buf = Bytes.create header.t_size in
+ t.chan#really_input buf 0 header.t_size;
+ let align = blocksize - (header.t_size mod blocksize) in
+ if align <> blocksize then begin
+- let leftover = String.create blocksize in
++ let leftover = Bytes.create blocksize in
+ t.chan#really_input leftover 0 align
+ end;
+- buf
++ Bytes.to_string buf
+
+ let read_entry t =
+ let head = read_header t in
+@@ -291,7 +293,7 @@ end
+
+ #ifdef USE_BZIP2
+ class bzout_chan o = object
+- method output str pos len = Bzip2.output o str pos len
++ method output str pos len = Bzip2.output o (Bytes.to_string str) pos len
+ method flush () = Bzip2.flush o
+ method close () = Bzip2.close_out o
+ end
+@@ -390,14 +392,14 @@ let write_gnu_header t buf =
+
+ let output t head body =
+ let size = String.length body in
+- let buf = String.copy empty_block in
++ let buf = Bytes.copy empty_block in
+ write_str buf 0 100 head.t_name;
+ write_num8 buf 100 head.t_mode;
+ write_num8 buf 108 head.t_uid;
+ write_num8 buf 116 head.t_gid;
+ write_num12 buf 124 size;
+ write_int32 buf 136 head.t_mtime;
+- buf.[156] <- typeflag_to_char head.t_typeflag;
++ Bytes.set buf 156 (typeflag_to_char head.t_typeflag);
+ write_str buf 157 100 head.t_linkname;
+ write_magic buf 257 head.t_format;
+ write_str buf 265 32 head.t_uname;
+@@ -407,16 +409,16 @@ let output t head body =
+ write_str buf 345 155 head.t_prefix;
+ if head.t_format = OLDGNU_FORMAT then
+ write_oldgnu_header head buf;
+- let chksum = compute_chksum buf in
++ let chksum = compute_chksum (Bytes.to_string buf) in
+ write_padded_num buf 148 chksum;
+ t.ochan#output buf 0 blocksize;
+- if head.t_format = GNU_FORMAT && isdigit buf.[156] then begin
+- let buf2 = String.copy empty_block in
++ if head.t_format = GNU_FORMAT && isdigit (Bytes.get buf 156) then begin
++ let buf2 = Bytes.copy empty_block in
+ write_gnu_header head buf2;
+ t.ochan#output buf2 0 blocksize
+ end;
+ if size > 0 then begin
+- t.ochan#output body 0 size;
++ t.ochan#output (Bytes.of_string body) 0 size;
+ let align = blocksize - (size mod blocksize) in
+ if align > 0 && align < blocksize then
+ t.ochan#output empty_block 0 align
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_unix2.ml
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_unix2.ml:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_unix2.ml Wed Mar 14 14:05:37 2018
@@ -0,0 +1,38 @@
+$NetBSD: patch-src_utils_cdk_unix2.ml,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/cdk/unix2.ml~ 2013-07-07 10:53:52.000000000 +0000
++++ src/utils/cdk/unix2.ml
+@@ -156,7 +156,7 @@ let copy oldname newname =
+ (try Unix.fchmod descr stats.Unix.LargeFile.st_perm
+ with e -> lprintf_nl "copy: failed to preserve mode"));
+ let buffer_len = 8192 in
+- let buffer = String.create buffer_len in
++ let buffer = Bytes.create buffer_len in
+ let rec copy_file () =
+ let n = input ic buffer 0 buffer_len in
+ if n = 0 then () else begin
+@@ -205,18 +205,18 @@ let rec remove_all_directory dirname =
+ Unix.rmdir dirname
+
+ let random () =
+- let s = String.create 7 in
++ let s = Bytes.create 7 in
+ for i = 0 to 6 do
+- s.[i] <- char_of_int (97 + Random.int 26)
++ Bytes.set s i (char_of_int (97 + Random.int 26))
+ done;
+- s
++ Bytes.to_string s
+
+ let can_write_to_directory dirname =
+ let temp_file = Filename.concat dirname "tmp_" ^ random () ^ "_mld.tmp" in
+ let check () = with_remove temp_file (fun _ ->
+ tryopen_openfile temp_file [O_WRONLY; O_CREAT] 0o600 (fun fd ->
+ let test_string = "mldonkey accesstest - this file can be deleted\n" in
+- really_write fd test_string 0 (String.length test_string)))
++ really_write fd (Bytes.of_string test_string) 0 (String.length test_string)))
+ in
+ try
+ check ()
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zlib.ml
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zlib.ml:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zlib.ml Wed Mar 14 14:05:37 2018
@@ -0,0 +1,47 @@
+$NetBSD: patch-src_utils_cdk_zlib.ml,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/cdk/zlib.mli~ 2005-08-01 20:09:13.000000000 +0000
++++ src/utils/cdk/zlib.mli
+@@ -2,10 +2,10 @@ exception Error of string * string
+
+ val compress:
+ ?level: int -> ?header: bool ->
+- (string -> int) -> (string -> int -> unit) -> unit
++ (bytes -> int) -> (bytes -> int -> unit) -> unit
+
+ val uncompress:
+- ?header: bool -> (string -> int) -> (string -> int -> unit) -> unit
++ ?header: bool -> (bytes -> int) -> (bytes -> int -> unit) -> unit
+
+ type stream
+
+@@ -17,14 +17,14 @@ type flush_command =
+
+ external deflate_init: int -> bool -> stream = "camlzip_deflateInit"
+ external deflate:
+- stream -> string -> int -> int -> string -> int -> int -> flush_command
++ stream -> bytes -> int -> int -> bytes -> int -> int -> flush_command
+ -> bool * int * int
+ = "camlzip_deflate_bytecode" "camlzip_deflate"
+ external deflate_end: stream -> unit = "camlzip_deflateEnd"
+
+ external inflate_init: bool -> stream = "camlzip_inflateInit"
+ external inflate:
+- stream -> string -> int -> int -> string -> int -> int -> flush_command
++ stream -> bytes -> int -> int -> bytes -> int -> int -> flush_command
+ -> bool * int * int
+ = "camlzip_inflate_bytecode" "camlzip_inflate"
+ external inflate_end: stream -> unit = "camlzip_inflateEnd"
+@@ -33,8 +33,8 @@ external update_crc: int32 -> string ->
+ = "camlzip_update_crc32"
+
+ val uncompress_string : string -> string
+-val uncompress_string2 : string -> string
+-val compress_string : ?level:int -> string -> string
++val uncompress_string2 : bytes -> bytes
++val compress_string : ?level:int -> bytes -> bytes
+ val gzip_string : ?level:int -> string -> string
+
+ val zlib_version_num : unit -> string
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zlib.mli
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zlib.mli:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_cdk_zlib.mli Wed Mar 14 14:05:37 2018
@@ -0,0 +1,153 @@
+$NetBSD: patch-src_utils_cdk_zlib.mli,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/cdk/zlib.ml~ 2007-02-11 13:15:49.000000000 +0000
++++ src/utils/cdk/zlib.ml
+@@ -13,14 +13,14 @@ type flush_command =
+
+ external deflate_init: int -> bool -> stream = "camlzip_deflateInit"
+ external deflate:
+- stream -> string -> int -> int -> string -> int -> int -> flush_command
++ stream -> bytes -> int -> int -> bytes -> int -> int -> flush_command
+ -> bool * int * int
+ = "camlzip_deflate_bytecode" "camlzip_deflate"
+ external deflate_end: stream -> unit = "camlzip_deflateEnd"
+
+ external inflate_init: bool -> stream = "camlzip_inflateInit"
+ external inflate:
+- stream -> string -> int -> int -> string -> int -> int -> flush_command
++ stream -> bytes -> int -> int -> bytes -> int -> int -> flush_command
+ -> bool * int * int
+ = "camlzip_inflate_bytecode" "camlzip_inflate"
+ external inflate_end: stream -> unit = "camlzip_inflateEnd"
+@@ -40,8 +40,8 @@ let zlib_version_num () =
+ let buffer_size = 1024
+
+ let compress ?(level = 6) ?(header = true) refill flush =
+- let inbuf = String.create buffer_size
+- and outbuf = String.create buffer_size in
++ let inbuf = Bytes.create buffer_size
++ and outbuf = Bytes.create buffer_size in
+ let zs = deflate_init level header in
+ let rec compr inpos inavail =
+ if inavail = 0 then begin
+@@ -63,15 +63,15 @@ let compress ?(level = 6) ?(header = tru
+ deflate_end zs
+
+ let grow_buffer s =
+- let s' = String.create (2 * String.length s) in
+- String.blit s 0 s' 0 (String.length s);
++ let s' = Bytes.create (2 * Bytes.length s) in
++ Bytes.blit s 0 s' 0 (Bytes.length s);
+ s'
+
+ let compress_string ?(level = 6) inbuf =
+ let zs = deflate_init level true in
+ let rec compr inpos outbuf outpos =
+- let inavail = String.length inbuf - inpos in
+- let outavail = String.length outbuf - outpos in
++ let inavail = Bytes.length inbuf - inpos in
++ let outavail = Bytes.length outbuf - outpos in
+ if outavail = 0
+ then compr inpos (grow_buffer outbuf) outpos
+ else begin
+@@ -79,11 +79,11 @@ let compress_string ?(level = 6) inbuf =
+ deflate zs inbuf inpos inavail outbuf outpos outavail
+ (if inavail = 0 then Z_FINISH else Z_NO_FLUSH) in
+ if finished then
+- String.sub outbuf 0 (outpos + used_out)
++ Bytes.sub outbuf 0 (outpos + used_out)
+ else
+ compr (inpos + used_in) outbuf (outpos + used_out)
+ end in
+- let res = compr 0 (String.create (String.length inbuf)) 0 in
++ let res = compr 0 (Bytes.create (Bytes.length inbuf)) 0 in
+ deflate_end zs;
+ res
+
+@@ -95,22 +95,22 @@ let gzip_string ?(level = 6) inbuf =
+ let out_crc = ref Int32.zero in
+ let rec compr inpos outbuf outpos =
+ let inavail = String.length inbuf - inpos in
+- let outavail = String.length outbuf - outpos in
++ let outavail = Bytes.length outbuf - outpos in
+ if outavail = 0
+ then compr inpos (grow_buffer outbuf) outpos
+ else begin
+ let (finished, used_in, used_out) =
+- deflate zs inbuf inpos inavail outbuf outpos outavail
++ deflate zs (Bytes.of_string inbuf) inpos inavail outbuf outpos outavail
+ (if inavail = 0 then Z_FINISH else Z_NO_FLUSH) in
+ out_crc := update_crc !out_crc inbuf inpos used_in;
+ if finished then
+- String.sub outbuf 0 (outpos + used_out)
++ Bytes.sub outbuf 0 (outpos + used_out)
+ else
+ compr (inpos + used_in) outbuf (outpos + used_out)
+ end in
+- let res = compr 0 (String.create (String.length inbuf)) 0 in
++ let res = compr 0 (Bytes.create (String.length inbuf)) 0 in
+ deflate_end zs;
+- let buf = Buffer.create (18 + String.length res) in
++ let buf = Buffer.create (18 + Bytes.length res) in
+ let write_int wbuf n =
+ Buffer.add_char wbuf (char_of_int n)
+ in
+@@ -128,15 +128,15 @@ let gzip_string ?(level = 6) inbuf =
+ for i = 1 to 4 do write_int buf 0 done;
+ write_int buf 0;
+ write_int buf 0xFF;
+- Buffer.add_string buf res;
++ Buffer.add_bytes buf res;
+ write_int32 buf !out_crc;
+ write_int32 buf (Int32.of_int (String.length inbuf));
+ Buffer.contents buf
+ end
+
+ let uncompress ?(header = true) refill flush =
+- let inbuf = String.create buffer_size
+- and outbuf = String.create buffer_size in
++ let inbuf = Bytes.create buffer_size
++ and outbuf = Bytes.create buffer_size in
+ let zs = inflate_init header in
+ let rec uncompr inpos inavail =
+ if inavail = 0 then begin
+@@ -164,19 +164,19 @@ let uncompress ?(header = true) refill f
+ let uncompress_string2 inbuf =
+ let zs = inflate_init true in
+ let rec uncompr inpos outbuf outpos =
+- let inavail = String.length inbuf - inpos in
+- let outavail = String.length outbuf - outpos in
++ let inavail = Bytes.length inbuf - inpos in
++ let outavail = Bytes.length outbuf - outpos in
+ if outavail = 0
+ then uncompr inpos (grow_buffer outbuf) outpos
+ else begin
+ let (finished, used_in, used_out) =
+ inflate zs inbuf inpos inavail outbuf outpos outavail Z_SYNC_FLUSH in
+ if finished then
+- String.sub outbuf 0 (outpos + used_out)
++ Bytes.sub outbuf 0 (outpos + used_out)
+ else
+ uncompr (inpos + used_in) outbuf (outpos + used_out)
+ end in
+- let res = uncompr 0 (String.create (2 * String.length inbuf)) 0 in
++ let res = uncompr 0 (Bytes.create (2 * Bytes.length inbuf)) 0 in
+ inflate_end zs;
+ res
+
+@@ -185,11 +185,11 @@ let uncompress_string s =
+ let pos = ref 0 in
+ let len = String.length s in
+ uncompress ~header: true (fun b ->
+- let n = min (String.length b) (len - !pos) in
++ let n = min (Bytes.length b) (len - !pos) in
+ if n < 1 then 0 else begin
+ String.blit s !pos b 0 n;
+ pos := !pos + n;
+ n end
+- ) (fun s len -> Buffer.add_string buf (String.sub s 0 len));
++ ) (fun s len -> Buffer.add_bytes buf (Bytes.sub s 0 len));
+ Buffer.contents buf
+
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_extlib_IO.ml
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_extlib_IO.ml:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_extlib_IO.ml Wed Mar 14 14:05:37 2018
@@ -0,0 +1,117 @@
+$NetBSD: patch-src_utils_extlib_IO.ml,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/extlib/IO.ml~ 2010-11-07 15:01:40.000000000 +0000
++++ src/utils/extlib/IO.ml
+@@ -20,7 +20,7 @@
+
+ type input = {
+ mutable in_read : unit -> char;
+- mutable in_input : string -> int -> int -> int;
++ mutable in_input : bytes -> int -> int -> int;
+ mutable in_close : unit -> unit;
+ }
+
+@@ -62,7 +62,7 @@ let nread i n =
+ if n = 0 then
+ ""
+ else
+- let s = String.create n in
++ let s = Bytes.create n in
+ let l = ref n in
+ let p = ref 0 in
+ try
+@@ -72,11 +72,11 @@ let nread i n =
+ p := !p + r;
+ l := !l - r;
+ done;
+- s
++ Bytes.to_string s
+ with
+ No_more_input as e ->
+ if !p = 0 then raise e;
+- String.sub s 0 !p
++ Bytes.to_string (Bytes.sub s 0 !p)
+
+ let really_output o s p l' =
+ let sl = String.length s in
+@@ -92,7 +92,7 @@ let really_output o s p l' =
+ l'
+
+ let input i s p l =
+- let sl = String.length s in
++ let sl = Bytes.length s in
+ if p + l > sl || p < 0 || l < 0 then invalid_arg "IO.input";
+ if l = 0 then
+ 0
+@@ -100,7 +100,7 @@ let input i s p l =
+ i.in_input s p l
+
+ let really_input i s p l' =
+- let sl = String.length s in
++ let sl = Bytes.length s in
+ if p + l' > sl || p < 0 || l' < 0 then invalid_arg "IO.really_input";
+ let l = ref l' in
+ let p = ref p in
+@@ -116,10 +116,10 @@ let really_nread i n =
+ if n < 0 then invalid_arg "IO.really_nread";
+ if n = 0 then ""
+ else
+- let s = String.create n
++ let s = Bytes.create n
+ in
+ ignore(really_input i s 0 n);
+- s
++ Bytes.to_string s
+
+ let close_in i =
+ let f _ = raise Input_closed in
+@@ -173,11 +173,11 @@ let read_all i =
+ loop()
+ with
+ No_more_input ->
+- let buf = String.create !pos in
++ let buf = Bytes.create !pos in
+ List.iter (fun (s,p) ->
+ String.unsafe_blit s 0 buf p (String.length s)
+ ) !str;
+- buf
++ Bytes.to_string buf
+
+ let pos_in i =
+ let p = ref 0 in
+@@ -267,7 +267,7 @@ let input_channel ch =
+ let output_channel ch =
+ {
+ out_write = (fun c -> output_char ch c);
+- out_output = (fun s p l -> Pervasives.output ch s p l; l);
++ out_output = (fun s p l -> Pervasives.output ch (Bytes.of_string s) p l; l);
+ out_close = (fun () -> Pervasives.close_out ch);
+ out_flush = (fun () -> Pervasives.flush ch);
+ }
+@@ -708,11 +708,11 @@ class out_chars ch =
+ end
+
+ let from_in_channel ch =
+- let cbuf = String.create 1 in
++ let cbuf = Bytes.create 1 in
+ let read() =
+ try
+ if ch#input cbuf 0 1 = 0 then raise Sys_blocked_io;
+- String.unsafe_get cbuf 0
++ Bytes.unsafe_get cbuf 0
+ with
+ End_of_file -> raise No_more_input
+ in
+@@ -725,9 +725,8 @@ let from_in_channel ch =
+ ~close:ch#close_in
+
+ let from_out_channel ch =
+- let cbuf = String.create 1 in
+ let write c =
+- String.unsafe_set cbuf 0 c;
++ let cbuf = String.make 1 c in
+ if ch#output cbuf 0 1 = 0 then raise Sys_blocked_io;
+ in
+ let output s p l =
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_extlib_IO.mli
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_extlib_IO.mli:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_extlib_IO.mli Wed Mar 14 14:05:37 2018
@@ -0,0 +1,41 @@
+$NetBSD: patch-src_utils_extlib_IO.mli,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/extlib/IO.mli~ 2010-11-07 15:01:40.000000000 +0000
++++ src/utils/extlib/IO.mli
+@@ -59,14 +59,14 @@ val really_nread : input -> int -> strin
+ from the input. Raises [No_more_input] if at least [n] characters are
+ not available. Raises [Invalid_argument] if [n] < 0. *)
+
+-val input : input -> string -> int -> int -> int
++val input : input -> bytes -> int -> int -> int
+ (** [input i s p l] reads up to [l] characters from the given input, storing
+ them in string [s], starting at character number [p]. It returns the actual
+ number of characters read or raise [No_more_input] if no character can be
+ read. It will raise [Invalid_argument] if [p] and [l] do not designate a
+ valid substring of [s]. *)
+
+-val really_input : input -> string -> int -> int -> int
++val really_input : input -> bytes -> int -> int -> int
+ (** [really_input i s p l] reads exactly [l] characters from the given input,
+ storing them in the string [s], starting at position [p]. For consistency with
+ {!IO.input} it returns [l]. Raises [No_more_input] if at [l] characters are
+@@ -126,7 +126,7 @@ val output_enum : unit -> char Enum.t ou
+
+ val create_in :
+ read:(unit -> char) ->
+- input:(string -> int -> int -> int) -> close:(unit -> unit) -> input
++ input:(bytes -> int -> int -> int) -> close:(unit -> unit) -> input
+ (** Fully create an input by giving all the needed functions. *)
+
+ val create_out :
+@@ -293,7 +293,7 @@ val drop_bits : in_bits -> unit
+
+ class in_channel : input ->
+ object
+- method input : string -> int -> int -> int
++ method input : bytes -> int -> int -> int
+ method close_in : unit -> unit
+ end
+
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_lib_md4.ml
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_lib_md4.ml:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_lib_md4.ml Wed Mar 14 14:05:37 2018
@@ -0,0 +1,410 @@
+$NetBSD: patch-src_utils_lib_md4.ml,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/lib/md4.ml~ 2006-02-02 00:33:28.000000000 +0000
++++ src/utils/lib/md4.ml
+@@ -46,16 +46,16 @@ module Base16 = struct
+ else Char.chr (Char.code '0' + x)
+
+ let to_string hash_length s =
+- let p = String.create (hash_length * 2) in
++ let p = Bytes.create (hash_length * 2) in
+ for i = 0 to hash_length - 1 do
+ let c = s.[i] in
+ let n = int_of_char c in
+ let i0 = (n/16) land 15 in
+ let i1 = n land 15 in
+- p.[2 * i] <- hexa_digit i0;
+- p.[2 * i+1] <- hexa_digit i1;
++ Bytes.set p (2 * i) (hexa_digit i0);
++ Bytes.set p (2 * i+1) (hexa_digit i1);
+ done;
+- p
++ Bytes.to_string p
+
+ let hexa_digit_case upper x =
+ if x >= 10 then Char.chr (Char.code (
+@@ -63,16 +63,16 @@ module Base16 = struct
+ else Char.chr (Char.code '0' + x)
+
+ let to_string_case upper hash_length s =
+- let p = String.create (hash_length * 2) in
++ let p = Bytes.create (hash_length * 2) in
+ for i = 0 to hash_length - 1 do
+ let c = s.[i] in
+ let n = int_of_char c in
+ let i0 = (n/16) land 15 in
+ let i1 = n land 15 in
+- p.[2 * i] <- hexa_digit_case upper i0;
+- p.[2 * i+1] <- hexa_digit_case upper i1;
++ Bytes.set p (2 * i) (hexa_digit_case upper i0);
++ Bytes.set p (2 * i+1) (hexa_digit_case upper i1);
+ done;
+- p
++ Bytes.to_string p
+
+ let digit_hexa c =
+ let i = int_of_char c in
+@@ -83,13 +83,13 @@ module Base16 = struct
+
+ let of_string hash_length s =
+ assert (String.length s = hash_length*2);
+- let p = String.create hash_length in
++ let p = Bytes.create hash_length in
+ for i = 0 to hash_length - 1 do
+ let c0 = s.[2*i] in
+ let c1 = s.[2*i+1] in
+- p.[i] <- char_of_int ((16 * digit_hexa c0) + digit_hexa c1);
++ Bytes.set p i (char_of_int ((16 * digit_hexa c0) + digit_hexa c1));
+ done;
+- p
++ Bytes.to_string p
+
+ end
+
+@@ -108,7 +108,7 @@ module Base32 = struct
+ let of_string hash_length r =
+ let len = String.length r in
+ assert (len = (hash_length * 8 + 4)/5);
+- let s = String.make hash_length '\000' in
++ let s = Bytes.make hash_length '\000' in
+ for i = 0 to len - 1 do
+ let pos = i * 5 in
+ let byte = pos / 8 in
+@@ -116,20 +116,20 @@ module Base32 = struct
+ let c = int5_of_char r.[i] in
+ if bit < 3 then
+ let x = c lsl (3-bit) in
+- s.[byte] <- char_of_int (int_of_char s.[byte] lor x);
++ Bytes.set s byte (char_of_int (int_of_char (Bytes.get s byte) lor x));
+ else
+ let x = (c lsr (bit - 3)) land 0xff in
+- s.[byte] <- char_of_int (int_of_char s.[byte] lor x);
++ Bytes.set s byte (char_of_int (int_of_char (Bytes.get s byte) lor x));
+ if byte+1 < hash_length then
+ let y = (c lsl (11 - bit)) land 0xff in
+- s.[byte+1] <- char_of_int (int_of_char s.[byte+1] lor y);
++ Bytes.set s (byte+1) (char_of_int (int_of_char (Bytes.get s (byte+1)) lor y));
+ done;
+- s
++ Bytes.to_string s
+
+ let to_string hash_length s =
+ assert (String.length s = hash_length);
+ let len = (hash_length * 8 + 4)/5 in
+- let r = String.create len in
++ let r = Bytes.create len in
+ for i = 0 to len - 1 do
+ let pos = i * 5 in
+ let byte = pos / 8 in
+@@ -137,16 +137,16 @@ module Base32 = struct
+ if bit < 3 then
+ let x = int_of_char s.[byte] in
+ let c = (x lsr (3 - bit)) land 0x1f in
+- r.[i] <- char_of_int5 c
++ Bytes.set r i (char_of_int5 c)
+ else
+ let x = int_of_char s.[byte] in
+ let y = if byte + 1 = hash_length then 0 else
+ int_of_char s.[byte+1] in
+ let x = (x lsl 8) + y in
+ let c = (x lsr (11 - bit)) land 0x1f in
+- r.[i] <- char_of_int5 c
++ Bytes.set r i (char_of_int5 c)
+ done;
+- r
++ Bytes.to_string r
+
+ let char_of_int5 upper n =
+ char_of_int (if n < 26 then (if upper then 65 else 97)+n else
+@@ -155,7 +155,7 @@ module Base32 = struct
+ let to_string_case upper hash_length s =
+ assert (String.length s = hash_length);
+ let len = (hash_length * 8 + 4)/5 in
+- let r = String.create len in
++ let r = Bytes.create len in
+ for i = 0 to len - 1 do
+ let pos = i * 5 in
+ let byte = pos / 8 in
+@@ -163,16 +163,16 @@ module Base32 = struct
+ if bit < 3 then
+ let x = int_of_char s.[byte] in
+ let c = (x lsr (3 - bit)) land 0x1f in
+- r.[i] <- char_of_int5 upper c
++ Bytes.set r i (char_of_int5 upper c)
+ else
+ let x = int_of_char s.[byte] in
+ let y = if byte + 1 = hash_length then 0 else
+ int_of_char s.[byte+1] in
+ let x = (x lsl 8) + y in
+ let c = (x lsr (11 - bit)) land 0x1f in
+- r.[i] <- char_of_int5 upper c
++ Bytes.set r i (char_of_int5 upper c)
+ done;
+- r
++ Bytes.to_string r
+
+ end
+
+@@ -182,9 +182,9 @@ module Base6427 = struct
+ let _ = assert (String.length base64tbl = 64)
+
+ let to_string _ hashbin =
+- let hash64 = String.create 30 in
++ let hash64 = Bytes.create 30 in
+ let hashbin n = int_of_char hashbin.[n] in
+- hash64.[0] <- '=';
++ Bytes.set hash64 0 '=';
+ let j = ref 1 in
+ for i = 0 to 6 do
+ let tmp = if i < 6 then
+@@ -194,24 +194,24 @@ module Base6427 = struct
+ ((hashbin(3*i)) lsl 16) lor ((hashbin(3*i+1)) lsl 8)
+ in
+ for k = 0 to 3 do
+- hash64.[!j] <- base64tbl.[(tmp lsr ((3- k)*6)) land 0x3f];
++ Bytes.set hash64 !j (base64tbl.[(tmp lsr ((3- k)*6)) land 0x3f]);
+ incr j
+ done
+ done;
+- hash64.[!j-1] <- '=';
+- String.sub hash64 0 !j
++ Bytes.set hash64 (!j-1) '=';
++ Bytes.to_string (Bytes.sub hash64 0 !j)
+
+- let base64tbl_inv = String.create 126
++ let base64tbl_inv = Bytes.create 126
+ let _ =
+ for i = 0 to 63 do
+- base64tbl_inv.[int_of_char base64tbl.[i]] <- char_of_int i
++ Bytes.set base64tbl_inv (int_of_char base64tbl.[i]) (char_of_int i)
+ done
+
+ let of_string _ hash64 =
+- let hashbin = String.make 20 '\000' in
++ let hashbin = Bytes.make 20 '\000' in
+ let hash64 n =
+ let c = hash64.[n] in
+- int_of_char base64tbl_inv.[int_of_char c]
++ int_of_char (Bytes.get base64tbl_inv (int_of_char c))
+ in
+ let j = ref 0 in
+ for i = 0 to 6 do
+@@ -220,9 +220,9 @@ module Base6427 = struct
+ for k = 0 to 3 do
+ tmp := (!tmp lsl 6) lor (hash64 (i*4+k+1))
+ done;
+- hashbin.[!j] <- char_of_int ((!tmp lsr 16) land 0xff);
+- hashbin.[!j+1] <- char_of_int ((!tmp lsr 8) land 0xff);
+- hashbin.[!j+2] <- char_of_int ((!tmp lsr 0) land 0xff);
++ Bytes.set hashbin (!j) (char_of_int ((!tmp lsr 16) land 0xff));
++ Bytes.set hashbin (!j+1) (char_of_int ((!tmp lsr 8) land 0xff));
++ Bytes.set hashbin (!j+2) (char_of_int ((!tmp lsr 0) land 0xff));
+ j := !j + 3;
+ else
+ let tmp = ref 0 in
+@@ -230,11 +230,11 @@ module Base6427 = struct
+ tmp := (!tmp lsl 6) lor (hash64 (i*4+k+1))
+ done;
+ tmp := (!tmp lsl 6);
+- hashbin.[!j] <- char_of_int ((!tmp lsr 16) land 0xff);
+- hashbin.[!j+1] <- char_of_int ((!tmp lsr 8) land 0xff);
++ Bytes.set hashbin (!j) (char_of_int ((!tmp lsr 16) land 0xff));
++ Bytes.set hashbin (!j+1) (char_of_int ((!tmp lsr 8) land 0xff));
+ j := !j + 2;
+ done;
+- hashbin
++ Bytes.to_string hashbin
+
+ let to_string_case _ = to_string
+ end
+@@ -265,7 +265,7 @@ module type Digest = sig
+
+ val string : string -> t
+ (* val file : string -> t *)
+- val create : unit -> t
++ val create : unit -> bytes
+ val direct_of_string : string -> t
+ val direct_to_string : t -> string
+ val random : unit -> t
+@@ -274,7 +274,7 @@ module type Digest = sig
+
+ val option : t Options.option_class
+
+- val xor : t -> t -> t
++ val xor : t -> t -> bytes
+ val value_to_hash : Options.option_value -> t
+ val hash_to_value : t -> Options.option_value
+
+@@ -292,12 +292,12 @@ module Make(M: sig
+ val hash_name : string
+
+ (* [unsafe_string digest string string_len] *)
+- val unsafe_string : string -> string -> int -> unit
++ val unsafe_string : bytes -> string -> int -> unit
+
+ (* [unsafe_file digest filename filesize] *)
+- val unsafe_file : string -> string -> int64 -> unit
++ val unsafe_file : bytes -> string -> int64 -> unit
+ (* [unsafe_string digest file_fd offset len] *)
+- val digest_subfile : string -> Unix.file_descr -> int64 -> int64 -> unit
++ val digest_subfile : bytes -> Unix.file_descr -> int64 -> int64 -> unit
+
+ module Base : Base
+ end) = struct
+@@ -315,44 +315,44 @@ module Make(M: sig
+
+ let string s =
+ let len = String.length s in
+- let digest = String.create hash_length in
++ let digest = Bytes.create hash_length in
+ unsafe_string digest s len;
+- digest
++ Bytes.to_string digest
+
+ let to_bits s =
+ let len = String.length s in
+- let digest = String.create (8*len) in
++ let digest = Bytes.create (8*len) in
+ for i = 0 to len-1 do
+ let c = int_of_char s.[i] in
+ for j = 7 downto 0 do
+- digest.[i*8 + (7-j)] <-
++ Bytes.set digest (i*8 + (7-j))
+ (if c land (1 lsl j) <> 0 then '1' else '0')
+
+ done
+ done;
+- digest
++ Bytes.to_string digest
+
+- external xor_c : t -> t -> t -> unit = "md4_xor" "noalloc"
++ external xor_c : t -> t -> bytes -> unit = "md4_xor" [@@noalloc]
+
+ let xor m1 m2 =
+- let m3 = String.create hash_length in
++ let m3 = Bytes.create hash_length in
+ xor_c m1 m2 m3;
+ m3
+
+ let file s =
+- let digest = String.create hash_length in
++ let digest = Bytes.create hash_length in
+ let file_size = Unix32.getsize s in
+ unsafe_file digest s file_size;
+- digest
++ Bytes.to_string digest
+
+ let digest_subfile fd pos len =
+- let digest = String.create hash_length in
++ let digest = Bytes.create hash_length in
+ Unix32.apply_on_chunk fd pos len
+ (fun fd pos ->
+ digest_subfile digest fd pos len);
+- digest
++ Bytes.to_string digest
+
+- let create () = String.create hash_length
++ let create () = Bytes.create hash_length
+
+ let direct_to_string s = s
+ let direct_of_string s = s
+@@ -360,9 +360,9 @@ module Make(M: sig
+ let random () =
+ let s = create () in
+ for i = 0 to hash_length - 1 do
+- s.[i] <- char_of_int (Random.int 256)
++ Bytes.set s i (char_of_int (Random.int 256))
+ done;
+- s
++ Bytes.to_string s
+
+ let of_string = Base.of_string hash_length
+ let to_string = Base.to_string hash_length
+@@ -397,10 +397,14 @@ module Make(M: sig
+ module Md4 = Make(struct
+ let hash_length = 16
+ let hash_name = "Md4"
+-
+- external unsafe_string : string -> string -> int -> unit = "md4_unsafe_string"
+- external unsafe_file : string -> string -> int64 -> unit = "md4_unsafe_file"
+- external digest_subfile : string -> Unix.file_descr -> int64 -> int64 -> unit =
++
++(*
++ * XXX the first arg was string and I can't find the implementation; hope
++ * this is safe enough
++ *)
++ external unsafe_string : bytes -> string -> int -> unit = "md4_unsafe_string"
++ external unsafe_file : bytes -> string -> int64 -> unit = "md4_unsafe_file"
++ external digest_subfile : bytes -> Unix.file_descr -> int64 -> int64 -> unit =
+ "md4_unsafe64_fd"
+
+ module Base = Base16
+@@ -410,9 +414,13 @@ module Md5 = Make(struct
+ let hash_length = 16
+ let hash_name = "Md5"
+
+- external unsafe_string : string -> string -> int -> unit = "md5_unsafe_string"
+- external unsafe_file : string -> string -> int64 -> unit = "md5_unsafe_file"
+- external digest_subfile : string -> Unix.file_descr -> int64 -> int64 -> unit =
++(*
++ * XXX the first arg was string and I can't find the implementation; hope
++ * this is safe enough
++ *)
++ external unsafe_string : bytes -> string -> int -> unit = "md5_unsafe_string"
++ external unsafe_file : bytes -> string -> int64 -> unit = "md5_unsafe_file"
++ external digest_subfile : bytes -> Unix.file_descr -> int64 -> int64 -> unit =
+ "md5_unsafe64_fd"
+
+ module Base = Base16
+@@ -422,9 +430,13 @@ module PreSha1 = Make(struct
+ let hash_length = 20
+ let hash_name = "Sha1"
+
+- external unsafe_string : string -> string -> int -> unit = "sha1_unsafe_string"
+- external unsafe_file : string -> string -> int64 -> unit = "sha1_unsafe_file"
+- external digest_subfile : string -> Unix.file_descr -> int64 -> int64 -> unit =
++(*
++ * XXX the first arg was string and I can't find the implementation; hope
++ * this is safe enough
++ *)
++ external unsafe_string : bytes -> string -> int -> unit = "sha1_unsafe_string"
++ external unsafe_file : bytes -> string -> int64 -> unit = "sha1_unsafe_file"
++ external digest_subfile : bytes -> Unix.file_descr -> int64 -> int64 -> unit =
+ "sha1_unsafe64_fd"
+
+ module Base = Base32
+@@ -465,7 +477,7 @@ module Tiger = Make(struct
+ let hash_length = 24
+ let hash_name = "Tiger"
+
+- external unsafe_string : string -> string -> int -> unit =
++ external unsafe_string : bytes -> string -> int -> unit =
+ "tiger_unsafe_string"
+
+ let unsafe_file digest filename =
+@@ -482,8 +494,8 @@ module PreTigerTree = Make(struct
+ let hash_length = 24
+ let hash_name = "TigerTree"
+
+- external unsafe_string : string -> string -> int -> unit = "tigertree_unsafe_string"
+- external digest_subfile : string -> Unix.file_descr -> int64 -> int64 -> unit =
++ external unsafe_string : bytes -> string -> int -> unit = "tigertree_unsafe_string"
++ external digest_subfile : bytes -> Unix.file_descr -> int64 -> int64 -> unit =
+ "tigertree_unsafe64_fd"
+
+ let unsafe_file digest filename file_size =
+@@ -531,10 +543,10 @@ module PreMd5Ext = Make(struct
+ let hash_length = 20
+ let hash_name = "Md5Ext"
+
+- external unsafe_string : string -> string -> int -> unit =
++ external unsafe_string : bytes -> string -> int -> unit =
+ "fst_hash_string_ml"
+
+- external unsafe_file : string -> string -> int64 -> unit = "fst_hash_file_ml"
++ external unsafe_file : bytes -> string -> int64 -> unit = "fst_hash_file_ml"
+ let digest_subfile _ _ _ _ =
+ failwith "Md5Ext.digest_subfile not implemented"
+
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_lib_md4.mli
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_lib_md4.mli:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_lib_md4.mli Wed Mar 14 14:05:37 2018
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_utils_lib_md4.mli,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/lib/md4.mli~ 2004-08-04 16:59:27.000000000 +0000
++++ src/utils/lib/md4.mli
+@@ -49,7 +49,7 @@ module type Digest = sig
+
+ val string : string -> t
+ (* val file : string -> t *)
+- val create : unit -> t
++ val create : unit -> bytes
+ val direct_of_string : string -> t
+ val direct_to_string : t -> string
+ val random : unit -> t
+@@ -58,7 +58,7 @@ module type Digest = sig
+
+ val option : t Options.option_class
+
+- val xor : t -> t -> t
++ val xor : t -> t -> bytes
+ val value_to_hash : Options.option_value -> t
+ val hash_to_value : t -> Options.option_value
+
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_lib_misc.ml
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_lib_misc.ml:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_lib_misc.ml Wed Mar 14 14:05:37 2018
@@ -0,0 +1,22 @@
+$NetBSD: patch-src_utils_lib_misc.ml,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/lib/misc.ml~ 2008-03-31 07:58:17.000000000 +0000
++++ src/utils/lib/misc.ml
+@@ -92,13 +92,13 @@ let zip_create zipfile files =
+ let gz_extract filename =
+ let file = ref "" in
+ try
+- let buffer = String.create 4096 in
++ let buffer = Bytes.create 4096 in
+ let file_out = Filename2.temp_file "arch_" ".tmp" in
+ file := file_out;
+ Unix2.tryopen_read_gzip filename (fun ic ->
+ Unix2.tryopen_write_bin file_out (fun oc ->
+ let rec decompress () =
+- let n = Gzip.input ic buffer 0 (String.length buffer) in
++ let n = Gzip.input ic buffer 0 (Bytes.length buffer) in
+ if n = 0 then ()
+ else
+ begin
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_lib_misc2.mlcpp
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_lib_misc2.mlcpp:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_lib_misc2.mlcpp Wed Mar 14 14:05:37 2018
@@ -0,0 +1,23 @@
+$NetBSD: patch-src_utils_lib_misc2.mlcpp,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/lib/misc2.mlcpp~ 2008-03-31 07:58:17.000000000 +0000
++++ src/utils/lib/misc2.mlcpp
+@@ -26,14 +26,14 @@ let bz2_extract filename =
+ else begin
+ let file = ref "" in
+ try
+- let buffer = String.create 4096 in
++ let buffer = Bytes.create 4096 in
+ let file_out = Filename2.temp_file "arch_" ".tmp" in
+ file := file_out;
+ let ic = Bzip2.open_in filename
+ in
+ let oc = open_out_bin file_out in
+ let rec decompress () =
+- let n = Bzip2.input ic buffer 0 (String.length buffer) in
++ let n = Bzip2.input ic buffer 0 (Bytes.length buffer) in
+ if n = 0 then ()
+ else
+ begin
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_lib_syslog.ml
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_lib_syslog.ml:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_lib_syslog.ml Wed Mar 14 14:05:37 2018
@@ -0,0 +1,47 @@
+$NetBSD: patch-src_utils_lib_syslog.ml,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/lib/syslog.ml~ 2007-06-17 01:24:28.000000000 +0000
++++ src/utils/lib/syslog.ml
+@@ -44,7 +44,7 @@ type level = [ `LOG_EMERG | `LOG_ALERT |
+ exception Syslog_error of string
+
+ let facility_of_string s =
+- match String.lowercase s with
++ match String.lowercase_ascii s with
+ "kern" -> `LOG_KERN
+ | "user" -> `LOG_USER
+ | "mail" -> `LOG_MAIL
+@@ -194,7 +194,7 @@ let protected_write loginfo str =
+ in
+ let prev = Sys.signal Sys.sigpipe (Sys.Signal_handle fallback) in
+ try
+- ignore (write loginfo.fd str 0 (String.length str));
++ ignore (write loginfo.fd str 0 (Bytes.length str));
+ Sys.set_signal Sys.sigpipe prev
+ with Unix_error (_, _, _) ->
+ (* on error, attempt to reconnect *)
+@@ -220,16 +220,16 @@ let syslog ?fac loginfo lev str =
+ if String.length loginfo.tag > 0 then
+ Buffer.add_string msg ": ";
+ Buffer.add_string msg str;
+- let realmsg = ref (Buffer.contents msg) in
+- if String.length !realmsg > 1024 then begin
+- realmsg := String.sub !realmsg 0 1024;
+- String.blit "<truncated>" 0 !realmsg 1012 11
++ let realmsg = ref (Bytes.of_string (Buffer.contents msg)) in
++ if Bytes.length !realmsg > 1024 then begin
++ realmsg := Bytes.sub !realmsg 0 1024;
++ Bytes.blit (Bytes.of_string "<truncated>") 0 !realmsg 1012 11
+ end;
+ protected_write loginfo !realmsg;
+ if List.mem `LOG_PERROR loginfo.flags then begin
+ try
+- ignore (Unix.write Unix.stderr !realmsg 0 (String.length !realmsg));
+- ignore (Unix.write Unix.stderr "\n" 0 1)
++ ignore (Unix.write Unix.stderr !realmsg 0 (Bytes.length !realmsg));
++ ignore (Unix.write Unix.stderr (Bytes.of_string "\n") 0 1)
+ with _ -> ()
+ end
+
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_lib_tiger.c
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_lib_tiger.c:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_lib_tiger.c Wed Mar 14 14:05:37 2018
@@ -0,0 +1,24 @@
+$NetBSD: patch-src_utils_lib_tiger.c,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/lib/tiger.c~ 2012-06-24 07:59:41.000000000 +0000
++++ src/utils/lib/tiger.c
+@@ -827,7 +827,7 @@ OFF_T tiger_block_size(OFF_T len)
+
+ value tigertree_unsafe_string(value digest_v, value string_v, value len_v)
+ {
+- unsigned char *digest = String_val(digest_v);
++ unsigned char *digest = Bytes_val(digest_v);
+ unsigned char *string = String_val(string_v);
+ long len = Long_val(len_v);
+
+@@ -838,7 +838,7 @@ value tigertree_unsafe_string(value dige
+
+ value tiger_unsafe_string(value digest_v, value string_v, value len_v)
+ {
+- unsigned char *digest = String_val(digest_v);
++ unsigned char *digest = Bytes_val(digest_v);
+ unsigned char *string = String_val(string_v);
+ long len = Long_val(len_v);
+
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_lib_unix32.ml
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_lib_unix32.ml:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_lib_unix32.ml Wed Mar 14 14:05:37 2018
@@ -0,0 +1,80 @@
+$NetBSD: patch-src_utils_lib_unix32.ml,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/lib/unix32.ml~ 2011-03-13 17:45:32.000000000 +0000
++++ src/utils/lib/unix32.ml
+@@ -318,7 +318,7 @@ module FDCache = struct
+ file_pos
+ len
+ string_pos
+- (String.length string)
++ (Bytes.length string)
+ (Printexc2.to_string e);
+ raise e
+
+@@ -327,7 +327,7 @@ module FDCache = struct
+ check_destroyed t2;
+ let buffer_len = 128 * 1024 in
+ let buffer_len64 = Int64.of_int buffer_len in
+- let buffer = String.make buffer_len '\001' in
++ let buffer = Bytes.make buffer_len '\001' in
+ let rec iter remaining pos1 pos2 =
+ let len64 = min remaining buffer_len64 in
+ let len = Int64.to_int len64 in
+@@ -363,8 +363,8 @@ module type File = sig
+ val mtime64 : t -> float
+ val exists : t -> bool
+ val remove : t -> unit
+- val read : t -> int64 -> string -> int -> int -> unit
+- val write : t -> int64 -> string -> int -> int -> unit
++ val read : t -> int64 -> bytes -> int -> int -> unit
++ val write : t -> int64 -> bytes -> int -> int -> unit
+ val destroy : t -> unit
+ val is_closed : t -> bool
+ end
+@@ -648,7 +648,7 @@ module MultiFile = struct
+ let possible_len = Int64.to_int possible_len64 in
+ if possible_len64 > zero then
+ FDCache.read file.fd in_file_pos s in_string_pos possible_len;
+- String.fill s (in_string_pos + possible_len) (len - possible_len) '\000'
++ Bytes.fill s (in_string_pos + possible_len) (len - possible_len) '\000'
+
+ let io f t chunk_begin string string_pos len =
+ let (file, tail) = find_file t chunk_begin in
+@@ -1039,7 +1039,7 @@ module SparseFile = struct
+ len = zero;
+ fd = fd;
+ } in
+- let new_array = Array.create (nchunks+1) chunk in
++ let new_array = Array.make (nchunks+1) chunk in
+ Array.blit t.chunks 0 new_array 0 nchunks;
+ t.chunks <- new_array
+
+@@ -1055,7 +1055,7 @@ module SparseFile = struct
+ len = zero;
+ fd = fd;
+ } in
+- let new_array = Array.create (nchunks+1) chunk in
++ let new_array = Array.make (nchunks+1) chunk in
+ Array.blit t.chunks 0 new_array 0 index;
+ Array.blit t.chunks index new_array (index+1) (nchunks-index);
+ t.chunks <- new_array;
+@@ -1226,7 +1226,7 @@ let flush_buffer t offset =
+ let len = String.length s in
+ try
+ if !verbose then lprintf_nl "seek64 %Ld" offset;
+- if len > 0 then write t offset s 0 len;
++ if len > 0 then write t offset (Bytes.of_string s) 0 len;
+ (*
+ let fd, offset = fd_of_chunk t offset (Int64.of_int len) in
+ let final_pos = Unix2.c_seek64 fd offset Unix.SEEK_SET in
+@@ -1349,7 +1349,7 @@ let copy_chunk t1 t2 pos1 pos2 len =
+ flush_fd t1;
+ flush_fd t2;
+ let buffer_size = 128 * 1024 in
+- let buffer = String.make buffer_size '\001' in
++ let buffer = Bytes.make buffer_size '\001' in
+ let rec iter remaining pos1 pos2 =
+ let len = mini remaining buffer_size in
+ if len > 0 then begin
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_lib_unix32.mli
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_lib_unix32.mli:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_lib_unix32.mli Wed Mar 14 14:05:37 2018
@@ -0,0 +1,20 @@
+$NetBSD: patch-src_utils_lib_unix32.mli,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/lib/unix32.mli~ 2011-01-31 17:17:07.000000000 +0000
++++ src/utils/lib/unix32.mli
+@@ -54,11 +54,11 @@ val flush : unit -> unit
+ val flush_fd : t -> unit
+ val buffered_write : t -> int64 -> string -> int -> int -> unit
+ val buffered_write_copy : t -> int64 -> string -> int -> int -> unit
+-val write : t -> int64 -> string -> int -> int -> unit
++val write : t -> int64 -> bytes -> int -> int -> unit
+ val max_buffered : int64 ref
+ val remove : t -> unit
+
+-val read : t -> int64 -> string -> int -> int -> unit
++val read : t -> int64 -> bytes -> int -> int -> unit
+ (*val allocate_chunk : t -> int64 -> int -> unit*)
+
+ val copy_chunk : t -> t -> int64 -> int64 -> int -> unit
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_lib_url.ml
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_lib_url.ml:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_lib_url.ml Wed Mar 14 14:05:37 2018
@@ -0,0 +1,34 @@
+$NetBSD: patch-src_utils_lib_url.ml,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/lib/url.ml~ 2009-02-24 18:38:34.000000000 +0000
++++ src/utils/lib/url.ml
+@@ -36,21 +36,21 @@ type url = {
+ let encode s =
+ let pos = ref 0 in
+ let len = String.length s in
+- let res = String.create (3*len) in
++ let res = Bytes.create (3*len) in
+ let hexa_digit x =
+ if x >= 10 then Char.chr (Char.code 'A' + x - 10)
+ else Char.chr (Char.code '0' + x) in
+ for i=0 to len-1 do
+ match s.[i] with
+ | 'a'..'z' | 'A'..'Z' | '0'..'9' | '.' | '-' | '*' | '_' | '\''| '(' | ')'->
+- res.[!pos] <- s.[i]; incr pos
++ Bytes.set res !pos s.[i]; incr pos
+ | c ->
+- res.[!pos] <- '%';
+- res.[!pos+1] <- hexa_digit (Char.code c / 16);
+- res.[!pos+2] <- hexa_digit (Char.code c mod 16);
++ Bytes.set res !pos '%';
++ Bytes.set res (!pos+1) (hexa_digit (Char.code c / 16));
++ Bytes.set res (!pos+2) (hexa_digit (Char.code c mod 16));
+ pos := !pos + 3
+ done;
+- String.sub res 0 !pos
++ Bytes.to_string (Bytes.sub res 0 !pos)
+
+ (** decodes a sting according RFC 1738
+ or x-www-form-urlencoded ('+' with ' ')
Index: pkgsrc/net/mldonkey/patches/patch-src_utils_lib_verificationBitmap.ml
diff -u /dev/null pkgsrc/net/mldonkey/patches/patch-src_utils_lib_verificationBitmap.ml:1.1
--- /dev/null Wed Mar 14 14:05:37 2018
+++ pkgsrc/net/mldonkey/patches/patch-src_utils_lib_verificationBitmap.ml Wed Mar 14 14:05:37 2018
@@ -0,0 +1,72 @@
+$NetBSD: patch-src_utils_lib_verificationBitmap.ml,v 1.1 2018/03/14 14:05:37 dholland Exp $
+
+Fix build with ocaml 4.06
+
+--- src/utils/lib/verificationBitmap.ml~ 2006-06-11 17:39:51.000000000 +0000
++++ src/utils/lib/verificationBitmap.ml
+@@ -1,4 +1,4 @@
+-type t = string
++type t = bytes
+ type part_state =
+ State_missing | State_partial | State_complete | State_verified
+
+@@ -15,24 +15,24 @@ let char_to_state = function
+ | '3' -> State_verified
+ | _ -> assert false
+
+-let create n c = String.make n (state_to_char c)
+-let get x i = (char_to_state x.[i])
+-let set x i c = x.[i] <- state_to_char c
+-let length = String.length
++let create n c = Bytes.make n (state_to_char c)
++let get x i = char_to_state (Bytes.get x i)
++let set x i c = Bytes.set x i (state_to_char c)
++let length = Bytes.length
+ let init n f =
+- let s = String.create n in
++ let s = Bytes.create n in
+ for i = 0 to n - 1 do
+ set s i (f i)
+ done;
+ s
+-let to_string x = x
+-let of_string x = x
++let to_string x = Bytes.to_string x
++let of_string x = Bytes.of_string x
+
+ let iteri f x =
+- let l = String.length x in
++ let l = Bytes.length x in
+ let rec aux i =
+ if i < l then begin
+- f i (char_to_state x.[i]);
++ f i (char_to_state (Bytes.get x i));
+ aux (i+1)
+ end in
+ aux 0
+@@ -41,20 +41,20 @@ let mapi f x =
+ Array.init (length x) (fun i -> f i (get x i))
+
+ let fold_lefti f acc x =
+- let l = String.length x in
++ let l = Bytes.length x in
+ let rec aux acc i =
+ if i = l then acc
+ else aux (f acc i (get x i)) (i + 1) in
+ aux acc 0
+
+ let existsi p x =
+- let l = String.length x in
++ let l = Bytes.length x in
+ let rec aux i =
+- i < l && (p i (char_to_state x.[i]) || aux (i+1)) in
++ i < l && (p i (char_to_state (Bytes.get x i)) || aux (i+1)) in
+ aux 0
+
+ let for_all p s =
+- let l = String.length s in
++ let l = Bytes.length s in
+ let rec aux i =
+- i >= l || p (char_to_state s.[i]) && aux (i+1) in
++ i >= l || p (char_to_state (Bytes.get s i)) && aux (i+1) in
+ aux 0
Home |
Main Index |
Thread Index |
Old Index