decode_www_form_component 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -9,13 +9,14 @@ decode_uri_changed(VALUE uri, unsigned i)
|
|
9
9
|
char tmp[3] = {0};
|
10
10
|
int j;
|
11
11
|
char *r;
|
12
|
-
VALUE ret =
|
13
|
-
|
12
|
+
VALUE ret = rb_usascii_str_new(NULL, length);
|
13
|
+
rb_str_resize(ret, 0);
|
14
|
+
rb_str_cat(ret, u, i);
|
14
15
|
r = StringValuePtr(ret);
|
15
|
-
for (j = i; i < length; i
|
16
|
+
for (j = i; i < length; i++) {
|
16
17
|
switch (u[i]) {
|
17
18
|
case '+':
|
18
|
-
r[j] = ' ';
|
19
|
+
r[j++] = ' ';
|
19
20
|
break;
|
20
21
|
case '%':
|
21
22
|
if (!ISXDIGIT(u[i+1]) || !ISXDIGIT(u[i+2])) {
|
@@ -23,11 +24,11 @@ decode_uri_changed(VALUE uri, unsigned i)
|
|
23
24
|
}
|
24
25
|
tmp[0] = u[i+1];
|
25
26
|
tmp[1] = u[i+2];
|
26
|
-
r[j] = (char)strtol(tmp, NULL, 16);
|
27
|
+
r[j++] = (char)strtol(tmp, NULL, 16);
|
27
28
|
i += 2;
|
28
29
|
break;
|
29
30
|
default:
|
30
|
-
r[j] = u[i];
|
31
|
+
r[j++] = u[i];
|
31
32
|
}
|
32
33
|
}
|
33
34
|
rb_str_resize(ret, j);
|