Index: generators/unicode/TableGenerator.m ================================================================== --- generators/unicode/TableGenerator.m +++ generators/unicode/TableGenerator.m @@ -135,11 +135,11 @@ bool compat = false; OFMutableString *string; if ([decomposed.firstObject hasPrefix: @"<"]) { decomposed = [decomposed objectsInRange: - of_range(1, decomposed.count - 1)]; + OFMakeRange(1, decomposed.count - 1)]; compat = true; } string = [OFMutableString string]; Index: src/OFAdjacentArray.m ================================================================== --- src/OFAdjacentArray.m +++ src/OFAdjacentArray.m @@ -204,11 +204,11 @@ - (id)objectAtIndexedSubscript: (size_t)idx { return *((id *)[_array itemAtIndex: idx]); } -- (void)getObjects: (id *)buffer inRange: (of_range_t)range +- (void)getObjects: (id *)buffer inRange: (OFRange)range { id const *objects = _array.items; size_t count = _array.count; if (range.length > SIZE_MAX - range.location || @@ -254,11 +254,11 @@ return OF_NOT_FOUND; } -- (OFArray *)objectsInRange: (of_range_t)range +- (OFArray *)objectsInRange: (OFRange)range { if (range.length > SIZE_MAX - range.location || range.location + range.length > _array.count) @throw [OFOutOfRangeException exception]; Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -268,11 +268,11 @@ * * @param buffer The buffer to copy the objects to * @param range The range to copy */ - (void)getObjects: (ObjectType __unsafe_unretained _Nonnull *_Nonnull)buffer - inRange: (of_range_t)range; + inRange: (OFRange)range; /** * @brief Returns the index of the first object that is equivalent to the * specified object or `OF_NOT_FOUND` if it was not found. * @@ -315,11 +315,11 @@ * @brief Returns the objects in the specified range as a new OFArray. * * @param range The range for the subarray * @return The subarray as a new autoreleased OFArray */ -- (OFArray OF_GENERIC(ObjectType) *)objectsInRange: (of_range_t)range; +- (OFArray OF_GENERIC(ObjectType) *)objectsInRange: (OFRange)range; /** * @brief Creates a string by joining all objects of the array. * * @param separator The string with which the objects should be joined Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -226,11 +226,11 @@ - (size_t)count { OF_UNRECOGNIZED_SELECTOR } -- (void)getObjects: (id *)buffer inRange: (of_range_t)range +- (void)getObjects: (id *)buffer inRange: (OFRange)range { for (size_t i = 0; i < range.length; i++) buffer[i] = [self objectAtIndex: range.location + i]; } @@ -238,11 +238,11 @@ { size_t count = self.count; id *buffer = of_alloc(count, sizeof(id)); @try { - [self getObjects: buffer inRange: of_range(0, count)]; + [self getObjects: buffer inRange: OFMakeRange(0, count)]; return [[OFData dataWithItemsNoCopy: buffer count: count itemSize: sizeof(id) freeWhenDone: true] items]; @@ -361,11 +361,11 @@ return [self objectAtIndex: count - 1]; return nil; } -- (OFArray *)objectsInRange: (of_range_t)range +- (OFArray *)objectsInRange: (OFRange)range { OFArray *ret; id *buffer; if (range.length > SIZE_MAX - range.location || @@ -743,11 +743,11 @@ - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state objects: (id *)objects count: (int)count { - of_range_t range = of_range(state->state, count); + OFRange range = OFMakeRange(state->state, count); if (range.length > SIZE_MAX - range.location) @throw [OFOutOfRangeException exception]; if (range.location + range.length > self.count) Index: src/OFCharacterSet.h ================================================================== --- src/OFCharacterSet.h +++ src/OFCharacterSet.h @@ -54,11 +54,11 @@ * range. * * @param range The range of characters for the character set * @return A new OFCharacterSet */ -+ (instancetype)characterSetWithRange: (of_range_t)range; ++ (instancetype)characterSetWithRange: (OFRange)range; /** * @brief A character set containing all Unicode characters in the category * `Zs` plus CHARACTER TABULATION (U+0009). */ @@ -78,11 +78,11 @@ * the specified range. * * @param range The range of characters for the character set * @return An initialized OFCharacterSet */ -- (instancetype)initWithRange: (of_range_t)range; +- (instancetype)initWithRange: (OFRange)range; /** * @brief Returns whether the specified character is a member of the character * set. * Index: src/OFCharacterSet.m ================================================================== --- src/OFCharacterSet.m +++ src/OFCharacterSet.m @@ -50,11 +50,11 @@ { return (id)[[OFBitSetCharacterSet alloc] initWithCharactersInString: characters]; } -- (instancetype)initWithRange: (of_range_t)range +- (instancetype)initWithRange: (OFRange)range { return (id)[[OFRangeCharacterSet alloc] initWithRange: range]; } - (instancetype)retain @@ -98,11 +98,11 @@ { return [[[self alloc] initWithCharactersInString: characters] autorelease]; } -+ (instancetype)characterSetWithRange: (of_range_t)range ++ (instancetype)characterSetWithRange: (OFRange)range { return [[[self alloc] initWithRange: range] autorelease]; } + (OFCharacterSet *)whitespaceCharacterSet @@ -132,11 +132,11 @@ - (instancetype)initWithCharactersInString: (OFString *)characters { OF_INVALID_INIT_METHOD } -- (instancetype)initWithRange: (of_range_t)range +- (instancetype)initWithRange: (OFRange)range { OF_INVALID_INIT_METHOD } - (bool)characterIsMember: (of_unichar_t)character Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -255,31 +255,31 @@ { [self finishInitialization]; return [self characterAtIndex: idx]; } -- (void)getCharacters: (of_unichar_t *)buffer inRange: (of_range_t)range +- (void)getCharacters: (of_unichar_t *)buffer inRange: (OFRange)range { [self finishInitialization]; [self getCharacters: buffer inRange: range]; } -- (of_range_t)rangeOfString: (OFString *)string +- (OFRange)rangeOfString: (OFString *)string { [self finishInitialization]; return [self rangeOfString: string]; } -- (of_range_t)rangeOfString: (OFString *)string options: (int)options +- (OFRange)rangeOfString: (OFString *)string options: (int)options { [self finishInitialization]; return [self rangeOfString: string options: options]; } -- (of_range_t)rangeOfString: (OFString *)string - options: (int)options - range: (of_range_t)range +- (OFRange)rangeOfString: (OFString *)string + options: (int)options + range: (OFRange)range { [self finishInitialization]; return [self rangeOfString: string options: options range: range]; } @@ -296,11 +296,11 @@ return [self indexOfCharacterFromSet: characterSet options: options]; } - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet options: (int)options - range: (of_range_t)range + range: (OFRange)range { [self finishInitialization]; return [self indexOfCharacterFromSet: characterSet options: options range: range]; @@ -322,11 +322,11 @@ { [self finishInitialization]; return [self substringToIndex: idx]; } -- (OFString *)substringWithRange: (of_range_t)range +- (OFString *)substringWithRange: (OFRange)range { [self finishInitialization]; return [self substringWithRange: range]; } @@ -364,11 +364,11 @@ } - (OFString *)stringByReplacingOccurrencesOfString: (OFString *)string withString: (OFString *)replacement options: (int)options - range: (of_range_t)range + range: (OFRange)range { [self finishInitialization]; return [self stringByReplacingOccurrencesOfString: string withString: replacement options: options Index: src/OFDNSResolverSettings.m ================================================================== --- src/OFDNSResolverSettings.m +++ src/OFDNSResolverSettings.m @@ -173,11 +173,11 @@ parseNetStackArray(OFString *string) { if (![string hasPrefix: @"["] || ![string hasSuffix: @"]"]) return nil; - string = [string substringWithRange: of_range(1, string.length - 2)]; + string = [string substringWithRange: OFMakeRange(1, string.length - 2)]; return [string componentsSeparatedByString: @"|"]; } #endif @@ -277,11 +277,11 @@ if (components.count < 2) continue; address = components.firstObject; hosts = [components objectsInRange: - of_range(1, components.count - 1)]; + OFMakeRange(1, components.count - 1)]; for (OFString *host in hosts) { OFMutableArray *addresses = [staticHosts objectForKey: host]; @@ -380,11 +380,11 @@ continue; } option = components.firstObject; arguments = [components objectsInRange: - of_range(1, components.count - 1)]; + OFMakeRange(1, components.count - 1)]; if ([option isEqual: @"nameserver"]) { if (arguments.count != 1) { objc_autoreleasePoolPop(pool2); continue; @@ -479,11 +479,11 @@ if (components.count < 2) continue; address = components.firstObject; hosts = [components objectsInRange: - of_range(1, components.count - 1)]; + OFMakeRange(1, components.count - 1)]; for (OFString *host in hosts) { OFMutableArray *addresses = [staticHosts objectForKey: host]; Index: src/OFData.h ================================================================== --- src/OFData.h +++ src/OFData.h @@ -290,11 +290,11 @@ * @brief Returns the data in the specified range as a new OFData. * * @param range The range of the data for the new OFData * @return The data in the specified range as a new OFData */ -- (OFData *)subdataWithRange: (of_range_t)range; +- (OFData *)subdataWithRange: (OFRange)range; /** * @brief Returns the range of the data. * * @param data The data to search for @@ -305,13 +305,13 @@ * `OF_DATA_SEARCH_BACKWARDS` | Search backwards in the data * @param range The range in which to search * @return The range of the first occurrence of the data or a range with * `OF_NOT_FOUND` as start position if it was not found. */ -- (of_range_t)rangeOfData: (OFData *)data - options: (int)options - range: (of_range_t)range; +- (OFRange)rangeOfData: (OFData *)data + options: (int)options + range: (OFRange)range; #ifdef OF_HAVE_FILES /** * @brief Writes the OFData into the specified file. * Index: src/OFData.m ================================================================== --- src/OFData.m +++ src/OFData.m @@ -491,11 +491,11 @@ OF_HASH_FINALIZE(hash); return hash; } -- (OFData *)subdataWithRange: (of_range_t)range +- (OFData *)subdataWithRange: (OFRange)range { OFData *ret; if (range.length > SIZE_MAX - range.location || range.location + range.length > _count) @@ -543,13 +543,13 @@ - (OFString *)stringByBase64Encoding { return of_base64_encode(_items, _count * _itemSize); } -- (of_range_t)rangeOfData: (OFData *)data - options: (int)options - range: (of_range_t)range +- (OFRange)rangeOfData: (OFData *)data + options: (int)options + range: (OFRange)range { const char *search; size_t searchLength; if (range.length > SIZE_MAX - range.location || @@ -558,22 +558,22 @@ if (data == nil || data.itemSize != _itemSize) @throw [OFInvalidArgumentException exception]; if ((searchLength = data.count) == 0) - return of_range(0, 0); + return OFMakeRange(0, 0); if (searchLength > range.length) - return of_range(OF_NOT_FOUND, 0); + return OFMakeRange(OF_NOT_FOUND, 0); search = data.items; if (options & OF_DATA_SEARCH_BACKWARDS) { for (size_t i = range.length - searchLength;; i--) { if (memcmp(_items + i * _itemSize, search, searchLength * _itemSize) == 0) - return of_range(i, searchLength); + return OFMakeRange(i, searchLength); /* No match and we're at the last item */ if (i == 0) break; } @@ -580,14 +580,14 @@ } else { for (size_t i = range.location; i <= range.length - searchLength; i++) if (memcmp(_items + i * _itemSize, search, searchLength * _itemSize) == 0) - return of_range(i, searchLength); + return OFMakeRange(i, searchLength); } - return of_range(OF_NOT_FOUND, 0); + return OFMakeRange(OF_NOT_FOUND, 0); } #ifdef OF_HAVE_FILES - (void)writeToFile: (OFString *)path { Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -458,16 +458,16 @@ if (![line hasPrefix: @"HTTP/"] || line.length < 9 || [line characterAtIndex: 8] != ' ') @throw [OFInvalidServerReplyException exception]; - _version = [[line substringWithRange: of_range(5, 3)] copy]; + _version = [[line substringWithRange: OFMakeRange(5, 3)] copy]; if (![_version isEqual: @"1.0"] && ![_version isEqual: @"1.1"]) @throw [OFUnsupportedVersionException exceptionWithVersion: _version]; - status = [line substringWithRange: of_range(9, 3)].longLongValue; + status = [line substringWithRange: OFMakeRange(9, 3)].longLongValue; if (status < 0 || status > 599) @throw [OFInvalidServerReplyException exception]; _status = (short)status; Index: src/OFHTTPCookie.m ================================================================== --- src/OFHTTPCookie.m +++ src/OFHTTPCookie.m @@ -93,11 +93,11 @@ } break; case STATE_NAME: if (characters[i] == '=') { name = [string substringWithRange: - of_range(last, i - last)]; + OFMakeRange(last, i - last)]; state = STATE_EXPECT_VALUE; } break; case STATE_EXPECT_VALUE: if (characters[i] == '"') { @@ -111,11 +111,11 @@ i--; break; case STATE_VALUE: if (characters[i] == ';' || characters[i] == ',') { value = [string substringWithRange: - of_range(last, i - last)]; + OFMakeRange(last, i - last)]; [ret addObject: [OFHTTPCookie cookieWithName: name value: value domain: domain]]; @@ -125,11 +125,11 @@ } break; case STATE_QUOTED_VALUE: if (characters[i] == '"') { value = [string substringWithRange: - of_range(last, i - last)]; + OFMakeRange(last, i - last)]; [ret addObject: [OFHTTPCookie cookieWithName: name value: value domain: domain]]; @@ -153,18 +153,18 @@ } break; case STATE_ATTR_NAME: if (characters[i] == '=') { name = [string substringWithRange: - of_range(last, i - last)]; + OFMakeRange(last, i - last)]; state = STATE_ATTR_VALUE; last = i + 1; } else if (characters[i] == ';' || characters[i] == ',') { name = [string substringWithRange: - of_range(last, i - last)]; + OFMakeRange(last, i - last)]; handleAttribute(ret.lastObject, name, nil); state = (characters[i] == ';' ? STATE_PRE_ATTR_NAME : STATE_PRE_NAME); @@ -172,11 +172,11 @@ break; case STATE_ATTR_VALUE: if (characters[i] == ';' || characters[i] == ',') { value = [string substringWithRange: - of_range(last, i - last)]; + OFMakeRange(last, i - last)]; /* * Expires often contains a comma, even though * the comma is used as a separator for * concatenating headers as per RFC 2616, @@ -213,11 +213,11 @@ case STATE_QUOTED_VALUE: @throw [OFInvalidFormatException exception]; break; case STATE_VALUE: value = [string substringWithRange: - of_range(last, length - last)]; + OFMakeRange(last, length - last)]; [ret addObject: [OFHTTPCookie cookieWithName: name value: value domain: domain]]; break; /* We end up here if the cookie is just foo= */ @@ -227,18 +227,18 @@ domain: domain]]; break; case STATE_ATTR_NAME: if (last != length) { name = [string substringWithRange: - of_range(last, length - last)]; + OFMakeRange(last, length - last)]; handleAttribute(ret.lastObject, name, nil); } break; case STATE_ATTR_VALUE: value = [string substringWithRange: - of_range(last, length - last)]; + OFMakeRange(last, length - last)]; handleAttribute(ret.lastObject, name, value); break; } Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -352,11 +352,11 @@ OFMutableString *path; size_t pos; @try { OFString *version = [line - substringWithRange: of_range(line.length - 9, 9)]; + substringWithRange: OFMakeRange(line.length - 9, 9)]; of_unichar_t tmp; if (![version hasPrefix: @" HTTP/1."]) return [self sendErrorAndClose: 505]; @@ -379,11 +379,11 @@ } @catch (OFInvalidArgumentException *e) { return [self sendErrorAndClose: 405]; } @try { - of_range_t range = of_range(pos + 1, line.length - pos - 10); + OFRange range = OFMakeRange(pos + 1, line.length - pos - 10); path = [[[line substringWithRange: range] mutableCopy] autorelease]; } @catch (OFOutOfRangeException *e) { return [self sendErrorAndClose: 400]; Index: src/OFINICategory.m ================================================================== --- src/OFINICategory.m +++ src/OFINICategory.m @@ -72,11 +72,11 @@ OFMutableString *mutableString; if (![string hasPrefix: @"\""] || ![string hasSuffix: @"\""]) return string; - string = [string substringWithRange: of_range(1, string.length - 2)]; + string = [string substringWithRange: OFMakeRange(1, string.length - 2)]; mutableString = [[string mutableCopy] autorelease]; [mutableString replaceOccurrencesOfString: @"\\f" withString: @"\f"]; [mutableString replaceOccurrencesOfString: @"\\r" withString: @"\r"]; [mutableString replaceOccurrencesOfString: @"\\n" withString: @"\n"]; Index: src/OFINIFile.m ================================================================== --- src/OFINIFile.m +++ src/OFINIFile.m @@ -137,11 +137,11 @@ if (![line hasSuffix: @"]"]) @throw [OFInvalidFormatException exception]; categoryName = [line substringWithRange: - of_range(1, line.length - 2)]; + OFMakeRange(1, line.length - 2)]; category = [[[OFINICategory alloc] of_initWithName: categoryName] autorelease]; [_categories addObject: category]; } else { if (category == nil) Index: src/OFMutableAdjacentArray.m ================================================================== --- src/OFMutableAdjacentArray.m +++ src/OFMutableAdjacentArray.m @@ -221,11 +221,11 @@ [objects[i] release]; [_array removeAllItems]; } -- (void)removeObjectsInRange: (of_range_t)range +- (void)removeObjectsInRange: (OFRange)range { id const *objects = _array.items; size_t count = _array.count; id *copy; Index: src/OFMutableArray.h ================================================================== --- src/OFMutableArray.h +++ src/OFMutableArray.h @@ -157,11 +157,11 @@ /** * @brief Removes the object in the specified range. * * @param range The range of the objects to remove */ -- (void)removeObjectsInRange: (of_range_t)range; +- (void)removeObjectsInRange: (OFRange)range; /** * @brief Removes the last object. */ - (void)removeLastObject; Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -360,11 +360,11 @@ return; } } } -- (void)removeObjectsInRange: (of_range_t)range +- (void)removeObjectsInRange: (OFRange)range { for (size_t i = 0; i < range.length; i++) [self removeObjectAtIndex: range.location]; } @@ -378,11 +378,11 @@ [self removeObjectAtIndex: count - 1]; } - (void)removeAllObjects { - [self removeObjectsInRange: of_range(0, self.count)]; + [self removeObjectsInRange: OFMakeRange(0, self.count)]; } #ifdef OF_HAVE_BLOCKS - (void)replaceObjectsUsingBlock: (of_array_replace_block_t)block { Index: src/OFMutableData.h ================================================================== --- src/OFMutableData.h +++ src/OFMutableData.h @@ -188,11 +188,11 @@ /** * @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; +- (void)removeItemsInRange: (OFRange)range; /** * @brief Removes the last item. */ - (void)removeLastItem; Index: src/OFMutableData.m ================================================================== --- src/OFMutableData.m +++ src/OFMutableData.m @@ -162,11 +162,11 @@ return NULL; return _items + (_count - 1) * _itemSize; } -- (OFData *)subdataWithRange: (of_range_t)range +- (OFData *)subdataWithRange: (OFRange)range { if (range.length > SIZE_MAX - range.location || range.location + range.length > _count) @throw [OFOutOfRangeException exception]; @@ -242,14 +242,14 @@ _count += count; } - (void)removeItemAtIndex: (size_t)idx { - [self removeItemsInRange: of_range(idx, 1)]; + [self removeItemsInRange: OFMakeRange(idx, 1)]; } -- (void)removeItemsInRange: (of_range_t)range +- (void)removeItemsInRange: (OFRange)range { if (range.length > SIZE_MAX - range.location || range.location + range.length > _count) @throw [OFOutOfRangeException exception]; Index: src/OFMutableString.h ================================================================== --- src/OFMutableString.h +++ src/OFMutableString.h @@ -154,19 +154,19 @@ /** * @brief Deletes the characters at the specified range. * * @param range The range of the characters which should be removed */ -- (void)deleteCharactersInRange: (of_range_t)range; +- (void)deleteCharactersInRange: (OFRange)range; /** * @brief Replaces the characters at the specified range. * * @param range The range of the characters which should be replaced * @param replacement The string to the replace the characters with */ -- (void)replaceCharactersInRange: (of_range_t)range +- (void)replaceCharactersInRange: (OFRange)range withString: (OFString *)replacement; /** * @brief Replaces all occurrences of a string with another string. * @@ -187,11 +187,11 @@ * @param range The range in which the string should be replaced */ - (void)replaceOccurrencesOfString: (OFString *)string withString: (OFString *)replacement options: (int)options - range: (of_range_t)range; + range: (OFRange)range; /** * @brief Deletes all whitespaces at the beginning of the string. */ - (void)deleteLeadingWhitespaces; Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -287,11 +287,11 @@ - (void)setCharacter: (of_unichar_t)character atIndex: (size_t)idx { void *pool = objc_autoreleasePoolPush(); OFString *string = [OFString stringWithCharacters: &character length: 1]; - [self replaceCharactersInRange: of_range(idx, 1) withString: string]; + [self replaceCharactersInRange: OFMakeRange(idx, 1) withString: string]; objc_autoreleasePoolPop(pool); } - (void)appendString: (OFString *)string { @@ -429,19 +429,19 @@ } #endif - (void)insertString: (OFString *)string atIndex: (size_t)idx { - [self replaceCharactersInRange: of_range(idx, 0) withString: string]; + [self replaceCharactersInRange: OFMakeRange(idx, 0) withString: string]; } -- (void)deleteCharactersInRange: (of_range_t)range +- (void)deleteCharactersInRange: (OFRange)range { [self replaceCharactersInRange: range withString: @""]; } -- (void)replaceCharactersInRange: (of_range_t)range +- (void)replaceCharactersInRange: (OFRange)range withString: (OFString *)replacement { OF_UNRECOGNIZED_SELECTOR } @@ -449,17 +449,17 @@ withString: (OFString *)replacement { [self replaceOccurrencesOfString: string withString: replacement options: 0 - range: of_range(0, self.length)]; + range: OFMakeRange(0, self.length)]; } - (void)replaceOccurrencesOfString: (OFString *)string withString: (OFString *)replacement options: (int)options - range: (of_range_t)range + range: (OFRange)range { void *pool = objc_autoreleasePoolPush(), *pool2; const of_unichar_t *characters; const of_unichar_t *searchCharacters = string.characters; size_t searchLength = string.length; @@ -483,11 +483,11 @@ for (size_t i = range.location; i <= range.length - searchLength; i++) { if (memcmp(characters + i, searchCharacters, searchLength * sizeof(of_unichar_t)) != 0) continue; - [self replaceCharactersInRange: of_range(i, searchLength) + [self replaceCharactersInRange: OFMakeRange(i, searchLength) withString: replacement]; range.length -= searchLength; range.length += replacementLength; @@ -515,11 +515,11 @@ break; } objc_autoreleasePoolPop(pool); - [self deleteCharactersInRange: of_range(0, i)]; + [self deleteCharactersInRange: OFMakeRange(0, i)]; } - (void)deleteTrailingWhitespaces { void *pool; @@ -542,11 +542,11 @@ d++; } objc_autoreleasePoolPop(pool); - [self deleteCharactersInRange: of_range(length - d, d)]; + [self deleteCharactersInRange: OFMakeRange(length - d, d)]; } - (void)deleteEnclosingWhitespaces { [self deleteLeadingWhitespaces]; Index: src/OFMutableURL.m ================================================================== --- src/OFMutableURL.m +++ src/OFMutableURL.m @@ -88,11 +88,11 @@ OFString *old; if ([URLEncodedHost hasPrefix: @"["] && [URLEncodedHost hasSuffix: @"]"]) { if (!of_url_is_ipv6_host([URLEncodedHost substringWithRange: - of_range(1, URLEncodedHost.length - 2)])) + OFMakeRange(1, URLEncodedHost.length - 2)])) @throw [OFInvalidFormatException exception]; } else if (URLEncodedHost != nil) of_url_verify_escaped(URLEncodedHost, [OFCharacterSet URLHostAllowedCharacterSet]); @@ -402,11 +402,11 @@ } if ([current isEqual: @".."] && parent != nil && ![parent isEqual: @".."]) { [array removeObjectsInRange: - of_range(i - 1, 2)]; + OFMakeRange(i - 1, 2)]; done = false; break; } } Index: src/OFMutableUTF8String.m ================================================================== --- src/OFMutableUTF8String.m +++ src/OFMutableUTF8String.m @@ -537,11 +537,11 @@ _s->isUTF8 = true; } else _s->isUTF8 = true; } -- (void)deleteCharactersInRange: (of_range_t)range +- (void)deleteCharactersInRange: (OFRange)range { size_t start = range.location; size_t end = range.location + range.length; if (range.length > SIZE_MAX - range.location || end > _s->length) @@ -566,11 +566,11 @@ } @catch (OFOutOfMemoryException *e) { /* We don't really care, as we only made it smaller */ } } -- (void)replaceCharactersInRange: (of_range_t)range +- (void)replaceCharactersInRange: (OFRange)range withString: (OFString *)replacement { size_t start = range.location; size_t end = range.location + range.length; size_t newCStringLength, newLength; @@ -630,11 +630,11 @@ } - (void)replaceOccurrencesOfString: (OFString *)string withString: (OFString *)replacement options: (int)options - range: (of_range_t)range + range: (OFRange)range { const char *searchString = string.UTF8String; const char *replacementString = replacement.UTF8String; size_t searchLength = string.UTF8StringLength; size_t replacementLength = replacement.UTF8StringLength; Index: src/OFNumber.h ================================================================== --- src/OFNumber.h +++ src/OFNumber.h @@ -127,11 +127,11 @@ #ifdef OF_HAVE_UNAVAILABLE + (instancetype)valueWithBytes: (const void *)bytes objCType: (const char *)objCType OF_UNAVAILABLE; + (instancetype)valueWithPointer: (const void *)pointer OF_UNAVAILABLE; + (instancetype)valueWithNonretainedObject: (id)object OF_UNAVAILABLE; -+ (instancetype)valueWithRange: (of_range_t)range OF_UNAVAILABLE; ++ (instancetype)valueWithRange: (OFRange)range OF_UNAVAILABLE; + (instancetype)valueWithPoint: (of_point_t)point OF_UNAVAILABLE; + (instancetype)valueWithDimension: (of_dimension_t)dimension OF_UNAVAILABLE; + (instancetype)valueWithRectangle: (of_rectangle_t)rectangle OF_UNAVAILABLE; #endif @@ -243,11 +243,11 @@ #ifdef OF_HAVE_UNAVAILABLE - (instancetype)initWithBytes: (const void *)bytes objCType: (const char *)objCType OF_UNAVAILABLE; - (instancetype)initWithPointer: (const void *)pointer OF_UNAVAILABLE; - (instancetype)initWithNonretainedObject: (id)object OF_UNAVAILABLE; -- (instancetype)initWithRange: (of_range_t)range OF_UNAVAILABLE; +- (instancetype)initWithRange: (OFRange)range OF_UNAVAILABLE; - (instancetype)initWithPoint: (of_point_t)point OF_UNAVAILABLE; - (instancetype)initWithDimension: (of_dimension_t)dimension OF_UNAVAILABLE; - (instancetype)initWithRectangle: (of_rectangle_t)rectangle OF_UNAVAILABLE; #endif Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -89,33 +89,33 @@ OFByteOrderNative = OFByteOrderLittleEndian #endif } OFByteOrder; /** - * @struct of_range_t OFObject.h ObjFW/OFObject.h + * @struct OFRange OFObject.h ObjFW/OFObject.h * * @brief A range. */ -struct OF_BOXABLE of_range_t { +struct OF_BOXABLE OFRange { /** The start of the range */ size_t location; /** The length of the range */ size_t length; }; -typedef struct of_range_t of_range_t; +typedef struct OFRange OFRange; /** - * @brief Creates a new of_range_t. + * @brief Creates a new OFRange. * * @param start The starting index of the range * @param length The length of the range - * @return An of_range with the specified start and length + * @return An OFRangeith the specified start and length */ -static OF_INLINE of_range_t OF_CONST_FUNC -of_range(size_t start, size_t length) +static OF_INLINE OFRange OF_CONST_FUNC +OFMakeRange(size_t start, size_t length) { - of_range_t range = { start, length }; + OFRange range = { start, length }; return range; } /** @@ -124,11 +124,11 @@ * @param range1 The first range for the comparison * @param range2 The second range for the comparison * @return Whether the two ranges are equal */ static OF_INLINE bool -of_range_equal(of_range_t range1, of_range_t range2) +OFEqualRanges(OFRange range1, OFRange range2) { if (range1.location != range2.location) return false; if (range1.length != range2.length) Index: src/OFOptionsParser.m ================================================================== --- src/OFOptionsParser.m +++ src/OFOptionsParser.m @@ -197,11 +197,11 @@ substringFromIndex: pos + 1] copy]; else pos = argument.length; _lastLongOption = [[argument substringWithRange: - of_range(2, pos - 2)] copy]; + OFMakeRange(2, pos - 2)] copy]; objc_autoreleasePoolPop(pool); option = [_longOptions objectForKey: _lastLongOption]; if (option == NULL) @@ -269,8 +269,8 @@ } - (OFArray *)remainingArguments { return [_arguments objectsInRange: - of_range(_index, _arguments.count - _index)]; + OFMakeRange(_index, _arguments.count - _index)]; } @end Index: src/OFRangeCharacterSet.h ================================================================== --- src/OFRangeCharacterSet.h +++ src/OFRangeCharacterSet.h @@ -17,10 +17,10 @@ OF_ASSUME_NONNULL_BEGIN @interface OFRangeCharacterSet: OFCharacterSet { - of_range_t _range; + OFRange _range; } @end OF_ASSUME_NONNULL_END Index: src/OFRangeCharacterSet.m ================================================================== --- src/OFRangeCharacterSet.m +++ src/OFRangeCharacterSet.m @@ -24,11 +24,11 @@ - (instancetype)init { OF_INVALID_INIT_METHOD } -- (instancetype)initWithRange: (of_range_t)range +- (instancetype)initWithRange: (OFRange)range { self = [super init]; @try { if (SIZE_MAX - range.location < range.length) Index: src/OFRangeValue.h ================================================================== --- src/OFRangeValue.h +++ src/OFRangeValue.h @@ -17,12 +17,12 @@ OF_ASSUME_NONNULL_BEGIN @interface OFRangeValue: OFValue { - of_range_t _range; + OFRange _range; } -- (instancetype)initWithRange: (of_range_t)range; +- (instancetype)initWithRange: (OFRange)range; @end OF_ASSUME_NONNULL_END Index: src/OFRangeValue.m ================================================================== --- src/OFRangeValue.m +++ src/OFRangeValue.m @@ -20,11 +20,11 @@ #import "OFOutOfRangeException.h" @implementation OFRangeValue @synthesize rangeValue = _range; -- (instancetype)initWithRange: (of_range_t)range +- (instancetype)initWithRange: (OFRange)range { self = [super init]; _range = range; @@ -31,11 +31,11 @@ return self; } - (const char *)objCType { - return @encode(of_range_t); + return @encode(OFRange); } - (void)getValue: (void *)value size: (size_t)size { if (size != sizeof(_range)) @@ -45,9 +45,9 @@ } - (OFString *)description { return [OFString stringWithFormat: - @"", + @"", _range.location, _range.length]; } @end Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -912,20 +912,20 @@ * buffer. * * @param buffer The buffer to store the Unicode characters * @param range The range of the Unicode characters to copy */ -- (void)getCharacters: (of_unichar_t *)buffer inRange: (of_range_t)range; +- (void)getCharacters: (of_unichar_t *)buffer inRange: (OFRange)range; /** * @brief Returns the range of the first occurrence of the string. * * @param string The string to search * @return The range of the first occurrence of the string or a range with * `OF_NOT_FOUND` as start position if it was not found */ -- (of_range_t)rangeOfString: (OFString *)string; +- (OFRange)rangeOfString: (OFString *)string; /** * @brief Returns the range of the string. * * @param string The string to search @@ -935,11 +935,11 @@ * -----------------------------|------------------------------- * `OF_STRING_SEARCH_BACKWARDS` | Search backwards in the string * @return The range of the first occurrence of the string or a range with * `OF_NOT_FOUND` as start position if it was not found */ -- (of_range_t)rangeOfString: (OFString *)string options: (int)options; +- (OFRange)rangeOfString: (OFString *)string options: (int)options; /** * @brief Returns the range of the string in the specified range. * * @param string The string to search @@ -950,13 +950,13 @@ * `OF_STRING_SEARCH_BACKWARDS` | Search backwards in the string * @param range The range in which to search * @return The range of the first occurrence of the string or a range with * `OF_NOT_FOUND` as start position if it was not found */ -- (of_range_t)rangeOfString: (OFString *)string - options: (int)options - range: (of_range_t)range; +- (OFRange)rangeOfString: (OFString *)string + options: (int)options + range: (OFRange)range; /** * @brief Returns the index of the first character from the set. * * @param characterSet The set of characters to search for @@ -993,11 +993,11 @@ * @return The index of the first occurrence of a character from the set or * `OF_NOT_FOUND` if it was not found */ - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet options: (int)options - range: (of_range_t)range; + range: (OFRange)range; /** * @brief Returns whether the string contains the specified string. * * @param string The string to search @@ -1025,11 +1025,11 @@ * @brief Creates a substring with the specified range. * * @param range The range of the substring * @return The substring as a new autoreleased OFString */ -- (OFString *)substringWithRange: (of_range_t)range; +- (OFString *)substringWithRange: (OFRange)range; /** * @brief The value of the string in the specified base as a `long long`. * * Leading and trailing whitespaces are ignored. @@ -1126,11 +1126,11 @@ * @return A new string with the occurrences of the specified string replaced */ - (OFString *)stringByReplacingOccurrencesOfString: (OFString *)string withString: (OFString *)replacement options: (int)options - range: (of_range_t)range; + range: (OFRange)range; /** * @brief Checks whether the string has the specified prefix. * * @param prefix The prefix to check for Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -1503,11 +1503,11 @@ { OF_UNRECOGNIZED_SELECTOR } - (void)getCharacters: (of_unichar_t *)buffer - inRange: (of_range_t)range + inRange: (OFRange)range { for (size_t i = 0; i < range.length; i++) buffer[i] = [self characterAtIndex: range.location + i]; } @@ -1796,38 +1796,38 @@ [data addItems: self.UTF8String count: length]; return data; } -- (of_range_t)rangeOfString: (OFString *)string +- (OFRange)rangeOfString: (OFString *)string { return [self rangeOfString: string options: 0 - range: of_range(0, self.length)]; + range: OFMakeRange(0, self.length)]; } -- (of_range_t)rangeOfString: (OFString *)string options: (int)options +- (OFRange)rangeOfString: (OFString *)string options: (int)options { return [self rangeOfString: string options: options - range: of_range(0, self.length)]; + range: OFMakeRange(0, self.length)]; } -- (of_range_t)rangeOfString: (OFString *)string - options: (int)options - range: (of_range_t)range +- (OFRange)rangeOfString: (OFString *)string + options: (int)options + range: (OFRange)range { void *pool; const of_unichar_t *searchCharacters; of_unichar_t *characters; size_t searchLength; if ((searchLength = string.length) == 0) - return of_range(0, 0); + return OFMakeRange(0, 0); if (searchLength > range.length) - return of_range(OF_NOT_FOUND, 0); + return OFMakeRange(OF_NOT_FOUND, 0); if (range.length > SIZE_MAX / sizeof(of_unichar_t)) @throw [OFOutOfRangeException exception]; pool = objc_autoreleasePoolPush(); @@ -1841,11 +1841,11 @@ if (options & OF_STRING_SEARCH_BACKWARDS) { for (size_t i = range.length - searchLength;; i--) { if (memcmp(characters + i, searchCharacters, searchLength * sizeof(of_unichar_t)) == 0) { objc_autoreleasePoolPop(pool); - return of_range(range.location + i, + return OFMakeRange(range.location + i, searchLength); } /* No match and we're at the last character */ if (i == 0) @@ -1855,11 +1855,11 @@ for (size_t i = 0; i <= range.length - searchLength; i++) { if (memcmp(characters + i, searchCharacters, searchLength * sizeof(of_unichar_t)) == 0) { objc_autoreleasePoolPop(pool); - return of_range(range.location + i, + return OFMakeRange(range.location + i, searchLength); } } } } @finally { @@ -1866,31 +1866,31 @@ free(characters); } objc_autoreleasePoolPop(pool); - return of_range(OF_NOT_FOUND, 0); + return OFMakeRange(OF_NOT_FOUND, 0); } - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet { return [self indexOfCharacterFromSet: characterSet options: 0 - range: of_range(0, self.length)]; + range: OFMakeRange(0, self.length)]; } - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet options: (int)options { return [self indexOfCharacterFromSet: characterSet options: options - range: of_range(0, self.length)]; + range: OFMakeRange(0, self.length)]; } - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet options: (int)options - range: (of_range_t)range + range: (OFRange)range { bool (*characterIsMember)(id, SEL, of_unichar_t) = (bool (*)(id, SEL, of_unichar_t))[characterSet methodForSelector: @selector(characterIsMember:)]; of_unichar_t *characters; @@ -1960,19 +1960,19 @@ return false; } - (OFString *)substringFromIndex: (size_t)idx { - return [self substringWithRange: of_range(idx, self.length - idx)]; + return [self substringWithRange: OFMakeRange(idx, self.length - idx)]; } - (OFString *)substringToIndex: (size_t)idx { - return [self substringWithRange: of_range(0, idx)]; + return [self substringWithRange: OFMakeRange(0, idx)]; } -- (OFString *)substringWithRange: (of_range_t)range +- (OFString *)substringWithRange: (OFRange)range { void *pool; OFString *ret; if (range.length > SIZE_MAX - range.location || @@ -2039,11 +2039,11 @@ } - (OFString *)stringByReplacingOccurrencesOfString: (OFString *)string withString: (OFString *)replacement options: (int)options - range: (of_range_t)range + range: (OFRange)range { OFMutableString *new = [[self mutableCopy] autorelease]; [new replaceOccurrencesOfString: string withString: replacement options: options @@ -2111,11 +2111,11 @@ tmp = of_alloc(prefixLength, sizeof(of_unichar_t)); @try { void *pool = objc_autoreleasePoolPush(); - [self getCharacters: tmp inRange: of_range(0, prefixLength)]; + [self getCharacters: tmp inRange: OFMakeRange(0, prefixLength)]; hasPrefix = (memcmp(tmp, prefix.characters, prefixLength * sizeof(of_unichar_t)) == 0); objc_autoreleasePoolPop(pool); @@ -2141,11 +2141,11 @@ tmp = of_alloc(suffixLength, sizeof(of_unichar_t)); @try { void *pool = objc_autoreleasePoolPush(); [self getCharacters: tmp - inRange: of_range(length - suffixLength, + inRange: OFMakeRange(length - suffixLength, suffixLength)]; suffixCharacters = suffix.characters; hasSuffix = (memcmp(tmp, suffixCharacters, suffixLength * sizeof(of_unichar_t)) == 0); @@ -2200,18 +2200,19 @@ for (size_t i = 0; i <= length - delimiterLength; i++) { if (memcmp(characters + i, delimiterCharacters, delimiterLength * sizeof(of_unichar_t)) != 0) continue; - component = [self substringWithRange: of_range(last, i - last)]; + component = [self substringWithRange: + OFMakeRange(last, i - last)]; if (!skipEmpty || component.length > 0) [array addObject: component]; i += delimiterLength - 1; last = i + 1; } - component = [self substringWithRange: of_range(last, length - last)]; + component = [self substringWithRange: OFMakeRange(last, length - last)]; if (!skipEmpty || component.length > 0) [array addObject: component]; [array makeImmutable]; @@ -2245,20 +2246,20 @@ for (size_t i = 0; i < length; i++) { if (characterIsMember(characterSet, @selector(characterIsMember:), characters[i])) { if (!skipEmpty || i != last) { OFString *component = [self substringWithRange: - of_range(last, i - last)]; + OFMakeRange(last, i - last)]; [array addObject: component]; } last = i + 1; } } if (!skipEmpty || length != last) { OFString *component = [self substringWithRange: - of_range(last, length - last)]; + OFMakeRange(last, length - last)]; [array addObject: component]; } [array makeImmutable]; @@ -2527,11 +2528,11 @@ size_t length = self.length; of_unichar_t *buffer; buffer = of_alloc(length, sizeof(of_unichar_t)); @try { - [self getCharacters: buffer inRange: of_range(0, length)]; + [self getCharacters: buffer inRange: OFMakeRange(0, length)]; return [[OFData dataWithItemsNoCopy: buffer count: length itemSize: sizeof(of_unichar_t) freeWhenDone: true] items]; @@ -2628,11 +2629,11 @@ size_t length = self.length; of_char32_t *buffer; buffer = of_alloc(length + 1, sizeof(of_char32_t)); @try { - [self getCharacters: buffer inRange: of_range(0, length)]; + [self getCharacters: buffer inRange: OFMakeRange(0, length)]; buffer[length] = 0; if (byteOrder != OFByteOrderNative) for (size_t i = 0; i < length; i++) buffer[i] = OF_BSWAP32(buffer[i]); @@ -2758,22 +2759,22 @@ if (characters[i] == '\n' || characters[i] == '\r') { void *pool2 = objc_autoreleasePoolPush(); block([self substringWithRange: - of_range(last, i - last)], &stop); + OFMakeRange(last, i - last)], &stop); last = i + 1; objc_autoreleasePoolPop(pool2); } lastCarriageReturn = (characters[i] == '\r'); } if (!stop) - block([self substringWithRange: of_range(last, i - last)], + block([self substringWithRange: OFMakeRange(last, i - last)], &stop); objc_autoreleasePoolPop(pool); } #endif @end Index: src/OFSubarray.h ================================================================== --- src/OFSubarray.h +++ src/OFSubarray.h @@ -18,13 +18,13 @@ OF_ASSUME_NONNULL_BEGIN @interface OFSubarray: OFArray { OFArray *_array; - of_range_t _range; + OFRange _range; } -+ (instancetype)arrayWithArray: (OFArray *)array range: (of_range_t)range; -- (instancetype)initWithArray: (OFArray *)array range: (of_range_t)range; ++ (instancetype)arrayWithArray: (OFArray *)array range: (OFRange)range; +- (instancetype)initWithArray: (OFArray *)array range: (OFRange)range; @end OF_ASSUME_NONNULL_END Index: src/OFSubarray.m ================================================================== --- src/OFSubarray.m +++ src/OFSubarray.m @@ -18,16 +18,16 @@ #import "OFSubarray.h" #import "OFOutOfRangeException.h" @implementation OFSubarray -+ (instancetype)arrayWithArray: (OFArray *)array range: (of_range_t)range ++ (instancetype)arrayWithArray: (OFArray *)array range: (OFRange)range { return [[[self alloc] initWithArray: array range: range] autorelease]; } -- (instancetype)initWithArray: (OFArray *)array range: (of_range_t)range +- (instancetype)initWithArray: (OFArray *)array range: (OFRange)range { self = [super init]; @try { /* Should usually be retain, as it's useless with a copy */ @@ -59,11 +59,11 @@ @throw [OFOutOfRangeException exception]; return [_array objectAtIndex: idx + _range.location]; } -- (void)getObjects: (id *)buffer inRange: (of_range_t)range +- (void)getObjects: (id *)buffer inRange: (OFRange)range { if (range.length > SIZE_MAX - range.location || range.location + range.length > _range.length) @throw [OFOutOfRangeException exception]; @@ -100,11 +100,11 @@ return OF_NOT_FOUND; return idx; } -- (OFArray *)objectsInRange: (of_range_t)range +- (OFArray *)objectsInRange: (OFRange)range { if (range.length > SIZE_MAX - range.location || range.location + range.length > _range.length) @throw [OFOutOfRangeException exception]; Index: src/OFSystemInfo.m ================================================================== --- src/OFSystemInfo.m +++ src/OFSystemInfo.m @@ -388,11 +388,11 @@ if ((home = [env objectForKey: @"HOME"]) == nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; - [path deleteCharactersInRange: of_range(0, 1)]; + [path deleteCharactersInRange: OFMakeRange(0, 1)]; [path prependString: home]; } [path makeImmutable]; @@ -480,11 +480,11 @@ if ((home = [env objectForKey: @"HOME"]) == nil) @throw [OFNotImplementedException exceptionWithSelector: _cmd object: self]; - [path deleteCharactersInRange: of_range(0, 1)]; + [path deleteCharactersInRange: OFMakeRange(0, 1)]; [path prependString: home]; } [path appendString: @"/Preferences"]; [path makeImmutable]; Index: src/OFURL.m ================================================================== --- src/OFURL.m +++ src/OFURL.m @@ -674,11 +674,11 @@ OFMutableString *path = [OFMutableString stringWithString: (URL->_URLEncodedPath != nil ? URL->_URLEncodedPath : @"/")]; - of_range_t range = [path + OFRange range = [path rangeOfString: @"/" options: OF_STRING_SEARCH_BACKWARDS]; if (range.location == OF_NOT_FOUND) @throw [OFInvalidFormatException @@ -877,11 +877,11 @@ - (OFString *)host { if ([_URLEncodedHost hasPrefix: @"["] && [_URLEncodedHost hasSuffix: @"]"]) { OFString *host = [_URLEncodedHost substringWithRange: - of_range(1, _URLEncodedHost.length - 2)]; + OFMakeRange(1, _URLEncodedHost.length - 2)]; if (!of_url_is_ipv6_host(host)) @throw [OFInvalidArgumentException exception]; return host; Index: src/OFUTF8String.m ================================================================== --- src/OFUTF8String.m +++ src/OFUTF8String.m @@ -963,11 +963,11 @@ @throw [OFInvalidEncodingException exception]; return character; } -- (void)getCharacters: (of_unichar_t *)buffer inRange: (of_range_t)range +- (void)getCharacters: (of_unichar_t *)buffer inRange: (OFRange)range { /* TODO: Could be slightly optimized */ void *pool = objc_autoreleasePoolPush(); const of_unichar_t *characters = self.characters; @@ -979,13 +979,13 @@ range.length * sizeof(of_unichar_t)); objc_autoreleasePoolPop(pool); } -- (of_range_t)rangeOfString: (OFString *)string - options: (int)options - range: (of_range_t)range +- (OFRange)rangeOfString: (OFString *)string + options: (int)options + range: (OFRange)range { const char *cString = string.UTF8String; size_t cStringLength = string.UTF8StringLength; size_t rangeLocation, rangeLength; @@ -1003,14 +1003,14 @@ rangeLocation = range.location; rangeLength = range.length; } if (cStringLength == 0) - return of_range(0, 0); + return OFMakeRange(0, 0); if (cStringLength > rangeLength) - return of_range(OF_NOT_FOUND, 0); + return OFMakeRange(OF_NOT_FOUND, 0); if (options & OF_STRING_SEARCH_BACKWARDS) { for (size_t i = rangeLength - cStringLength;; i--) { if (memcmp(_s->cString + rangeLocation + i, cString, cStringLength) == 0) { @@ -1021,11 +1021,11 @@ return range; } /* Did not match and we're at the last char */ if (i == 0) - return of_range(OF_NOT_FOUND, 0); + return OFMakeRange(OF_NOT_FOUND, 0); } } else { for (size_t i = 0; i <= rangeLength - cStringLength; i++) { if (memcmp(_s->cString + rangeLocation + i, cString, cStringLength) == 0) { @@ -1036,11 +1036,11 @@ return range; } } } - return of_range(OF_NOT_FOUND, 0); + return OFMakeRange(OF_NOT_FOUND, 0); } - (bool)containsString: (OFString *)string { const char *cString = string.UTF8String; @@ -1057,11 +1057,11 @@ return true; return false; } -- (OFString *)substringWithRange: (of_range_t)range +- (OFString *)substringWithRange: (OFRange)range { size_t start = range.location; size_t end = range.location + range.length; if (range.length > SIZE_MAX - range.location || end > _s->length) Index: src/OFValue.h ================================================================== --- src/OFValue.h +++ src/OFValue.h @@ -49,11 +49,11 @@ /** * @brief The value as a range. * * If the value is not range-sized, @ref OFOutOfRangeException is thrown. */ -@property (readonly, nonatomic) of_range_t rangeValue; +@property (readonly, nonatomic) OFRange rangeValue; /** * @brief The value as a point. * * If the value is not point-sized, @ref OFOutOfRangeException is thrown. @@ -111,11 +111,11 @@ * @brief Creates a new, autoreleased OFValue containing the specified range. * * @param range The range the OFValue should contain * @return A new, autoreleased OFValue */ -+ (instancetype)valueWithRange: (of_range_t)range; ++ (instancetype)valueWithRange: (OFRange)range; /** * @brief Creates a new, autoreleased OFValue containing the specified point. * * @param point The point the OFValue should contain Index: src/OFValue.m ================================================================== --- src/OFValue.m +++ src/OFValue.m @@ -51,11 +51,11 @@ { return [[[OFNonretainedObjectValue alloc] initWithNonretainedObject: object] autorelease]; } -+ (instancetype)valueWithRange: (of_range_t)range ++ (instancetype)valueWithRange: (OFRange)range { return [[[OFRangeValue alloc] initWithRange: range] autorelease]; } + (instancetype)valueWithPoint: (of_point_t)point @@ -171,13 +171,13 @@ id ret; [self getValue: &ret size: sizeof(ret)]; return ret; } -- (of_range_t)rangeValue +- (OFRange)rangeValue { - of_range_t ret; + OFRange ret; [self getValue: &ret size: sizeof(ret)]; return ret; } - (of_point_t)pointValue Index: src/OFZIPArchive.m ================================================================== --- src/OFZIPArchive.m +++ src/OFZIPArchive.m @@ -666,12 +666,12 @@ OF_ZIP_ARCHIVE_ENTRY_EXTRA_FIELD_ZIP64, &ZIP64Size); if (ZIP64Index != OF_NOT_FOUND) { const uint8_t *ZIP64 = [extraField itemAtIndex: ZIP64Index]; - of_range_t range = - of_range(ZIP64Index - 4, ZIP64Size + 4); + OFRange range = + OFMakeRange(ZIP64Index - 4, ZIP64Size + 4); if (_uncompressedSize == 0xFFFFFFFF) _uncompressedSize = of_zip_archive_read_field64( &ZIP64, &ZIP64Size); if (_compressedSize == 0xFFFFFFFF) Index: src/OFZIPArchiveEntry.m ================================================================== --- src/OFZIPArchiveEntry.m +++ src/OFZIPArchiveEntry.m @@ -255,12 +255,12 @@ OF_ZIP_ARCHIVE_ENTRY_EXTRA_FIELD_ZIP64, &ZIP64Size); if (ZIP64Index != OF_NOT_FOUND) { const uint8_t *ZIP64 = [extraField itemAtIndex: ZIP64Index]; - of_range_t range = - of_range(ZIP64Index - 4, ZIP64Size + 4); + OFRange range = + OFMakeRange(ZIP64Index - 4, ZIP64Size + 4); if (_uncompressedSize == 0xFFFFFFFF) _uncompressedSize = of_zip_archive_read_field64( &ZIP64, &ZIP64Size); if (_compressedSize == 0xFFFFFFFF) Index: src/platform/amiga/OFString+PathAdditions.m ================================================================== --- src/platform/amiga/OFString+PathAdditions.m +++ src/platform/amiga/OFString+PathAdditions.m @@ -153,11 +153,11 @@ objc_autoreleasePoolPop(pool); return @""; } components = [components objectsInRange: - of_range(0, components.count - 1)]; + OFMakeRange(0, components.count - 1)]; ret = [OFString pathWithComponents: components]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; @@ -233,11 +233,11 @@ } if ([component isEqual: @"/"] && parent != nil && ![parent isEqual: @"/"]) { [array removeObjectsInRange: - of_range(i - 1, 2)]; + OFMakeRange(i - 1, 2)]; done = false; break; } } Index: src/platform/libfat/OFString+PathAdditions.m ================================================================== --- src/platform/libfat/OFString+PathAdditions.m +++ src/platform/libfat/OFString+PathAdditions.m @@ -279,11 +279,11 @@ } if ([component isEqual: @".."] && parent != nil && ![parent isEqual: @".."]) { [array removeObjectsInRange: - of_range(i - 1, 2)]; + OFMakeRange(i - 1, 2)]; done = false; break; } } Index: src/platform/posix/OFString+PathAdditions.m ================================================================== --- src/platform/posix/OFString+PathAdditions.m +++ src/platform/posix/OFString+PathAdditions.m @@ -275,11 +275,11 @@ } if ([component isEqual: @".."] && parent != nil && ![parent isEqual: @".."]) { [array removeObjectsInRange: - of_range(i - 1, 2)]; + OFMakeRange(i - 1, 2)]; done = false; break; } } Index: src/platform/windows/OFString+PathAdditions.m ================================================================== --- src/platform/windows/OFString+PathAdditions.m +++ src/platform/windows/OFString+PathAdditions.m @@ -201,11 +201,11 @@ objc_autoreleasePoolPop(pool); return @"."; } components = [components objectsInRange: - of_range(0, components.count - 1)]; + OFMakeRange(0, components.count - 1)]; ret = [OFString pathWithComponents: components]; [ret retain]; objc_autoreleasePoolPop(pool); return [ret autorelease]; @@ -286,11 +286,11 @@ ![parent hasSuffix: @":"] && ![parent hasSuffix: @":\\"] && ![parent hasSuffix: @"://"] && (![parent hasPrefix: @"\\"] || i != 1)) { [array removeObjectsInRange: - of_range(i - 1, 2)]; + OFMakeRange(i - 1, 2)]; done = false; break; } } @@ -337,11 +337,11 @@ *URLEncodedHost = [[components objectAtIndex: 1] stringByURLEncodingWithAllowedCharacters: [OFCharacterSet URLHostAllowedCharacterSet]]; path = [OFString pathWithComponents: [components - objectsInRange: of_range(2, components.count - 2)]]; + objectsInRange: OFMakeRange(2, components.count - 2)]]; } path = [path stringByReplacingOccurrencesOfString: @"\\" withString: @"/"]; path = [path stringByPrependingString: @"/"]; Index: tests/OFArrayTests.m ================================================================== --- tests/OFArrayTests.m +++ tests/OFArrayTests.m @@ -180,11 +180,11 @@ TEST(@"-[indexOfObjectIdenticalTo:]", [a[1] indexOfObjectIdenticalTo: c_ary[1]] == 1) TEST(@"-[objectsInRange:]", - [[a[0] objectsInRange: of_range(1, 2)] isEqual: + [[a[0] objectsInRange: OFMakeRange(1, 2)] isEqual: [arrayClass arrayWithObjects: c_ary[1], c_ary[2], nil]]) TEST(@"-[replaceObject:withObject:]", R([m[0] replaceObject: c_ary[1] withObject: c_ary[0]]) && [[m[0] objectAtIndex: 0] isEqual: c_ary[0]] && @@ -213,11 +213,11 @@ TEST(@"-[removeObjectAtIndex:]", R([m[1] removeObjectAtIndex: 1]) && m[1].count == 2 && [[m[1] objectAtIndex: 1] isEqual: c_ary[2]]) m[1] = [[a[0] mutableCopy] autorelease]; TEST(@"-[removeObjectsInRange:]", - R([m[1] removeObjectsInRange: of_range(0, 2)]) && + R([m[1] removeObjectsInRange: OFMakeRange(0, 2)]) && m[1].count == 1 && [[m[1] objectAtIndex: 0] isEqual: c_ary[2]]) m[1] = [[a[0] mutableCopy] autorelease]; [m[1] addObject: @"qux"]; [m[1] addObject: @"last"]; @@ -246,11 +246,11 @@ EXPECT_EXCEPTION(@"Detect out of range in -[objectAtIndex:]", OFOutOfRangeException, [a[0] objectAtIndex: a[0].count]) EXPECT_EXCEPTION(@"Detect out of range in -[removeObjectsInRange:]", OFOutOfRangeException, [m[0] removeObjectsInRange: - of_range(0, m[0].count + 1)]) + OFMakeRange(0, m[0].count + 1)]) TEST(@"-[componentsJoinedByString:]", (a[1] = [arrayClass arrayWithObjects: @"", @"a", @"b", @"c", nil]) && [[a[1] componentsJoinedByString: @" "] isEqual: @" a b c"] && Index: tests/OFCharacterSetTests.m ================================================================== --- tests/OFCharacterSetTests.m +++ tests/OFCharacterSetTests.m @@ -72,11 +72,12 @@ TEST(@"-[characterIsMember:]", ok); module = @"OFRangeCharacterSet"; TEST(@"+[characterSetWithRange:]", - (cs = [OFCharacterSet characterSetWithRange: of_range('0', 10)]) && + (cs = [OFCharacterSet + characterSetWithRange: OFMakeRange('0', 10)]) && [cs isKindOfClass: [OFRangeCharacterSet class]]) ok = true; for (of_unichar_t c = 0; c < 65536; c++) { if (c >= '0' && c <= '9') { Index: tests/OFDataTests.m ================================================================== --- tests/OFDataTests.m +++ tests/OFDataTests.m @@ -27,11 +27,11 @@ { void *pool = objc_autoreleasePoolPush(); OFMutableData *mutable; OFData *immutable; void *raw[2]; - of_range_t range; + OFRange range; TEST(@"+[dataWithItemSize:]", (mutable = [OFMutableData dataWithItemSize: 4096])) raw[0] = of_alloc(1, 4096); @@ -74,11 +74,11 @@ TEST(@"-[removeLastItem]", R([mutable removeLastItem]) && mutable.count == 5 && memcmp(mutable.items, "abcde", 5) == 0) TEST(@"-[removeItemsInRange:]", - R([mutable removeItemsInRange: of_range(1, 2)]) && + R([mutable removeItemsInRange: OFMakeRange(1, 2)]) && mutable.count == 3 && memcmp(mutable.items, "ade", 3) == 0) TEST(@"-[insertItems:atIndex:count:]", R([mutable insertItems: "bc" atIndex: 1 count: 2]) && mutable.count == 5 && memcmp(mutable.items, "abcde", 5) == 0) @@ -89,51 +89,51 @@ range = [immutable rangeOfData: [OFData dataWithItems: "aa" count: 1 itemSize: 2] options: 0 - range: of_range(0, 7)]; + range: OFMakeRange(0, 7)]; TEST(@"-[rangeOfData:options:range:] #1", range.location == 0 && range.length == 1) range = [immutable rangeOfData: [OFData dataWithItems: "aa" count: 1 itemSize: 2] options: OF_DATA_SEARCH_BACKWARDS - range: of_range(0, 7)]; + range: OFMakeRange(0, 7)]; TEST(@"-[rangeOfData:options:range:] #2", range.location == 5 && range.length == 1) range = [immutable rangeOfData: [OFData dataWithItems: "ac" count: 1 itemSize: 2] options: 0 - range: of_range(0, 7)]; + range: OFMakeRange(0, 7)]; TEST(@"-[rangeOfData:options:range:] #3", range.location == 2 && range.length == 1) range = [immutable rangeOfData: [OFData dataWithItems: "aabb" count: 2 itemSize: 2] - options: 0 - range: of_range(0, 7)]; + options: 0 + range: OFMakeRange(0, 7)]; TEST(@"-[rangeOfData:options:range:] #4", range.location == 5 && range.length == 2) TEST(@"-[rangeOfData:options:range:] #5", R(range = [immutable rangeOfData: [OFData dataWithItems: "aa" count: 1 itemSize: 2] options: 0 - range: of_range(1, 6)]) && + range: OFMakeRange(1, 6)]) && range.location == 5 && range.length == 1) range = [immutable rangeOfData: [OFData dataWithItems: "aa" count: 1 itemSize: 2] options: OF_DATA_SEARCH_BACKWARDS - range: of_range(0, 5)]; + range: OFMakeRange(0, 5)]; TEST(@"-[rangeOfData:options:range:] #6", range.location == 0 && range.length == 1) EXPECT_EXCEPTION( @"-[rangeOfData:options:range:] failing on different itemSize", @@ -140,35 +140,37 @@ OFInvalidArgumentException, [immutable rangeOfData: [OFData dataWithItems: "aaa" count: 1 itemSize: 3] options: 0 - range: of_range(0, 1)]) + range: OFMakeRange(0, 1)]) EXPECT_EXCEPTION( @"-[rangeOfData:options:range:] failing on out of range", OFOutOfRangeException, [immutable rangeOfData: [OFData dataWithItems: "" count: 0 itemSize: 2] options: 0 - range: of_range(8, 1)]) + range: OFMakeRange(8, 1)]) TEST(@"-[subdataWithRange:]", - [[immutable subdataWithRange: of_range(2, 4)] + [[immutable subdataWithRange: OFMakeRange(2, 4)] isEqual: [OFData dataWithItems: "accdacaa" count: 4 itemSize: 2]] && - [[mutable subdataWithRange: of_range(2, 3)] + [[mutable subdataWithRange: OFMakeRange(2, 3)] isEqual: [OFData dataWithItems: "cde" count: 3]]) EXPECT_EXCEPTION(@"-[subdataWithRange:] failing on out of range #1", - OFOutOfRangeException, [immutable subdataWithRange: of_range(7, 1)]) + OFOutOfRangeException, + [immutable subdataWithRange: OFMakeRange(7, 1)]) EXPECT_EXCEPTION(@"-[subdataWithRange:] failing on out of range #2", - OFOutOfRangeException, [mutable subdataWithRange: of_range(6, 1)]) + OFOutOfRangeException, + [mutable subdataWithRange: OFMakeRange(6, 1)]) TEST(@"-[stringByMD5Hashing]", [mutable.stringByMD5Hashing isEqual: @"ab56b4d92b40713acc5af89985d4b786"]) TEST(@"-[stringByRIPEMD160Hashing]", [mutable.stringByRIPEMD160Hashing @@ -212,13 +214,13 @@ EXPECT_EXCEPTION(@"Detect out of range in -[addItems:count:]", OFOutOfRangeException, [mutable addItems: raw[0] count: SIZE_MAX]) EXPECT_EXCEPTION(@"Detect out of range in -[removeItemsInRange:]", OFOutOfRangeException, - [mutable removeItemsInRange: of_range(mutable.count, 1)]) + [mutable removeItemsInRange: OFMakeRange(mutable.count, 1)]) free(raw[0]); free(raw[1]); objc_autoreleasePoolPop(pool); } @end Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -185,11 +185,11 @@ { if (self == [SimpleMutableString class]) [self inheritMethodsFromClass: [SimpleString class]]; } -- (void)replaceCharactersInRange: (of_range_t)range +- (void)replaceCharactersInRange: (OFRange)range withString: (OFString *)string { [_string replaceCharactersInRange: range withString: string]; } @end @@ -498,11 +498,11 @@ options: OF_STRING_SEARCH_BACKWARDS].location == OF_NOT_FOUND) EXPECT_EXCEPTION( @"Detect out of range in -[rangeOfString:options:range:]", OFOutOfRangeException, - [C(@"𝄞öö") rangeOfString: @"ö" options: 0 range: of_range(3, 1)]) + [C(@"𝄞öö") rangeOfString: @"ö" options: 0 range: OFMakeRange(3, 1)]) cs = [OFCharacterSet characterSetWithCharactersInString: @"cđ"]; TEST(@"-[indexOfCharacterFromSet:]", [C(@"abcđabcđe") indexOfCharacterFromSet: cs] == 2 && [C(@"abcđabcđë") @@ -509,33 +509,33 @@ indexOfCharacterFromSet: cs options: OF_STRING_SEARCH_BACKWARDS] == 7 && [C(@"abcđabcđë") indexOfCharacterFromSet: cs options: 0 - range: of_range(4, 4)] == 6 && + range: OFMakeRange(4, 4)] == 6 && [C(@"abcđabcđëf") indexOfCharacterFromSet: cs options: 0 - range: of_range(8, 2)] == OF_NOT_FOUND) + range: OFMakeRange(8, 2)] == OF_NOT_FOUND) EXPECT_EXCEPTION( @"Detect out of range in -[indexOfCharacterFromSet:options:range:]", OFOutOfRangeException, [C(@"𝄞öö") indexOfCharacterFromSet: cs options: 0 - range: of_range(3, 1)]) + range: OFMakeRange(3, 1)]) TEST(@"-[substringWithRange:]", - [[C(@"𝄞öö") substringWithRange: of_range(1, 1)] isEqual: @"ö"] && - [[C(@"𝄞öö") substringWithRange: of_range(3, 0)] isEqual: @""]) + [[C(@"𝄞öö") substringWithRange: OFMakeRange(1, 1)] isEqual: @"ö"] && + [[C(@"𝄞öö") substringWithRange: OFMakeRange(3, 0)] isEqual: @""]) EXPECT_EXCEPTION(@"Detect out of range in -[substringWithRange:] #1", OFOutOfRangeException, - [C(@"𝄞öö") substringWithRange: of_range(2, 2)]) + [C(@"𝄞öö") substringWithRange: OFMakeRange(2, 2)]) EXPECT_EXCEPTION(@"Detect out of range in -[substringWithRange:] #2", OFOutOfRangeException, - [C(@"𝄞öö") substringWithRange: of_range(4, 0)]) + [C(@"𝄞öö") substringWithRange: OFMakeRange(4, 0)]) TEST(@"-[stringByAppendingString:]", [[C(@"foo") stringByAppendingString: @"bar"] isEqual: @"foobar"]) TEST(@"-[stringByPrependingString:]", @@ -1266,47 +1266,47 @@ [s[0] isEqual: @"abc€e"] && R([s[0] setCharacter: 'x' atIndex: 1]) && [s[0] isEqual: @"axc€e"]) TEST(@"-[deleteCharactersInRange:]", (s[0] = [mutableStringClass stringWithString: @"𝄞öööbä€"]) && - R([s[0] deleteCharactersInRange: of_range(1, 3)]) && + R([s[0] deleteCharactersInRange: OFMakeRange(1, 3)]) && [s[0] isEqual: @"𝄞bä€"] && - R([s[0] deleteCharactersInRange: of_range(0, 4)]) && + R([s[0] deleteCharactersInRange: OFMakeRange(0, 4)]) && [s[0] isEqual: @""]) TEST(@"-[replaceCharactersInRange:withString:]", (s[0] = [mutableStringClass stringWithString: @"𝄞öööbä€"]) && - R([s[0] replaceCharactersInRange: of_range(1, 3) + R([s[0] replaceCharactersInRange: OFMakeRange(1, 3) withString: @"äöüß"]) && [s[0] isEqual: @"𝄞äöüßbä€"] && - R([s[0] replaceCharactersInRange: of_range(4, 2) + R([s[0] replaceCharactersInRange: OFMakeRange(4, 2) withString: @"b"]) && [s[0] isEqual: @"𝄞äöübä€"] && - R([s[0] replaceCharactersInRange: of_range(0, 7) + R([s[0] replaceCharactersInRange: OFMakeRange(0, 7) withString: @""]) && [s[0] isEqual: @""]) EXPECT_EXCEPTION(@"Detect OoR in -[deleteCharactersInRange:] #1", OFOutOfRangeException, { s[0] = [mutableStringClass stringWithString: @"𝄞öö"]; - [s[0] deleteCharactersInRange: of_range(2, 2)]; + [s[0] deleteCharactersInRange: OFMakeRange(2, 2)]; }) EXPECT_EXCEPTION(@"Detect OoR in -[deleteCharactersInRange:] #2", OFOutOfRangeException, - [s[0] deleteCharactersInRange: of_range(4, 0)]) + [s[0] deleteCharactersInRange: OFMakeRange(4, 0)]) EXPECT_EXCEPTION(@"Detect OoR in " @"-[replaceCharactersInRange:withString:] #1", OFOutOfRangeException, - [s[0] replaceCharactersInRange: of_range(2, 2) withString: @""]) + [s[0] replaceCharactersInRange: OFMakeRange(2, 2) withString: @""]) EXPECT_EXCEPTION(@"Detect OoR in " @"-[replaceCharactersInRange:withString:] #2", OFOutOfRangeException, - [s[0] replaceCharactersInRange: of_range(4, 0) withString: @""]) + [s[0] replaceCharactersInRange: OFMakeRange(4, 0) withString: @""]) TEST(@"-[replaceOccurrencesOfString:withString:]", (s[0] = [mutableStringClass stringWithString: @"asd fo asd fofo asd"]) && R([s[0] replaceOccurrencesOfString: @"fo" withString: @"foo"]) && @@ -1319,11 +1319,11 @@ (s[0] = [mutableStringClass stringWithString: @"foofoobarfoobarfoo"]) && R([s[0] replaceOccurrencesOfString: @"oo" withString: @"óò" options: 0 - range: of_range(2, 15)]) && + range: OFMakeRange(2, 15)]) && [s[0] isEqual: @"foofóòbarfóòbarfoo"]) TEST(@"-[deleteLeadingWhitespaces]", (s[0] = [mutableStringClass stringWithString: whitespace[0]]) && R([s[0] deleteLeadingWhitespaces]) && Index: tests/OFValueTests.m ================================================================== --- tests/OFValueTests.m +++ tests/OFValueTests.m @@ -23,31 +23,31 @@ @implementation TestsAppDelegate (OFValueTests) - (void)valueTests { void *pool = objc_autoreleasePoolPush(); - of_range_t range = of_range(1, 64), range2; + OFRange range = OFMakeRange(1, 64), range2; of_point_t point = of_point(1.5f, 3.0f), point2; of_dimension_t dimension = of_dimension(4.5f, 5.0f), dimension2; of_rectangle_t rectangle = of_rectangle(1.5f, 3.0f, 4.5f, 6.0f); of_rectangle_t rectangle2; OFValue *value; void *pointer = &value; TEST(@"+[valueWithBytes:objCType:]", (value = [OFValue valueWithBytes: &range - objCType: @encode(of_range_t)])) + objCType: @encode(OFRange)])) - TEST(@"-[objCType]", strcmp(value.objCType, @encode(of_range_t)) == 0) + TEST(@"-[objCType]", strcmp(value.objCType, @encode(OFRange)) == 0) TEST(@"-[getValue:size:]", - R([value getValue: &range2 size: sizeof(of_range_t)]) && - of_range_equal(range2, range)) + R([value getValue: &range2 size: sizeof(OFRange)]) && + OFEqualRanges(range2, range)) EXPECT_EXCEPTION(@"-[getValue:size:] with wrong size throws", OFOutOfRangeException, - [value getValue: &range size: sizeof(of_range_t) - 1]) + [value getValue: &range size: sizeof(OFRange) - 1]) TEST(@"+[valueWithPointer:]", (value = [OFValue valueWithPointer: pointer])) TEST(@"-[pointerValue]", @@ -75,19 +75,19 @@ TEST(@"+[valueWithRange:]", (value = [OFValue valueWithRange: range])) TEST(@"-[rangeValue]", - of_range_equal(value.rangeValue, range) && + OFEqualRanges(value.rangeValue, range) && (value = [OFValue valueWithBytes: &range - objCType: @encode(of_range_t)]) && - of_range_equal(value.rangeValue, range)) + objCType: @encode(OFRange)]) && + OFEqualRanges(value.rangeValue, range)) TEST(@"-[getValue:size:] for OFRangeValue", (value = [OFValue valueWithRange: range]) && R([value getValue: &range2 size: sizeof(range2)]) && - of_range_equal(range2, range)) + OFEqualRanges(range2, range)) EXPECT_EXCEPTION(@"-[rangeValue] with wrong size throws", OFOutOfRangeException, [[OFValue valueWithBytes: "a" objCType: @encode(char)] rangeValue]) Index: utils/ofarc/OFArc.m ================================================================== --- utils/ofarc/OFArc.m +++ utils/ofarc/OFArc.m @@ -314,11 +314,11 @@ case 'c': if (remainingArguments.count < 1) help(of_stderr, false, 1); files = [remainingArguments objectsInRange: - of_range(1, remainingArguments.count - 1)]; + OFMakeRange(1, remainingArguments.count - 1)]; #ifdef OF_HAVE_SANDBOX if (![remainingArguments.firstObject isEqual: @"-"]) [sandbox unveilPath: remainingArguments.firstObject permissions: (mode == 'a' ? @"rwc" : @"wc")]; @@ -371,11 +371,11 @@ sandbox.allowsUnveil = false; [OFApplication of_activateSandbox: sandbox]; #endif files = [remainingArguments objectsInRange: - of_range(1, remainingArguments.count - 1)]; + OFMakeRange(1, remainingArguments.count - 1)]; archive = [self openArchiveWithPath: remainingArguments.firstObject type: type mode: mode @@ -386,11 +386,11 @@ case 'x': if (remainingArguments.count < 1) help(of_stderr, false, 1); files = [remainingArguments objectsInRange: - of_range(1, remainingArguments.count - 1)]; + OFMakeRange(1, remainingArguments.count - 1)]; #ifdef OF_HAVE_SANDBOX if (![remainingArguments.firstObject isEqual: @"-"]) [sandbox unveilPath: remainingArguments.firstObject permissions: @"r"];