File: 14_percent_decoding.dpatch

package info (click to toggle)
alsaplayer 0.99.76-9%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 4,752 kB
  • ctags: 2,970
  • sloc: ansic: 16,775; sh: 10,709; cpp: 9,442; makefile: 694
file content (73 lines) | stat: -rw-r--r-- 1,753 bytes parent folder | download | duplicates (2)
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
#! /bin/sh /usr/share/dpatch/dpatch-run
## 14_percent_decoding by  <hubert@uhoreg.ca>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix the percent decoding.
## DP: adapted from alsaplayer CVS (committed on 2004-02-15)

@DPATCH@
--- alsaplayer-0.99.76/reader/file/file.c	9 Mar 2003 02:48:35 -0000	1.11
+++ alsaplayer-cvs/reader/file/file.c	15 Feb 2004 18:58:30 -0000	1.12
@@ -28,12 +28,17 @@
 
 #include "reader.h"
 #include "string.h"
+#include "utilities.h"
 #include "alsaplayer_error.h"
 
 static void decode_uri(const char *src, char *dst, int len)
 {
     int j;
-    
+   
+    if (!is_uri(src)) {
+	    strncpy(dst, src, len);
+	    return;
+    }	    
     for (j=0; j<len && *src; j++, src++) {
 	if (*src == '%') {
 	    int c;
--- alsaplayer-0.99.76/alsaplayer/utilities.h	16 Feb 2003 15:06:09 -0000	1.6
+++ alsaplayer-cvs/alsaplayer/utilities.h	15 Feb 2004 18:58:30 -0000	1.7
@@ -40,6 +40,7 @@
 char *get_prefsdir(void);
 char *parse_file_uri(const char *);
 int is_playlist(const char *);
+int is_uri(const char *);
 
 #ifdef __cplusplus
 }
--- alsaplayer-0.99.76/app/utilities.c	9 Mar 2003 02:48:34 -0000	1.8
+++ alsaplayer-cvs/app/utilities.c	15 Feb 2004 18:58:30 -0000	1.9
@@ -82,9 +82,11 @@
 	char *res;
 	char escape[4];
 	int r,w, t, percent, e, val;
+	alsaplayer_error("parsing: %s", furi);
+
 	if (!furi)
 		return NULL;
-	if ((strncmp(furi, "file:", 5) != 0)) {
+	if ((strncmp(furi, "file:", 5) != 0) || !is_uri(furi)) {
 		return NULL;
 	}
 	t=strlen(furi);
@@ -128,6 +130,7 @@
 		r++;
 		res[w] = 0;
 	}
+	alsaplayer_error("parsed to: %s", res);
 	return res;
 		
 }
@@ -150,3 +153,10 @@
 	return 0;
 }
 
+int is_uri(const char *path)
+{
+	if (strstr(path, "://"))
+		return 1;
+	return 0;
+}
+