Comment: | Enable -Wnullable-to-nonnull-conversion and adjust |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
2de966031225d50bab6c2dc1a7fa3055 |
User & Date: | js on 2017-09-28 23:02:23 |
Other Links: | manifest | tags |
2017-10-01
| ||
09:28 | Nullability fixes for macOS High Sierra check-in: 166fd50e82 user: js tags: trunk | |
2017-09-28
| ||
23:02 | Enable -Wnullable-to-nonnull-conversion and adjust check-in: 2de9660312 user: js tags: trunk | |
2017-09-27
| ||
22:35 | More nullability fixes check-in: 697e3ecbf7 user: js tags: trunk | |
Modified configure.ac from [8d9285e4df] to [94abb5e481].
︙ | ︙ | |||
185 186 187 188 189 190 191 192 193 194 195 196 197 198 | [OBJCFLAGS="$OBJCFLAGS -Wsemicolon-before-method-body"]) AX_CHECK_COMPILER_FLAGS([-Wobjc-missing-property-synthesis -Werror], [OBJCFLAGS="$OBJCFLAGS -Wobjc-missing-property-synthesis"]) AX_CHECK_COMPILER_FLAGS([-Watomic-properties -Werror], [ OBJCFLAGS="$OBJCFLAGS -Watomic-properties" TESTS_OBJCFLAGS="$TESTS_OBJCFLAGS -Wno-atomic-properties" ]) AC_MSG_CHECKING(whether Objective C compiler supports properties) AC_TRY_COMPILE([ #ifdef __has_attribute # if __has_attribute(objc_root_class) __attribute__((__objc_root_class__)) # endif | > > | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | [OBJCFLAGS="$OBJCFLAGS -Wsemicolon-before-method-body"]) AX_CHECK_COMPILER_FLAGS([-Wobjc-missing-property-synthesis -Werror], [OBJCFLAGS="$OBJCFLAGS -Wobjc-missing-property-synthesis"]) AX_CHECK_COMPILER_FLAGS([-Watomic-properties -Werror], [ OBJCFLAGS="$OBJCFLAGS -Watomic-properties" TESTS_OBJCFLAGS="$TESTS_OBJCFLAGS -Wno-atomic-properties" ]) AX_CHECK_COMPILER_FLAGS([-Wnullable-to-nonnull-conversion -Werror], [OBJCFLAGS="$OBJCFLAGS -Wnullable-to-nonnull-conversion"]) AC_MSG_CHECKING(whether Objective C compiler supports properties) AC_TRY_COMPILE([ #ifdef __has_attribute # if __has_attribute(objc_root_class) __attribute__((__objc_root_class__)) # endif |
︙ | ︙ |
Modified src/OFApplication.m from [f12746971d] to [031d2d2246].
︙ | ︙ | |||
95 96 97 98 99 100 101 | [delegate release]; } #define SIGNAL_HANDLER(sig) \ static void \ handle##sig(int signal) \ { \ | | > | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | [delegate release]; } #define SIGNAL_HANDLER(sig) \ static void \ handle##sig(int signal) \ { \ app->_##sig##Handler( \ (id <OFApplicationDelegate>)app->_delegate, \ @selector(applicationDidReceive##sig)); \ } SIGNAL_HANDLER(SIGINT) #ifdef SIGHUP SIGNAL_HANDLER(SIGHUP) #endif #ifdef SIGUSR1 |
︙ | ︙ |
Modified src/OFDate.m from [618922b043] to [fde4276673].
︙ | ︙ | |||
640 641 642 643 644 645 646 | } - (OFDate *)earlierDate: (OFDate *)otherDate { if (otherDate == nil) return self; | | | | | | 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | } - (OFDate *)earlierDate: (OFDate *)otherDate { if (otherDate == nil) return self; if ([self compare: (OFDate *)otherDate] == OF_ORDERED_DESCENDING) return (OFDate *)otherDate; return self; } - (OFDate *)laterDate: (OFDate *)otherDate { if (otherDate == nil) return self; if ([self compare: (OFDate *)otherDate] == OF_ORDERED_ASCENDING) return (OFDate *)otherDate; return self; } - (of_time_interval_t)timeIntervalSince1970 { return _seconds; |
︙ | ︙ |
Modified src/OFDictionary.h from [4699be28c7] to [085a75867d].
︙ | ︙ | |||
227 228 229 230 231 232 233 | /*! * @brief Checks whether the dictionary contains an object equal to the * specified object. * * @param object The object which is checked for being in the dictionary * @return A boolean whether the dictionary contains the specified object */ | | | | 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 | /*! * @brief Checks whether the dictionary contains an object equal to the * specified object. * * @param object The object which is checked for being in the dictionary * @return A boolean whether the dictionary contains the specified object */ - (bool)containsObject: (ObjectType)object; /*! * @brief Checks whether the dictionary contains an object with the specified * address. * * @param object The object which is checked for being in the dictionary * @return A boolean whether the dictionary contains an object with the * specified address */ - (bool)containsObjectIdenticalTo: (ObjectType)object; /*! * @brief Returns an array of all keys. * * @return An array of all keys */ - (OFArray OF_GENERIC(KeyType) *)allKeys; |
︙ | ︙ |
Modified src/OFDictionary.m from [bd2dcff559] to [20c3611bfd].
︙ | ︙ | |||
466 467 468 469 470 471 472 | #ifdef OF_HAVE_BLOCKS - (void)enumerateKeysAndObjectsUsingBlock: (of_dictionary_enumeration_block_t)block { bool stop = false; for (id key in self) { | | | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | #ifdef OF_HAVE_BLOCKS - (void)enumerateKeysAndObjectsUsingBlock: (of_dictionary_enumeration_block_t)block { bool stop = false; for (id key in self) { block(key, (id)[self objectForKey: key], &stop); if (stop) break; } } - (OFDictionary *)mappedDictionaryUsingBlock: (of_dictionary_map_block_t)block |
︙ | ︙ |
Modified src/OFDictionary_hashtable.m from [0f9f60ec04] to [6d5e327cda].
︙ | ︙ | |||
342 343 344 345 346 347 348 | count = [_mapTable count]; keys = [self allocMemoryWithSize: sizeof(*keys) count: count]; @try { void *pool = objc_autoreleasePoolPush(); OFMapTableEnumerator *enumerator; | | | | | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | count = [_mapTable count]; keys = [self allocMemoryWithSize: sizeof(*keys) count: count]; @try { void *pool = objc_autoreleasePoolPush(); OFMapTableEnumerator *enumerator; void **keyPtr; size_t i; i = 0; enumerator = [_mapTable keyEnumerator]; while ((keyPtr = [enumerator nextObject]) != NULL) { assert(i < count); keys[i++] = (id)*keyPtr; } objc_autoreleasePoolPop(pool); ret = [OFArray arrayWithObjects: keys count: count]; } @finally { |
︙ | ︙ | |||
377 378 379 380 381 382 383 | count = [_mapTable count]; objects = [self allocMemoryWithSize: sizeof(*objects) count: count]; @try { void *pool = objc_autoreleasePoolPush(); OFMapTableEnumerator *enumerator; | | | | | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | count = [_mapTable count]; objects = [self allocMemoryWithSize: sizeof(*objects) count: count]; @try { void *pool = objc_autoreleasePoolPush(); OFMapTableEnumerator *enumerator; void **objectPtr; size_t i; i = 0; enumerator = [_mapTable objectEnumerator]; while ((objectPtr = [enumerator nextObject]) != NULL) { assert(i < count); objects[i++] = (id)*objectPtr; } objc_autoreleasePoolPop(pool); ret = [OFArray arrayWithObjects: objects count: count]; } @finally { |
︙ | ︙ |
Modified src/OFHMAC.m from [298535fc6e] to [fa6e2e00eb].
︙ | ︙ | |||
123 124 125 126 127 128 129 | - (const unsigned char *)digest { if (_outerHash == nil || _innerHash == nil) @throw [OFInvalidArgumentException exception]; if (_calculated) | | | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | - (const unsigned char *)digest { if (_outerHash == nil || _innerHash == nil) @throw [OFInvalidArgumentException exception]; if (_calculated) return (const unsigned char *)[_outerHash digest]; [_outerHash updateWithBuffer: (const unsigned char *)[_innerHash digest] length: [_hashClass digestSize]]; _calculated = true; return (const unsigned char *)[_outerHash digest]; } - (size_t)digestSize { return [_hashClass digestSize]; } |
︙ | ︙ |
Modified src/OFHTTPClient.m from [6841c42cc1] to [f0ee0fc898].
︙ | ︙ | |||
93 94 95 96 97 98 99 | path = @"/"; requestString = [OFMutableString stringWithFormat: @"%s %@", of_http_request_method_to_string(method), path]; if ([URL query] != nil) { [requestString appendString: @"?"]; | | | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | path = @"/"; requestString = [OFMutableString stringWithFormat: @"%s %@", of_http_request_method_to_string(method), path]; if ([URL query] != nil) { [requestString appendString: @"?"]; [requestString appendString: (OFString *)[URL query]]; } [requestString appendString: @" HTTP/"]; [requestString appendString: [request protocolVersionString]]; [requestString appendString: @"\r\n"]; headers = [[[request headers] mutableCopy] autorelease]; |
︙ | ︙ |
Modified src/OFHTTPCookie.m from [13073ad757] to [dc41fbd99f].
︙ | ︙ | |||
401 402 403 404 405 406 407 | OFMutableString *ret = [OFMutableString stringWithFormat: @"%@=%@", _name, _value]; void *pool = objc_autoreleasePoolPush(); [ret appendFormat: @"; Domain=%@; Path=%@", _domain, _path]; if (_expires != nil) | | | | | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | OFMutableString *ret = [OFMutableString stringWithFormat: @"%@=%@", _name, _value]; void *pool = objc_autoreleasePoolPush(); [ret appendFormat: @"; Domain=%@; Path=%@", _domain, _path]; if (_expires != nil) [ret appendString: [(OFDate *)_expires dateStringWithFormat: @"; Expires=%a, %d %b %Y " @"%H:%M:%S +0000"]]; if (_secure) [ret appendString: @"; Secure"]; if (_HTTPOnly) [ret appendString: @"; HTTPOnly"]; |
︙ | ︙ |
Modified src/OFHTTPServer.m from [1e27dfeb94] to [f5a4b0ce8e].
︙ | ︙ | |||
721 722 723 724 725 726 727 | if (_host == nil) @throw [OFInvalidArgumentException exception]; if (_listeningSocket != nil) @throw [OFAlreadyConnectedException exception]; _listeningSocket = [[OFTCPSocket alloc] init]; | | | 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | if (_host == nil) @throw [OFInvalidArgumentException exception]; if (_listeningSocket != nil) @throw [OFAlreadyConnectedException exception]; _listeningSocket = [[OFTCPSocket alloc] init]; _port = [_listeningSocket bindToHost: (OFString *)_host port: _port]; [_listeningSocket listen]; [_listeningSocket asyncAcceptWithTarget: self selector: @selector(of_socket: didAcceptSocket:context: exception:) |
︙ | ︙ |
Modified src/OFList.h from [ebae885803] to [2bcd2e7a45].
︙ | ︙ | |||
131 132 133 134 135 136 137 | /*! * @brief Checks whether the list contains an object equal to the specified * object. * * @param object The object which is checked for being in the list * @return A boolean whether the list contains the specified object */ | | | | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | /*! * @brief Checks whether the list contains an object equal to the specified * object. * * @param object The object which is checked for being in the list * @return A boolean whether the list contains the specified object */ - (bool)containsObject: (ObjectType)object; /*! * @brief Checks whether the list contains an object with the specified address. * * @param object The object which is checked for being in the list * @return A boolean whether the list contains an object with the specified * address */ - (bool)containsObjectIdenticalTo: (ObjectType)object; /*! * @brief Returns an OFEnumerator to enumerate through all objects of the list. * * @returns An OFEnumerator to enumerate through all objects of the list */ - (OFEnumerator OF_GENERIC(ObjectType) *)objectEnumerator; |
︙ | ︙ |
Modified src/OFMapTable.h from [59f43aca32] to [975babca81].
︙ | ︙ | |||
43 44 45 46 47 48 49 | * @brief A block for enumerating an OFMapTable. * * @param key The current key * @param object The current object * @param stop A pointer to a variable that can be set to true to stop the * enumeration */ | | | | > | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | * @brief A block for enumerating an OFMapTable. * * @param key The current key * @param object The current object * @param stop A pointer to a variable that can be set to true to stop the * enumeration */ typedef void (^of_map_table_enumeration_block_t)(void *_Nullable key, void *_Nullable object, bool *stop); /*! * @brief A block for replacing objects in an OFMapTable. * * @param key The key of the object to replace * @param object The object to replace * @return The object to replace the object with */ typedef void *_Nullable (^of_map_table_replace_block_t)(void *_Nullable key, void *_Nullable object); #endif @class OFMapTableEnumerator; /*! * @class OFMapTable OFMapTable.h ObjFW/OFMapTable.h * |
︙ | ︙ | |||
157 158 159 160 161 162 163 | /*! * @brief Sets an object for a key. * * @param key The key to set * @param object The object to set the key to */ | | | | | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | /*! * @brief Sets an object for a key. * * @param key The key to set * @param object The object to set the key to */ - (void)setObject: (nullable void *)object forKey: (nullable void *)key; /*! * @brief Removes the object for the specified key from the map table. * * @param key The key whose object should be removed */ - (void)removeObjectForKey: (nullable void *)key; /*! * @brief Removes all objects. */ - (void)removeAllObjects; /*! |
︙ | ︙ | |||
244 245 246 247 248 249 250 | unsigned long *_Nullable _mutationsPtr; uint32_t _position; } - init OF_UNAVAILABLE; /*! | | > | | | | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | unsigned long *_Nullable _mutationsPtr; uint32_t _position; } - init OF_UNAVAILABLE; /*! * @brief Returns a pointer to the next object, or NULL if the enumeration * finished. * * @return The next object */ - (void *_Nullable *_Nullable)nextObject; /*! * @brief Resets the enumerator, so the next call to @ref nextObject returns the * first object again. */ - (void)reset; @end OF_ASSUME_NONNULL_END |
Modified src/OFMapTable.m from [9a08c57256] to [73724a7b07].
︙ | ︙ | |||
685 686 687 688 689 690 691 | - (void)dealloc { [_mapTable release]; [super dealloc]; } | | | | | | | 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | - (void)dealloc { [_mapTable release]; [super dealloc]; } - (void **)nextObject { OF_UNRECOGNIZED_SELECTOR } - (void)reset { if (*_mutationsPtr != _mutations) @throw [OFEnumerationMutationException exceptionWithObject: _mapTable]; _position = 0; } @end @implementation OFMapTableKeyEnumerator - (void **)nextObject { if (*_mutationsPtr != _mutations) @throw [OFEnumerationMutationException exceptionWithObject: _mapTable]; for (; _position < _capacity && (_buckets[_position] == NULL || _buckets[_position] == &deleted); _position++); if (_position < _capacity) return &_buckets[_position++]->key; else return NULL; } @end @implementation OFMapTableObjectEnumerator - (void **)nextObject { if (*_mutationsPtr != _mutations) @throw [OFEnumerationMutationException exceptionWithObject: _mapTable]; for (; _position < _capacity && (_buckets[_position] == NULL || _buckets[_position] == &deleted); _position++); if (_position < _capacity) return &_buckets[_position++]->object; else return NULL; } @end @implementation OFMapTable_EnumeratorWrapper - initWithEnumerator: (OFMapTableEnumerator *)enumerator |
︙ | ︙ | |||
756 757 758 759 760 761 762 | [_object release]; [super dealloc]; } - (id)nextObject { | | | > > > | | 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 | [_object release]; [super dealloc]; } - (id)nextObject { void **objectPtr; @try { objectPtr = [_enumerator nextObject]; if (objectPtr == NULL) return nil; } @catch (OFEnumerationMutationException *e) { @throw [OFEnumerationMutationException exceptionWithObject: _object]; } return (id)*objectPtr; } - (void)reset { @try { [_enumerator reset]; } @catch (OFEnumerationMutationException *e) { @throw [OFEnumerationMutationException exceptionWithObject: _object]; } } @end |
Modified src/OFMutableString_UTF8.m from [4a3385c744] to [fc29ab31f7].
︙ | ︙ | |||
209 210 211 212 213 214 215 | @throw [OFInvalidEncodingException exception]; _s->hashed = false; if (lenNew == (size_t)lenOld) memcpy(_s->cString + index, buffer, lenNew); else if (lenNew > (size_t)lenOld) { | | | | | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | @throw [OFInvalidEncodingException exception]; _s->hashed = false; if (lenNew == (size_t)lenOld) memcpy(_s->cString + index, buffer, lenNew); else if (lenNew > (size_t)lenOld) { _s->cString = (void *)[self resizeMemory: _s->cString size: _s->cStringLength - lenOld + lenNew + 1]; memmove(_s->cString + index + lenNew, _s->cString + index + lenOld, _s->cStringLength - index - lenOld); memcpy(_s->cString + index, buffer, lenNew); _s->cStringLength -= lenOld; |
︙ | ︙ | |||
238 239 240 241 242 243 244 | _s->cStringLength += lenNew; _s->cString[_s->cStringLength] = '\0'; if (character >= 0x80) _s->isUTF8 = true; @try { | | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | _s->cStringLength += lenNew; _s->cString[_s->cStringLength] = '\0'; if (character >= 0x80) _s->isUTF8 = true; @try { _s->cString = (void *)[self resizeMemory: _s->cString size: _s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ } } } |
︙ | ︙ | |||
267 268 269 270 271 272 273 | _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } _s->hashed = false; | | | | | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } _s->hashed = false; _s->cString = (void *)[self resizeMemory: _s->cString size: _s->cStringLength + UTF8StringLength + 1]; memcpy(_s->cString + _s->cStringLength, UTF8String, UTF8StringLength + 1); _s->cStringLength += UTF8StringLength; _s->length += length; } |
︙ | ︙ | |||
297 298 299 300 301 302 303 | _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } _s->hashed = false; | | | | | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } _s->hashed = false; _s->cString = (void *)[self resizeMemory: _s->cString size: _s->cStringLength + UTF8StringLength + 1]; memcpy(_s->cString + _s->cStringLength, UTF8String, UTF8StringLength); _s->cStringLength += UTF8StringLength; _s->length += length; _s->cString[_s->cStringLength] = 0; } |
︙ | ︙ | |||
345 346 347 348 349 350 351 | if (string == nil) @throw [OFInvalidArgumentException exception]; UTF8StringLength = [string UTF8StringLength]; _s->hashed = false; | | | | | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | if (string == nil) @throw [OFInvalidArgumentException exception]; UTF8StringLength = [string UTF8StringLength]; _s->hashed = false; _s->cString = (void *)[self resizeMemory: _s->cString size: _s->cStringLength + UTF8StringLength + 1]; memcpy(_s->cString + _s->cStringLength, [string UTF8String], UTF8StringLength); _s->cStringLength += UTF8StringLength; _s->length += [string length]; _s->cString[_s->cStringLength] = 0; |
︙ | ︙ | |||
390 391 392 393 394 395 396 | j += len; } tmp[j] = '\0'; _s->hashed = false; | > | | | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | j += len; } tmp[j] = '\0'; _s->hashed = false; _s->cString = (void *)[self resizeMemory: _s->cString size: _s->cStringLength + j + 1]; memcpy(_s->cString + _s->cStringLength, tmp, j + 1); _s->cStringLength += j; _s->length += length; if (isUTF8) _s->isUTF8 = true; |
︙ | ︙ | |||
519 520 521 522 523 524 525 | if (_s->isUTF8) index = of_string_utf8_get_position(_s->cString, index, _s->cStringLength); newCStringLength = _s->cStringLength + [string UTF8StringLength]; _s->hashed = false; | | | | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | if (_s->isUTF8) index = of_string_utf8_get_position(_s->cString, index, _s->cStringLength); newCStringLength = _s->cStringLength + [string UTF8StringLength]; _s->hashed = false; _s->cString = (void *)[self resizeMemory: _s->cString size: newCStringLength + 1]; memmove(_s->cString + index + [string UTF8StringLength], _s->cString + index, _s->cStringLength - index); memcpy(_s->cString + index, [string UTF8String], [string UTF8StringLength]); _s->cString[newCStringLength] = '\0'; |
︙ | ︙ | |||
562 563 564 565 566 567 568 | _s->cStringLength - end); _s->hashed = false; _s->length -= range.length; _s->cStringLength -= end - start; _s->cString[_s->cStringLength] = 0; @try { | > | | | 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | _s->cStringLength - end); _s->hashed = false; _s->length -= range.length; _s->cStringLength -= end - start; _s->cString[_s->cStringLength] = 0; @try { _s->cString = (void *)[self resizeMemory: _s->cString size: _s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ } } - (void)replaceCharactersInRange: (of_range_t)range withString: (OFString *)replacement |
︙ | ︙ | |||
604 605 606 607 608 609 610 | * memmove() the rest of the string to the end. * * We must not resize the string if the new string is smaller, because * then we can't memmove() the rest of the string forward as the rest is * lost due to the resize! */ if (newCStringLength > _s->cStringLength) | | | | | | 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | * memmove() the rest of the string to the end. * * We must not resize the string if the new string is smaller, because * then we can't memmove() the rest of the string forward as the rest is * lost due to the resize! */ if (newCStringLength > _s->cStringLength) _s->cString = (void *)[self resizeMemory: _s->cString size: newCStringLength + 1]; memmove(_s->cString + start + [replacement UTF8StringLength], _s->cString + end, _s->cStringLength - end); memcpy(_s->cString + start, [replacement UTF8String], [replacement UTF8StringLength]); _s->cString[newCStringLength] = '\0'; /* * If the new string is smaller, we can safely resize it now as we're * done with memmove(). */ if (newCStringLength < _s->cStringLength) _s->cString = (void *)[self resizeMemory: _s->cString size: newCStringLength + 1]; _s->cStringLength = newCStringLength; _s->length = newLength; if ([replacement isKindOfClass: [OFString_UTF8 class]] || [replacement isKindOfClass: [OFMutableString_UTF8 class]]) { if (((OFString_UTF8 *)replacement)->_s->isUTF8) |
︙ | ︙ | |||
735 736 737 738 739 740 741 | _s->cStringLength -= i; _s->length -= i; memmove(_s->cString, _s->cString + i, _s->cStringLength); _s->cString[_s->cStringLength] = '\0'; @try { | > | | | 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 | _s->cStringLength -= i; _s->length -= i; memmove(_s->cString, _s->cString + i, _s->cStringLength); _s->cString[_s->cStringLength] = '\0'; @try { _s->cString = (void *)[self resizeMemory: _s->cString size: _s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ } } - (void)deleteTrailingWhitespaces { |
︙ | ︙ | |||
762 763 764 765 766 767 768 | d++; } _s->cStringLength -= d; _s->length -= d; @try { | > | | | 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | d++; } _s->cStringLength -= d; _s->length -= d; @try { _s->cString = (void *)[self resizeMemory: _s->cString size: _s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ } } - (void)deleteEnclosingWhitespaces { |
︙ | ︙ | |||
799 800 801 802 803 804 805 | _s->cStringLength -= i; _s->length -= i; memmove(_s->cString, _s->cString + i, _s->cStringLength); _s->cString[_s->cStringLength] = '\0'; @try { | > | | | 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 | _s->cStringLength -= i; _s->length -= i; memmove(_s->cString, _s->cString + i, _s->cStringLength); _s->cString[_s->cStringLength] = '\0'; @try { _s->cString = (void *)[self resizeMemory: _s->cString size: _s->cStringLength + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ } } - (void)makeImmutable { object_setClass(self, [OFString_UTF8 class]); } @end |
Modified src/OFObject.h from [09a592a800] to [8cde88e60d].
︙ | ︙ | |||
673 674 675 676 677 678 679 | * * It will be freed automatically when the object is deallocated. * * @param size The size of the memory to allocate * @return A pointer to the allocated memory. May return NULL if the specified * size is 0. */ | | | | | 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | * * It will be freed automatically when the object is deallocated. * * @param size The size of the memory to allocate * @return A pointer to the allocated memory. May return NULL if the specified * size is 0. */ - (nullable void *)allocMemoryWithSize: (size_t)size; /*! * @brief Allocates memory for the specified number of items and stores it in * the object's memory pool. * * It will be freed automatically when the object is deallocated. * * @param size The size of each item to allocate * @param count The number of items to allocate * @return A pointer to the allocated memory. May return NULL if the specified * size or count is 0. */ - (nullable void *)allocMemoryWithSize: (size_t)size count: (size_t)count; /*! * @brief Resizes memory in the object's memory pool to the specified size. * * If the pointer is NULL, this is equivalent to allocating memory. * If the size is 0, this is equivalent to freeing memory. * |
︙ | ︙ |
Modified src/OFOptionsParser.m from [f1e270d342] to [77a19bfe68].
︙ | ︙ | |||
103 104 105 106 107 108 109 | if (iter->longOption != nil) { @try { iter2->longOption = [iter->longOption copy]; if ([_longOptions objectForKey: | | > > | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | if (iter->longOption != nil) { @try { iter2->longOption = [iter->longOption copy]; if ([_longOptions objectForKey: (OFString *)iter2->longOption] != NULL) @throw [OFInvalidArgumentException exception]; [_longOptions setObject: iter2 forKey: (OFString *) iter2->longOption]; } @catch (id e) { /* * Make sure we are in a consistent * state where dealloc works. */ [iter2->longOption release]; |
︙ | ︙ | |||
205 206 207 208 209 210 211 | pos = [argument length]; _lastLongOption = [[argument substringWithRange: of_range(2, pos - 2)] copy]; objc_autoreleasePoolPop(pool); | | > | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | pos = [argument length]; _lastLongOption = [[argument substringWithRange: of_range(2, pos - 2)] copy]; objc_autoreleasePoolPop(pool); option = [_longOptions objectForKey: (OFString *)_lastLongOption]; if (option == NULL) return '?'; if (option->hasArgument == 1 && _argument == nil) return ':'; if (option->hasArgument == 0 && _argument != nil) return '='; |
︙ | ︙ |
Modified src/OFSet.h from [c9d70b7eb7] to [968a9faa33].
︙ | ︙ | |||
211 212 213 214 215 216 217 | /*! * @brief Checks whether the set contains an object equal to the specified * object. * * @param object The object which is checked for being in the set * @return A boolean whether the set contains the specified object */ | | | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | /*! * @brief Checks whether the set contains an object equal to the specified * object. * * @param object The object which is checked for being in the set * @return A boolean whether the set contains the specified object */ - (bool)containsObject: (ObjectType)object; /*! * @brief Returns the value for the specified key * * If the key starts with an `@`, the `@` is stripped and * `[super valueForKey:]` is called. * If the key does not start with an `@`, a new set with the value for the |
︙ | ︙ |
Modified src/OFSet_hashtable.m from [84c4225949] to [dab1aab8a3].
︙ | ︙ | |||
253 254 255 256 257 258 259 260 261 | return [set->_mapTable isEqual: _mapTable]; } - (id)anyObject { void *pool = objc_autoreleasePoolPush(); id object; | > | > > > > > > | | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | return [set->_mapTable isEqual: _mapTable]; } - (id)anyObject { void *pool = objc_autoreleasePoolPush(); void **objectPtr; id object; objectPtr = [[_mapTable keyEnumerator] nextObject]; if (objectPtr == NULL) { objc_autoreleasePoolPop(pool); return nil; } object = [(id)*objectPtr retain]; objc_autoreleasePoolPop(pool); return [object autorelease]; } - (OFEnumerator *)objectEnumerator |
︙ | ︙ |
Modified src/OFStream.m from [815f2dd728] to [9e8fe0a5ac].
︙ | ︙ | |||
657 658 659 660 661 662 663 | if OF_UNLIKELY (_readBuffer[i] == '\n' || _readBuffer[i] == '\0') { retLength = i; if (i > 0 && _readBuffer[i - 1] == '\r') retLength--; | | > | | | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | if OF_UNLIKELY (_readBuffer[i] == '\n' || _readBuffer[i] == '\0') { retLength = i; if (i > 0 && _readBuffer[i - 1] == '\r') retLength--; ret = [OFString stringWithCString: (char *)_readBuffer encoding: encoding length: retLength]; _readBuffer += i + 1; _readBufferLength -= i + 1; _waitingForDelimiter = false; return ret; } |
︙ | ︙ | |||
686 687 688 689 690 691 692 | } retLength = _readBufferLength; if (retLength > 0 && _readBuffer[retLength - 1] == '\r') retLength--; | | | 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | } retLength = _readBufferLength; if (retLength > 0 && _readBuffer[retLength - 1] == '\r') retLength--; ret = [OFString stringWithCString: (char *)_readBuffer encoding: encoding length: retLength]; [self freeMemory: _readBufferMemory]; _readBuffer = _readBufferMemory = NULL; _readBufferLength = 0; |
︙ | ︙ | |||
881 882 883 884 885 886 887 | j = 0; if (j == delimiterLength || _readBuffer[i] == '\0') { if (_readBuffer[i] == '\0') delimiterLength = 1; ret = [OFString | | | 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 | j = 0; if (j == delimiterLength || _readBuffer[i] == '\0') { if (_readBuffer[i] == '\0') delimiterLength = 1; ret = [OFString stringWithCString: (char *)_readBuffer encoding: encoding length: i + 1 - delimiterLength]; _readBuffer += i + 1; _readBufferLength -= i + 1; _waitingForDelimiter = false; |
︙ | ︙ | |||
905 906 907 908 909 910 911 | @try { if ([self lowlevelIsAtEndOfStream]) { if (_readBuffer == NULL) { _waitingForDelimiter = false; return nil; } | | | 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | @try { if ([self lowlevelIsAtEndOfStream]) { if (_readBuffer == NULL) { _waitingForDelimiter = false; return nil; } ret = [OFString stringWithCString: (char *)_readBuffer encoding: encoding length: _readBufferLength]; [self freeMemory: _readBufferMemory]; _readBuffer = _readBufferMemory = NULL; _readBufferLength = 0; |
︙ | ︙ | |||
1035 1036 1037 1038 1039 1040 1041 | } - (void)flushWriteBuffer { if (_writeBuffer == NULL) return; | | | 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 | } - (void)flushWriteBuffer { if (_writeBuffer == NULL) return; [self lowlevelWriteBuffer: (char *)_writeBuffer length: _writeBufferLength]; [self freeMemory: _writeBuffer]; _writeBuffer = NULL; _writeBufferLength = 0; } |
︙ | ︙ |
Modified src/OFString_UTF8.m from [62af83b584] to [c4bb148231].
︙ | ︙ | |||
175 176 177 178 179 180 181 | - init { self = [super init]; @try { _s = &_storage; | | | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | - init { self = [super init]; @try { _s = &_storage; _s->cString = (void *)[self allocMemoryWithSize: 1]; _s->cString[0] = '\0'; } @catch (id e) { [self release]; @throw e; } return self; |
︙ | ︙ | |||
241 242 243 244 245 246 247 | memcmp(cString, "\xEF\xBB\xBF", 3) == 0) { cString += 3; cStringLength -= 3; } _s = &_storage; | > | | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | memcmp(cString, "\xEF\xBB\xBF", 3) == 0) { cString += 3; cStringLength -= 3; } _s = &_storage; _s->cString = (void *)[self allocMemoryWithSize: cStringLength + 1]; _s->cStringLength = cStringLength; if (encoding == OF_STRING_ENCODING_UTF_8 || encoding == OF_STRING_ENCODING_ASCII) { switch (of_string_utf8_check(cString, cStringLength, &_s->length)) { case 1: |
︙ | ︙ | |||
288 289 290 291 292 293 294 | (uint8_t)cString[i], buffer); if (bytes == 0) @throw [OFInvalidEncodingException exception]; _s->cStringLength += bytes - 1; | | | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | (uint8_t)cString[i], buffer); if (bytes == 0) @throw [OFInvalidEncodingException exception]; _s->cStringLength += bytes - 1; _s->cString = (void *)[self resizeMemory: _s->cString size: _s->cStringLength + 1]; memcpy(_s->cString + j, buffer, bytes); j += bytes; } |
︙ | ︙ | |||
369 370 371 372 373 374 375 | _s->isUTF8 = true; byteLength = of_string_utf8_encode(unichar, buffer); if (byteLength == 0) @throw [OFInvalidEncodingException exception]; _s->cStringLength += byteLength - 1; | | | 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | _s->isUTF8 = true; byteLength = of_string_utf8_encode(unichar, buffer); if (byteLength == 0) @throw [OFInvalidEncodingException exception]; _s->cStringLength += byteLength - 1; _s->cString = (void *)[self resizeMemory: _s->cString size: _s->cStringLength + 1]; memcpy(_s->cString + j, buffer, byteLength); j += byteLength; } |
︙ | ︙ | |||
441 442 443 444 445 446 447 | [string isKindOfClass: [OFMutableString_UTF8 class]]) _s->isUTF8 = ((OFString_UTF8 *)string)->_s->isUTF8; else _s->isUTF8 = true; _s->length = [string length]; | > | > | | | | 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 488 489 490 491 492 493 494 495 496 497 498 499 500 | [string isKindOfClass: [OFMutableString_UTF8 class]]) _s->isUTF8 = ((OFString_UTF8 *)string)->_s->isUTF8; else _s->isUTF8 = true; _s->length = [string length]; _s->cString = (void *)[self allocMemoryWithSize: _s->cStringLength + 1]; memcpy(_s->cString, [string UTF8String], _s->cStringLength + 1); } @catch (id e) { [self release]; @throw e; } return self; } - initWithCharacters: (const of_unichar_t *)characters length: (size_t)length { self = [super init]; @try { size_t j; _s = &_storage; _s->cString = (void *)[self allocMemoryWithSize: (length * 4) + 1]; _s->length = length; j = 0; for (size_t i = 0; i < length; i++) { size_t len = of_string_utf8_encode(characters[i], _s->cString + j); if (len == 0) @throw [OFInvalidEncodingException exception]; if (len > 1) _s->isUTF8 = true; j += len; } _s->cString[j] = '\0'; _s->cStringLength = j; @try { _s->cString = (void *)[self resizeMemory: _s->cString size: j + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only tried to make it smaller */ } } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
517 518 519 520 521 522 523 | string++; length--; } else if (byteOrder != OF_BYTE_ORDER_NATIVE) swap = true; _s = &_storage; | > | | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | string++; length--; } else if (byteOrder != OF_BYTE_ORDER_NATIVE) swap = true; _s = &_storage; _s->cString = (void *)[self allocMemoryWithSize: (length * 4) + 1]; _s->length = length; j = 0; for (size_t i = 0; i < length; i++) { of_unichar_t character = (swap ? OF_BSWAP16(string[i]) : string[i]); size_t len; |
︙ | ︙ | |||
567 568 569 570 571 572 573 | j += len; } _s->cString[j] = '\0'; _s->cStringLength = j; @try { | | | | 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | j += len; } _s->cString[j] = '\0'; _s->cStringLength = j; @try { _s->cString = (void *)[self resizeMemory: _s->cString size: j + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only tried to make it smaller */ } } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
602 603 604 605 606 607 608 | characters++; length--; } else if (byteOrder != OF_BYTE_ORDER_NATIVE) swap = true; _s = &_storage; | > | | 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | characters++; length--; } else if (byteOrder != OF_BYTE_ORDER_NATIVE) swap = true; _s = &_storage; _s->cString = (void *)[self allocMemoryWithSize: (length * 4) + 1]; _s->length = length; j = 0; for (size_t i = 0; i < length; i++) { char buffer[4]; size_t len = of_string_utf8_encode( (swap ? OF_BSWAP32(characters[i]) : characters[i]), |
︙ | ︙ | |||
634 635 636 637 638 639 640 | } } _s->cString[j] = '\0'; _s->cStringLength = j; @try { | | | | 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 | } } _s->cString[j] = '\0'; _s->cStringLength = j; @try { _s->cString = (void *)[self resizeMemory: _s->cString size: j + 1]; } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only tried to make it smaller */ } } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
677 678 679 680 681 682 683 | case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } | | | 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 | case 1: _s->isUTF8 = true; break; case -1: @throw [OFInvalidEncodingException exception]; } _s->cString = (void *)[self allocMemoryWithSize: cStringLength + 1]; memcpy(_s->cString, tmp, cStringLength + 1); } @finally { free(tmp); } } @catch (id e) { [self release]; |
︙ | ︙ |
Modified src/OFTCPSocket.m from [bfcab86676] to [736afef818].
︙ | ︙ | |||
261 262 263 264 265 266 267 | int errNo = 0; if (_socket != INVALID_SOCKET) @throw [OFAlreadyConnectedException exceptionWithSocket: self]; if (_SOCKS5Host != nil) { /* Connect to the SOCKS5 proxy instead */ | | | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | int errNo = 0; if (_socket != INVALID_SOCKET) @throw [OFAlreadyConnectedException exceptionWithSocket: self]; if (_SOCKS5Host != nil) { /* Connect to the SOCKS5 proxy instead */ host = (OFString *)_SOCKS5Host; port = _SOCKS5Port; } results = of_resolve_host(host, port, SOCK_STREAM); for (iter = results; *iter != NULL; iter++) { of_resolver_result_t *result = *iter; |
︙ | ︙ | |||
603 604 605 606 607 608 609 | if (_socket == INVALID_SOCKET) @throw [OFNotOpenException exceptionWithObject: self]; if (_address == NULL) @throw [OFInvalidArgumentException exception]; | | > | 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | if (_socket == INVALID_SOCKET) @throw [OFNotOpenException exceptionWithObject: self]; if (_address == NULL) @throw [OFInvalidArgumentException exception]; of_address_to_string_and_port((struct sockaddr *)_address, _addressLength, &ret, NULL); return ret; } - (bool)isListening { return _listening; |
︙ | ︙ |
Modified src/OFTarArchive.m from [f74f1d447e] to [0808282283].
︙ | ︙ | |||
204 205 206 207 208 209 210 | } - (OFStream *)streamForReadingCurrentEntry { if (_mode != OF_TAR_ARCHIVE_MODE_READ) @throw [OFInvalidArgumentException exception]; | > > > | | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | } - (OFStream *)streamForReadingCurrentEntry { if (_mode != OF_TAR_ARCHIVE_MODE_READ) @throw [OFInvalidArgumentException exception]; if (_lastReturnedStream == nil) @throw [OFInvalidArgumentException exception]; return [[(OFStream *)_lastReturnedStream retain] autorelease]; } - (OFStream *)streamForWritingEntry: (OFTarArchiveEntry *)entry { void *pool; if (_mode != OF_TAR_ARCHIVE_MODE_WRITE && |
︙ | ︙ | |||
229 230 231 232 233 234 235 | _lastReturnedStream = [[OFTarArchive_FileWriteStream alloc] initWithStream: _stream entry: entry]; objc_autoreleasePoolPop(pool); | | | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | _lastReturnedStream = [[OFTarArchive_FileWriteStream alloc] initWithStream: _stream entry: entry]; objc_autoreleasePoolPop(pool); return [[(OFStream *)_lastReturnedStream retain] autorelease]; } - (void)close { if (_stream == nil) return; |
︙ | ︙ |
Modified src/OFThread.m from [c1e478224c] to [488341d5ad].
︙ | ︙ | |||
383 384 385 386 387 388 389 | # else @synchronized (self) { if (_runLoop == nil) _runLoop = [[OFRunLoop alloc] init]; } # endif | | | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | # else @synchronized (self) { if (_runLoop == nil) _runLoop = [[OFRunLoop alloc] init]; } # endif return (OFRunLoop *)_runLoop; } - (OFString *)name { return [[_name copy] autorelease]; } |
︙ | ︙ |
Modified src/OFXMLAttribute.m from [464c2003f8] to [292617ba84].
︙ | ︙ | |||
161 162 163 164 165 166 167 | namespace: OF_SERIALIZATION_NS]; [element addAttributeWithName: @"name" stringValue: _name]; if (_namespace != nil) [element addAttributeWithName: @"namespace" | | | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | namespace: OF_SERIALIZATION_NS]; [element addAttributeWithName: @"name" stringValue: _name]; if (_namespace != nil) [element addAttributeWithName: @"namespace" stringValue: (OFString *)_namespace]; [element addAttributeWithName: @"stringValue" stringValue: _stringValue]; [element retain]; objc_autoreleasePoolPop(pool); |
︙ | ︙ |
Modified src/OFXMLElement.m from [28440d417d] to [8c36bd33b3].
︙ | ︙ | |||
172 173 174 175 176 177 178 | _namespaces = [[OFMutableDictionary alloc] initWithKeysAndObjects: @"http://www.w3.org/XML/1998/namespace", @"xml", @"http://www.w3.org/2000/xmlns/", @"xmlns", nil]; if (stringValue != nil) | | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | _namespaces = [[OFMutableDictionary alloc] initWithKeysAndObjects: @"http://www.w3.org/XML/1998/namespace", @"xml", @"http://www.w3.org/2000/xmlns/", @"xmlns", nil]; if (stringValue != nil) [self setStringValue: (OFString *)stringValue]; } @catch (id e) { [self release]; @throw e; } return self; } |
︙ | ︙ | |||
434 435 436 437 438 439 440 | OFString *ret; OFString *defaultNS; pool = objc_autoreleasePoolPush(); parentPrefix = [allNamespaces objectForKey: (parent != nil && parent->_namespace != nil | | | | 434 435 436 437 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 | OFString *ret; OFString *defaultNS; pool = objc_autoreleasePoolPush(); parentPrefix = [allNamespaces objectForKey: (parent != nil && parent->_namespace != nil ? (OFString *)parent->_namespace : (OFString *)@"")]; /* Add the namespaces of the current element */ if (allNamespaces != nil) { OFEnumerator *keyEnumerator = [_namespaces keyEnumerator]; OFEnumerator *objectEnumerator = [_namespaces objectEnumerator]; OFMutableDictionary *tmp; id key, object; tmp = [[allNamespaces mutableCopy] autorelease]; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) [tmp setObject: object forKey: key]; allNamespaces = tmp; } else allNamespaces = _namespaces; prefix = [allNamespaces objectForKey: (_namespace != nil ? (OFString *)_namespace : (OFString *)@"")]; if (parent != nil && parent->_namespace != nil && parentPrefix == nil) defaultNS = parent->_namespace; else if (parent != nil && parent->_defaultNamespace != nil) defaultNS = parent->_defaultNamespace; else defaultNS = _defaultNamespace; |
︙ | ︙ | |||
523 524 525 526 527 528 529 | void *pool2 = objc_autoreleasePoolPush(); OFString *attributeName = [attribute name]; OFString *attributePrefix = nil; OFString *tmp = [[attribute stringValue] stringByXMLEscaping]; if ([attribute namespace] != nil && (attributePrefix = [allNamespaces objectForKey: | | | > | 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | void *pool2 = objc_autoreleasePoolPush(); OFString *attributeName = [attribute name]; OFString *attributePrefix = nil; OFString *tmp = [[attribute stringValue] stringByXMLEscaping]; if ([attribute namespace] != nil && (attributePrefix = [allNamespaces objectForKey: (OFString *)[attribute namespace]]) == nil) @throw [OFUnboundNamespaceException exceptionWithNamespace: (OFString *) [attribute namespace] element: self]; length += [attributeName UTF8StringLength] + (attributePrefix != nil ? [attributePrefix UTF8StringLength] + 1 : 0) + [tmp UTF8StringLength] + 4; |
︙ | ︙ | |||
699 700 701 702 703 704 705 | if (_name != nil) [element addAttributeWithName: @"name" stringValue: _name]; if (_namespace != nil) [element addAttributeWithName: @"namespace" | | | | | 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 | if (_name != nil) [element addAttributeWithName: @"name" stringValue: _name]; if (_namespace != nil) [element addAttributeWithName: @"namespace" stringValue: (OFString *)_namespace]; if (_defaultNamespace != nil) [element addAttributeWithName: @"defaultNamespace" stringValue: (OFString *)_defaultNamespace]; if (_attributes != nil) { OFXMLElement *attributesElement; attributesElement = [OFXMLElement elementWithName: @"attributes" namespace: OF_SERIALIZATION_NS]; [attributesElement addChild: [(OFArray *)_attributes XMLElementBySerializing]]; [element addChild: attributesElement]; } if (_namespaces != nil) { OFXMLElement *namespacesElement; OFMutableDictionary *namespacesCopy = [[_namespaces mutableCopy] autorelease]; |
︙ | ︙ | |||
742 743 744 745 746 747 748 | if (_children != nil) { OFXMLElement *childrenElement; childrenElement = [OFXMLElement elementWithName: @"children" namespace: OF_SERIALIZATION_NS]; | | > | 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | if (_children != nil) { OFXMLElement *childrenElement; childrenElement = [OFXMLElement elementWithName: @"children" namespace: OF_SERIALIZATION_NS]; [childrenElement addChild: [(OFArray *)_children XMLElementBySerializing]]; [element addChild: childrenElement]; } [element retain]; objc_autoreleasePoolPop(pool); |
︙ | ︙ |
Modified src/OFXMLElementBuilder.m from [8f1f7d2342] to [112bbd4243].
︙ | ︙ | |||
113 114 115 116 117 118 119 | namespace: namespace]; else @throw [OFMalformedXMLException exception]; return; case 1: [_delegate elementBuilder: self | > | | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | namespace: namespace]; else @throw [OFMalformedXMLException exception]; return; case 1: [_delegate elementBuilder: self didBuildElement: (OFXMLElement *) [_stack firstObject]]; break; } [_stack removeLastObject]; } - (void)parser: (OFXMLParser *)parser |
︙ | ︙ |
Modified src/OFXMLParser.m from [913f851c54] to [8522ee412a].
︙ | ︙ | |||
543 544 545 546 547 548 549 | if (_data[_i] == '>' || _data[_i] == '/') { OFString *namespace; namespace = namespaceForPrefix(_prefix, _namespaces); if (_prefix != nil && namespace == nil) @throw [OFUnboundPrefixException | | | | | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | if (_data[_i] == '>' || _data[_i] == '/') { OFString *namespace; namespace = namespaceForPrefix(_prefix, _namespaces); if (_prefix != nil && namespace == nil) @throw [OFUnboundPrefixException exceptionWithPrefix: (OFString *)_prefix parser: self]; if ([_delegate respondsToSelector: @selector(parser: didStartElement:prefix:namespace:attributes:)]) [_delegate parser: self didStartElement: (OFString *)_name prefix: _prefix namespace: namespace attributes: nil]; if (_data[_i] == '/') { if ([_delegate respondsToSelector: @selector(parser:didEndElement:prefix:namespace:)]) [_delegate parser: self didEndElement: (OFString *)_name prefix: _prefix namespace: namespace]; if ([_previous count] == 0) _finishedParsing = true; } else [_previous addObject: bufferString]; |
︙ | ︙ | |||
630 631 632 633 634 635 636 | [_previous removeLastObject]; [_buffer removeAllItems]; namespace = namespaceForPrefix(_prefix, _namespaces); if (_prefix != nil && namespace == nil) | | > | | | 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | [_previous removeLastObject]; [_buffer removeAllItems]; namespace = namespaceForPrefix(_prefix, _namespaces); if (_prefix != nil && namespace == nil) @throw [OFUnboundPrefixException exceptionWithPrefix: (OFString *)_prefix parser: self]; if ([_delegate respondsToSelector: @selector(parser:didEndElement:prefix:namespace:)]) [_delegate parser: self didEndElement: (OFString *)_name prefix: _prefix namespace: namespace]; objc_autoreleasePoolPop(pool); [_namespaces removeLastObject]; [_name release]; |
︙ | ︙ | |||
681 682 683 684 685 686 687 | attributesObjects = [_attributes objects]; attributesCount = [_attributes count]; namespace = namespaceForPrefix(_prefix, _namespaces); if (_prefix != nil && namespace == nil) | | > | | | | | 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 | attributesObjects = [_attributes objects]; attributesCount = [_attributes count]; namespace = namespaceForPrefix(_prefix, _namespaces); if (_prefix != nil && namespace == nil) @throw [OFUnboundPrefixException exceptionWithPrefix: (OFString *)_prefix parser: self]; for (size_t j = 0; j < attributesCount; j++) resolveAttributeNamespace(attributesObjects[j], _namespaces, self); pool = objc_autoreleasePoolPush(); if ([_delegate respondsToSelector: @selector(parser:didStartElement:prefix:namespace:attributes:)]) [_delegate parser: self didStartElement: (OFString *)_name prefix: _prefix namespace: namespace attributes: _attributes]; if (_data[_i] == '/') { if ([_delegate respondsToSelector: @selector(parser:didEndElement:prefix:namespace:)]) [_delegate parser: self didEndElement: (OFString *)_name prefix: _prefix namespace: namespace]; if ([_previous count] == 0) _finishedParsing = true; [_namespaces removeLastObject]; } else if (_prefix != nil) { OFString *str = [OFString stringWithFormat: @"%@:%@", _prefix, _name]; [_previous addObject: str]; } else [_previous addObject: (OFString *)_name]; objc_autoreleasePoolPop(pool); [_name release]; [_prefix release]; [_attributes removeAllObjects]; _name = _prefix = nil; |
︙ | ︙ | |||
826 827 828 829 830 831 832 | pool = objc_autoreleasePoolPush(); attributeValue = transformString(self, _buffer, 0, true); if (_attributePrefix == nil && [_attributeName isEqual: @"xmlns"]) [[_namespaces lastObject] setObject: attributeValue forKey: @""]; if ([_attributePrefix isEqual: @"xmlns"]) | | > | | | 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | pool = objc_autoreleasePoolPush(); attributeValue = transformString(self, _buffer, 0, true); if (_attributePrefix == nil && [_attributeName isEqual: @"xmlns"]) [[_namespaces lastObject] setObject: attributeValue forKey: @""]; if ([_attributePrefix isEqual: @"xmlns"]) [[_namespaces lastObject] setObject: attributeValue forKey: (OFString *)_attributeName]; [_attributes addObject: [OFXMLAttribute attributeWithName: (OFString *)_attributeName namespace: _attributePrefix stringValue: attributeValue]]; objc_autoreleasePoolPop(pool); [_buffer removeAllItems]; [_attributeName release]; |
︙ | ︙ |
Modified src/OFZIPArchive.m from [700f57a4db] to [0736b3b069].
︙ | ︙ | |||
463 464 465 466 467 468 469 | _lastReturnedStream = [[OFZIPArchive_FileReadStream alloc] initWithStream: _stream entry: entry]; objc_autoreleasePoolPop(pool); | | | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | _lastReturnedStream = [[OFZIPArchive_FileReadStream alloc] initWithStream: _stream entry: entry]; objc_autoreleasePoolPop(pool); return [[(OFStream *)_lastReturnedStream retain] autorelease]; } - (OFStream *)streamForWritingEntry: (OFZIPArchiveEntry *)entry_ { /* TODO: Avoid data descriptor when _stream is an OFSeekableStream */ int64_t offsetAdd = 0; void *pool; |
︙ | ︙ | |||
554 555 556 557 558 559 560 | _lastReturnedStream = [[OFZIPArchive_FileWriteStream alloc] initWithStream: _stream entry: entry]; objc_autoreleasePoolPop(pool); | | | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | _lastReturnedStream = [[OFZIPArchive_FileWriteStream alloc] initWithStream: _stream entry: entry]; objc_autoreleasePoolPop(pool); return [[(OFStream *)_lastReturnedStream retain] autorelease]; } - (void)of_writeCentralDirectory { void *pool = objc_autoreleasePoolPush(); _centralDirectoryEntries = 0; |
︙ | ︙ | |||
601 602 603 604 605 606 607 | [_stream writeLittleEndianInt16: 0xFFFF]; /* CD disk */ [_stream writeLittleEndianInt16: 0xFFFF]; /* CD entries in disk */ [_stream writeLittleEndianInt16: 0xFFFF]; /* CD entries */ [_stream writeLittleEndianInt32: 0xFFFFFFFF]; /* CD size */ [_stream writeLittleEndianInt32: 0xFFFFFFFF]; /* CD offset */ [_stream writeLittleEndianInt16: [_archiveComment UTF8StringLength]]; if (_archiveComment != nil) | | | 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | [_stream writeLittleEndianInt16: 0xFFFF]; /* CD disk */ [_stream writeLittleEndianInt16: 0xFFFF]; /* CD entries in disk */ [_stream writeLittleEndianInt16: 0xFFFF]; /* CD entries */ [_stream writeLittleEndianInt32: 0xFFFFFFFF]; /* CD size */ [_stream writeLittleEndianInt32: 0xFFFFFFFF]; /* CD offset */ [_stream writeLittleEndianInt16: [_archiveComment UTF8StringLength]]; if (_archiveComment != nil) [_stream writeString: (OFString *)_archiveComment]; objc_autoreleasePoolPop(pool); } - (void)close { if (_stream == nil) |
︙ | ︙ |
Modified src/OFZIPArchiveEntry.m from [c8f541f60e] to [f6ad079c58].
︙ | ︙ | |||
461 462 463 464 465 466 467 | [stream writeLittleEndianInt64: _uncompressedSize]; [stream writeLittleEndianInt64: _compressedSize]; [stream writeLittleEndianInt64: _localFileHeaderOffset]; [stream writeLittleEndianInt32: _startDiskNumber]; size += (2 * 2) + (3 * 8) + 4; if (_extraField != nil) | | | | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | [stream writeLittleEndianInt64: _uncompressedSize]; [stream writeLittleEndianInt64: _compressedSize]; [stream writeLittleEndianInt64: _localFileHeaderOffset]; [stream writeLittleEndianInt32: _startDiskNumber]; size += (2 * 2) + (3 * 8) + 4; if (_extraField != nil) [stream writeData: (OFData *)_extraField]; size += (uint64_t)[_extraField count]; if (_fileComment != nil) [stream writeString: (OFString *)_fileComment]; size += (uint64_t)[_fileComment UTF8StringLength]; objc_autoreleasePoolPop(pool); return size; } @end |
Modified src/bridge/NSString+OFObject.m from [02a295e9aa] to [0a0d7245e4].
︙ | ︙ | |||
16 17 18 19 20 21 22 | #import "NSString+OFObject.h" #import "OFString.h" @implementation NSString (OFObject) - (id)OFObject { | | | 16 17 18 19 20 21 22 23 24 25 | #import "NSString+OFObject.h" #import "OFString.h" @implementation NSString (OFObject) - (id)OFObject { return [OFString stringWithUTF8String: (const char *)[self UTF8String]]; } @end |
Modified src/bridge/OFString+NSObject.m from [f1289a59f8] to [d89258eedd].
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 | * file. */ #import <Foundation/NSString.h> #import "OFString+NSObject.h" @implementation OFString (NSObject) - (id)NSObject { | > > | | > > > > > > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | * file. */ #import <Foundation/NSString.h> #import "OFString+NSObject.h" #import "OFInitializationFailedException.h" @implementation OFString (NSObject) - (id)NSObject { NSString *string = [NSString stringWithUTF8String: [self UTF8String]]; if (string == nil) @throw [OFInitializationFailedException exceptionWithClass: [NSString class]]; return string; } @end |
Modified src/macros.h from [7f6db52639] to [ffa2588354].
︙ | ︙ | |||
573 574 575 576 577 578 579 | # define OF_BSWAP_FLOAT_IF_BE(i) (i) # define OF_BSWAP_DOUBLE_IF_BE(i) (i) # define OF_BSWAP_FLOAT_IF_LE(i) OF_BSWAP_FLOAT(i) # define OF_BSWAP_DOUBLE_IF_LE(i) OF_BSWAP_DOUBLE(i) #endif static OF_INLINE uint16_t | | | | | | | | | | | | | | | | | | | | | | 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 | # define OF_BSWAP_FLOAT_IF_BE(i) (i) # define OF_BSWAP_DOUBLE_IF_BE(i) (i) # define OF_BSWAP_FLOAT_IF_LE(i) OF_BSWAP_FLOAT(i) # define OF_BSWAP_DOUBLE_IF_LE(i) OF_BSWAP_DOUBLE(i) #endif static OF_INLINE uint16_t of_be16_ptr_read(void *_Nonnull ptr) { uint16_t value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP16_IF_LE(value); } static OF_INLINE uint32_t of_be32_ptr_read(void *_Nonnull ptr) { uint32_t value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP32_IF_LE(value); } static OF_INLINE uint64_t of_be64_ptr_read(void *_Nonnull ptr) { uint64_t value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP64_IF_LE(value); } static OF_INLINE float of_be_float_ptr_read(void *_Nonnull ptr) { float value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP_FLOAT_IF_LE(value); } static OF_INLINE double of_be_double_ptr_read(void *_Nonnull ptr) { double value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP_DOUBLE_IF_LE(value); } static OF_INLINE uint16_t of_le16_ptr_read(void *_Nonnull ptr) { uint16_t value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP16_IF_BE(value); } static OF_INLINE uint32_t of_le32_ptr_read(void *_Nonnull ptr) { uint32_t value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP32_IF_BE(value); } static OF_INLINE uint64_t of_le64_ptr_read(void *_Nonnull ptr) { uint64_t value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP64_IF_BE(value); } static OF_INLINE float of_le_float_ptr_read(void *_Nonnull ptr) { float value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP_FLOAT_IF_BE(value); } static OF_INLINE double of_le_double_ptr_read(void *_Nonnull ptr) { double value; memcpy(&value, ptr, sizeof(value)); return OF_BSWAP_DOUBLE_IF_BE(value); } static OF_INLINE void of_be16_ptr_write(void *_Nonnull ptr, uint16_t value) { value = OF_BSWAP16_IF_LE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void of_be32_ptr_write(void *_Nonnull ptr, uint32_t value) { value = OF_BSWAP32_IF_LE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void of_be64_ptr_write(void *_Nonnull ptr, uint64_t value) { value = OF_BSWAP64_IF_LE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void of_be_float_ptr_write(void *_Nonnull ptr, float value) { value = OF_BSWAP_FLOAT_IF_LE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void of_be_double_ptr_write(void *_Nonnull ptr, double value) { value = OF_BSWAP_DOUBLE_IF_LE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void of_le16_ptr_write(void *_Nonnull ptr, uint16_t value) { value = OF_BSWAP16_IF_BE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void of_le32_ptr_write(void *_Nonnull ptr, uint32_t value) { value = OF_BSWAP32_IF_BE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void of_le64_ptr_write(void *_Nonnull ptr, uint64_t value) { value = OF_BSWAP64_IF_BE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void of_le_float_ptr_write(void *_Nonnull ptr, float value) { value = OF_BSWAP_FLOAT_IF_BE(value); memcpy(ptr, &value, sizeof(value)); } static OF_INLINE void of_le_double_ptr_write(void *_Nonnull ptr, double value) { value = OF_BSWAP_DOUBLE_IF_BE(value); memcpy(ptr, &value, sizeof(value)); } #define OF_ROL(value, bits) \ (((bits) % (sizeof(value) * 8)) > 0 \ |
︙ | ︙ | |||
758 759 760 761 762 763 764 | OF_HASH_ADD(hash, (otherCopy >> 24) & 0xFF); \ OF_HASH_ADD(hash, (otherCopy >> 16) & 0xFF); \ OF_HASH_ADD(hash, (otherCopy >> 8) & 0xFF); \ OF_HASH_ADD(hash, otherCopy & 0xFF); \ } static OF_INLINE bool | | | | | | | | 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 | OF_HASH_ADD(hash, (otherCopy >> 24) & 0xFF); \ OF_HASH_ADD(hash, (otherCopy >> 16) & 0xFF); \ OF_HASH_ADD(hash, (otherCopy >> 8) & 0xFF); \ OF_HASH_ADD(hash, otherCopy & 0xFF); \ } static OF_INLINE bool of_bitset_isset(uint8_t *_Nonnull storage, size_t index) { return storage[index / 8] & (1 << (index % 8)); } static OF_INLINE void of_bitset_set(uint8_t *_Nonnull storage, size_t index) { storage[index / 8] |= (1 << (index % 8)); } static OF_INLINE void of_bitset_clear(uint8_t *_Nonnull storage, size_t index) { storage[index / 8] &= ~(1 << (index % 8)); } static OF_INLINE char *_Nullable of_strdup(const char *_Nonnull string) { char *copy; size_t length = strlen(string); if ((copy = (char *)malloc(length + 1)) == NULL) return NULL; memcpy(copy, string, length + 1); return copy; } static OF_INLINE void of_explicit_memset(void *_Nonnull buffer_, int character, size_t length) { volatile unsigned char *buffer = (volatile unsigned char *)buffer_; while (buffer < (unsigned char *)buffer_ + length) *buffer++ = character; } |
︙ | ︙ |
Modified tests/OFDictionaryTests.m from [76bc88ef2a] to [513f38a1a5].
︙ | ︙ | |||
234 235 236 237 238 239 240 | for (OFString *key in mutDict) { if (i > 1 || ![key isEqual: keys[i]]) { ok = false; break; } | | | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | for (OFString *key in mutDict) { if (i > 1 || ![key isEqual: keys[i]]) { ok = false; break; } [mutDict setObject: (OFString *)[mutDict objectForKey: key] forKey: key]; i++; } TEST(@"Fast Enumeration", ok) ok = false; |
︙ | ︙ | |||
275 276 277 278 279 280 281 | ^ (id key, id obj, bool *stop) { if (i > 1 || ![key isEqual: keys[i]]) { ok = false; *stop = true; return; } | > | | | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | ^ (id key, id obj, bool *stop) { if (i > 1 || ![key isEqual: keys[i]]) { ok = false; *stop = true; return; } [mutDict setObject: (OFString *)[mutDict objectForKey: key] forKey: key]; i++; }]; TEST(@"Enumeration using blocks", ok) ok = false; @try { |
︙ | ︙ |
Modified tests/OFInvocationTests.m from [1bbbdf67b6] to [852b660a9a].
︙ | ︙ | |||
251 252 253 254 255 256 257 | } #endif - (void)invocationTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; SEL selector = @selector(invocationTestMethod1::::); | | > | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | } #endif - (void)invocationTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; SEL selector = @selector(invocationTestMethod1::::); OFMethodSignature *sig = (OFMethodSignature *)[self methodSignatureForSelector: selector]; OFInvocation *invocation; struct test_struct st, st2, *stp = &st, *stp2; unsigned const char c = 0xAA; unsigned char c2; const unsigned int i = 0x55555555; unsigned int i2; |
︙ | ︙ | |||
309 310 311 312 313 314 315 | atIndex: 5]) && memcmp(&st, &st2, sizeof(st)) == 0) #ifdef OF_INVOCATION_CAN_INVOKE /* -[invoke] #1 */ selector = @selector(invocationTestMethod2::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: | | | | | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 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 361 362 363 | atIndex: 5]) && memcmp(&st, &st2, sizeof(st)) == 0) #ifdef OF_INVOCATION_CAN_INVOKE /* -[invoke] #1 */ selector = @selector(invocationTestMethod2::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: (OFMethodSignature *)[self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; for (int i = 1; i <= 16; i++) [invocation setArgument: &i atIndex: i + 1]; int intResult; TEST(@"-[invoke] #1", R([invocation invoke]) && R([invocation getReturnValue: &intResult]) && intResult == 8) /* -[invoke] #2 */ selector = @selector(invocationTestMethod3::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: (OFMethodSignature *)[self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; for (int i = 1; i <= 16; i++) { double d = i; [invocation setArgument: &d atIndex: i + 1]; } double doubleResult; TEST(@"-[invoke] #2", R([invocation invoke]) && R([invocation getReturnValue: &doubleResult]) && doubleResult == 8.5) /* -[invoke] #3 */ selector = @selector(invocationTestMethod4::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: (OFMethodSignature *)[self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; for (int i = 1; i <= 16; i++) { |
︙ | ︙ | |||
376 377 378 379 380 381 382 383 384 385 386 387 388 389 | R([invocation getReturnValue: &floatResult]) && floatResult == 8.5) /* Only when encoding long doubles is supported */ if (strcmp(@encode(double), @encode(long double)) != 0) { /* -[invoke] #4 */ selector = @selector(invocationTestMethod5::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; | > | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | R([invocation getReturnValue: &floatResult]) && floatResult == 8.5) /* Only when encoding long doubles is supported */ if (strcmp(@encode(double), @encode(long double)) != 0) { /* -[invoke] #4 */ selector = @selector(invocationTestMethod5::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: (OFMethodSignature *) [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; |
︙ | ︙ | |||
399 400 401 402 403 404 405 | longDoubleResult == 8.5) } # ifndef __STDC_NO_COMPLEX__ /* -[invoke] #5 */ selector = @selector(invocationTestMethod6::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: | | | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | longDoubleResult == 8.5) } # ifndef __STDC_NO_COMPLEX__ /* -[invoke] #5 */ selector = @selector(invocationTestMethod6::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: (OFMethodSignature *)[self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; for (int i = 1; i <= 16; i++) { |
︙ | ︙ | |||
429 430 431 432 433 434 435 436 437 438 439 440 441 442 | /* Only when encoding complex long doubles is supported */ if (strcmp(@encode(complex double), @encode(complex long double)) != 0) { /* -[invoke] #6 */ selector = @selector(invocationTestMethod7::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; | > | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | /* Only when encoding complex long doubles is supported */ if (strcmp(@encode(complex double), @encode(complex long double)) != 0) { /* -[invoke] #6 */ selector = @selector(invocationTestMethod7::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: (OFMethodSignature *) [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; |
︙ | ︙ | |||
468 469 470 471 472 473 474 | } # endif # ifdef __SIZEOF_INT128__ /* -[invoke] #7 */ selector = @selector(invocationTestMethod8::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: | | | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | } # endif # ifdef __SIZEOF_INT128__ /* -[invoke] #7 */ selector = @selector(invocationTestMethod8::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: (OFMethodSignature *)[self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; [invocation setArgument: &selector atIndex: 1]; for (int i = 1; i <= 16; i++) { |
︙ | ︙ |
Modified tests/OFListTests.m from [3c7e2e133b] to [8387465471].
︙ | ︙ | |||
56 57 58 59 60 61 62 | TEST(@"-[lastListObject]", [[list lastListObject]->object isEqual: strings[2]]) TEST(@"-[lastListObject]->previous", [[list lastListObject]->previous->object isEqual: strings[1]]) TEST(@"-[removeListObject:]", | | > | > | > | | 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 | TEST(@"-[lastListObject]", [[list lastListObject]->object isEqual: strings[2]]) TEST(@"-[lastListObject]->previous", [[list lastListObject]->previous->object isEqual: strings[1]]) TEST(@"-[removeListObject:]", R([list removeListObject: (of_list_object_t *)[list lastListObject]]) && [[list lastListObject]->object isEqual: strings[1]] && R([list removeListObject: (of_list_object_t *)[list firstListObject]]) && [[list firstListObject]->object isEqual: [list lastListObject]->object]) TEST(@"-[insertObject:beforeListObject:]", [list insertObject: strings[0] beforeListObject: (of_list_object_t *)[list lastListObject]] && [[list lastListObject]->previous->object isEqual: strings[0]]) TEST(@"-[insertObject:afterListObject:]", [list insertObject: strings[2] afterListObject: (of_list_object_t *) [list firstListObject]->next] && [[list lastListObject]->object isEqual: strings[2]]) TEST(@"-[count]", [list count] == 3) TEST(@"-[containsObject:]", [list containsObject: strings[1]] && ![list containsObject: @"nonexistant"]) |
︙ | ︙ | |||
112 113 114 115 116 117 118 | if ([list count] != i) ok = false; TEST(@"OFEnumerator's -[nextObject]", ok); [enumerator reset]; | | | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | if ([list count] != i) ok = false; TEST(@"OFEnumerator's -[nextObject]", ok); [enumerator reset]; [list removeListObject: (of_list_object_t *)[list firstListObject]]; EXPECT_EXCEPTION(@"Detection of mutation during enumeration", OFEnumerationMutationException, [enumerator nextObject]) [list prependObject: strings[0]]; loe = [list firstListObject]; |
︙ | ︙ | |||
141 142 143 144 145 146 147 | TEST(@"Fast Enumeration", ok) ok = false; @try { for (OFString *obj in list) { (void)obj; | | > | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | TEST(@"Fast Enumeration", ok) ok = false; @try { for (OFString *obj in list) { (void)obj; [list removeListObject: (of_list_object_t *)[list lastListObject]]; } } @catch (OFEnumerationMutationException *e) { ok = true; } TEST(@"Detection of mutation during Fast Enumeration", ok) [pool drain]; } @end |