Overview
| Comment: | Allow + as prefix in -[OFString decimalValue]. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
11c7661a422de56551b88a44c0c66895 |
| User & Date: | js on 2011-01-15 18:03:18 |
| Other Links: | manifest | tags |
Context
|
2011-01-15
| ||
| 18:17 | Define enums as types. (check-in: b5ec30fa9d user: js tags: trunk) | |
| 18:03 | Allow + as prefix in -[OFString decimalValue]. (check-in: 11c7661a42 user: js tags: trunk) | |
| 17:59 | Improve OFURL. (check-in: c655fa54d2 user: js tags: trunk) | |
Changes
Modified src/OFString.m from [76062f9e81] to [e1b8eb30ed].
| ︙ | ︙ | |||
972 973 974 975 976 977 978 |
}
- (intmax_t)decimalValue
{
int i = 0;
intmax_t num = 0;
| | | 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 |
}
- (intmax_t)decimalValue
{
int i = 0;
intmax_t num = 0;
if (string[0] == '-' || string[0] == '+')
i++;
for (; i < length; i++) {
if (string[i] >= '0' && string[i] <= '9') {
if (INTMAX_MAX / 10 < num ||
INTMAX_MAX - num * 10 < string[i] - '0')
@throw [OFOutOfRangeException
|
| ︙ | ︙ |
Modified tests/OFStringTests.m from [5d85ec7796] to [f983422e61].
| ︙ | ︙ | |||
224 225 226 227 228 229 230 231 232 233 234 235 236 237 | [[a objectAtIndex: i++] isEqual: @""] && [[a objectAtIndex: i++] isEqual: @"baz"] && [[a objectAtIndex: i++] isEqual: @""] && [[a objectAtIndex: i++] isEqual: @""]) TEST(@"-[decimalValue]", [@"1234" decimalValue] == 1234 && [@"-500" decimalValue] == -500 && [@"" decimalValue] == 0) TEST(@"-[hexadecimalValue]", [@"123f" hexadecimalValue] == 0x123f && [@"0xABcd" hexadecimalValue] == 0xABCD && [@"xbCDE" hexadecimalValue] == 0xBCDE && | > | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | [[a objectAtIndex: i++] isEqual: @""] && [[a objectAtIndex: i++] isEqual: @"baz"] && [[a objectAtIndex: i++] isEqual: @""] && [[a objectAtIndex: i++] isEqual: @""]) TEST(@"-[decimalValue]", [@"1234" decimalValue] == 1234 && [@"+123" decimalValue] == 123 && [@"-500" decimalValue] == -500 && [@"" decimalValue] == 0) TEST(@"-[hexadecimalValue]", [@"123f" hexadecimalValue] == 0x123f && [@"0xABcd" hexadecimalValue] == 0xABCD && [@"xbCDE" hexadecimalValue] == 0xBCDE && |
| ︙ | ︙ |