Overview
Comment: | Add a warning to -[OFString JSONValue]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
509ab0affd09c8a2929d7f4bf6b0ea1b |
User & Date: | js on 2012-06-05 14:51:43 |
Other Links: | manifest | tags |
Context
2012-06-05
| ||
15:03 | JSON5: Allow identifiers as dictionary keys. check-in: c9a3ac1a03 user: js tags: trunk | |
14:51 | Add a warning to -[OFString JSONValue]. check-in: 509ab0affd user: js tags: trunk | |
10:21 | JSON5: Allow trailing commas. check-in: 62cd394e96 user: js tags: trunk | |
Changes
Modified src/OFString+JSONValue.h from [7f041856a4] to [9180243d68].
︙ | ︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 | @interface OFString (JSONValue) /** * \brief Creates an object from the JSON value of the string. * * \note This also allows parsing JSON5, an extension of JSON. See * http://json5.org/ for more details. * * \return An object */ - (id)JSONValue; @end | > > > > > > > > > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | @interface OFString (JSONValue) /** * \brief Creates an object from the JSON value of the string. * * \note This also allows parsing JSON5, an extension of JSON. See * http://json5.org/ for more details. * * \warning Although not specified by the JSON specification, this can also * return primitives like strings and numbers. The rationale behind * this is that most JSON parsers allow JSON data just consisting of a * single primitive, leading to realworld JSON files sometimes only * consisting of a single primitive. Therefore, you should not make any * assumptions about the object returned by this method if you don't * want your program to terminate due to a message not understood, but * instead check the returned object using -[isKindOfClass:]. * * \return An object */ - (id)JSONValue; @end |
Modified src/OFString+JSONValue.m from [9867823bd8] to [9471862e0a].
︙ | ︙ | |||
191 192 193 194 195 196 197 | return nil; } /* Normal character */ if ((c1 & 0xFC00) != 0xD800) { l = of_string_unicode_to_utf8(c1, buffer + i); | < | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | return nil; } /* Normal character */ if ((c1 & 0xFC00) != 0xD800) { l = of_string_unicode_to_utf8(c1, buffer + i); if (l == 0) { free(buffer); return nil; } i += l; *pointer += 5; |
︙ | ︙ | |||
218 219 220 221 222 223 224 | return nil; } c = (((c1 & 0x3FF) << 10) | (c2 & 0x3FF)) + 0x10000; l = of_string_unicode_to_utf8(c, buffer + i); | < | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | return nil; } c = (((c1 & 0x3FF) << 10) | (c2 & 0x3FF)) + 0x10000; l = of_string_unicode_to_utf8(c, buffer + i); if (l == 0) { free(buffer); return nil; } i += l; *pointer += 11; |
︙ | ︙ |