38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
* @"" literal.
*/
if ((ret_c = malloc((length * 3) + 1)) == NULL)
@throw [OFOutOfMemoryException newWithClass: isa
andSize: (length * 3) + 1];
for (i = 0; *s != '\0'; s++) {
if (isalnum(*s) || *s == '-' || *s == '_' || *s == '.')
ret_c[i++] = *s;
else {
char buf[3];
snprintf(buf, 3, "%02X", *s);
ret_c[i++] = '%';
ret_c[i++] = buf[0];
ret_c[i++] = buf[1];
|
|
>
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
* @"" literal.
*/
if ((ret_c = malloc((length * 3) + 1)) == NULL)
@throw [OFOutOfMemoryException newWithClass: isa
andSize: (length * 3) + 1];
for (i = 0; *s != '\0'; s++) {
if (isalnum(*s) || *s == '-' || *s == '_' || *s == '.' ||
*s == '~')
ret_c[i++] = *s;
else {
char buf[3];
snprintf(buf, 3, "%02X", *s);
ret_c[i++] = '%';
ret_c[i++] = buf[0];
ret_c[i++] = buf[1];
|