Comment: | Rework OFDataArray API.
Also adds more checks. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d5ddb2cb48c73cddb352cdcdaf279a38 |
User & Date: | js on 2012-06-06 13:09:08 |
Other Links: | manifest | tags |
2012-06-06
| ||
13:14 | Remove -[OFMutableArray removeNObjects:]. check-in: 6f0ef1c5e1 user: js tags: trunk | |
13:09 | Rework OFDataArray API. check-in: d5ddb2cb48 user: js tags: trunk | |
12:23 | Add a missing check in OFDataArray. check-in: e68229ff3b user: js tags: trunk | |
Modified src/OFArray_adjacent.m from [c8a1da4bf7] to [7c4a615aae].
︙ | ︙ | |||
100 101 102 103 104 105 106 | @throw e; } @try { for (i = 0; i < count; i++) [objects[i] retain]; | < | > | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | @throw e; } @try { for (i = 0; i < count; i++) [objects[i] retain]; [array addItemsFromCArray: objects count: count]; } @catch (id e) { for (i = 0; i < count; i++) [objects[i] release]; /* Prevent double-release of objects */ [array release]; array = nil; |
︙ | ︙ | |||
128 129 130 131 132 133 134 | @try { size_t i; for (i = 0; i < count; i++) [objects[i] retain]; | < | > | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | @try { size_t i; for (i = 0; i < count; i++) [objects[i] retain]; [array addItemsFromCArray: objects count: count]; } @catch (id e) { size_t i; for (i = 0; i < count; i++) [objects[i] release]; [self release]; |
︙ | ︙ |
Modified src/OFDataArray.h from [f2dc48f29f] to [4922f55b79].
︙ | ︙ | |||
184 185 186 187 188 189 190 | /** * \brief Adds an item to the OFDataArray at the specified index. * * \param item A pointer to an arbitrary item * \param index The index where the item should be added */ | | | | < | > < > < | | > < < < < < < < | < | < | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | /** * \brief Adds an item to the OFDataArray at the specified index. * * \param item A pointer to an arbitrary item * \param index The index where the item should be added */ - (void)insertItem: (const void*)item atIndex: (size_t)index; /** * \brief Adds items from a C array to the OFDataArray. * * \param count The number of items to add * \param cArray A C array containing the items to add */ - (void)addItemsFromCArray: (const void*)cArray count: (size_t)count; /** * \brief Adds items from a C array to the OFDataArray at the specified index. * * \param cArray A C array containing the items to add * \param index The index where the items should be added * \param count The number of items to add */ - (void)insertItemsFromCArray: (const void*)cArray atIndex: (size_t)index count: (size_t)count; /** * \brief Removes the item at the specified index. * * \param index The index of the item to remove */ - (void)removeItemAtIndex: (size_t)index; /** * \brief Removes the specified amount of items at the specified index. * * \param range The range of items to remove */ - (void)removeItemsInRange: (of_range_t)range; /** * \brief Removes the last item. */ - (void)removeLastItem; /** |
︙ | ︙ |
Modified src/OFDataArray.m from [d431a67a01] to [490fab954b].
︙ | ︙ | |||
109 110 111 112 113 114 115 | char *buffer = [self allocMemoryWithSize: of_pagesize]; while (![file isAtEndOfStream]) { size_t length; length = [file readNBytes: of_pagesize intoBuffer: buffer]; | < | > | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | char *buffer = [self allocMemoryWithSize: of_pagesize]; while (![file isAtEndOfStream]) { size_t length; length = [file readNBytes: of_pagesize intoBuffer: buffer]; [self addItemsFromCArray: buffer count: length]; } [self freeMemory: buffer]; } @finally { [file release]; } } @catch (id e) { |
︙ | ︙ | |||
261 262 263 264 265 266 267 | ofSize: itemSize]; memcpy(data + count * itemSize, item, itemSize); count++; } | | | < | | > < | > < | | > | < | | | < < < < < < < < < | < < < < < | < < | | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | ofSize: itemSize]; memcpy(data + count * itemSize, item, itemSize); count++; } - (void)insertItem: (const void*)item atIndex: (size_t)index { [self insertItemsFromCArray: item atIndex: index count: 1]; } - (void)addItemsFromCArray: (const void*)cArray count: (size_t)nItems { if (nItems > SIZE_MAX - count) @throw [OFOutOfRangeException exceptionWithClass: isa]; data = [self resizeMemory: data toNItems: count + nItems ofSize: itemSize]; memcpy(data + count * itemSize, cArray, nItems * itemSize); count += nItems; } - (void)insertItemsFromCArray: (const void*)cArray atIndex: (size_t)index count: (size_t)nItems { if (nItems > SIZE_MAX - count || index > count) @throw [OFOutOfRangeException exceptionWithClass: isa]; data = [self resizeMemory: data toNItems: count + nItems ofSize: itemSize]; memmove(data + (index + nItems) * itemSize, data + index * itemSize, (count - index) * itemSize); memcpy(data + index * itemSize, cArray, nItems * itemSize); count += nItems; } - (void)removeItemAtIndex: (size_t)index { [self removeItemsInRange: of_range(index, 1)]; } - (void)removeItemsInRange: (of_range_t)range { if (range.start + range.length > count) @throw [OFOutOfRangeException exceptionWithClass: isa]; memmove(data + range.start * itemSize, data + (range.start + range.length) * itemSize, (count - range.start - range.length) * itemSize); count -= range.length; @try { data = [self resizeMemory: data toNItems: count ofSize: itemSize]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ } |
︙ | ︙ | |||
369 370 371 372 373 374 375 | count = 0; } - copy { OFDataArray *copy = [[isa alloc] initWithItemSize: itemSize]; | < | > | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | count = 0; } - copy { OFDataArray *copy = [[isa alloc] initWithItemSize: itemSize]; [copy addItemsFromCArray: data count: count]; return copy; } - (BOOL)isEqual: (id)object { OFDataArray *otherDataArray; |
︙ | ︙ | |||
501 502 503 504 505 506 507 | memcpy(data + count * itemSize, item, itemSize); count++; size = newSize; } | < | > < | | > | > | | < < < | < < < < < | < < < < | < < < < < | | 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 | memcpy(data + count * itemSize, item, itemSize); count++; size = newSize; } - (void)addItemsFromCArray: (const void*)cArray count: (size_t)nItems { size_t newSize, lastPageByte; if (nItems > SIZE_MAX - count || count + nItems > SIZE_MAX / itemSize) @throw [OFOutOfRangeException exceptionWithClass: isa]; lastPageByte = of_pagesize - 1; newSize = ((count + nItems) * itemSize + lastPageByte) & ~lastPageByte; if (size != newSize) data = [self resizeMemory: data toSize: newSize]; memcpy(data + count * itemSize, cArray, nItems * itemSize); count += nItems; size = newSize; } - (void)insertItemsFromCArray: (const void*)cArray atIndex: (size_t)index count: (size_t)nItems { size_t newSize, lastPageByte; if (nItems > SIZE_MAX - count || index > count || count + nItems > SIZE_MAX / itemSize) @throw [OFOutOfRangeException exceptionWithClass: isa]; lastPageByte = of_pagesize - 1; newSize = ((count + nItems) * itemSize + lastPageByte) & ~lastPageByte; if (size != newSize) data = [self resizeMemory: data toSize: newSize]; memmove(data + (index + nItems) * itemSize, data + index * itemSize, (count - index) * itemSize); memcpy(data + index * itemSize, cArray, nItems * itemSize); count += nItems; size = newSize; } - (void)removeItemsInRange: (of_range_t)range { size_t newSize, lastPageByte; if (range.start + range.length > count) @throw [OFOutOfRangeException exceptionWithClass: isa]; memmove(data + range.start * itemSize, data + (range.start + range.length) * itemSize, (count - range.start - range.length) * itemSize); count -= range.length; lastPageByte = of_pagesize - 1; newSize = (count * itemSize + lastPageByte) & ~lastPageByte; if (size != newSize) data = [self resizeMemory: data toSize: newSize]; size = newSize; |
︙ | ︙ |
Modified src/OFHTTPRequest.m from [4b826a148e] to [456aec5d03].
︙ | ︙ | |||
427 428 429 430 431 432 433 | [delegate request: self didReceiveData: buffer withLength: length]; [pool2 releaseObjects]; bytesReceived += length; | < | > | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | [delegate request: self didReceiveData: buffer withLength: length]; [pool2 releaseObjects]; bytesReceived += length; [data addItemsFromCArray: buffer count: length]; toRead -= length; } @try { line = [sock readLine]; } @catch (OFInvalidEncodingException *e) { |
︙ | ︙ | |||
457 458 459 460 461 462 463 | intoBuffer: buffer]) > 0) { [delegate request: self didReceiveData: buffer withLength: length]; [pool2 releaseObjects]; bytesReceived += length; | < | > | 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | intoBuffer: buffer]) > 0) { [delegate request: self didReceiveData: buffer withLength: length]; [pool2 releaseObjects]; bytesReceived += length; [data addItemsFromCArray: buffer count: length]; if (contentLengthHeader != nil && bytesReceived >= contentLength) break; } } |
︙ | ︙ |
Modified src/OFMutableArray.h from [1edd47fa69] to [7d1dea4d27].
︙ | ︙ | |||
22 23 24 25 26 27 28 | /** * \brief An abstract class for storing, adding and removing objects in anr * array. */ @interface OFMutableArray: OFArray /** | | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | /** * \brief An abstract class for storing, adding and removing objects in anr * array. */ @interface OFMutableArray: OFArray /** * \brief Adds an object to the end of the array. * * \param object An object to add */ - (void)addObject: (id)object; /** * \brief Inserts an object to the OFArray at the specified index. * * \param object An object to add * \param index The index where the object should be inserted */ - (void)insertObject: (id)object atIndex: (size_t)index; /** * \brief Replaces the first object equivalent to the specified object with the * other specified object. |
︙ | ︙ |
Modified src/OFMutableArray.m from [e6d36fbf2d] to [9461a9b182].
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <string.h> #import "OFMutableArray.h" #import "OFMutableArray_adjacent.h" #import "OFAutoreleasePool.h" #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" | > > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <string.h> #include <assert.h> #import "OFMutableArray.h" #import "OFMutableArray_adjacent.h" #import "OFAutoreleasePool.h" #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" |
︙ | ︙ |
Modified src/OFMutableArray_adjacent.m from [725da742e3] to [168c402c93].
︙ | ︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #import "OFArray_adjacent.h" #import "OFDataArray.h" #import "OFAutoreleasePool.h" #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" #import "OFOutOfRangeException.h" @implementation OFMutableArray_adjacent + (void)initialize { if (self == [OFMutableArray_adjacent class]) [self inheritMethodsFromClass: [OFArray_adjacent class]]; } - (void)addObject: (id)object { [array addItem: &object]; [object retain]; mutations++; } - (void)insertObject: (id)object atIndex: (size_t)index { | > > | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #import "OFArray_adjacent.h" #import "OFDataArray.h" #import "OFAutoreleasePool.h" #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" #import "OFOutOfRangeException.h" #import "macros.h" @implementation OFMutableArray_adjacent + (void)initialize { if (self == [OFMutableArray_adjacent class]) [self inheritMethodsFromClass: [OFArray_adjacent class]]; } - (void)addObject: (id)object { [array addItem: &object]; [object retain]; mutations++; } - (void)insertObject: (id)object atIndex: (size_t)index { [array insertItem: &object atIndex: index]; [object retain]; mutations++; } - (void)replaceObject: (id)oldObject withObject: (id)newObject |
︙ | ︙ | |||
154 155 156 157 158 159 160 | @throw [OFOutOfRangeException exceptionWithClass: isa]; copy = [self allocMemoryForNItems: nObjects ofSize: sizeof(id)]; memcpy(copy, objects + (count - nObjects), nObjects * sizeof(id)); @try { | | > | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | @throw [OFOutOfRangeException exceptionWithClass: isa]; copy = [self allocMemoryForNItems: nObjects ofSize: sizeof(id)]; memcpy(copy, objects + (count - nObjects), nObjects * sizeof(id)); @try { [array removeItemsInRange: of_range(count - nObjects, nObjects)]; mutations++; for (i = 0; i < nObjects; i++) [copy[i] release]; } @finally { [self freeMemory: copy]; } |
︙ | ︙ | |||
188 189 190 191 192 193 194 | @throw [OFOutOfRangeException exceptionWithClass: isa]; copy = [self allocMemoryForNItems: range.length ofSize: sizeof(id)]; memcpy(copy, objects + range.start, range.length * sizeof(id)); @try { | | < | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | @throw [OFOutOfRangeException exceptionWithClass: isa]; copy = [self allocMemoryForNItems: range.length ofSize: sizeof(id)]; memcpy(copy, objects + range.start, range.length * sizeof(id)); @try { [array removeItemsInRange: range]; mutations++; for (i = 0; i < range.length; i++) [copy[i] release]; } @finally { [self freeMemory: copy]; } |
︙ | ︙ |
Modified src/OFStream.m from [79c2ad057e] to [4d96b81ee9].
︙ | ︙ | |||
438 439 440 441 442 443 444 | return [self readDataArrayWithItemSize: 1 andNItems: nItems]; } - (OFDataArray*)readDataArrayWithItemSize: (size_t)itemSize andNItems: (size_t)nItems { | | | < | > | < | > | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | return [self readDataArrayWithItemSize: 1 andNItems: nItems]; } - (OFDataArray*)readDataArrayWithItemSize: (size_t)itemSize andNItems: (size_t)nItems { OFDataArray *dataArray; char *tmp; dataArray = [OFDataArray dataArrayWithItemSize: itemSize]; tmp = [self allocMemoryForNItems: nItems ofSize: itemSize]; @try { [self readExactlyNBytes: nItems * itemSize intoBuffer: tmp]; [dataArray addItemsFromCArray: tmp count: nItems]; } @finally { [self freeMemory: tmp]; } return dataArray; } - (OFDataArray*)readDataArrayTillEndOfStream { OFDataArray *dataArray; char *buffer; dataArray = [OFDataArray dataArray]; buffer = [self allocMemoryWithSize: of_pagesize]; @try { while (![self isAtEndOfStream]) { size_t length; length = [self readNBytes: of_pagesize intoBuffer: buffer]; [dataArray addItemsFromCArray: buffer count: length]; } } @finally { [self freeMemory: buffer]; } return dataArray; } |
︙ | ︙ |
Modified src/OFStreamObserver.m from [89d321be6d] to [9591f1939e].
︙ | ︙ | |||
350 351 352 353 354 355 356 | break; default: assert(0); } } | | | | | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | break; default: assert(0); } } [queue removeAllObjects]; [queueInfo removeAllItems]; [queueFDs removeAllItems]; } @finally { [mutex unlock]; } } - (void)observe { |
︙ | ︙ |
Modified src/OFStreamObserver_kqueue.m from [688eaf3047] to [c2387049cc].
︙ | ︙ | |||
123 124 125 126 127 128 129 | [pool release]; @throw [OFOutOfMemoryException exceptionWithClass: isa]; default: assert(0); } } | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | [pool release]; @throw [OFOutOfMemoryException exceptionWithClass: isa]; default: assert(0); } } [changeList removeAllItems]; if (events == 0) { [pool release]; return NO; } for (i = 0; i < events; i++) { |
︙ | ︙ |
Modified src/OFXMLElement.m from [05fab1ecc3] to [23e15b2038].
︙ | ︙ | |||
636 637 638 639 640 641 642 | indentation: ind level: level + 1]; else child = [childrenObjects[j] XMLStringWithIndentation: ind level: level + 1]; | | | | 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | indentation: ind level: level + 1]; else child = [childrenObjects[j] XMLStringWithIndentation: ind level: level + 1]; [tmp addItemsFromCArray: [child UTF8String] count: [child UTF8StringLength]]; } if (indent) [tmp addItem: "\n"]; length += [tmp count] + [name UTF8StringLength] + 2 + (indent ? level * indentation : 0); |
︙ | ︙ |
Modified src/OFXMLParser.m from [8f2d46a92b] to [2619682154].
︙ | ︙ | |||
41 42 43 44 45 46 47 | static state_function lookupTable[OF_XMLPARSER_NUM_STATES]; static OF_INLINE void cache_append(OFDataArray *cache, const char *string, of_string_encoding_t encoding, size_t length) { if (OF_LIKELY(encoding == OF_STRING_ENCODING_UTF_8)) | < | > | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | static state_function lookupTable[OF_XMLPARSER_NUM_STATES]; static OF_INLINE void cache_append(OFDataArray *cache, const char *string, of_string_encoding_t encoding, size_t length) { if (OF_LIKELY(encoding == OF_STRING_ENCODING_UTF_8)) [cache addItemsFromCArray: string count: length]; else { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFString *tmp = [OFString stringWithCString: string encoding: encoding length: length]; [cache addItemsFromCArray: [tmp UTF8String] count: [tmp UTF8StringLength]]; [pool release]; } } static OFString* transform_string(OFDataArray *cache, size_t cut, BOOL unescape, OFObject <OFStringXMLUnescapingDelegate> *delegate) |
︙ | ︙ |
Modified src/base64.m from [467c9771cc] to [b831cbbe10].
︙ | ︙ | |||
146 147 148 149 150 151 152 | sb |= tmp; db[0] = (sb & 0xFF0000) >> 16; db[1] = (sb & 0x00FF00) >> 8; db[2] = sb & 0x0000FF; | < | > | 146 147 148 149 150 151 152 153 154 155 156 157 158 | sb |= tmp; db[0] = (sb & 0xFF0000) >> 16; db[1] = (sb & 0x00FF00) >> 8; db[2] = sb & 0x0000FF; [data addItemsFromCArray: db count: count]; } return YES; } |
Modified tests/OFDataArrayTests.m from [4d33d1b6d0] to [742e94e327].
︙ | ︙ | |||
55 56 57 58 59 60 61 | TEST(@"-[count]", [array[0] count] == 2) other = (class == [OFDataArray class] ? [OFBigDataArray class] : [OFDataArray class]); TEST(@"-[isEqual:]", (array[1] = [other dataArrayWithItemSize: 4096]) && | | | | | | | | | | < | | < | > | | | | > | | | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | TEST(@"-[count]", [array[0] count] == 2) other = (class == [OFDataArray class] ? [OFBigDataArray class] : [OFDataArray class]); TEST(@"-[isEqual:]", (array[1] = [other dataArrayWithItemSize: 4096]) && R([array[1] addItemsFromCArray: [array[0] cArray] count: [array[0] count]]) && [array[1] isEqual: array[0]] && R([array[1] removeLastItem]) && ![array[0] isEqual: array[1]]) TEST(@"-[copy]", (array[1] = [[array[0] copy] autorelease]) && [array[0] isEqual: array[1]]) array[2] = [OFDataArray dataArray]; array[3] = [OFDataArray dataArray]; [array[2] addItem: "a"]; [array[2] addItem: "a"]; [array[3] addItem: "z"]; TEST(@"-[compare]", [array[0] compare: array[1]] == 0 && R([array[1] removeLastItem]) && [array[0] compare: array[1]] == OF_ORDERED_DESCENDING && [array[1] compare: array[0]] == OF_ORDERED_ASCENDING && [array[2] compare: array[3]] == OF_ORDERED_ASCENDING) TEST(@"-[hash]", [array[0] hash] == 0x634A529F) array[0] = [class dataArray]; [array[0] addItemsFromCArray: "abcdef" count: 6]; TEST(@"-[removeLastItem]", R([array[0] removeLastItem]) && [array[0] count] == 5 && !memcmp([array[0] cArray], "abcde", 5)) TEST(@"-[removeItemsInRange:]", R([array[0] removeItemsInRange: of_range(1, 2)]) && [array[0] count] == 3 && !memcmp([array[0] cArray], "ade", 3)) TEST(@"-[insertItemsFromCArray:atIndex:count:]", R([array[0] insertItemsFromCArray: "bc" atIndex: 1 count: 2]) && [array[0] count] == 5 && !memcmp([array[0] cArray], "abcde", 5)) TEST(@"-[MD5Hash]", [[array[0] MD5Hash] isEqual: [@"abcde" MD5Hash]]) TEST(@"-[SHA1Hash]", [[array[0] SHA1Hash] isEqual: [@"abcde" SHA1Hash]]) TEST(@"-[stringByBase64Encoding]", [[array[0] stringByBase64Encoding] isEqual: @"YWJjZGU="]) TEST(@"+[dataArrayWithBase64EncodedString:]", !memcmp([[class dataArrayWithBase64EncodedString: @"YWJjZGU="] cArray], "abcde", 5)) TEST(@"Building strings", (array[0] = [class dataArray]) && R([array[0] addItemsFromCArray: (void*)str count: 6]) && R([array[0] addItem: ""]) && !strcmp([array[0] cArray], str)) EXPECT_EXCEPTION(@"Detect out of range in -[itemAtIndex:]", OFOutOfRangeException, [array[0] itemAtIndex: [array[0] count]]) EXPECT_EXCEPTION(@"Detect out of range in " @"-[addItemsFromCArray:count:]", OFOutOfRangeException, [array[0] addItemsFromCArray: NULL count: SIZE_MAX]) EXPECT_EXCEPTION(@"Detect out of range in -[removeItemsInRange:]", OFOutOfRangeException, [array[0] removeItemsInRange: of_range([array[0] count], 1)]) } - (void)dataArrayTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; module = @"OFDataArray"; |
︙ | ︙ |
Modified tests/OFSerializationTests.m from [8b60915267] to [cf7d67e102].
︙ | ︙ | |||
63 64 65 66 67 68 69 | [l appendObject: [OFSet setWithObjects: @"foo", @"foo", @"bar", nil]]; [l appendObject: [OFCountedSet setWithObjects: @"foo", @"foo", @"bar", nil]]; [d setObject: @"list" forKey: l]; | < | > | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | [l appendObject: [OFSet setWithObjects: @"foo", @"foo", @"bar", nil]]; [l appendObject: [OFCountedSet setWithObjects: @"foo", @"foo", @"bar", nil]]; [d setObject: @"list" forKey: l]; [da addItemsFromCArray: "0123456789:;<ABCDEFGHJIKLMNOPQRSTUVWXYZ" count: 39]; [d setObject: @"data" forKey: da]; TEST(@"-[stringBySerializing]", (s = [d stringBySerializing]) && [s isEqual: [OFString stringWithContentsOfFile: @"serialization.xml"]]) |
︙ | ︙ |