34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
-
+
|
/*
* Worst case: 3 times longer than before.
* Oh, and we can't use [self allocWithSize:] here as self might be a
* @"" literal.
*/
if ((ret_c = malloc((length * 3) + 1)) == NULL)
@throw [OFOutOfMemoryException newWithClass: isa
size: (length * 3) + 1];
requestedSize: (length * 3) + 1];
for (i = 0; *s != '\0'; s++) {
if (isalnum((int)*s) || *s == '-' || *s == '_' || *s == '.' ||
*s == '~')
ret_c[i++] = *s;
else {
uint8_t high, low;
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
-
+
|
int st;
OFString *ret;
s = string;
if ((ret_c = malloc(length + 1)) == NULL)
@throw [OFOutOfMemoryException newWithClass: isa
size: length + 1];
requestedSize: length + 1];
for (st = 0, i = 0, c = 0; *s; s++) {
switch (st) {
case 0:
if (*s == '%')
st = 1;
else if (*s == '+')
|