1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
--- config.ml.orig 2003-04-09 23:32:54 UTC
+++ config.ml
@@ -381,7 +381,7 @@ class configure ~defaults ~files ~required =
let len = in_channel_length file in
let data = String.create len in
really_input file data 0 len;
- let tokens = tokenize data in
+ let tokens = tokenize (Bytes.to_string data) in
if not default then
self#parse_tokens tokens
else self#parse_tokens_default tokens
--- fcp.ml.orig 2003-04-09 23:32:54 UTC
+++ fcp.ml
@@ -82,7 +82,7 @@ class transact connect = object (self)
begin try really_input in_chan data 0 len
with Sys_error _ -> raise Io_error
end;
- data
+ Bytes.to_string data
end
method private recv_soft len =
if not opened then raise Closed
@@ -91,7 +91,7 @@ class transact connect = object (self)
let rlen =
try input in_chan data 0 len
with Sys_error _ -> raise Io_error
- in String.sub data 0 rlen
+ in Bytes.sub_string data 0 rlen
method private recv_line =
if not opened then raise Closed
else try input_line in_chan
--- fstream.ml.orig 2003-04-09 23:32:54 UTC
+++ fstream.ml
@@ -18,8 +18,8 @@ class virtual fstream_in =
method virtual input_line : string
method virtual input : int -> string
method virtual really_input : int -> string
- method virtual input_buf : string -> int -> int -> int
- method virtual really_input_buf : string -> int -> int -> unit
+ method virtual input_buf : bytes -> int -> int -> int
+ method virtual really_input_buf : bytes -> int -> int -> unit
method virtual seek : int -> unit
method virtual pos : int
end
@@ -34,7 +34,7 @@ class fstream_in_channel chan =
let buf = String.create len in
let len_read = input chan buf 0 len in
if len_read > 0 then
- String.sub buf 0 len_read
+ Bytes.sub_string buf 0 len_read
else
if self#pos = self#length then
raise End_of_file
@@ -42,7 +42,7 @@ class fstream_in_channel chan =
method really_input len =
let buf = String.create len in
really_input chan buf 0 len;
- buf
+ Bytes.to_string buf
method input_buf buf off len =
try input chan buf off len
with Invalid_argument _ ->
@@ -165,7 +165,7 @@ class fstream_out_channel chan =
inherit fstream_out
method output_char ch = output_char chan ch
method output_string data = output_string chan data
- method output_buf buf off len = output chan buf off len
+ method output_buf buf off len = output chan (Bytes.of_string buf) off len
method output_byte byte = output_byte chan byte
method clear = seek_out chan 0
end
--- fstream.mli.orig 2003-04-09 23:32:54 UTC
+++ fstream.mli
@@ -17,8 +17,8 @@ class virtual fstream_in : object
method virtual input_line : string
method virtual input : int -> string
method virtual really_input : int -> string
- method virtual input_buf : string -> int -> int -> int
- method virtual really_input_buf : string -> int -> int -> unit
+ method virtual input_buf : bytes -> int -> int -> int
+ method virtual really_input_buf : bytes -> int -> int -> unit
method virtual seek : int -> unit
method virtual pos : int
end
@@ -29,8 +29,8 @@ class fstream_in_channel : in_channel -> object
method input_line : string
method input : int -> string
method really_input : int -> string
- method input_buf : string -> int -> int -> int
- method really_input_buf : string -> int -> int -> unit
+ method input_buf : bytes -> int -> int -> int
+ method really_input_buf : bytes -> int -> int -> unit
method seek : int -> unit
method pos : int
end
@@ -42,8 +42,8 @@ class fstream_in_string : string -> object
method input_line : string
method input : int -> string
method really_input : int -> string
- method input_buf : string -> int -> int -> int
- method really_input_buf : string -> int -> int -> unit
+ method input_buf : bytes -> int -> int -> int
+ method really_input_buf : bytes -> int -> int -> unit
method seek : int -> unit
method pos : int
end
--- hlfreenet.ml.orig 2003-04-09 23:32:54 UTC
+++ hlfreenet.ml
@@ -653,8 +653,8 @@ let rec insert node_info uri htl map stream =
let len = stream#input_buf buf 0 node_info.nin_block_len in
if len > 0 then begin
if len = node_info.nin_block_len then
- transact#block buf
- else transact#block (String.sub buf 0 len);
+ transact#block (Bytes.to_string buf)
+ else transact#block (Bytes.sub_string buf 0 len);
step ()
end else ()
with
@@ -820,8 +820,8 @@ let generate_chk node_info map (stream : fstream_in) =
let len = stream#input_buf buf 0 node_info.nin_block_len in
if len > 0 then begin
if len = node_info.nin_block_len then
- transact#block buf
- else transact#block (String.sub buf 0 len);
+ transact#block (Bytes.to_string buf)
+ else transact#block (Bytes.sub_string buf 0 len);
step ()
end else ()
with
--- liber.ml.orig 2003-04-09 23:32:54 UTC
+++ liber.ml
@@ -463,7 +463,7 @@ let basic_metadata conf (log : Log.log_type) =
let buf = String.create len in
really_input channel buf 0 len;
close_in channel;
- fields_parse buf
+ fields_parse (Bytes.to_string buf)
with Sys_error _ ->
raise (Die_msg ("cannot open or read metadata file " ^ file))
end
|