Package: liquidsoap / 1.1.1-7.2+deb9u1

bf0640779b2e7095e01755d3660c7e3f0865171d.patch Patch series | download
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
From bf0640779b2e7095e01755d3660c7e3f0865171d Mon Sep 17 00:00:00 2001
From: Romain Beauxis <toots@rastageeks.org>
Date: Thu, 14 May 2015 14:38:40 -0500
Subject: [PATCH] More stuff to compile with 3.12.1 -> 4.03.0

---
 src/Makefile                     |  2 +-
 src/decoder/decoder.ml           |  6 +--
 src/decoder/image_decoder.ml     |  2 +-
 src/decoder/ogg_decoder.ml       |  2 +-
 src/encoder/encoder.ml           |  2 +-
 src/encoder/taglib_id3v2.ml      |  2 +-
 src/lang/lang_builtins.ml        |  8 ++--
 src/lang/lang_encoders.ml        | 86 ++++++++++++++++++++--------------------
 src/lang/lang_pp.ml              |  2 +-
 src/lang/lang_types.ml           |  2 +-
 src/operators/frei0r_op.ml       |  2 +-
 src/operators/setvol.ml          |  2 +-
 src/outputs/harbor_output.camlp4 |  2 +-
 src/outputs/harbor_output.ml     |  6 +--
 src/outputs/icecast2.ml          |  2 +-
 src/playlists/playlist_basic.ml  |  2 +-
 src/protocols/mpd.ml             |  2 +-
 src/request.ml                   |  2 +-
 src/stream/frame.ml              |  2 +-
 src/tools/harbor.camlp4          | 12 +++---
 src/tools/harbor.ml              | 17 +++++---
 src/tools/http.ml                |  8 ++--
 src/tools/plug.ml                |  4 +-
 src/tools/utils.ml               | 60 ++++++++++++++++++++++++++--
 24 files changed, 147 insertions(+), 90 deletions(-)

Index: liquidsoap-1.1.1/src/Makefile
===================================================================
--- liquidsoap-1.1.1.orig/src/Makefile
+++ liquidsoap-1.1.1/src/Makefile
@@ -173,7 +173,7 @@ $(call conditional_compilation,io,$(W_OS
 $(call conditional_compilation,io,$(W_PULSEAUDIO),io/pulseaudio_io.ml)
 $(call conditional_compilation,io,$(W_PORTAUDIO),io/portaudio_io.ml)
 
-tools = tools/stdlib.ml tools/doc.ml tools/plug.ml tools/utils.ml \
+tools = tools/stdlib.ml tools/doc.ml tools/utils.ml tools/plug.ml \
 	$(if $(W_DYNLINK),tools/dyntools.ml) \
 	tools/rqueue.ml \
 	$(if $(W_LAME_DYN),tools/lame_dynlink.ml) \
Index: liquidsoap-1.1.1/src/decoder/decoder.ml
===================================================================
--- liquidsoap-1.1.1.orig/src/decoder/decoder.ml
+++ liquidsoap-1.1.1/src/decoder/decoder.ml
@@ -277,7 +277,7 @@ let get_image_file_decoder filename =
   with
   | Pervasives.Exit -> !ans
 
-exception Exit of stream_decoder
+exception Exit_decoder of stream_decoder
 
 let get_stream_decoder mime kind =
   try
@@ -287,13 +287,13 @@ let get_stream_decoder mime kind =
          match try decoder mime kind with _ -> None with
            | Some f ->
                log#f 3 "Method %S accepted %S." name mime ;
-               raise (Exit f)
+               raise (Exit_decoder f)
            | None -> ()) (get_decoders conf_stream_decoders
                                        stream_decoders);
     log#f 3 "Unable to decode stream of type %S!" mime ;
     None
   with
-    | Exit f -> Some f
+    | Exit_decoder f -> Some f
 
 (** {1 Helpers for defining decoders} *)
 
Index: liquidsoap-1.1.1/src/decoder/ogg_decoder.ml
===================================================================
--- liquidsoap-1.1.1.orig/src/decoder/ogg_decoder.ml
+++ liquidsoap-1.1.1/src/decoder/ogg_decoder.ml
@@ -167,7 +167,7 @@ let create_decoder ?(merge_tracks=false)
         let metas = Hashtbl.create 10 in
         List.iter 
           (fun (x,y) -> 
-            Hashtbl.add metas (String.lowercase x) y)
+            Hashtbl.add metas (Utils.StringCompat.lowercase_ascii x) y)
             m;
         Hashtbl.add metas "vendor" v;
         Generator.add_metadata buffer metas
Index: liquidsoap-1.1.1/src/encoder/encoder.ml
===================================================================
--- liquidsoap-1.1.1.orig/src/encoder/encoder.ml
+++ liquidsoap-1.1.1/src/encoder/encoder.ml
@@ -53,7 +53,7 @@ module Meta :
     let export_metadata m =
       let ret = Hashtbl.create 10 in
       let l = conf_export_metadata#get in
-      Hashtbl.iter (fun x y -> if List.mem (String.lowercase x) l then
+      Hashtbl.iter (fun x y -> if List.mem (Utils.StringCompat.lowercase_ascii x) l then
                                Hashtbl.add ret x y) m;
     ret
     let to_metadata m = m
Index: liquidsoap-1.1.1/src/encoder/taglib_id3v2.ml
===================================================================
--- liquidsoap-1.1.1.orig/src/encoder/taglib_id3v2.ml
+++ liquidsoap-1.1.1/src/encoder/taglib_id3v2.ml
@@ -35,7 +35,7 @@ let render m =
     try
       Hashtbl.iter
         (fun k x ->
-          if (String.uppercase l) = (String.uppercase k) then
+          if (Utils.StringCompat.uppercase_ascii l) = (Utils.StringCompat.uppercase_ascii k) then
            raise (Found x)) m ;
      t
     with
Index: liquidsoap-1.1.1/src/lang/lang_builtins.ml
===================================================================
--- liquidsoap-1.1.1.orig/src/lang/lang_builtins.ml
+++ liquidsoap-1.1.1/src/lang/lang_builtins.ml
@@ -810,9 +810,9 @@ let () =
        let string = Lang.to_string (List.assoc "" p) in
        Lang.string
          (if lower then
-           String.lowercase(string)
+           Utils.StringCompat.lowercase_ascii string
           else
-           String.uppercase(string)))
+           Utils.StringCompat.uppercase_ascii string))
 
 let () =
   add_builtin "string.capitalize" ~cat:String
@@ -830,9 +830,9 @@ let () =
        let string = Lang.to_string (List.assoc "" p) in
        let f s =
            if cap then
-             String.capitalize(s)
+             Utils.StringCompat.capitalize_ascii s
            else
-             String.uncapitalize(s)
+             Utils.StringCompat.uncapitalize_ascii s
       in
       Lang.string
       (if space_sensitive then
Index: liquidsoap-1.1.1/src/lang/lang_pp.ml
===================================================================
--- liquidsoap-1.1.1.orig/src/lang/lang_pp.ml
+++ liquidsoap-1.1.1/src/lang/lang_pp.ml
@@ -386,7 +386,7 @@ let expand_define tokenizer =
       (
         match tokenizer lexbuf with
         | Lang_parser.VAR x ->
-          if x <> String.uppercase x then raise Parsing.Parse_error;
+          if x <> Utils.StringCompat.uppercase_ascii x then raise Parsing.Parse_error;
           (
             match tokenizer lexbuf with
             | Lang_parser.INT _
Index: liquidsoap-1.1.1/src/lang/lang_types.ml
===================================================================
--- liquidsoap-1.1.1.orig/src/lang/lang_types.ml
+++ liquidsoap-1.1.1/src/lang/lang_types.ml
@@ -200,7 +200,7 @@ let repr ?(filter_out=fun _->false) ?(ge
           try
             Hashtbl.find evars i
           with Not_found ->
-            let name = String.uppercase (name (counter ())) in
+            let name = Utils.StringCompat.uppercase_ascii (name (counter ())) in
               Hashtbl.add evars i name ;
               name
         in
Index: liquidsoap-1.1.1/src/operators/frei0r_op.ml
===================================================================
--- liquidsoap-1.1.1.orig/src/operators/frei0r_op.ml
+++ liquidsoap-1.1.1/src/operators/frei0r_op.ml
@@ -308,7 +308,7 @@ let register_plugin fname =
   in
   let explanation =
     let e = info.Frei0r.explanation in
-    let e = String.capitalize e in
+    let e = Utils.StringCompat.capitalize_ascii e in
     let e = Pcre.substitute ~pat:"@" ~subst:(fun _ -> "(at)") e in
     if e = "" then e else
       if e.[String.length e - 1] = '.' then
Index: liquidsoap-1.1.1/src/operators/setvol.ml
===================================================================
--- liquidsoap-1.1.1.orig/src/operators/setvol.ml
+++ liquidsoap-1.1.1/src/operators/setvol.ml
@@ -86,5 +86,5 @@ let () =
        let c = Lang.to_float_getter (Lang.assoc "" 1 p) in
        let s = Lang.to_source (Lang.assoc "" 2 p) in
        let o = Lang.to_string (Lang.assoc "override" 1 p) in
-       let o = if o = "" then None else Some (String.lowercase o) in
+       let o = if o = "" then None else Some (Utils.StringCompat.lowercase_ascii o) in
          new amplify ~kind s o c)
Index: liquidsoap-1.1.1/src/outputs/icecast2.ml
===================================================================
--- liquidsoap-1.1.1.orig/src/outputs/icecast2.ml
+++ liquidsoap-1.1.1/src/outputs/icecast2.ml
@@ -243,7 +243,7 @@ class output ~kind p =
            "ISO-8859-1"
          else
            "UTF-8"
-      | s -> String.uppercase s
+      | s -> Utils.StringCompat.uppercase_ascii s
   in
 
   let source = Lang.assoc "" 2 p in
Index: liquidsoap-1.1.1/src/playlists/playlist_basic.ml
===================================================================
--- liquidsoap-1.1.1.orig/src/playlists/playlist_basic.ml
+++ liquidsoap-1.1.1/src/playlists/playlist_basic.ml
@@ -77,7 +77,7 @@ let parse_scpls ?pwd string =
   test_text string ;
   let string = Pcre.replace ~pat:"#[^\\r\\n]*[\\n\\r]+" string in
   (* Format check, raise Not_found if invalid *)
-  ignore(Pcre.exec ~pat:"^[\\r\\n\\s]*\\[playlist\\]" (String.lowercase string)) ;
+  ignore(Pcre.exec ~pat:"^[\\r\\n\\s]*\\[playlist\\]" (Utils.StringCompat.lowercase_ascii string)) ;
   let lines = split_lines string in
   let urls =
     List.map
Index: liquidsoap-1.1.1/src/request.ml
===================================================================
--- liquidsoap-1.1.1.orig/src/request.ml
+++ liquidsoap-1.1.1/src/request.ml
@@ -351,7 +351,7 @@ let local_check t =
                      let ans = resolver name in
                        List.iter
                          (fun (k,v) ->
-                           let k = String.lowercase k in
+                           let k = Utils.StringCompat.lowercase_ascii k in
                            if conf_override_metadata#get || get_metadata t k = None then
                              Hashtbl.replace indicator.metadata
                               k (cleanup v))
Index: liquidsoap-1.1.1/src/tools/harbor.camlp4
===================================================================
--- liquidsoap-1.1.1.orig/src/tools/harbor.camlp4
+++ liquidsoap-1.1.1/src/tools/harbor.camlp4
@@ -95,7 +95,7 @@ type verb = [
 ]
 
 let verb_of_string s =
-  match (String.uppercase s) with
+  match (Utils.StringCompat.uppercase_ascii s) with
     | "GET"     -> `Get
     | "POST"    -> `Post
     | "PUT"     -> `Put
@@ -105,7 +105,7 @@ let verb_of_string s =
     | _ -> raise Not_found
 
 let verb_or_source_of_string s =
-  match (String.uppercase s) with
+  match (Utils.StringCompat.uppercase_ascii s) with
     | "SOURCE"  -> `Source
     | _         -> verb_of_string s
 
@@ -158,7 +158,7 @@ exception Assoc of string
 let assoc_uppercase x y =
   try
     List.iter
-      (fun (l,v) -> if String.uppercase l = x then
+      (fun (l,v) -> if Utils.StringCompat.uppercase_ascii l = x then
                      raise (Assoc v)) y ;
     raise Not_found
   with
@@ -210,7 +210,7 @@ let parse_http_request_line r =
    duppy_return
      (protocol,
       List.nth data 1,
-     (match (String.uppercase (List.nth data 2)) with
+     (match (Utils.StringCompat.uppercase_ascii (List.nth data 2)) with
         | "HTTP/1.0" -> `Http_10
         | "HTTP/1.1" -> `Http_11
         | "ICE/1.0"  -> `Ice_10
@@ -232,7 +232,7 @@ let parse_headers headers =
     with
       | Not_found -> l
   in
-  let f x = String.uppercase x in
+  let f x = Utils.StringCompat.uppercase_ascii x in
   let headers = List.fold_right split_header headers [] in
   let display_headers =
     List.filter
@@ -449,7 +449,7 @@ let handle_http_request ~hmethod ~hproto
                let in_enc =
                 try
                  let enc = 
-                   match String.uppercase (Hashtbl.find args "charset") with
+                   match Utils.StringCompat.uppercase_ascii (Hashtbl.find args "charset") with
                      | "LATIN1" -> "ISO-8859-1"
                      | s        -> s
                  in
Index: liquidsoap-1.1.1/src/tools/harbor.ml
===================================================================
--- liquidsoap-1.1.1.orig/src/tools/harbor.ml
+++ liquidsoap-1.1.1/src/tools/harbor.ml
@@ -82,7 +82,7 @@ type verb =
   ]
 
 let verb_of_string s =
-  match String.uppercase s with
+  match Utils.StringCompat.uppercase_ascii s with
   | "GET" -> `Get
   | "POST" -> `Post
   | "PUT" -> `Put
@@ -92,7 +92,9 @@ let verb_of_string s =
   | _ -> raise Not_found
   
 let verb_or_source_of_string s =
-  match String.uppercase s with | "SOURCE" -> `Source | _ -> verb_of_string s
+  match Utils.StringCompat.uppercase_ascii s with
+  | "SOURCE" -> `Source
+  | _ -> verb_of_string s
   
 let string_of_verb =
   function
@@ -139,7 +141,9 @@ let assoc_uppercase x y =
   try
     (List.iter
        (fun (l, v) ->
-          if (String.uppercase l) = x then raise (Assoc v) else ())
+          if (Utils.StringCompat.uppercase_ascii l) = x
+          then raise (Assoc v)
+          else ())
        y;
      raise Not_found)
   with | Assoc s -> s
@@ -193,7 +197,7 @@ let parse_http_request_line r =
     in
       Duppy.Monad.return
         (protocol, (List.nth data 1),
-         (match String.uppercase (List.nth data 2) with
+         (match Utils.StringCompat.uppercase_ascii (List.nth data 2) with
           | "HTTP/1.0" -> `Http_10
           | "HTTP/1.1" -> `Http_11
           | "ICE/1.0" -> `Ice_10
@@ -211,7 +215,7 @@ let parse_headers headers =
       let sub = Pcre.exec ~rex h
       in ((Pcre.get_substring sub 1), (Pcre.get_substring sub 2)) :: l
     with | Not_found -> l in
-  let f x = String.uppercase x in
+  let f x = Utils.StringCompat.uppercase_ascii x in
   let headers = List.fold_right split_header headers [] in
   let display_headers =
     List.filter
@@ -417,7 +421,8 @@ let handle_http_request ~hmethod ~hproto
                                     let in_enc =
                                       try
                                         let enc =
-                                          match String.uppercase
+                                          match Utils.StringCompat.
+                                                  uppercase_ascii
                                                   (Hashtbl.find args
                                                      "charset")
                                           with
Index: liquidsoap-1.1.1/src/tools/plug.ml
===================================================================
--- liquidsoap-1.1.1.orig/src/tools/plug.ml
+++ liquidsoap-1.1.1/src/tools/plug.ml
@@ -32,7 +32,7 @@ object (self)
   val mutable aliases : (string*'a) list = []
 
   method register plugin ?plugin_aliases ?doc ?sdoc v =
-    let plugin = if insensitive then String.uppercase plugin else plugin in
+    let plugin = if insensitive then Utils.StringCompat.uppercase_ascii plugin else plugin in
     let doc = match doc,sdoc with
       | (Some d), _ -> d
       | _, None -> Doc.trivial "(no doc)"
@@ -64,7 +64,7 @@ object (self)
     List.iter (fun (k,v) -> f k v) plugins
   method get_all = plugins
   method get plugin =
-    let plugin = if insensitive then String.uppercase plugin else plugin in
+    let plugin = if insensitive then Utils.StringCompat.uppercase_ascii plugin else plugin in
       try
         Some (List.assoc plugin plugins)
       with
Index: liquidsoap-1.1.1/src/tools/utils.ml
===================================================================
--- liquidsoap-1.1.1.orig/src/tools/utils.ml
+++ liquidsoap-1.1.1/src/tools/utils.ml
@@ -96,7 +96,59 @@ let hashtbl_get : ('a,'b) Hashtbl.t -> '
   fun h k ->
     try Some (Hashtbl.find h k) with Not_found -> None
 
-(** Unescapt a string. *)
+(* Backward-compatible API.. *)
+
+module LazyCompat =
+struct
+  let from_fun f = lazy (f ())
+  let from_val v = lazy v
+  (* Make compiler happy.. *)
+  let () =
+    ignore(from_fun (fun () -> ()));
+    ignore(from_val ())
+  include Lazy
+end
+
+exception Not_implemented
+
+module type StringWrapper =
+sig
+  include module type of String
+  val capitalize : string -> string
+  val uncapitalize : string -> string
+  val lowercase : string -> string
+  val uppercase : string -> string
+end
+
+module StringWrapper : StringWrapper =
+struct
+  let capitalize _ = raise Not_implemented
+  let uncapitalize _ = raise Not_implemented
+  let lowercase _ = raise Not_implemented
+  let uppercase _ = raise Not_implemented
+  let () =
+    let e f = try ignore(f "") with Not_implemented -> () in
+    e capitalize; e uncapitalize;
+    e lowercase; e uppercase
+  include String
+end
+
+module StringCompat =
+struct
+  let capitalize_ascii = StringWrapper.capitalize
+  let uncapitalize_ascii = StringWrapper.uncapitalize
+  let lowercase_ascii = StringWrapper.lowercase
+  let uppercase_ascii = StringWrapper.uppercase
+
+  let () =
+    let e f = try ignore(f "") with Not_implemented -> () in
+    e capitalize_ascii; e uncapitalize_ascii;
+    e lowercase_ascii; e uppercase_ascii
+
+  include String
+end
+
+(** Unescape a string. *)
 let unescape s =
   try
     Scanf.sscanf s "%S" (fun u -> u)
@@ -568,7 +620,7 @@ let get_ext s =
  try
   let rex = Pcre.regexp "\\.([a-zA-Z0-9]+)[^.]*$" in
   let ret = Pcre.exec ~rex s in
-  String.lowercase (Pcre.get_substring ret 1)
+  StringCompat.lowercase_ascii (Pcre.get_substring ret 1)
  with
    | _ -> raise Not_found
 
@@ -604,7 +656,7 @@ let normalize_parameter_string s =
   let s = Pcre.substitute ~pat:" +$" ~subst:(fun _ -> "") s in
   let s = Pcre.substitute ~pat:"( +|/+|-+)" ~subst:(fun _ -> "_") s in
   let s = Pcre.substitute ~pat:"\"" ~subst:(fun _ -> "") s in
-  let s = String.lowercase s in
+  let s = StringCompat.lowercase_ascii s in
   (* Identifiers cannot begin with a digit. *)
   let s = if Pcre.pmatch ~pat:"^[0-9]" s then "_"^s else s in
   s