Overview
Comment: | Add support for \x from JSON5 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
229486deb1773db9373fcb15f9513882 |
User & Date: | js on 2024-10-27 23:57:09 |
Other Links: | manifest | tags |
Context
2024-10-28
| ||
21:35 | Initial MPTCP implementation for Linux check-in: 71834180cb user: js tags: mptcp | |
2024-10-27
| ||
23:57 | Add support for \x from JSON5 Leaf check-in: 229486deb1 user: js tags: trunk | |
23:48 | Allow \u0000 in JSON check-in: d7bbf983f0 user: js tags: trunk | |
Changes
Modified src/OFString+JSONParsing.m from [14e3ab6458] to [b1e85992b9].
︙ | |||
135 136 137 138 139 140 141 142 143 144 145 146 147 148 | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + | ret |= c + 10 - 'A'; else return 0xFFFF; } return ret; } static inline OFChar16 parseHexEscape(const char *pointer, const char *stop) { OFChar16 ret = 0; if (pointer + 3 >= stop) return 0xFFFF; if (pointer[0] != '\\' || pointer[1] != 'x') return 0xFFFF; for (uint8_t i = 0; i < 2; i++) { char c = pointer[i + 2]; ret <<= 4; if (c >= '0' && c <= '9') ret |= c - '0'; else if (c >= 'a' && c <= 'f') ret |= c + 10 - 'a'; else if (c >= 'A' && c <= 'F') ret |= c + 10 - 'A'; else return 0xFFFF; } return ret; } static inline OFString * parseString(const char **pointer, const char *stop, size_t *line) { char *buffer; size_t i = 0; char delimiter = **pointer; |
︙ | |||
242 243 244 245 246 247 248 249 250 251 252 253 254 255 | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | + + + + + + + + + + + + + + + + + | OFFreeMemory(buffer); return nil; } i += l; *pointer += 11; break; case 'x': c1 = parseHexEscape(*pointer - 1, stop); if (c1 == 0xFFFF) { OFFreeMemory(buffer); return nil; } l = _OFUTF8StringEncode(c1, buffer + i); if (l == 0) { OFFreeMemory(buffer); return nil; } i += l; *pointer += 3; break; case '\r': (*pointer)++; if (*pointer < stop && **pointer == '\n') { (*pointer)++; (*line)++; |
︙ |
Modified tests/OFJSONTests.m from [f4ec78e136] to [bb6556cac3].
︙ | |||
24 25 26 27 28 29 30 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | - - + + | @interface OFJSONTests: OTTestCase { OFDictionary *_dictionary; } @end |
︙ |