Overview
Comment: | Rename -[decimalValueAsInteger] to -[decimalValue]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
7564bf44452194d9b6f5305d630240c5 |
User & Date: | js on 2010-12-13 22:36:41 |
Other Links: | manifest | tags |
Context
2010-12-13
| ||
23:32 | OFFile: Accept usernames and groupnames instead of UIDs and GIDs. check-in: bc3cdb9ee9 user: js tags: trunk | |
22:36 | Rename -[decimalValueAsInteger] to -[decimalValue]. check-in: 7564bf4445 user: js tags: trunk | |
20:46 | objfw-config: --lib-ldflags might need LIB exported. check-in: 622ef3e78d user: js tags: trunk | |
Changes
Modified generators/TableGenerator.m from [124b72162e] to [35a23f64fe].
︙ | ︙ | |||
63 64 65 66 67 68 69 | if ([splitted count] != 15) { [of_stderr writeFormat: @"Invalid line: %s\n", [line cString]]; [OFApplication terminateWithStatus: 1]; } splitted_carray = [splitted cArray]; | | | < | < | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | if ([splitted count] != 15) { [of_stderr writeFormat: @"Invalid line: %s\n", [line cString]]; [OFApplication terminateWithStatus: 1]; } splitted_carray = [splitted cArray]; codep = [splitted_carray[0] hexadecimalValue]; upperTable[codep] = [splitted_carray[12] hexadecimalValue]; lowerTable[codep] = [splitted_carray[13] hexadecimalValue]; [pool2 releaseObjects]; } [pool release]; } |
︙ | ︙ | |||
103 104 105 106 107 108 109 | } splitted_carray = [splitted cArray]; if (![splitted_carray[1] isEqual: @"S"] && ![splitted_carray[1] isEqual: @"C"]) continue; | | | < | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | } splitted_carray = [splitted cArray]; if (![splitted_carray[1] isEqual: @"S"] && ![splitted_carray[1] isEqual: @"C"]) continue; codep = [splitted_carray[0] hexadecimalValue]; casefoldingTable[codep] = [splitted_carray[2] hexadecimalValue]; [pool2 releaseObjects]; } [pool release]; } |
︙ | ︙ |
Modified src/OFString.h from [3ca2bba748] to [43d907f36d].
︙ | ︙ | |||
348 349 350 351 352 353 354 | */ - (OFArray*)componentsSeparatedByString: (OFString*)delimiter; /** * Returns the decimal value of the string as an intmax_t or throws an * OFInvalidEncoding exception if the string contains any non-number characters. * | | | | | | 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | */ - (OFArray*)componentsSeparatedByString: (OFString*)delimiter; /** * Returns the decimal value of the string as an intmax_t or throws an * OFInvalidEncoding exception if the string contains any non-number characters. * * \return An intmax_t with the value of the string */ - (intmax_t)decimalValue; /** * Returns the hexadecimal value of the string as an intmax_t or throws an * OFInvalidEncoding exception if the string contains any non-number characters. * * \return A uintmax_t with the value of the string */ - (uintmax_t)hexadecimalValue; /** * Returns the string as an array of of_unichar_t. The result needs to be * free()'d by the caller, as the memory is not marked as belonging to the * object. * * \return The string as an array of Unicode characters |
︙ | ︙ |
Modified src/OFString.m from [197d311a2d] to [e36cd47ab5].
︙ | ︙ | |||
962 963 964 965 966 967 968 | [array addObject: [OFString stringWithCString: string + last]]; [pool release]; return array; } | | | 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | [array addObject: [OFString stringWithCString: string + last]]; [pool release]; return array; } - (intmax_t)decimalValue { int i = 0; intmax_t num = 0; if (string[0] == '-') i++; |
︙ | ︙ | |||
989 990 991 992 993 994 995 | if (string[0] == '-') num *= -1; return num; } | | | 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 | if (string[0] == '-') num *= -1; return num; } - (uintmax_t)hexadecimalValue { int i = 0; uintmax_t num = 0; if (length == 0) return 0; |
︙ | ︙ |
Modified tests/OFStringTests.m from [0feeee8df5] to [860575542d].
︙ | ︙ | |||
217 218 219 220 221 222 223 | [[a objectAtIndex: i++] isEqual: @"foo"] && [[a objectAtIndex: i++] isEqual: @"bar"] && [[a objectAtIndex: i++] isEqual: @""] && [[a objectAtIndex: i++] isEqual: @"baz"] && [[a objectAtIndex: i++] isEqual: @""] && [[a objectAtIndex: i++] isEqual: @""]) | | | | | | | | | | | | | < | | < | < | | < | | < | | | | | | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | [[a objectAtIndex: i++] isEqual: @"foo"] && [[a objectAtIndex: i++] isEqual: @"bar"] && [[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 && [@"$CdEf" hexadecimalValue] == 0xCDEF && [@"" hexadecimalValue] == 0) EXPECT_EXCEPTION(@"Detect invalid characters in -[decimalValue] #1", OFInvalidEncodingException, [@"abc" decimalValue]) EXPECT_EXCEPTION(@"Detect invalid characters in -[decimalValue] #2", OFInvalidEncodingException, [@"0a" decimalValue]) EXPECT_EXCEPTION(@"Detect invalid chars in -[hexadecimalValue] #1", OFInvalidEncodingException, [@"0xABCDEFG" hexadecimalValue]) EXPECT_EXCEPTION(@"Detect invalid chars in -[hexadecimalValue] #2", OFInvalidEncodingException, [@"0x" hexadecimalValue]) EXPECT_EXCEPTION(@"Detect invalid chars in -[hexadecimalValue] #3", OFInvalidEncodingException, [@"$" hexadecimalValue]) EXPECT_EXCEPTION(@"Detect out of range in -[decimalValue]", OFOutOfRangeException, [@"12345678901234567890123456789012345678901234567890" @"12345678901234567890123456789012345678901234567890" decimalValue]) EXPECT_EXCEPTION(@"Detect out of range in -[hexadecimalValue]", OFOutOfRangeException, [@"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" @"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" hexadecimalValue]) TEST(@"-[unicodeString]", (ua = [@"fööbär" unicodeString]) && !memcmp(ua, ucstr, 7 * sizeof(of_unichar_t)) && R(free(ua))) TEST(@"-[MD5Hash]", [[@"asdfoobar" MD5Hash] isEqual: @"184dce2ec49b5422c7cfd8728864db4c"]) |
︙ | ︙ |