-
Notifications
You must be signed in to change notification settings - Fork 4
/
vim74-gtags-cscope.patch
57 lines (54 loc) · 1.53 KB
/
vim74-gtags-cscope.patch
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
/*
* This is a patch for vim-7.4 to treat output of gtags-cscope(1)
* correctly. Now, you can use files which include spaces in path name.
*
* $ tar jxvf vim-7.4.tar.bz2
* $ cd vim74
* $ patch -p1 < [THIS PATCH]
*
* This file is placed into the public domain by the author,
* Shigio Yamaguchi <[email protected]>
*/
diff -cr vim74/src/if_cscope.c vim74-modify/src/if_cscope.c
*** vim74/src/if_cscope.c 2013-06-30 21:59:21.000000000 +0900
--- vim74-modify/src/if_cscope.c 2014-09-10 11:12:43.000000000 +0900
***************
*** 1813,1818 ****
--- 1813,1842 ----
} /* cs_manage_matches */
+ #define outofrange(c) (c < '0' || c > 'f')
+ #define h2int(c) (c >= 'a' ? c - 'a' + 10 : c - '0')
+ char *
+ urldecode(char *path)
+ {
+ char *p, *q;
+
+ for (p = q = path; *p; p++, q++) {
+ if (*p == '%') {
+ int c1, c2;
+ c1 = *(p + 1);
+ c2 = *(p + 2);
+ if (!outofrange(c1) && !outofrange(c2)) {
+ *q = h2int(c1) * 16 + h2int(c2);
+ p += 2;
+ }
+ } else {
+ *q = *p;
+ }
+ }
+ *q = 0;
+ return path;
+ }
+
/*
* PRIVATE: cs_parse_results
*
***************
*** 1871,1876 ****
--- 1895,1901 ----
if (strcmp(*search, "<unknown>") == 0)
*search = NULL;
+ urldecode(name);
name = cs_resolve_file(cnumber, name);
return name;
}