Differences From Artifact [05ac91dbb0]:
- File src/OFURLEncoding.m — part of check-in [eeaee04433] at 2009-07-16 23:15:00 on branch trunk — '~' does not need escaping in -[stringByURLEncoding]. (user: js, size: 2406) [annotate] [blame] [check-ins using]
To Artifact [f51e0ac16e]:
- File
src/OFURLEncoding.m
— part of check-in
[8f4d7a5b74]
at
2009-07-17 15:16:25
on branch trunk
— Initial OFXMLParser implementation. There's still a LOT missing.
Missing stuff includes proper namespace handling, handling of comments,
handling of <?xml ...?>, error handling and much more. (user: js, size: 2471) [annotate] [blame] [check-ins using]
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * Copyright (c) 2008 - 2009 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #include "config.h" | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * Copyright (c) 2008 - 2009 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #include "config.h" #include <stdlib.h> #include <string.h> #include <ctype.h> #import "OFURLEncoding.h" #import "OFExceptions.h" |
︙ | ︙ | |||
42 43 44 45 46 47 48 | andSize: (length * 3) + 1]; for (i = 0; *s != '\0'; s++) { if (isalnum(*s) || *s == '-' || *s == '_' || *s == '.' || *s == '~') ret_c[i++] = *s; else { | > | > > | | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | andSize: (length * 3) + 1]; for (i = 0; *s != '\0'; s++) { if (isalnum(*s) || *s == '-' || *s == '_' || *s == '.' || *s == '~') ret_c[i++] = *s; else { uint8_t high, low; high = *s >> 4; low = *s & 0x0F; ret_c[i++] = '%'; ret_c[i++] = (high > 9 ? high - 10 + 'A' : high + '0'); ret_c[i++] = (low > 9 ? low - 10 + 'A' : low + '0'); } } ret_c[i] = '\0'; @try { ret = [OFString stringWithCString: ret_c]; } @finally { |
︙ | ︙ | |||
87 88 89 90 91 92 93 | ret_c[i++] = ' '; else ret_c[i++] = *s; break; case 1: case 2: if (*s >= '0' && *s <= '9') | | | | | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | ret_c[i++] = ' '; else ret_c[i++] = *s; break; case 1: case 2: if (*s >= '0' && *s <= '9') c += (*s - '0') << (st == 1 ? 4 : 0); else if (*s >= 'A' && *s <= 'F') c += (*s - 'A' + 10) << (st == 1 ? 4 : 0); else if (*s >= 'a' && *s <= 'f') c += (*s - 'a' + 10) << (st == 1 ? 4 : 0); else { free(ret_c); @throw [OFInvalidEncodingException newWithClass: isa]; } if (++st == 3) { |
︙ | ︙ |