pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/www/swiftsurf Fix build with ocaml 4.06.
details: https://anonhg.NetBSD.org/pkgsrc/rev/4ffb4e12f12d
branches: trunk
changeset: 377222:4ffb4e12f12d
user: dholland <dholland%pkgsrc.org@localhost>
date: Wed Mar 14 08:58:43 2018 +0000
description:
Fix build with ocaml 4.06.
diffstat:
www/swiftsurf/distinfo | 8 +-
www/swiftsurf/patches/patch-request.ml | 69 +++++++++++++++
www/swiftsurf/patches/patch-src_activebuffer.ml | 105 +++++++++++++++++++++++
www/swiftsurf/patches/patch-src_activebuffer.mli | 41 ++++++++
www/swiftsurf/patches/patch-src_answer.ml | 68 ++++++++++++++
www/swiftsurf/patches/patch-src_dns.ml | 15 +++
www/swiftsurf/patches/patch-src_utils.ml | 104 ++++++++++++++++++++++
7 files changed, 409 insertions(+), 1 deletions(-)
diffs (truncated from 445 to 300 lines):
diff -r c2ddda98a047 -r 4ffb4e12f12d www/swiftsurf/distinfo
--- a/www/swiftsurf/distinfo Wed Mar 14 08:48:10 2018 +0000
+++ b/www/swiftsurf/distinfo Wed Mar 14 08:58:43 2018 +0000
@@ -1,8 +1,14 @@
-$NetBSD: distinfo,v 1.4 2015/11/04 02:47:39 agc Exp $
+$NetBSD: distinfo,v 1.5 2018/03/14 08:58:43 dholland Exp $
SHA1 (swiftsurf-1.2.5.tar.gz) = bf58a2afcbb8d9ee4cbeb9b8a6ebe00ab6f3d9c8
RMD160 (swiftsurf-1.2.5.tar.gz) = 243c9c05352e83b5f7b64a8398ea1373e7f8dc59
SHA512 (swiftsurf-1.2.5.tar.gz) = 3e6edc84624a134e5e4ada149e9d6a5444c9e1a57fa3b8b5dfde179c13c58e4bfdcfd4c00a2d563446e56804f3e00f9f373320710544a89e868304d95715ab04
Size (swiftsurf-1.2.5.tar.gz) = 31950 bytes
SHA1 (patch-aa) = 7882d5c8542e8ebab40100462ecfaaf3f282f5a2
+SHA1 (patch-request.ml) = 3d5e97a15be8b197682001fc3a694cb94a896fe9
SHA1 (patch-src_Makefile) = e4dad6b60ca5da10b27a9d90b868b3c0f2845cec
+SHA1 (patch-src_activebuffer.ml) = 9d36c013f177161f34b178ee6e2bd82c7064d395
+SHA1 (patch-src_activebuffer.mli) = fb7ff84dc8ac5a5550dce06470faf7ba6ce00f68
+SHA1 (patch-src_answer.ml) = 6deec06a5d460dd3794e281660534980c38434a5
+SHA1 (patch-src_dns.ml) = 3e5b277329a0be090c45b571e0096a39ea6957d8
+SHA1 (patch-src_utils.ml) = 8d590c70402e48ebc51b82860d60e510a1aa12ad
diff -r c2ddda98a047 -r 4ffb4e12f12d www/swiftsurf/patches/patch-request.ml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/www/swiftsurf/patches/patch-request.ml Wed Mar 14 08:58:43 2018 +0000
@@ -0,0 +1,69 @@
+$NetBSD: patch-request.ml,v 1.1 2018/03/14 08:58:43 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- src/request.ml~ 2002-03-04 11:46:08.000000000 +0000
++++ src/request.ml
+@@ -68,7 +68,7 @@ let goto_content conn =
+ try
+ conn.prof <- Conf.get_profile conn.auth;
+ if conn.prof.req_in then
+- (print_string (String.sub conn.read_req.buffer 0
++ (print_bytes (Bytes.sub conn.read_req.buffer 0
+ conn.read_req.pos_fin);
+ flush stdout);
+ if conn.prof.req_1 then
+@@ -101,12 +101,12 @@ let verif_auth conn deb len =
+ let rec aux i =
+ if i == len2
+ then true
+- else str.[i] == (Char.lowercase conn.read_req.buffer.[deb+i])
++ else str.[i] == (Char.lowercase_ascii (Bytes.get conn.read_req.buffer (deb+i)))
+ && aux (i+1) in
+ if aux 0
+ then
+- (conn.auth <- decode64 (String.sub conn.read_req.buffer
+- (deb+len2+6) (len-len2-8));
++ (conn.auth <- decode64 (Bytes.to_string (Bytes.sub conn.read_req.buffer
++ (deb+len2+6) (len-len2-8)));
+ false)
+ else true
+ with _ -> false
+@@ -203,7 +203,7 @@ let rec compute_read conn =
+ | CMD_LINE ->
+ (try
+ let pos = index conn.read_req '\n' in
+- let cmd = String.sub conn.read_req.buffer 0 (pos+1) in
++ let cmd = Bytes.to_string (Bytes.sub conn.read_req.buffer 0 (pos+1)) in
+ conn.read_req.pos_deb <- pos+1;
+ gere_cmdline cmd conn;
+ match conn.state_req with
+@@ -237,8 +237,8 @@ let rec compute_read conn =
+ (try
+ let pos = index conn.read_req '\n' in
+ let len = pos + 1 - conn.read_req.pos_deb in
+- let header = String.sub conn.read_req.buffer
+- conn.read_req.pos_deb len in
++ let header = Bytes.to_string (Bytes.sub conn.read_req.buffer
++ conn.read_req.pos_deb len) in
+ let deb = conn.read_req.pos_deb in
+ conn.read_req.pos_deb <- pos+1;
+ if len <= 2 then
+@@ -393,7 +393,7 @@ let gere_conns time active_read active_w
+ let nb = Unix.write conn.server str pos len in
+ if nb > 0 then
+ (if conn.prof.req_out then
+- print_string (String.sub str pos nb);
++ print_bytes (Bytes.sub str pos nb);
+ sub conn.write_req nb (len - nb);
+ conn.size_req <- min (conn.size_req + nb) buf_size;
+ conn.timeout <- time +. !Types.timeout);
+@@ -419,7 +419,7 @@ let gere_conns time active_read active_w
+ false
+ | nb ->
+ if conn.prof.req_in then
+- print_string (String.sub str pos nb);
++ print_bytes (Bytes.sub str pos nb);
+ after_read conn.read_req nb;
+ conn.timeout <- time +. !Types.timeout;
+ conn.size_req <- conn.size_req - nb;
diff -r c2ddda98a047 -r 4ffb4e12f12d www/swiftsurf/patches/patch-src_activebuffer.ml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/www/swiftsurf/patches/patch-src_activebuffer.ml Wed Mar 14 08:58:43 2018 +0000
@@ -0,0 +1,105 @@
+$NetBSD: patch-src_activebuffer.ml,v 1.1 2018/03/14 08:58:43 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- src/activebuffer.ml~ 2002-01-02 17:14:42.000000000 +0000
++++ src/activebuffer.ml
+@@ -1,7 +1,7 @@
+ (* Active buffers : can grow and reduce *)
+
+ type t = {
+- mutable buffer : string;
++ mutable buffer : bytes;
+ mutable pos_deb : int;
+ mutable pos_fin : int;
+ mutable size : int
+@@ -14,15 +14,15 @@ let create n =
+ else if n > Sys.max_string_length
+ then Sys.max_string_length
+ else n in
+- let s = String.create n in
++ let s = Bytes.create n in
+ { buffer = s; pos_deb = 0; pos_fin = 0; size = n }
+
+ let activebuffer_of_string str =
+ let n = String.length str in
+- { buffer = str; pos_deb = 0; pos_fin = n; size = n }
++ { buffer = (Bytes.of_string str); pos_deb = 0; pos_fin = n; size = n }
+
+ let contents b =
+- String.sub b.buffer b.pos_deb (b.pos_fin - b.pos_deb)
++ Bytes.to_string (Bytes.sub b.buffer b.pos_deb (b.pos_fin - b.pos_deb))
+
+ let length b = b.pos_fin - b.pos_deb
+
+@@ -34,19 +34,19 @@ let resize b more =
+ let len = b.pos_fin - b.pos_deb in
+ if len + more <= b.size
+ then (* no need to resize *)
+- String.blit b.buffer b.pos_deb b.buffer 0 len
++ Bytes.blit b.buffer b.pos_deb b.buffer 0 len
+ else
+ (let new_len = ref b.size in
+ while len + more > !new_len do new_len := 2 * !new_len done;
+- let new_buffer = String.create !new_len in
+- String.blit b.buffer b.pos_deb new_buffer 0 len;
++ let new_buffer = Bytes.create !new_len in
++ Bytes.blit b.buffer b.pos_deb new_buffer 0 len;
+ b.buffer <- new_buffer;
+ b.size <- !new_len);
+ b.pos_deb <- 0; b.pos_fin <- len
+
+ let add_char b c =
+ if b.pos_fin >= b.size then resize b 1;
+- b.buffer.[b.pos_fin] <- c;
++ Bytes.set b.buffer b.pos_fin c;
+ b.pos_fin <- b.pos_fin + 1
+
+ let add_substring b s offset len =
+@@ -56,14 +56,27 @@ let add_substring b s offset len =
+ String.blit s offset b.buffer b.pos_fin len;
+ b.pos_fin <- b.pos_fin + len
+
++let add_subbytes b s offset len =
++ if offset < 0 || len < 0 || offset + len > Bytes.length s
++ then invalid_arg "Buffer.add_subbytes";
++ if b.pos_fin + len > b.size then resize b len;
++ Bytes.blit s offset b.buffer b.pos_fin len;
++ b.pos_fin <- b.pos_fin + len
++
+ let add_string b s =
+ let len = String.length s in
+ if b.pos_fin + len > b.size then resize b len;
+ String.blit s 0 b.buffer b.pos_fin len;
+ b.pos_fin <- b.pos_fin + len
+
++let add_bytes b s =
++ let len = Bytes.length s in
++ if b.pos_fin + len > b.size then resize b len;
++ Bytes.blit s 0 b.buffer b.pos_fin len;
++ b.pos_fin <- b.pos_fin + len
++
+ let add_buffer b bs =
+- add_substring b bs.buffer bs.pos_deb (bs.pos_fin - bs.pos_deb)
++ add_subbytes b bs.buffer bs.pos_deb (bs.pos_fin - bs.pos_deb)
+
+ let add_channel b ic len =
+ if b.pos_fin + len > b.size then resize b len;
+@@ -75,7 +88,7 @@ let output_buffer oc b =
+
+ (* the follwing functions do not exist in the original buffer module *)
+ let add_subbuffer b bs offset len =
+- add_substring b bs.buffer (bs.pos_deb + offset) len
++ add_subbytes b bs.buffer (bs.pos_deb + offset) len
+
+ let sub b offset len =
+ if offset < 0 || len < 0 || offset + len > b.pos_fin - b.pos_deb
+@@ -96,7 +109,7 @@ let after_read b len =
+
+ let rec index_rec s lim i c =
+ if i >= lim then raise Not_found else
+- if String.unsafe_get s i = c then i else index_rec s lim (i+1) c;;
++ if Bytes.unsafe_get s i = c then i else index_rec s lim (i+1) c;;
+
+ let index b chr =
+ index_rec b.buffer b.pos_fin b.pos_deb chr
diff -r c2ddda98a047 -r 4ffb4e12f12d www/swiftsurf/patches/patch-src_activebuffer.mli
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/www/swiftsurf/patches/patch-src_activebuffer.mli Wed Mar 14 08:58:43 2018 +0000
@@ -0,0 +1,41 @@
+$NetBSD: patch-src_activebuffer.mli,v 1.1 2018/03/14 08:58:43 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- src/activebuffer.mli~ 2002-01-02 17:14:42.000000000 +0000
++++ src/activebuffer.mli
+@@ -1,5 +1,5 @@
+ type t = {
+- mutable buffer : string;
++ mutable buffer : bytes;
+ mutable pos_deb : int;
+ mutable pos_fin : int;
+ mutable size : int
+@@ -22,6 +22,9 @@ val add_char : t -> char -> unit
+ val add_string : t -> string -> unit
+ (*d [add_string b s] appends the string [s] at the end of
+ the buffer [b]. *)
++val add_bytes : t -> bytes -> unit
++ (*d [add_bytes b s] appends the bytes [s] at the end of
++ the buffer [b]. *)
+ val add_substring : t -> string -> int -> int -> unit
+ (*d [add_substring b s ofs len] takes [len] characters from offset
+ [ofs] in string [s] and appends them at the end of the buffer [b]. *)
+@@ -50,7 +53,7 @@ val sub : t -> int -> int -> unit
+ starting at offset [pos] and of length [len]. This function
+ does not copy nor create strings. Raise [Invalid_argument]
+ if [pos] and [len] do not designate a valid sub_part of the buffer *)
+-val buffer : t -> string*int
++val buffer : t -> bytes*int
+ (*d [buffer b] gives the internal string used by the buffer and the
+ starting active posistion. It can be used in conjunction with
+ [sub] when doing [write] in order to avoid unnecessary copy.
+@@ -58,7 +61,7 @@ val buffer : t -> string*int
+ let str, pos = buffer b in
+ let nb_written = write fds str pos len in
+ sub b nb_written (len - nb_written)] *)
+-val before_read : t -> int -> string*int
++val before_read : t -> int -> bytes*int
+ val after_read : t -> int -> unit
+ (*d [buffer b] gives the internal string used by the buffer and the
+ starting active posistion. It can be used in conjunction with
diff -r c2ddda98a047 -r 4ffb4e12f12d www/swiftsurf/patches/patch-src_answer.ml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/www/swiftsurf/patches/patch-src_answer.ml Wed Mar 14 08:58:43 2018 +0000
@@ -0,0 +1,68 @@
+$NetBSD: patch-src_answer.ml,v 1.1 2018/03/14 08:58:43 dholland Exp $
+
+Fix build with ocaml 4.06.
+
+--- src/answer.ml~ 2002-02-25 18:27:15.000000000 +0000
++++ src/answer.ml
+@@ -21,12 +21,12 @@ let rec compute_read conn =
+ | CMD_LINE ->
+ (try
+ let pos = index conn.read_ans '\n' in
+- let cmd = String.sub conn.read_ans.buffer 0 (pos+1) in
++ let cmd = Bytes.sub conn.read_ans.buffer 0 (pos+1) in
+ conn.read_ans.pos_deb <- pos+1;
+- Activebuffer.add_string conn.write_ans cmd;
++ Activebuffer.add_bytes conn.write_ans cmd;
+ conn.state_ans <- HEADERS;
+ if conn.prof.ans_1 then
+- (print_string cmd; flush stdout);
++ (print_bytes cmd; flush stdout);
+ compute_read conn
+ with Not_found ->
+ (* the command line is not finished *)
+@@ -34,20 +34,20 @@ let rec compute_read conn =
+ | HEADERS ->
+ (try
+ let pos = index conn.read_ans '\n' in
+- let header = String.sub conn.read_ans.buffer
++ let header = Bytes.sub conn.read_ans.buffer
+ conn.read_ans.pos_deb (pos+1-conn.read_ans.pos_deb) in
+ conn.read_ans.pos_deb <- pos+1;
+- if String.length header <= 2 then
++ if Bytes.length header <= 2 then
+ (* last line of headers *)
+ (if conn.prof.ans_1 then
+- (print_string header; flush stdout);
++ (print_bytes header; flush stdout);
+ conn.state_ans <- CONTENT;
+- Activebuffer.add_string conn.write_ans header)
++ Activebuffer.add_bytes conn.write_ans header)
+ else
+- (if ok_ans_header header then
++ (if ok_ans_header (Bytes.to_string header) then
+ (if conn.prof.ans_1 then
+- (print_string header; flush stdout);
+- Activebuffer.add_string conn.write_ans header));
++ (print_bytes header; flush stdout);
++ Activebuffer.add_bytes conn.write_ans header));
+ compute_read conn
+ with Not_found ->
+ (* this line of headers is not finished *)
Home |
Main Index |
Thread Index |
Old Index