Differences From Artifact [57186c2c7a]:
- File src/OFNumber.m — part of check-in [d8123a1f26] at 2020-07-19 16:12:41 on branch trunk — OFNumber: Add singletons for 0, 1, 2, true & false (user: js, size: 30160) [annotate] [blame] [check-ins using] [more...]
To Artifact [bbb46f4d11]:
- File
src/OFNumber.m
— part of check-in
[b6ee372b98]
at
2020-08-11 19:45:36
on branch trunk
— OFString: Rework number parsing API
This solves the old signed vs. unsigned problem and allows for more
bases than just 8, 10 and 16, as well as auto-detection of the base (if
base is 0). (user: js, size: 30224) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
881 882 883 884 885 886 887 | OFString *stringValue = element.stringValue; if ([stringValue isEqual: @"true"]) self = [self initWithBool: true]; else if ([stringValue isEqual: @"false"]) self = [self initWithBool: false]; else @throw [OFInvalidArgumentException exception]; | | > > > > > > | < | | < < < < | > | 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 | OFString *stringValue = element.stringValue; if ([stringValue isEqual: @"true"]) self = [self initWithBool: true]; else if ([stringValue isEqual: @"false"]) self = [self initWithBool: false]; else @throw [OFInvalidArgumentException exception]; } else if ([typeString isEqual: @"float"]) { unsigned long long value = [element unsignedLongLongValueWithBase: 16]; if (value > UINT64_MAX) @throw [OFOutOfRangeException exception]; self = [self initWithDouble: OF_BSWAP_DOUBLE_IF_LE( OF_INT_TO_DOUBLE_RAW(OF_BSWAP64_IF_LE(value)))]; } else if ([typeString isEqual: @"signed"]) self = [self initWithLongLong: element.longLongValue]; else if ([typeString isEqual: @"unsigned"]) self = [self initWithUnsignedLongLong: element.unsignedLongLongValue]; else @throw [OFInvalidArgumentException exception]; objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; |
︙ | ︙ |