Differences From Artifact [bc121f7ad1]:
- File
src/OFNumber.m
— part of check-in
[cba771824e]
at
2013-06-19 19:14:11
on branch trunk
— Implement the new MessagePack specification.
No support for extensions yet.
This obsoletes BinaryPack. (user: js, size: 36336) [annotate] [blame] [check-ins using]
To Artifact [779309786a]:
- File
src/OFNumber.m
— part of check-in
[3d16a30f41]
at
2013-06-22 12:12:36
on branch trunk
— Rework exceptions.
This mostly removes the argument for the class in which the exception
occurred. As backtraces were recently added for all platforms, the
passed class does not give any extra information on where the exception
occurred anymore.This also removes a few other arguments which were not too helpful. In
the past, the idea was to pass as many arguments as possible so that it
is easier to find the origin of the exception. However, as backtraces
are a much better way to find the origin, those are not useful anymore
and just make the exception more cumbersome to use. The rule is now to
only pass arguments that might help in recovering from the exception or
provide information that is otherwise not easily accessible. (user: js, size: 35770) [annotate] [blame] [check-ins using]
︙ | |||
88 89 90 91 92 93 94 | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | - + - | case OF_NUMBER_UINTPTR: \ return (t)_value.uintptr; \ case OF_NUMBER_FLOAT: \ return (t)_value.float_; \ case OF_NUMBER_DOUBLE: \ return (t)_value.double_; \ default: \ |
︙ | |||
178 179 180 181 182 183 184 | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | - + - | case OF_NUMBER_FLOAT: \ return [OFNumber numberWithFloat: \ _value.float_ o [n floatValue]]; \ case OF_NUMBER_DOUBLE: \ return [OFNumber numberWithDouble: \ _value.double_ o [n doubleValue]]; \ default: \ |
︙ | |||
263 264 265 266 267 268 269 | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | - + - - - + - | return [OFNumber numberWithIntPtr: \ _value.intptr o [n intPtrValue]]; \ case OF_NUMBER_UINTPTR: \ return [OFNumber numberWithUIntPtr: \ _value.uintptr o [n uIntPtrValue]]; \ case OF_NUMBER_FLOAT: \ case OF_NUMBER_DOUBLE: \ |
︙ | |||
334 335 336 337 338 339 340 | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | - + - | case OF_NUMBER_UINTPTR: \ return [OFNumber numberWithUIntPtr: _value.uintptr o]; \ case OF_NUMBER_FLOAT: \ return [OFNumber numberWithFloat: _value.float_ o]; \ case OF_NUMBER_DOUBLE: \ return [OFNumber numberWithDouble: _value.double_ o]; \ default: \ |
︙ | |||
781 782 783 784 785 786 787 | 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 | - + - - - + - - | @try { void *pool = objc_autoreleasePoolPush(); OFString *typeString; if (![[element name] isEqual: [self className]] || ![[element namespace] isEqual: OF_SERIALIZATION_NS]) |
︙ | |||
829 830 831 832 833 834 835 | 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | - + - - | } d; d.u = (uint64_t)[element hexadecimalValue]; _type = OF_NUMBER_DOUBLE; _value.double_ = d.d; } else |
︙ | |||
1010 1011 1012 1013 1014 1015 1016 | 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | - + - - | } - (of_comparison_result_t)compare: (id <OFComparing>)object { OFNumber *number; if (![object isKindOfClass: [OFNumber class]]) |
︙ | |||
1253 1254 1255 1256 1257 1258 1259 | 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 | - + - | case OF_NUMBER_FLOAT: return [OFNumber numberWithFloat: fmodf(_value.float_, [number floatValue])]; case OF_NUMBER_DOUBLE: return [OFNumber numberWithDouble: fmod(_value.double_, [number doubleValue])]; default: |
︙ | |||
1317 1318 1319 1320 1321 1322 1323 | 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 | - + - | if (![ret containsString: @"."]) [ret appendString: @".0"]; [ret makeImmutable]; return ret; default: |
︙ | |||
1396 1397 1398 1399 1400 1401 1402 | 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 | - + - | [element addAttributeWithName: @"type" stringValue: @"double"]; [element setStringValue: [OFString stringWithFormat: @"%016" PRIx64, d.u]]; break; default: |
︙ | |||
1511 1512 1513 1514 1515 1516 1517 | 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 | - + - | data = [OFDataArray dataArrayWithItemSize: 1 capacity: 9]; [data addItem: &type]; [data addItems: &tmp count: sizeof(tmp)]; } else |
︙ | |||
1563 1564 1565 1566 1567 1568 1569 | 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 | - + - | data = [OFDataArray dataArrayWithItemSize: 1 capacity: 9]; [data addItem: &type]; [data addItems: &tmp count: sizeof(tmp)]; } else |