pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/devel/ocaml-biniou
Module Name: pkgsrc
Committed By: dholland
Date: Sun Mar 11 02:30:34 UTC 2018
Modified Files:
pkgsrc/devel/ocaml-biniou: Makefile distinfo
Added Files:
pkgsrc/devel/ocaml-biniou/patches: patch-bi__inbuf.ml
patch-bi__inbuf.mli patch-bi__io.ml patch-bi__outbuf.ml
patch-bi__outbuf.mli patch-bi__stream.ml patch-bi__util.ml
patch-bi__vint.ml
Log Message:
Fix up mutable strings to make it build with ocaml 4.06.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 pkgsrc/devel/ocaml-biniou/Makefile
cvs rdiff -u -r1.2 -r1.3 pkgsrc/devel/ocaml-biniou/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/devel/ocaml-biniou/patches/patch-bi__inbuf.ml \
pkgsrc/devel/ocaml-biniou/patches/patch-bi__inbuf.mli \
pkgsrc/devel/ocaml-biniou/patches/patch-bi__io.ml \
pkgsrc/devel/ocaml-biniou/patches/patch-bi__outbuf.ml \
pkgsrc/devel/ocaml-biniou/patches/patch-bi__outbuf.mli \
pkgsrc/devel/ocaml-biniou/patches/patch-bi__stream.ml \
pkgsrc/devel/ocaml-biniou/patches/patch-bi__util.ml \
pkgsrc/devel/ocaml-biniou/patches/patch-bi__vint.ml
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/devel/ocaml-biniou/Makefile
diff -u pkgsrc/devel/ocaml-biniou/Makefile:1.4 pkgsrc/devel/ocaml-biniou/Makefile:1.5
--- pkgsrc/devel/ocaml-biniou/Makefile:1.4 Wed Jan 10 16:53:08 2018
+++ pkgsrc/devel/ocaml-biniou/Makefile Sun Mar 11 02:30:34 2018
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.4 2018/01/10 16:53:08 jaapb Exp $
+# $NetBSD: Makefile,v 1.5 2018/03/11 02:30:34 dholland Exp $
GITHUB_PROJECT= biniou
GITHUB_TAG= v${PKGVERSION_NOREV}
DISTNAME= ${GITHUB_PROJECT}-1.0.13
PKGNAME= ocaml-${DISTNAME}
-PKGREVISION= 3
+PKGREVISION= 4
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GITHUB:=mjambon/}
Index: pkgsrc/devel/ocaml-biniou/distinfo
diff -u pkgsrc/devel/ocaml-biniou/distinfo:1.2 pkgsrc/devel/ocaml-biniou/distinfo:1.3
--- pkgsrc/devel/ocaml-biniou/distinfo:1.2 Thu Jul 13 10:41:33 2017
+++ pkgsrc/devel/ocaml-biniou/distinfo Sun Mar 11 02:30:34 2018
@@ -1,7 +1,15 @@
-$NetBSD: distinfo,v 1.2 2017/07/13 10:41:33 jaapb Exp $
+$NetBSD: distinfo,v 1.3 2018/03/11 02:30:34 dholland Exp $
SHA1 (biniou-1.0.13.tar.gz) = 87d62aeb15437f7ba26654b774b3106f374aad3c
RMD160 (biniou-1.0.13.tar.gz) = 7b3306894c3407190acb707d53078ebd7118e82d
SHA512 (biniou-1.0.13.tar.gz) = 2fe109e83260f546181dd26ea175d2c4f63d0f6604c6d26fa44ee31925ba1fdaac0139a436cd0271a31294de9cd8ea65f8dde0981403c652d31de721ef696788
Size (biniou-1.0.13.tar.gz) = 24327 bytes
SHA1 (patch-Makefile) = b9cf0685ae977211ebcc45b3f0e67408ae16162c
+SHA1 (patch-bi__inbuf.ml) = 3e62d15239d101323070655545e411a31f2dcda0
+SHA1 (patch-bi__inbuf.mli) = 7d493ce921bab96647117afe8ff554782259d85f
+SHA1 (patch-bi__io.ml) = 1330f33bd377d31f3bdf3d308b86e51ab77705bd
+SHA1 (patch-bi__outbuf.ml) = 7aa79eaccfd22b722b6d81f63c2fb74f6494eaa2
+SHA1 (patch-bi__outbuf.mli) = 21ce049e4133d2420c436e6021de99e0812f3456
+SHA1 (patch-bi__stream.ml) = 4e4d0c25d66bf83de682f353f8becc5fe25bf87f
+SHA1 (patch-bi__util.ml) = 1065354c10392255e1eedf2e5326c6c00bd6b8ff
+SHA1 (patch-bi__vint.ml) = 488d439585b4895174fb5434c6e3f5033e207828
Added files:
Index: pkgsrc/devel/ocaml-biniou/patches/patch-bi__inbuf.ml
diff -u /dev/null pkgsrc/devel/ocaml-biniou/patches/patch-bi__inbuf.ml:1.1
--- /dev/null Sun Mar 11 02:30:34 2018
+++ pkgsrc/devel/ocaml-biniou/patches/patch-bi__inbuf.ml Sun Mar 11 02:30:34 2018
@@ -0,0 +1,81 @@
+$NetBSD: patch-bi__inbuf.ml,v 1.1 2018/03/11 02:30:34 dholland Exp $
+
+Fix up mutable strings to make it build with ocaml 4.06.
+
+--- bi_inbuf.ml~ 2017-05-04 17:38:05.000000000 +0000
++++ bi_inbuf.ml
+@@ -1,5 +1,5 @@
+ type t = {
+- mutable i_s : string;
++ mutable i_s : bytes;
+ mutable i_pos : int;
+ mutable i_len : int;
+ mutable i_offs : int;
+@@ -35,14 +35,14 @@ let read ib n =
+ let read_char ib =
+ let pos = ib.i_pos in
+ if ib.i_len - pos > 0 then (
+- let c = String.unsafe_get ib.i_s pos in
++ let c = Bytes.unsafe_get ib.i_s pos in
+ ib.i_pos <- pos + 1;
+ c
+ )
+ else
+ if try_preread ib 1 > 0 then
+ let pos = ib.i_pos in
+- let c = String.unsafe_get ib.i_s pos in
++ let c = Bytes.unsafe_get ib.i_s pos in
+ ib.i_pos <- pos + 1;
+ c
+ else
+@@ -51,24 +51,27 @@ let read_char ib =
+ let peek ib =
+ let pos = ib.i_pos in
+ if ib.i_len - pos > 0 then (
+- String.unsafe_get ib.i_s pos
++ Bytes.unsafe_get ib.i_s pos
+ )
+ else
+ if try_preread ib 1 > 0 then
+- String.unsafe_get ib.i_s ib.i_pos
++ Bytes.unsafe_get ib.i_s ib.i_pos
+ else
+ raise End_of_input
+
+-let from_string ?(pos = 0) ?(shrlen = 16) s = {
++let from_bytes ?(pos = 0) ?(shrlen = 16) s = {
+ i_s = s;
+ i_pos = pos;
+- i_len = String.length s;
++ i_len = Bytes.length s;
+ i_offs = -pos;
+- i_max_len = String.length s;
++ i_max_len = Bytes.length s;
+ i_refill = (fun ib n -> ());
+ i_shared = Bi_share.Rd.create shrlen;
+ }
+
++let from_string ?(pos = 0) ?(shrlen = 16) s =
++ from_bytes ~pos ~shrlen (Bytes.of_string s)
++
+ (*
+ Like Pervasives.really_input but returns the number of bytes
+ read instead of raising End_of_file when the end of file is reached.
+@@ -87,7 +90,7 @@ let refill_from_channel ic ib n =
+ let rem_len = ib.i_len - ib.i_pos in
+ if rem_len < n then
+ let s = ib.i_s in
+- String.blit s ib.i_pos s 0 rem_len;
++ Bytes.blit s ib.i_pos s 0 rem_len;
+ let to_read = n - rem_len in
+ let really_read = not_really_input ic s rem_len to_read 0 in
+ ib.i_offs <- ib.i_offs + ib.i_pos;
+@@ -96,7 +99,7 @@ let refill_from_channel ic ib n =
+ )
+
+ let from_channel ?(len = 4096) ?(shrlen = 16) ic = {
+- i_s = String.create len;
++ i_s = Bytes.create len;
+ i_pos = 0;
+ i_len = 0;
+ i_offs = 0;
Index: pkgsrc/devel/ocaml-biniou/patches/patch-bi__inbuf.mli
diff -u /dev/null pkgsrc/devel/ocaml-biniou/patches/patch-bi__inbuf.mli:1.1
--- /dev/null Sun Mar 11 02:30:34 2018
+++ pkgsrc/devel/ocaml-biniou/patches/patch-bi__inbuf.mli Sun Mar 11 02:30:34 2018
@@ -0,0 +1,33 @@
+$NetBSD: patch-bi__inbuf.mli,v 1.1 2018/03/11 02:30:34 dholland Exp $
+
+Fix up mutable strings to make it build with ocaml 4.06.
+
+--- bi_inbuf.mli~ 2017-05-04 17:38:05.000000000 +0000
++++ bi_inbuf.mli
+@@ -1,7 +1,7 @@
+ (** Input buffer *)
+
+ type t = {
+- mutable i_s : string;
++ mutable i_s : bytes;
+ (** This is the buffer string.
+ It can be accessed for reading but should normally only
+ be written to or replaced only by the [i_refill] function.
+@@ -92,9 +92,17 @@ val peek : t -> char
+ @raise End_of_input if the end of input has already been reached.
+ *)
+
++val from_bytes : ?pos:int -> ?shrlen:int -> bytes -> t
++ (**
++ Create an input buffer from a byte buffer.
++ @param pos position to start from. Default: 0.
++ @param shrlen initial length of the table used to store shared values.
++ *)
++
+ val from_string : ?pos:int -> ?shrlen:int -> string -> t
+ (**
+ Create an input buffer from a string.
++ The string is copied into the internal buffer.
+ @param pos position to start from. Default: 0.
+ @param shrlen initial length of the table used to store shared values.
+ *)
Index: pkgsrc/devel/ocaml-biniou/patches/patch-bi__io.ml
diff -u /dev/null pkgsrc/devel/ocaml-biniou/patches/patch-bi__io.ml:1.1
--- /dev/null Sun Mar 11 02:30:34 2018
+++ pkgsrc/devel/ocaml-biniou/patches/patch-bi__io.ml Sun Mar 11 02:30:34 2018
@@ -0,0 +1,141 @@
+$NetBSD: patch-bi__io.ml,v 1.1 2018/03/11 02:30:34 dholland Exp $
+
+Fix up mutable strings to make it build with ocaml 4.06.
+
+--- bi_io.ml~ 2017-05-04 17:38:05.000000000 +0000
++++ bi_io.ml
+@@ -89,13 +89,13 @@ let write_hashtag ob h has_arg =
+ let h = mask_31bit h in
+ let pos = Bi_outbuf.alloc ob 4 in
+ let s = ob.o_s in
+- String.unsafe_set s (pos+3) (Char.chr (h land 0xff));
++ Bytes.unsafe_set s (pos+3) (Char.chr (h land 0xff));
+ let h = h lsr 8 in
+- String.unsafe_set s (pos+2) (Char.chr (h land 0xff));
++ Bytes.unsafe_set s (pos+2) (Char.chr (h land 0xff));
+ let h = h lsr 8 in
+- String.unsafe_set s (pos+1) (Char.chr (h land 0xff));
++ Bytes.unsafe_set s (pos+1) (Char.chr (h land 0xff));
+ let h = h lsr 8 in
+- String.unsafe_set s pos (
++ Bytes.unsafe_set s pos (
+ Char.chr (
+ if has_arg then h lor 0x80
+ else h
+@@ -110,12 +110,12 @@ let string_of_hashtag h has_arg =
+ let read_hashtag ib cont =
+ let i = Bi_inbuf.read ib 4 in
+ let s = ib.i_s in
+- let x0 = Char.code s.[i] in
++ let x0 = Char.code (Bytes.get s i) in
+ let has_arg = x0 >= 0x80 in
+ let x1 = (x0 land 0x7f) lsl 24 in
+- let x2 = (Char.code s.[i+1]) lsl 16 in
+- let x3 = (Char.code s.[i+2]) lsl 8 in
+- let x4 = Char.code s.[i+3] in
++ let x2 = (Char.code (Bytes.get s (i+1))) lsl 16 in
++ let x3 = (Char.code (Bytes.get s (i+2))) lsl 8 in
++ let x4 = Char.code (Bytes.get s (i+3)) in
+ let h = make_signed (x1 lor x2 lor x3 lor x4) in
+
+ cont ib h has_arg
+@@ -124,13 +124,13 @@ let read_hashtag ib cont =
+ let read_field_hashtag ib =
+ let i = Bi_inbuf.read ib 4 in
+ let s = ib.i_s in
+- let x0 = Char.code (String.unsafe_get s i) in
++ let x0 = Char.code (Bytes.unsafe_get s i) in
+ if x0 < 0x80 then
+ Bi_util.error "Corrupted data (invalid field hashtag)";
+ let x1 = (x0 land 0x7f) lsl 24 in
+- let x2 = (Char.code (String.unsafe_get s (i+1))) lsl 16 in
+- let x3 = (Char.code (String.unsafe_get s (i+2))) lsl 8 in
+- let x4 = Char.code (String.unsafe_get s (i+3)) in
++ let x2 = (Char.code (Bytes.unsafe_get s (i+1))) lsl 16 in
++ let x3 = (Char.code (Bytes.unsafe_get s (i+2))) lsl 8 in
++ let x4 = Char.code (Bytes.unsafe_get s (i+3)) in
+ make_signed (x1 lor x2 lor x3 lor x4)
+
+
+@@ -147,7 +147,7 @@ let write_numtag ob i has_arg =
+
+ let read_numtag ib cont =
+ let i = Bi_inbuf.read ib 1 in
+- let x = Char.code ib.i_s.[i] in
++ let x = Char.code (Bytes.get ib.i_s i) in
+ let has_arg = x >= 0x80 in
+ cont ib (x land 0x7f) has_arg
+
+@@ -219,11 +219,11 @@ let read_untagged_float64 ib =
+ (match Lazy.force float_endianness with
+ `Little ->
+ for j = 0 to 7 do
+- String.unsafe_set (Obj.obj x) (7-j) (String.unsafe_get s (i+j))
++ Bytes.unsafe_set (Obj.obj x) (7-j) (Bytes.unsafe_get s (i+j))
+ done
+ | `Big ->
+ for j = 0 to 7 do
+- String.unsafe_set (Obj.obj x) j (String.unsafe_get s (i+j))
++ Bytes.unsafe_set (Obj.obj x) j (Bytes.unsafe_get s (i+j))
+ done
+ );
+ (Obj.obj x : float)
+@@ -234,11 +234,11 @@ let write_untagged_float64 ob x =
+ (match Lazy.force float_endianness with
+ `Little ->
+ for j = 0 to 7 do
+- String.unsafe_set s (i+j) (String.unsafe_get (Obj.magic x) (7-j))
++ Bytes.unsafe_set s (i+j) (Bytes.unsafe_get (Obj.magic x) (7-j))
+ done
+ | `Big ->
+ for j = 0 to 7 do
+- String.unsafe_set s (i+j) (String.unsafe_get (Obj.magic x) j)
++ Bytes.unsafe_set s (i+j) (Bytes.unsafe_get (Obj.magic x) j)
+ done
+ )
+
+@@ -526,16 +526,16 @@ let read_untagged_int8 ib =
+ let read_untagged_int16 ib =
+ let i = Bi_inbuf.read ib 2 in
+ let s = ib.i_s in
+- ((Char.code s.[i]) lsl 8) lor (Char.code s.[i+1])
++ ((Char.code (Bytes.get s i)) lsl 8) lor (Char.code (Bytes.get s (i+1)))
+
+
+ let read_untagged_int32 ib =
+ let i = Bi_inbuf.read ib 4 in
+ let s = ib.i_s in
+ let x1 =
+- Int32.of_int (((Char.code s.[i ]) lsl 8) lor (Char.code s.[i+1])) in
++ Int32.of_int (((Char.code (Bytes.get s (i ))) lsl 8) lor (Char.code (Bytes.get s (i+1)))) in
+ let x2 =
+- Int32.of_int (((Char.code s.[i+2]) lsl 8) lor (Char.code s.[i+3])) in
++ Int32.of_int (((Char.code (Bytes.get s (i+2))) lsl 8) lor (Char.code (Bytes.get s (i+3)))) in
+ Int32.logor (Int32.shift_left x1 16) x2
+
+ let read_untagged_float32 ib =
+@@ -565,7 +565,7 @@ let read_untagged_int64 ib =
+
+ let read_untagged_string ib =
+ let len = Bi_vint.read_uvint ib in
+- let str = String.create len in
++ let str = Bytes.create len in
+ let pos = ref 0 in
+ let rem = ref len in
+ while !rem > 0 do
+@@ -573,13 +573,13 @@ let read_untagged_string ib =
+ if bytes_read = 0 then
+ Bi_util.error "Corrupted data (string)"
+ else (
+- String.blit ib.i_s ib.i_pos str !pos bytes_read;
++ Bytes.blit ib.i_s ib.i_pos str !pos bytes_read;
+ ib.i_pos <- ib.i_pos + bytes_read;
+ pos := !pos + bytes_read;
+ rem := !rem - bytes_read
+ )
+ done;
+- str
++ Bytes.to_string str
+
+ let read_untagged_uvint = Bi_vint.read_uvint
+ let read_untagged_svint = Bi_vint.read_svint
Index: pkgsrc/devel/ocaml-biniou/patches/patch-bi__outbuf.ml
diff -u /dev/null pkgsrc/devel/ocaml-biniou/patches/patch-bi__outbuf.ml:1.1
--- /dev/null Sun Mar 11 02:30:34 2018
+++ pkgsrc/devel/ocaml-biniou/patches/patch-bi__outbuf.ml Sun Mar 11 02:30:34 2018
@@ -0,0 +1,82 @@
+$NetBSD: patch-bi__outbuf.ml,v 1.1 2018/03/11 02:30:34 dholland Exp $
+
+Fix up mutable strings to make it build with ocaml 4.06.
+
+--- bi_outbuf.ml~ 2017-05-04 17:38:05.000000000 +0000
++++ bi_outbuf.ml
+@@ -1,5 +1,5 @@
+ type t = {
+- mutable o_s : string;
++ mutable o_s : bytes;
+ mutable o_max_len : int;
+ mutable o_len : int;
+ mutable o_offs : int;
+@@ -21,8 +21,8 @@ let really_extend b n =
+ else
+ Sys.max_string_length
+ in
+- let s = String.create slen in
+- String.blit b.o_s 0 s 0 b.o_len;
++ let s = Bytes.create slen in
++ Bytes.blit b.o_s 0 s 0 b.o_len;
+ b.o_s <- s;
+ b.o_max_len <- slen
+
+@@ -37,7 +37,7 @@ let flush_to_channel oc = flush_to_outpu
+
+
+ let create ?(make_room = really_extend) ?(shrlen = 16) n = {
+- o_s = String.create n;
++ o_s = Bytes.create n;
+ o_max_len = n;
+ o_len = 0;
+ o_offs = 0;
+@@ -83,26 +83,26 @@ let add_string b s =
+
+ let add_char b c =
+ let pos = alloc b 1 in
+- b.o_s.[pos] <- c
++ Bytes.set b.o_s pos c
+
+ let unsafe_add_char b c =
+ let len = b.o_len in
+- b.o_s.[len] <- c;
++ Bytes.set b.o_s len c;
+ b.o_len <- len + 1
+
+ let add_char2 b c1 c2 =
+ let pos = alloc b 2 in
+ let s = b.o_s in
+- String.unsafe_set s pos c1;
+- String.unsafe_set s (pos+1) c2
++ Bytes.unsafe_set s pos c1;
++ Bytes.unsafe_set s (pos+1) c2
+
+ let add_char4 b c1 c2 c3 c4 =
+ let pos = alloc b 4 in
+ let s = b.o_s in
+- String.unsafe_set s pos c1;
+- String.unsafe_set s (pos+1) c2;
+- String.unsafe_set s (pos+2) c3;
+- String.unsafe_set s (pos+3) c4
++ Bytes.unsafe_set s pos c1;
++ Bytes.unsafe_set s (pos+1) c2;
++ Bytes.unsafe_set s (pos+2) c3;
++ Bytes.unsafe_set s (pos+3) c4
+
+
+
+@@ -112,10 +112,10 @@ let clear b =
+ Bi_share.Wr.clear b.o_shared
+
+ let reset b =
+- if String.length b.o_s <> b.o_init_len then
+- b.o_s <- String.create b.o_init_len;
++ if Bytes.length b.o_s <> b.o_init_len then
++ b.o_s <- Bytes.create b.o_init_len;
+ b.o_offs <- 0;
+ b.o_len <- 0;
+ b.o_shared <- Bi_share.Wr.create b.o_shared_init_len
+
+-let contents b = String.sub b.o_s 0 b.o_len
++let contents b = Bytes.to_string (Bytes.sub b.o_s 0 b.o_len)
Index: pkgsrc/devel/ocaml-biniou/patches/patch-bi__outbuf.mli
diff -u /dev/null pkgsrc/devel/ocaml-biniou/patches/patch-bi__outbuf.mli:1.1
--- /dev/null Sun Mar 11 02:30:34 2018
+++ pkgsrc/devel/ocaml-biniou/patches/patch-bi__outbuf.mli Sun Mar 11 02:30:34 2018
@@ -0,0 +1,24 @@
+$NetBSD: patch-bi__outbuf.mli,v 1.1 2018/03/11 02:30:34 dholland Exp $
+
+Fix up mutable strings to make it build with ocaml 4.06.
+
+--- bi_outbuf.mli~ 2017-05-04 17:38:05.000000000 +0000
++++ bi_outbuf.mli
+@@ -1,7 +1,7 @@
+ (** Output buffer *)
+
+ type t = {
+- mutable o_s : string;
++ mutable o_s : bytes;
+ (** Buffer string *)
+
+ mutable o_max_len : int;
+@@ -68,7 +68,7 @@ val flush_channel_writer : t -> unit
+ *)
+
+ val create_output_writer :
+- ?len:int -> ?shrlen:int -> < output : string -> int -> int -> int; .. > -> t
++ ?len:int -> ?shrlen:int -> < output : bytes -> int -> int -> int; .. > -> t
+ val flush_output_writer : t -> unit
+ (**
+ Pair of convenience functions for creating a buffer that
Index: pkgsrc/devel/ocaml-biniou/patches/patch-bi__stream.ml
diff -u /dev/null pkgsrc/devel/ocaml-biniou/patches/patch-bi__stream.ml:1.1
--- /dev/null Sun Mar 11 02:30:34 2018
+++ pkgsrc/devel/ocaml-biniou/patches/patch-bi__stream.ml Sun Mar 11 02:30:34 2018
@@ -0,0 +1,18 @@
+$NetBSD: patch-bi__stream.ml,v 1.1 2018/03/11 02:30:34 dholland Exp $
+
+Fix up mutable strings to make it build with ocaml 4.06.
+
+--- bi_stream.ml~ 2017-05-04 17:38:05.000000000 +0000
++++ bi_stream.ml
+@@ -53,9 +53,9 @@ let rec read_chunk of_string ic =
+ error
+ (sprintf
+ "Corrupted stream: excessive chunk length (%i bytes)" len);
+- let s = String.create len in
++ let s = Bytes.create len in
+ really_input ic s 0 len;
+- Some (of_string s)
++ Some (of_string (Bytes.to_string s))
+
+ | '\000' -> None
+
Index: pkgsrc/devel/ocaml-biniou/patches/patch-bi__util.ml
diff -u /dev/null pkgsrc/devel/ocaml-biniou/patches/patch-bi__util.ml:1.1
--- /dev/null Sun Mar 11 02:30:34 2018
+++ pkgsrc/devel/ocaml-biniou/patches/patch-bi__util.ml Sun Mar 11 02:30:34 2018
@@ -0,0 +1,52 @@
+$NetBSD: patch-bi__util.ml,v 1.1 2018/03/11 02:30:34 dholland Exp $
+
+Fix up mutable strings to make it build with ocaml 4.06.
+
+--- bi_util.ml~ 2017-05-04 17:38:05.000000000 +0000
++++ bi_util.ml
+@@ -8,18 +8,18 @@ let error s = raise (Error s)
+ *)
+
+ let string8_of_int x =
+- let s = String.create 8 in
++ let s = Bytes.create 8 in
+ for i = 0 to 7 do
+- s.[7-i] <- Char.chr (0xff land (x lsr (8 * i)))
++ Bytes.set s (7-i) (Char.chr (0xff land (x lsr (8 * i))))
+ done;
+- s
++ Bytes.to_string s
+
+ let string4_of_int x =
+- let s = String.create 4 in
++ let s = Bytes.create 4 in
+ for i = 0 to 3 do
+- s.[3-i] <- Char.chr (0xff land (x lsr (8 * i)))
++ Bytes.set s (3-i) (Char.chr (0xff land (x lsr (8 * i))))
+ done;
+- s
++ Bytes.to_string s
+
+ let print_bits ?(pos = 0) ?len s =
+ let slen = String.length s in
+@@ -33,16 +33,16 @@ let print_bits ?(pos = 0) ?len s =
+ else len
+ in
+
+- let r = String.create (len * 9) in
++ let r = Bytes.create (len * 9) in
+ for i = 0 to len - 1 do
+ let k = i * 9 in
+ let x = Char.code s.[pos+i] in
+ for j = 0 to 7 do
+- r.[k+j] <- if (x lsr (7 - j)) land 1 = 0 then '0' else '1'
++ Bytes.set r (k+j) (if (x lsr (7 - j)) land 1 = 0 then '0' else '1')
+ done;
+- r.[k+8] <- if (i + 1) mod 8 = 0 then '\n' else ' '
++ Bytes.set r (k+8) (if (i + 1) mod 8 = 0 then '\n' else ' ')
+ done;
+- r
++ Bytes.to_string r
+
+ (* int size in bits *)
+ let int_size =
Index: pkgsrc/devel/ocaml-biniou/patches/patch-bi__vint.ml
diff -u /dev/null pkgsrc/devel/ocaml-biniou/patches/patch-bi__vint.ml:1.1
--- /dev/null Sun Mar 11 02:30:34 2018
+++ pkgsrc/devel/ocaml-biniou/patches/patch-bi__vint.ml Sun Mar 11 02:30:34 2018
@@ -0,0 +1,15 @@
+$NetBSD: patch-bi__vint.ml,v 1.1 2018/03/11 02:30:34 dholland Exp $
+
+Fix up mutable strings to make it build with ocaml 4.06.
+
+--- bi_vint.ml~ 2017-05-04 17:38:05.000000000 +0000
++++ bi_vint.ml
+@@ -80,7 +80,7 @@ let read_uvint ib =
+ let x = ref 0 in
+ (try
+ for i = 0 to avail - 1 do
+- let b = Char.code s.[pos+i] in
++ let b = Char.code (Bytes.get s (pos+i)) in
+ x := ((b land 0x7f) lsl (7*i)) lor !x;
+ if b < 0x80 then (
+ ib.i_pos <- pos + i + 1;
Home |
Main Index |
Thread Index |
Old Index