Overview
Comment: | Slightly changed serialization format.
printf's %a was too fragile to serialize floats and doubles, as it was |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
a6ee2b20655bc5165c9244b121b82d1f |
User & Date: | js on 2012-07-31 12:05:46 |
Other Links: | manifest | tags |
Context
2012-07-31
| ||
18:56 | .gitignore: Add tests/objc_sync/objc_sync. check-in: 7806e49ef6 user: js tags: trunk | |
12:05 | Slightly changed serialization format. check-in: a6ee2b2065 user: js tags: trunk | |
11:32 | Check version of serialization format. check-in: a2b0cd02a5 user: js tags: trunk | |
Changes
Modified src/OFDate.m from [c0e29e0a91] to [1da3535d97].
︙ | |||
319 320 321 322 323 324 325 326 327 328 329 330 331 332 | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | + + + + + - + | - initWithSerialization: (OFXMLElement*)element { self = [super init]; @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; union { double d; uint64_t u; } d; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; d.u = (uint64_t)[element hexadecimalValue]; |
︙ | |||
406 407 408 409 410 411 412 413 414 415 | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | + + + + + + - + + | return [self dateStringWithFormat: @"%Y-%m-%dT%H:%M:%SZ"]; } - (OFXMLElement*)XMLElementBySerializing { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFXMLElement *element; union { double d; uint64_t u; } d; element = [OFXMLElement elementWithName: [self className] namespace: OF_SERIALIZATION_NS]; d.d = of_bswap_double_if_le(seconds); |
︙ |
Modified src/OFNumber.m from [b82d9f97c4] to [b7208d53f6].
︙ | |||
748 749 750 751 752 753 754 755 | 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | + + + + + + + - + + + + + + + + - + | */ type = OF_NUMBER_UINTMAX; value.uintmax = [element decimalValue]; } else if ([typeString isEqual: @"signed"]) { type = OF_NUMBER_INTMAX; value.intmax = [element decimalValue]; } else if ([typeString isEqual: @"float"]) { union { float f; uint32_t u; } f; f.u = (uint32_t)[element hexadecimalValue]; type = OF_NUMBER_FLOAT; |
︙ | |||
1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 | 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 | + + + + + + + - + + + + + + + + - + | case OF_NUMBER_INTMAX: case OF_NUMBER_PTRDIFF: case OF_NUMBER_INTPTR:; [element addAttributeWithName: @"type" stringValue: @"signed"]; break; case OF_NUMBER_FLOAT:; union { float f; uint32_t u; } f; f.f = of_bswap_float_if_le(value.float_); [element addAttributeWithName: @"type" stringValue: @"float"]; [element setStringValue: |
︙ |
Modified src/OFObject+Serialization.m from [012cfeffa7] to [d27599f768].
︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | - + | pool = [[OFAutoreleasePool alloc] init]; element = [(id)self XMLElementBySerializing]; root = [OFXMLElement elementWithName: @"serialization" namespace: OF_SERIALIZATION_NS]; [root addAttributeWithName: @"version" |
Modified src/OFString+Serialization.m from [7cccc18871] to [5a29f34399].
︙ | |||
53 54 55 56 57 58 59 | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | - + | version = [[root attributeForName: @"version"] stringValue]; if (version == nil) @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; |
︙ |
Modified src/asprintf.m from [852b8ff01b] to [dcf7698e7b].
︙ | |||
16 17 18 19 20 21 22 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | - - - - | #include "config.h" #include <stdio.h> #include <stdlib.h> #include <stdarg.h> |
︙ |
Modified tests/serialization.xml from [56f53a7b7a] to [b4acfa6af4].
1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | - + - + - + | <?xml version='1.0' encoding='UTF-8'?> |
︙ |