Differences From Artifact [b7208d53f6]:
- File
src/OFNumber.m
— part of check-in
[a6ee2b2065]
at
2012-07-31 12:05:46
on branch trunk
— Slightly changed serialization format.
printf's %a was too fragile to serialize floats and doubles, as it was
behaving differently on different OSes and OS versions. Instead, a hex
representation of the float/double in big endian is used now. While this
is less readable, it is guaranteed to be accurate and always the same. (user: js, size: 29087) [annotate] [blame] [check-ins using]
To Artifact [70f21d39ef]:
- File
src/OFNumber.m
— part of check-in
[1255f3a11a]
at
2012-08-10 20:08:24
on branch trunk
— Directly use the runtime's autorelease pools.
This greatly improves performance, as it gets rid of the overhead of
OFAutoreleasePool. (user: js, size: 29064) [annotate] [blame] [check-ins using]
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | - + | #include <math.h> #import "OFNumber.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFXMLAttribute.h" |
︙ | |||
715 716 717 718 719 720 721 | 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 | - + | } - initWithSerialization: (OFXMLElement*)element { self = [super init]; @try { |
︙ | |||
772 773 774 775 776 777 778 | 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 | - + | type = OF_NUMBER_DOUBLE; value.double_ = of_bswap_double_if_le(d.d); } else @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; |
︙ | |||
1207 1208 1209 1210 1211 1212 1213 | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 | - + | @throw [OFInvalidFormatException exceptionWithClass: [self class]]; } } - (OFXMLElement*)XMLElementBySerializing { |
︙ | |||
1282 1283 1284 1285 1286 1287 1288 | 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 | - - + + - + | break; default: @throw [OFInvalidFormatException exceptionWithClass: [self class]]; } [element retain]; |