Overview
Comment: | Remove useless casts. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
675eda4ad39abf97c5b88d5cf2d96484 |
User & Date: | js on 2011-06-04 13:34:41 |
Other Links: | manifest | tags |
Context
2011-06-04
| ||
13:36 | Better sanity checks in +[OFSerialization objectByDeserializingString:]. check-in: ef62225e51 user: js tags: trunk | |
13:34 | Remove useless casts. check-in: 675eda4ad3 user: js tags: trunk | |
13:29 | Fix -[OFURL isEqual:]. check-in: 9d48ed225c user: js tags: trunk | |
Changes
Modified src/OFArray.m from [8ef39fadce] to [b12d9bd25f].
︙ | ︙ | |||
426 427 428 429 430 431 432 | OFArray *otherArray; id *cArray, *otherCArray; size_t i, count; if (![object isKindOfClass: [OFArray class]]) return NO; | | | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | OFArray *otherArray; id *cArray, *otherCArray; size_t i, count; if (![object isKindOfClass: [OFArray class]]) return NO; otherArray = object; count = [array count]; if (count != [otherArray count]) return NO; cArray = [array cArray]; |
︙ | ︙ |
Modified src/OFDataArray.m from [0e2718679c] to [1dbaab5743].
︙ | ︙ | |||
326 327 328 329 330 331 332 | - (BOOL)isEqual: (id)object { OFDataArray *otherDataArray; if (![object isKindOfClass: [OFDataArray class]]) return NO; | | | | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | - (BOOL)isEqual: (id)object { OFDataArray *otherDataArray; if (![object isKindOfClass: [OFDataArray class]]) return NO; otherDataArray = object; if ([otherDataArray count] != count || [otherDataArray itemSize] != itemSize) return NO; if (memcmp([otherDataArray cArray], data, count * itemSize)) return NO; return YES; } - (of_comparison_result_t)compare: (id)object { OFDataArray *otherDataArray; int comparison; size_t otherCount, minimumCount; if (![object isKindOfClass: [OFDataArray class]]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; otherDataArray = object; if ([otherDataArray itemSize] != itemSize) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; otherCount = [otherDataArray count]; minimumCount = (count > otherCount ? otherCount : count); |
︙ | ︙ |
Modified src/OFDate.m from [31c04ee022] to [dd1167284f].
︙ | ︙ | |||
283 284 285 286 287 288 289 | - (BOOL)isEqual: (id)object { OFDate *otherDate; if (![object isKindOfClass: [OFDate class]]) return NO; | | | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | - (BOOL)isEqual: (id)object { OFDate *otherDate; if (![object isKindOfClass: [OFDate class]]) return NO; otherDate = object; if (otherDate->seconds != seconds || otherDate->microseconds != microseconds) return NO; return YES; } |
︙ | ︙ | |||
305 306 307 308 309 310 311 | { OFDate *otherDate; if (![object isKindOfClass: [OFDate class]]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; | | | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | { OFDate *otherDate; if (![object isKindOfClass: [OFDate class]]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; otherDate = object; if (seconds < otherDate->seconds) return OF_ORDERED_ASCENDING; if (seconds > otherDate->seconds) return OF_ORDERED_DESCENDING; if (microseconds < otherDate->microseconds) |
︙ | ︙ |
Modified src/OFList.m from [3246422836] to [5bd4aeba86].
︙ | ︙ | |||
225 226 227 228 229 230 231 | { OFList *otherList; of_list_object_t *iter, *iter2; if (![object isKindOfClass: [OFList class]]) return NO; | | | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | { OFList *otherList; of_list_object_t *iter, *iter2; if (![object isKindOfClass: [OFList class]]) return NO; otherList = object; if ([otherList count] != count) return NO; for (iter = firstListObject, iter2 = [otherList firstListObject]; iter != NULL && iter2 != NULL; iter = iter->next, iter2 = iter2->next) |
︙ | ︙ |
Modified src/OFString.m from [6df5a31603] to [24bf0bd650].
︙ | ︙ | |||
1125 1126 1127 1128 1129 1130 1131 | - (BOOL)isEqual: (id)object { OFString *otherString; if (![object isKindOfClass: [OFString class]]) return NO; | | | 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 | - (BOOL)isEqual: (id)object { OFString *otherString; if (![object isKindOfClass: [OFString class]]) return NO; otherString = object; if (strcmp(string, [otherString cString])) return NO; return YES; } |
︙ | ︙ | |||
1153 1154 1155 1156 1157 1158 1159 | size_t otherLen, minLen; int cmp; if (![object isKindOfClass: [OFString class]]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; | | < | 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 | size_t otherLen, minLen; int cmp; if (![object isKindOfClass: [OFString class]]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; otherString = object; otherLen = [otherString cStringLength]; minLen = (length > otherLen ? otherLen : length); if ((cmp = memcmp(string, [otherString cString], minLen)) == 0) { if (length > otherLen) return OF_ORDERED_DESCENDING; if (length < otherLen) |
︙ | ︙ |
Modified src/OFURL.m from [fb49e7ba43] to [72e6419d11].
︙ | ︙ | |||
331 332 333 334 335 336 337 | - (BOOL)isEqual: (id)object { OFURL *otherURL; if (![object isKindOfClass: [OFURL class]]) return NO; | | | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | - (BOOL)isEqual: (id)object { OFURL *otherURL; if (![object isKindOfClass: [OFURL class]]) return NO; otherURL = object; if (![otherURL->scheme isEqual: scheme]) return NO; if (![otherURL->host isEqual: host]) return NO; if (otherURL->port != port) return NO; |
︙ | ︙ |
Modified tests/OFURLTests.m from [8b94bb792f] to [9eb68d19df].
︙ | ︙ | |||
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | TEST(@"-[fragment]", [[u1 fragment] isEqual: @"f"] && [u4 fragment] == nil) TEST(@"-[copy]", R(u4 = [[u1 copy] autorelease])) TEST(@"-[isEqual:]", [u1 isEqual: u4] && ![u2 isEqual: u3] && [[OFURL URLWithString: @"http://bar/"] isEqual: u3]) TEST(@"-[hash:]", [u1 hash] == [u4 hash] && [u2 hash] != [u3 hash]) EXPECT_EXCEPTION(@"Detection of invalid format", OFInvalidFormatException, [OFURL URLWithString: @"http"]) EXPECT_EXCEPTION(@"Detection of invalid scheme", OFInvalidFormatException, [OFURL URLWithString: @"foo://"]) [pool drain]; } @end | > | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | TEST(@"-[fragment]", [[u1 fragment] isEqual: @"f"] && [u4 fragment] == nil) TEST(@"-[copy]", R(u4 = [[u1 copy] autorelease])) TEST(@"-[isEqual:]", [u1 isEqual: u4] && ![u2 isEqual: u3] && [[OFURL URLWithString: @"http://bar/"] isEqual: u3]) TEST(@"-[hash:]", [u1 hash] == [u4 hash] && [u2 hash] != [u3 hash]) EXPECT_EXCEPTION(@"Detection of invalid format", OFInvalidFormatException, [OFURL URLWithString: @"http"]) EXPECT_EXCEPTION(@"Detection of invalid scheme", OFInvalidFormatException, [OFURL URLWithString: @"foo://"]) [pool drain]; } @end |