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: - OFRangeMake(1, decomposed.count - 1)]; + OFMakeRange(1, decomposed.count - 1)]; compat = true; } string = [OFMutableString string]; Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -240,11 +240,11 @@ size_t count = self.count; id *buffer = OFAllocMemory(count, sizeof(id)); id const *ret; @try { - [self getObjects: buffer inRange: OFRangeMake(0, count)]; + [self getObjects: buffer inRange: OFMakeRange(0, count)]; ret = [[OFData dataWithItemsNoCopy: buffer count: count itemSize: sizeof(id) freeWhenDone: true] items]; @@ -749,11 +749,11 @@ - (int)countByEnumeratingWithState: (OFFastEnumerationState *)state objects: (id *)objects count: (int)count { - OFRange range = OFRangeMake(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/OFColor.m ================================================================== --- src/OFColor.m +++ src/OFColor.m @@ -126,23 +126,23 @@ OFHashInit(&hash); tmp = OFToLittleEndianFloat(_red); for (uint_fast8_t i = 0; i < sizeof(float); i++) - OFHashAdd(&hash, ((char *)&tmp)[i]); + OFHashAddByte(&hash, ((char *)&tmp)[i]); tmp = OFToLittleEndianFloat(_green); for (uint_fast8_t i = 0; i < sizeof(float); i++) - OFHashAdd(&hash, ((char *)&tmp)[i]); + OFHashAddByte(&hash, ((char *)&tmp)[i]); tmp = OFToLittleEndianFloat(_blue); for (uint_fast8_t i = 0; i < sizeof(float); i++) - OFHashAdd(&hash, ((char *)&tmp)[i]); + OFHashAddByte(&hash, ((char *)&tmp)[i]); tmp = OFToLittleEndianFloat(_alpha); for (uint_fast8_t i = 0; i < sizeof(float); i++) - OFHashAdd(&hash, ((char *)&tmp)[i]); + OFHashAddByte(&hash, ((char *)&tmp)[i]); OFHashFinalize(&hash); return hash; } Index: src/OFDNSQuery.m ================================================================== --- src/OFDNSQuery.m +++ src/OFDNSQuery.m @@ -95,12 +95,12 @@ { unsigned long hash; OFHashInit(&hash); OFHashAddHash(&hash, _domainName.hash); - OFHashAdd(&hash, _DNSClass); - OFHashAdd(&hash, _recordType); + OFHashAddByte(&hash, _DNSClass); + OFHashAddByte(&hash, _recordType); OFHashFinalize(&hash); return hash; } Index: src/OFDNSResolverSettings.m ================================================================== --- src/OFDNSResolverSettings.m +++ src/OFDNSResolverSettings.m @@ -180,11 +180,11 @@ parseNetStackArray(OFString *string) { if (![string hasPrefix: @"["] || ![string hasSuffix: @"]"]) return nil; - string = [string substringWithRange: OFRangeMake(1, string.length - 2)]; + string = [string substringWithRange: OFMakeRange(1, string.length - 2)]; return [string componentsSeparatedByString: @"|"]; } #endif @@ -284,11 +284,11 @@ if (components.count < 2) continue; address = components.firstObject; hosts = [components objectsInRange: - OFRangeMake(1, components.count - 1)]; + OFMakeRange(1, components.count - 1)]; for (OFString *host in hosts) { OFMutableArray *addresses = [staticHosts objectForKey: host]; @@ -387,11 +387,11 @@ continue; } option = components.firstObject; arguments = [components objectsInRange: - OFRangeMake(1, components.count - 1)]; + OFMakeRange(1, components.count - 1)]; if ([option isEqual: @"nameserver"]) { if (arguments.count != 1) { objc_autoreleasePoolPop(pool2); continue; @@ -486,11 +486,11 @@ if (components.count < 2) continue; address = components.firstObject; hosts = [components objectsInRange: - OFRangeMake(1, components.count - 1)]; + OFMakeRange(1, components.count - 1)]; for (OFString *host in hosts) { OFMutableArray *addresses = [staticHosts objectForKey: host]; Index: src/OFDNSResourceRecord.m ================================================================== --- src/OFDNSResourceRecord.m +++ src/OFDNSResourceRecord.m @@ -248,14 +248,14 @@ unsigned long hash; OFHashInit(&hash); OFHashAddHash(&hash, _name.hash); - OFHashAdd(&hash, _DNSClass >> 8); - OFHashAdd(&hash, _DNSClass); - OFHashAdd(&hash, _recordType >> 8); - OFHashAdd(&hash, _recordType); + OFHashAddByte(&hash, _DNSClass >> 8); + OFHashAddByte(&hash, _DNSClass); + OFHashAddByte(&hash, _recordType >> 8); + OFHashAddByte(&hash, _recordType); OFHashAddHash(&hash, OFSocketAddressHash(&_address)); OFHashFinalize(&hash); return hash; @@ -333,14 +333,14 @@ unsigned long hash; OFHashInit(&hash); OFHashAddHash(&hash, _name.hash); - OFHashAdd(&hash, _DNSClass >> 8); - OFHashAdd(&hash, _DNSClass); - OFHashAdd(&hash, _recordType >> 8); - OFHashAdd(&hash, _recordType); + OFHashAddByte(&hash, _DNSClass >> 8); + OFHashAddByte(&hash, _DNSClass); + OFHashAddByte(&hash, _recordType >> 8); + OFHashAddByte(&hash, _recordType); OFHashAddHash(&hash, OFSocketAddressHash(&_address)); OFHashFinalize(&hash); return hash; @@ -428,14 +428,14 @@ unsigned long hash; OFHashInit(&hash); OFHashAddHash(&hash, _name.hash); - OFHashAdd(&hash, _DNSClass >> 8); - OFHashAdd(&hash, _DNSClass); - OFHashAdd(&hash, _recordType >> 8); - OFHashAdd(&hash, _recordType); + OFHashAddByte(&hash, _DNSClass >> 8); + OFHashAddByte(&hash, _DNSClass); + OFHashAddByte(&hash, _recordType >> 8); + OFHashAddByte(&hash, _recordType); OFHashAddHash(&hash, _alias.hash); OFHashFinalize(&hash); return hash; @@ -530,14 +530,14 @@ unsigned long hash; OFHashInit(&hash); OFHashAddHash(&hash, _name.hash); - OFHashAdd(&hash, _DNSClass >> 8); - OFHashAdd(&hash, _DNSClass); - OFHashAdd(&hash, _recordType >> 8); - OFHashAdd(&hash, _recordType); + OFHashAddByte(&hash, _DNSClass >> 8); + OFHashAddByte(&hash, _DNSClass); + OFHashAddByte(&hash, _recordType >> 8); + OFHashAddByte(&hash, _recordType); OFHashAddHash(&hash, _CPU.hash); OFHashAddHash(&hash, _OS.hash); OFHashFinalize(&hash); @@ -634,16 +634,16 @@ unsigned long hash; OFHashInit(&hash); OFHashAddHash(&hash, _name.hash); - OFHashAdd(&hash, _DNSClass >> 8); - OFHashAdd(&hash, _DNSClass); - OFHashAdd(&hash, _recordType >> 8); - OFHashAdd(&hash, _recordType); - OFHashAdd(&hash, _preference >> 8); - OFHashAdd(&hash, _preference); + OFHashAddByte(&hash, _DNSClass >> 8); + OFHashAddByte(&hash, _DNSClass); + OFHashAddByte(&hash, _recordType >> 8); + OFHashAddByte(&hash, _recordType); + OFHashAddByte(&hash, _preference >> 8); + OFHashAddByte(&hash, _preference); OFHashAddHash(&hash, _mailExchange.hash); OFHashFinalize(&hash); return hash; @@ -735,14 +735,14 @@ unsigned long hash; OFHashInit(&hash); OFHashAddHash(&hash, _name.hash); - OFHashAdd(&hash, _DNSClass >> 8); - OFHashAdd(&hash, _DNSClass); - OFHashAdd(&hash, _recordType >> 8); - OFHashAdd(&hash, _recordType); + OFHashAddByte(&hash, _DNSClass >> 8); + OFHashAddByte(&hash, _DNSClass); + OFHashAddByte(&hash, _recordType >> 8); + OFHashAddByte(&hash, _recordType); OFHashAddHash(&hash, _authoritativeHost.hash); OFHashFinalize(&hash); return hash; @@ -833,14 +833,14 @@ unsigned long hash; OFHashInit(&hash); OFHashAddHash(&hash, _name.hash); - OFHashAdd(&hash, _DNSClass >> 8); - OFHashAdd(&hash, _DNSClass); - OFHashAdd(&hash, _recordType >> 8); - OFHashAdd(&hash, _recordType); + OFHashAddByte(&hash, _DNSClass >> 8); + OFHashAddByte(&hash, _DNSClass); + OFHashAddByte(&hash, _recordType >> 8); + OFHashAddByte(&hash, _recordType); OFHashAddHash(&hash, _domainName.hash); OFHashFinalize(&hash); return hash; @@ -938,14 +938,14 @@ unsigned long hash; OFHashInit(&hash); OFHashAddHash(&hash, _name.hash); - OFHashAdd(&hash, _DNSClass >> 8); - OFHashAdd(&hash, _DNSClass); - OFHashAdd(&hash, _recordType >> 8); - OFHashAdd(&hash, _recordType); + OFHashAddByte(&hash, _DNSClass >> 8); + OFHashAddByte(&hash, _DNSClass); + OFHashAddByte(&hash, _recordType >> 8); + OFHashAddByte(&hash, _recordType); OFHashAddHash(&hash, _mailbox.hash); OFHashAddHash(&hash, _TXTDomainName.hash); OFHashFinalize(&hash); @@ -1074,36 +1074,36 @@ unsigned long hash; OFHashInit(&hash); OFHashAddHash(&hash, _name.hash); - OFHashAdd(&hash, _DNSClass >> 8); - OFHashAdd(&hash, _DNSClass); - OFHashAdd(&hash, _recordType >> 8); - OFHashAdd(&hash, _recordType); + OFHashAddByte(&hash, _DNSClass >> 8); + OFHashAddByte(&hash, _DNSClass); + OFHashAddByte(&hash, _recordType >> 8); + OFHashAddByte(&hash, _recordType); OFHashAddHash(&hash, _primaryNameServer.hash); OFHashAddHash(&hash, _responsiblePerson.hash); - OFHashAdd(&hash, _serialNumber >> 24); - OFHashAdd(&hash, _serialNumber >> 16); - OFHashAdd(&hash, _serialNumber >> 8); - OFHashAdd(&hash, _serialNumber); - OFHashAdd(&hash, _refreshInterval >> 24); - OFHashAdd(&hash, _refreshInterval >> 16); - OFHashAdd(&hash, _refreshInterval >> 8); - OFHashAdd(&hash, _refreshInterval); - OFHashAdd(&hash, _retryInterval >> 24); - OFHashAdd(&hash, _retryInterval >> 16); - OFHashAdd(&hash, _retryInterval >> 8); - OFHashAdd(&hash, _retryInterval); - OFHashAdd(&hash, _expirationInterval >> 24); - OFHashAdd(&hash, _expirationInterval >> 16); - OFHashAdd(&hash, _expirationInterval >> 8); - OFHashAdd(&hash, _expirationInterval); - OFHashAdd(&hash, _minTTL >> 24); - OFHashAdd(&hash, _minTTL >> 16); - OFHashAdd(&hash, _minTTL >> 8); - OFHashAdd(&hash, _minTTL); + OFHashAddByte(&hash, _serialNumber >> 24); + OFHashAddByte(&hash, _serialNumber >> 16); + OFHashAddByte(&hash, _serialNumber >> 8); + OFHashAddByte(&hash, _serialNumber); + OFHashAddByte(&hash, _refreshInterval >> 24); + OFHashAddByte(&hash, _refreshInterval >> 16); + OFHashAddByte(&hash, _refreshInterval >> 8); + OFHashAddByte(&hash, _refreshInterval); + OFHashAddByte(&hash, _retryInterval >> 24); + OFHashAddByte(&hash, _retryInterval >> 16); + OFHashAddByte(&hash, _retryInterval >> 8); + OFHashAddByte(&hash, _retryInterval); + OFHashAddByte(&hash, _expirationInterval >> 24); + OFHashAddByte(&hash, _expirationInterval >> 16); + OFHashAddByte(&hash, _expirationInterval >> 8); + OFHashAddByte(&hash, _expirationInterval); + OFHashAddByte(&hash, _minTTL >> 24); + OFHashAddByte(&hash, _minTTL >> 16); + OFHashAddByte(&hash, _minTTL >> 8); + OFHashAddByte(&hash, _minTTL); OFHashFinalize(&hash); return hash; } @@ -1215,21 +1215,21 @@ unsigned long hash; OFHashInit(&hash); OFHashAddHash(&hash, _name.hash); - OFHashAdd(&hash, _DNSClass >> 8); - OFHashAdd(&hash, _DNSClass); - OFHashAdd(&hash, _recordType >> 8); - OFHashAdd(&hash, _recordType); - OFHashAdd(&hash, _priority >> 8); - OFHashAdd(&hash, _priority); - OFHashAdd(&hash, _weight >> 8); - OFHashAdd(&hash, _weight); + OFHashAddByte(&hash, _DNSClass >> 8); + OFHashAddByte(&hash, _DNSClass); + OFHashAddByte(&hash, _recordType >> 8); + OFHashAddByte(&hash, _recordType); + OFHashAddByte(&hash, _priority >> 8); + OFHashAddByte(&hash, _priority); + OFHashAddByte(&hash, _weight >> 8); + OFHashAddByte(&hash, _weight); OFHashAddHash(&hash, _target.hash); - OFHashAdd(&hash, _port >> 8); - OFHashAdd(&hash, _port); + OFHashAddByte(&hash, _port >> 8); + OFHashAddByte(&hash, _port); OFHashFinalize(&hash); return hash; } @@ -1320,14 +1320,14 @@ unsigned long hash; OFHashInit(&hash); OFHashAddHash(&hash, _name.hash); - OFHashAdd(&hash, _DNSClass >> 8); - OFHashAdd(&hash, _DNSClass); - OFHashAdd(&hash, _recordType >> 8); - OFHashAdd(&hash, _recordType); + OFHashAddByte(&hash, _DNSClass >> 8); + OFHashAddByte(&hash, _DNSClass); + OFHashAddByte(&hash, _recordType >> 8); + OFHashAddByte(&hash, _recordType); OFHashAddHash(&hash, _textStrings.hash); OFHashFinalize(&hash); return hash; Index: src/OFData.m ================================================================== --- src/OFData.m +++ src/OFData.m @@ -475,11 +475,11 @@ unsigned long hash; OFHashInit(&hash); for (size_t i = 0; i < _count * _itemSize; i++) - OFHashAdd(&hash, ((uint8_t *)_items)[i]); + OFHashAddByte(&hash, ((uint8_t *)_items)[i]); OFHashFinalize(&hash); return hash; } @@ -549,22 +549,22 @@ if (data == nil || data.itemSize != _itemSize) @throw [OFInvalidArgumentException exception]; if ((searchLength = data.count) == 0) - return OFRangeMake(0, 0); + return OFMakeRange(0, 0); if (searchLength > range.length) - return OFRangeMake(OFNotFound, 0); + return OFMakeRange(OFNotFound, 0); search = data.items; if (options & OFDataSearchBackwards) { for (size_t i = range.length - searchLength;; i--) { if (memcmp(_items + i * _itemSize, search, searchLength * _itemSize) == 0) - return OFRangeMake(i, searchLength); + return OFMakeRange(i, searchLength); /* No match and we're at the last item */ if (i == 0) break; } @@ -571,14 +571,14 @@ } else { for (size_t i = range.location; i <= range.length - searchLength; i++) if (memcmp(_items + i * _itemSize, search, searchLength * _itemSize) == 0) - return OFRangeMake(i, searchLength); + return OFMakeRange(i, searchLength); } - return OFRangeMake(OFNotFound, 0); + return OFMakeRange(OFNotFound, 0); } #ifdef OF_HAVE_FILES - (void)writeToFile: (OFString *)path { Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -550,11 +550,11 @@ OFHashInit(&hash); tmp = OFToLittleEndianDouble(self.timeIntervalSince1970); for (size_t i = 0; i < sizeof(double); i++) - OFHashAdd(&hash, ((char *)&tmp)[i]); + OFHashAddByte(&hash, ((char *)&tmp)[i]); OFHashFinalize(&hash); return hash; } Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -457,16 +457,16 @@ if (![line hasPrefix: @"HTTP/"] || line.length < 9 || [line characterAtIndex: 8] != ' ') @throw [OFInvalidServerReplyException exception]; - _version = [[line substringWithRange: OFRangeMake(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: OFRangeMake(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 stateName: if (characters[i] == '=') { name = [string substringWithRange: - OFRangeMake(last, i - last)]; + OFMakeRange(last, i - last)]; state = stateExpectValue; } break; case stateExpectValue: if (characters[i] == '"') { @@ -111,11 +111,11 @@ i--; break; case stateValue: if (characters[i] == ';' || characters[i] == ',') { value = [string substringWithRange: - OFRangeMake(last, i - last)]; + OFMakeRange(last, i - last)]; [ret addObject: [OFHTTPCookie cookieWithName: name value: value domain: domain]]; @@ -125,11 +125,11 @@ } break; case stateQuotedValue: if (characters[i] == '"') { value = [string substringWithRange: - OFRangeMake(last, i - last)]; + OFMakeRange(last, i - last)]; [ret addObject: [OFHTTPCookie cookieWithName: name value: value domain: domain]]; @@ -153,18 +153,18 @@ } break; case stateAttrName: if (characters[i] == '=') { name = [string substringWithRange: - OFRangeMake(last, i - last)]; + OFMakeRange(last, i - last)]; state = stateAttrValue; last = i + 1; } else if (characters[i] == ';' || characters[i] == ',') { name = [string substringWithRange: - OFRangeMake(last, i - last)]; + OFMakeRange(last, i - last)]; handleAttribute(ret.lastObject, name, nil); state = (characters[i] == ';' ? statePreAttrName : statePreName); @@ -172,11 +172,11 @@ break; case stateAttrValue: if (characters[i] == ';' || characters[i] == ',') { value = [string substringWithRange: - OFRangeMake(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 stateQuotedValue: @throw [OFInvalidFormatException exception]; break; case stateValue: value = [string substringWithRange: - OFRangeMake(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 stateAttrName: if (last != length) { name = [string substringWithRange: - OFRangeMake(last, length - last)]; + OFMakeRange(last, length - last)]; handleAttribute(ret.lastObject, name, nil); } break; case stateAttrValue: value = [string substringWithRange: - OFRangeMake(last, length - last)]; + OFMakeRange(last, length - last)]; handleAttribute(ret.lastObject, name, value); break; } @@ -369,12 +369,12 @@ OFHashAddHash(&hash, _name.hash); OFHashAddHash(&hash, _value.hash); OFHashAddHash(&hash, _domain.hash); OFHashAddHash(&hash, _path.hash); OFHashAddHash(&hash, _expires.hash); - OFHashAdd(&hash, _secure); - OFHashAdd(&hash, _HTTPOnly); + OFHashAddByte(&hash, _secure); + OFHashAddByte(&hash, _HTTPOnly); OFHashAddHash(&hash, _extensions.hash); OFHashFinalize(&hash); return hash; } Index: src/OFHTTPRequest.m ================================================================== --- src/OFHTTPRequest.m +++ src/OFHTTPRequest.m @@ -178,13 +178,13 @@ { unsigned long hash; OFHashInit(&hash); - OFHashAdd(&hash, _method); - OFHashAdd(&hash, _protocolVersion.major); - OFHashAdd(&hash, _protocolVersion.minor); + OFHashAddByte(&hash, _method); + OFHashAddByte(&hash, _protocolVersion.major); + OFHashAddByte(&hash, _protocolVersion.minor); OFHashAddHash(&hash, _URL.hash); OFHashAddHash(&hash, _headers.hash); if (_hasRemoteAddress) OFHashAddHash(&hash, OFSocketAddressHash(&_remoteAddress)); Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -357,11 +357,11 @@ OFMutableString *path; size_t pos; @try { OFString *version = [line - substringWithRange: OFRangeMake(line.length - 9, 9)]; + substringWithRange: OFMakeRange(line.length - 9, 9)]; OFUnichar tmp; if (![version hasPrefix: @" HTTP/1."]) return [self sendErrorAndClose: 505]; @@ -384,11 +384,11 @@ } @catch (OFInvalidArgumentException *e) { return [self sendErrorAndClose: 405]; } @try { - OFRange range = OFRangeMake(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: OFRangeMake(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 @@ -136,11 +136,11 @@ if (![line hasSuffix: @"]"]) @throw [OFInvalidFormatException exception]; categoryName = [line substringWithRange: - OFRangeMake(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/OFMessagePackExtension.m ================================================================== --- src/OFMessagePackExtension.m +++ src/OFMessagePackExtension.m @@ -172,11 +172,11 @@ { unsigned long hash; OFHashInit(&hash); - OFHashAdd(&hash, (uint8_t)_type); + OFHashAddByte(&hash, (uint8_t)_type); OFHashAddHash(&hash, _data.hash); OFHashFinalize(&hash); return hash; Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -379,11 +379,11 @@ [self removeObjectAtIndex: count - 1]; } - (void)removeAllObjects { - [self removeObjectsInRange: OFRangeMake(0, self.count)]; + [self removeObjectsInRange: OFMakeRange(0, self.count)]; } #ifdef OF_HAVE_BLOCKS - (void)replaceObjectsUsingBlock: (OFArrayReplaceBlock)block { Index: src/OFMutableData.m ================================================================== --- src/OFMutableData.m +++ src/OFMutableData.m @@ -242,11 +242,11 @@ _count += count; } - (void)removeItemAtIndex: (size_t)idx { - [self removeItemsInRange: OFRangeMake(idx, 1)]; + [self removeItemsInRange: OFMakeRange(idx, 1)]; } - (void)removeItemsInRange: (OFRange)range { if (range.length > SIZE_MAX - range.location || Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -287,11 +287,11 @@ - (void)setCharacter: (OFUnichar)character atIndex: (size_t)idx { void *pool = objc_autoreleasePoolPush(); OFString *string = [OFString stringWithCharacters: &character length: 1]; - [self replaceCharactersInRange: OFRangeMake(idx, 1) withString: string]; + [self replaceCharactersInRange: OFMakeRange(idx, 1) withString: string]; objc_autoreleasePoolPop(pool); } - (void)appendString: (OFString *)string { @@ -429,11 +429,11 @@ } #endif - (void)insertString: (OFString *)string atIndex: (size_t)idx { - [self replaceCharactersInRange: OFRangeMake(idx, 0) withString: string]; + [self replaceCharactersInRange: OFMakeRange(idx, 0) withString: string]; } - (void)deleteCharactersInRange: (OFRange)range { [self replaceCharactersInRange: range withString: @""]; @@ -449,11 +449,11 @@ withString: (OFString *)replacement { [self replaceOccurrencesOfString: string withString: replacement options: 0 - range: OFRangeMake(0, self.length)]; + range: OFMakeRange(0, self.length)]; } - (void)replaceOccurrencesOfString: (OFString *)string withString: (OFString *)replacement options: (int)options @@ -483,11 +483,11 @@ for (size_t i = range.location; i <= range.length - searchLength; i++) { if (memcmp(characters + i, searchCharacters, searchLength * sizeof(OFUnichar)) != 0) continue; - [self replaceCharactersInRange: OFRangeMake(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: OFRangeMake(0, i)]; + [self deleteCharactersInRange: OFMakeRange(0, i)]; } - (void)deleteTrailingWhitespaces { void *pool; @@ -542,11 +542,11 @@ d++; } objc_autoreleasePoolPop(pool); - [self deleteCharactersInRange: OFRangeMake(length - d, d)]; + [self deleteCharactersInRange: OFMakeRange(length - d, d)]; } - (void)deleteEnclosingWhitespaces { [self deleteLeadingWhitespaces]; Index: src/OFMutableURL.m ================================================================== --- src/OFMutableURL.m +++ src/OFMutableURL.m @@ -86,11 +86,11 @@ OFString *old; if ([URLEncodedHost hasPrefix: @"["] && [URLEncodedHost hasSuffix: @"]"]) { if (!OFURLIsIPv6Host([URLEncodedHost substringWithRange: - OFRangeMake(1, URLEncodedHost.length - 2)])) + OFMakeRange(1, URLEncodedHost.length - 2)])) @throw [OFInvalidFormatException exception]; } else if (URLEncodedHost != nil) OFURLVerifyIsEscaped(URLEncodedHost, [OFCharacterSet URLHostAllowedCharacterSet]); @@ -400,11 +400,11 @@ } if ([current isEqual: @".."] && parent != nil && ![parent isEqual: @".."]) { [array removeObjectsInRange: - OFRangeMake(i - 1, 2)]; + OFMakeRange(i - 1, 2)]; done = false; break; } } Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -1036,16 +1036,16 @@ return 0; d = OFToLittleEndianDouble(self.doubleValue); for (uint_fast8_t i = 0; i < sizeof(double); i++) - OFHashAdd(&hash, ((char *)&d)[i]); + OFHashAddByte(&hash, ((char *)&d)[i]); } else if (isSigned(self) || isUnsigned(self)) { unsigned long long value = self.unsignedLongLongValue; while (value != 0) { - OFHashAdd(&hash, value & 0xFF); + OFHashAddByte(&hash, value & 0xFF); value >>= 8; } } else @throw [OFInvalidFormatException exception]; Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -108,11 +108,11 @@ * @param start The starting index of the range * @param length The length of the range * @return An OFRangeith the specified start and length */ static OF_INLINE OFRange OF_CONST_FUNC -OFRangeMake(size_t start, size_t length) +OFMakeRange(size_t start, size_t length) { OFRange range = { start, length }; return range; } @@ -123,11 +123,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 -OFRangeEqual(OFRange range1, OFRange range2) +OFEqualRanges(OFRange range1, OFRange range2) { if (range1.location != range2.location) return false; if (range1.length != range2.length) @@ -159,11 +159,11 @@ * @param x The x coordinate of the point * @param y The x coordinate of the point * @return An OFPoint with the specified coordinates */ static OF_INLINE OFPoint OF_CONST_FUNC -OFPointMake(float x, float y) +OFMakePoint(float x, float y) { OFPoint point = { x, y }; return point; } @@ -174,11 +174,11 @@ * @param point1 The first point for the comparison * @param point2 The second point for the comparison * @return Whether the two points are equal */ static OF_INLINE bool -OFPointEqual(OFPoint point1, OFPoint point2) +OFEqualPoints(OFPoint point1, OFPoint point2) { if (point1.x != point2.x) return false; if (point1.y != point2.y) @@ -205,11 +205,11 @@ * @param width The width of the size * @param height The height of the size * @return An OFSize with the specified width and height */ static OF_INLINE OFSize OF_CONST_FUNC -OFSizeMake(float width, float height) +OFMakeSize(float width, float height) { OFSize size = { width, height }; return size; } @@ -220,11 +220,11 @@ * @param size1 The first size for the comparison * @param size2 The second size for the comparison * @return Whether the two sizes are equal */ static OF_INLINE bool -OFSizeEqual(OFSize size1, OFSize size2) +OFEqualSizes(OFSize size1, OFSize size2) { if (size1.width != size2.width) return false; if (size1.height != size2.height) @@ -253,15 +253,15 @@ * @param width The width of the rectangle * @param height The height of the rectangle * @return An OFRect with the specified origin and size */ static OF_INLINE OFRect OF_CONST_FUNC -OFRectMake(float x, float y, float width, float height) +OFMakeRect(float x, float y, float width, float height) { OFRect rect = { - OFPointMake(x, y), - OFSizeMake(width, height) + OFMakePoint(x, y), + OFMakeSize(width, height) }; return rect; } @@ -271,16 +271,16 @@ * @param rect1 The first rectangle for the comparison * @param rect2 The second rectangle for the comparison * @return Whether the two rectangles are equal */ static OF_INLINE bool -OFRectEqual(OFRect rect1, OFRect rect2) +OFEqualRects(OFRect rect1, OFRect rect2) { - if (!OFPointEqual(rect1.origin, rect2.origin)) + if (!OFEqualPoints(rect1.origin, rect2.origin)) return false; - if (!OFSizeEqual(rect1.size, rect2.size)) + if (!OFEqualSizes(rect1.size, rect2.size)) return false; return true; } @@ -289,11 +289,11 @@ * * @param hash A pointer to a hash to add the byte to * @param byte The byte to add to the hash */ static OF_INLINE void -OFHashAdd(unsigned long *_Nonnull hash, unsigned char byte) +OFHashAddByte(unsigned long *_Nonnull hash, unsigned char byte) { uint32_t tmp = (uint32_t)*hash; tmp += byte; tmp += tmp << 10; @@ -309,14 +309,14 @@ * @param otherHash The hash to add to the hash */ static OF_INLINE void OFHashAddHash(unsigned long *_Nonnull hash, unsigned long otherHash) { - OFHashAdd(hash, (otherHash >> 24) & 0xFF); - OFHashAdd(hash, (otherHash >> 16) & 0xFF); - OFHashAdd(hash, (otherHash >> 8) & 0xFF); - OFHashAdd(hash, otherHash & 0xFF); + OFHashAddByte(hash, (otherHash >> 24) & 0xFF); + OFHashAddByte(hash, (otherHash >> 16) & 0xFF); + OFHashAddByte(hash, (otherHash >> 8) & 0xFF); + OFHashAddByte(hash, otherHash & 0xFF); } /** * @brief Finalizes the specified hash. * @@ -360,20 +360,20 @@ * @return The superclass of the object */ - (nullable Class)superclass; /** - * @brief Returns a 32 bit hash for the object. + * @brief Returns a hash for the object. * * Classes containing data (like strings, arrays, lists etc.) should reimplement * this! * * @warning If you reimplement this, you also need to reimplement @ref isEqual: * to behave in a way compatible to your reimplementation of this * method! * - * @return A 32 bit hash for the object + * @return A hash for the object */ - (unsigned long)hash; /** * @brief Returns the retain count. @@ -388,20 +388,13 @@ * @return Whether the object is a proxy object */ - (bool)isProxy; /** - * @brief Returns whether the object allows weak references. - * - * @return Whether the object allows weak references - */ -- (bool)allowsWeakReference; - -/** - * @brief Returns a boolean whether the object of the specified kind. - * - * @param class_ The class whose kind is checked + * @brief Returns a boolean whether the object is of the specified kind. + * + * @param class_ The class for which the receiver is checked * @return A boolean whether the object is of the specified kind */ - (bool)isKindOfClass: (Class)class_; /** @@ -550,10 +543,17 @@ * * @return The receiver */ - (instancetype)self; +/** + * @brief Returns whether the object allows a weak reference. + * + * @return Whether the object allows a weak references + */ +- (bool)allowsWeakReference; + /** * @brief Retain a weak reference to this object. * * @return Whether a weak reference to this object has been retained */ Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -1080,11 +1080,11 @@ unsigned long hash; OFHashInit(&hash); for (size_t i = 0; i < sizeof(ptr); i++) { - OFHashAdd(&hash, ptr & 0xFF); + OFHashAddByte(&hash, ptr & 0xFF); ptr >>= 8; } OFHashFinalize(&hash); 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: - OFRangeMake(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: - OFRangeMake(_index, _arguments.count - _index)]; + OFMakeRange(_index, _arguments.count - _index)]; } @end Index: src/OFSandbox.m ================================================================== --- src/OFSandbox.m +++ src/OFSandbox.m @@ -471,40 +471,40 @@ { unsigned long hash; OFHashInit(&hash); - OFHashAdd(&hash, _allowsStdIO); - OFHashAdd(&hash, _allowsReadingFiles); - OFHashAdd(&hash, _allowsWritingFiles); - OFHashAdd(&hash, _allowsCreatingFiles); - OFHashAdd(&hash, _allowsCreatingSpecialFiles); - OFHashAdd(&hash, _allowsTemporaryFiles); - OFHashAdd(&hash, _allowsIPSockets); - OFHashAdd(&hash, _allowsMulticastSockets); - OFHashAdd(&hash, _allowsChangingFileAttributes); - OFHashAdd(&hash, _allowsFileOwnerChanges); - OFHashAdd(&hash, _allowsFileLocks); - OFHashAdd(&hash, _allowsUNIXSockets); - OFHashAdd(&hash, _allowsDNS); - OFHashAdd(&hash, _allowsUserDatabaseReading); - OFHashAdd(&hash, _allowsFileDescriptorSending); - OFHashAdd(&hash, _allowsFileDescriptorReceiving); - OFHashAdd(&hash, _allowsTape); - OFHashAdd(&hash, _allowsTTY); - OFHashAdd(&hash, _allowsProcessOperations); - OFHashAdd(&hash, _allowsExec); - OFHashAdd(&hash, _allowsProtExec); - OFHashAdd(&hash, _allowsSetTime); - OFHashAdd(&hash, _allowsPS); - OFHashAdd(&hash, _allowsVMInfo); - OFHashAdd(&hash, _allowsChangingProcessRights); - OFHashAdd(&hash, _allowsPF); - OFHashAdd(&hash, _allowsAudio); - OFHashAdd(&hash, _allowsBPF); - OFHashAdd(&hash, _allowsUnveil); - OFHashAdd(&hash, _returnsErrors); + OFHashAddByte(&hash, _allowsStdIO); + OFHashAddByte(&hash, _allowsReadingFiles); + OFHashAddByte(&hash, _allowsWritingFiles); + OFHashAddByte(&hash, _allowsCreatingFiles); + OFHashAddByte(&hash, _allowsCreatingSpecialFiles); + OFHashAddByte(&hash, _allowsTemporaryFiles); + OFHashAddByte(&hash, _allowsIPSockets); + OFHashAddByte(&hash, _allowsMulticastSockets); + OFHashAddByte(&hash, _allowsChangingFileAttributes); + OFHashAddByte(&hash, _allowsFileOwnerChanges); + OFHashAddByte(&hash, _allowsFileLocks); + OFHashAddByte(&hash, _allowsUNIXSockets); + OFHashAddByte(&hash, _allowsDNS); + OFHashAddByte(&hash, _allowsUserDatabaseReading); + OFHashAddByte(&hash, _allowsFileDescriptorSending); + OFHashAddByte(&hash, _allowsFileDescriptorReceiving); + OFHashAddByte(&hash, _allowsTape); + OFHashAddByte(&hash, _allowsTTY); + OFHashAddByte(&hash, _allowsProcessOperations); + OFHashAddByte(&hash, _allowsExec); + OFHashAddByte(&hash, _allowsProtExec); + OFHashAddByte(&hash, _allowsSetTime); + OFHashAddByte(&hash, _allowsPS); + OFHashAddByte(&hash, _allowsVMInfo); + OFHashAddByte(&hash, _allowsChangingProcessRights); + OFHashAddByte(&hash, _allowsPF); + OFHashAddByte(&hash, _allowsAudio); + OFHashAddByte(&hash, _allowsBPF); + OFHashAddByte(&hash, _allowsUnveil); + OFHashAddByte(&hash, _returnsErrors); OFHashFinalize(&hash); return hash; } Index: src/OFSocket.m ================================================================== --- src/OFSocket.m +++ src/OFSocket.m @@ -667,11 +667,11 @@ OFSocketAddressHash(const OFSocketAddress *address) { unsigned long hash; OFHashInit(&hash); - OFHashAdd(&hash, address->family); + OFHashAddByte(&hash, address->family); switch (address->family) { case OFSocketAddressFamilyIPv4: #if defined(OF_WII) || defined(OF_NINTENDO_3DS) if (address->length < 8) @@ -679,28 +679,30 @@ #else if (address->length < (socklen_t)sizeof(struct sockaddr_in)) @throw [OFInvalidArgumentException exception]; #endif - OFHashAdd(&hash, address->sockaddr.in.sin_port >> 8); - OFHashAdd(&hash, address->sockaddr.in.sin_port); - OFHashAdd(&hash, address->sockaddr.in.sin_addr.s_addr >> 24); - OFHashAdd(&hash, address->sockaddr.in.sin_addr.s_addr >> 16); - OFHashAdd(&hash, address->sockaddr.in.sin_addr.s_addr >> 8); - OFHashAdd(&hash, address->sockaddr.in.sin_addr.s_addr); + OFHashAddByte(&hash, address->sockaddr.in.sin_port >> 8); + OFHashAddByte(&hash, address->sockaddr.in.sin_port); + OFHashAddByte(&hash, + address->sockaddr.in.sin_addr.s_addr >> 24); + OFHashAddByte(&hash, + address->sockaddr.in.sin_addr.s_addr >> 16); + OFHashAddByte(&hash, address->sockaddr.in.sin_addr.s_addr >> 8); + OFHashAddByte(&hash, address->sockaddr.in.sin_addr.s_addr); break; case OFSocketAddressFamilyIPv6: if (address->length < (socklen_t)sizeof(struct sockaddr_in6)) @throw [OFInvalidArgumentException exception]; - OFHashAdd(&hash, address->sockaddr.in6.sin6_port >> 8); - OFHashAdd(&hash, address->sockaddr.in6.sin6_port); + OFHashAddByte(&hash, address->sockaddr.in6.sin6_port >> 8); + OFHashAddByte(&hash, address->sockaddr.in6.sin6_port); for (size_t i = 0; i < sizeof(address->sockaddr.in6.sin6_addr.s6_addr); i++) - OFHashAdd(&hash, + OFHashAddByte(&hash, address->sockaddr.in6.sin6_addr.s6_addr[i]); break; case OFSocketAddressFamilyUNIX:; void *pool = objc_autoreleasePoolPush(); @@ -716,21 +718,22 @@ sizeof(address->sockaddr.ipx.sipx_network)]; if (address->length < (socklen_t)sizeof(struct sockaddr_ipx)) @throw [OFInvalidArgumentException exception]; - OFHashAdd(&hash, address->sockaddr.ipx.sipx_port >> 8); - OFHashAdd(&hash, address->sockaddr.ipx.sipx_port); + OFHashAddByte(&hash, address->sockaddr.ipx.sipx_port >> 8); + OFHashAddByte(&hash, address->sockaddr.ipx.sipx_port); memcpy(network, &address->sockaddr.ipx.sipx_network, sizeof(network)); for (size_t i = 0; i < sizeof(network); i++) - OFHashAdd(&hash, network[i]); + OFHashAddByte(&hash, network[i]); for (size_t i = 0; i < IPX_NODE_LEN; i++) - OFHashAdd(&hash, address->sockaddr.ipx.sipx_node[i]); + OFHashAddByte(&hash, + address->sockaddr.ipx.sipx_node[i]); break; default: @throw [OFInvalidArgumentException exception]; } Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -1683,13 +1683,13 @@ OFHashInit(&hash); for (size_t i = 0; i < length; i++) { const OFUnichar c = characters[i]; - OFHashAdd(&hash, (c & 0xFF0000) >> 16); - OFHashAdd(&hash, (c & 0x00FF00) >> 8); - OFHashAdd(&hash, c & 0x0000FF); + OFHashAddByte(&hash, (c & 0xFF0000) >> 16); + OFHashAddByte(&hash, (c & 0x00FF00) >> 8); + OFHashAddByte(&hash, c & 0x0000FF); } OFHashFinalize(&hash); return hash; @@ -1818,19 +1818,19 @@ - (OFRange)rangeOfString: (OFString *)string { return [self rangeOfString: string options: 0 - range: OFRangeMake(0, self.length)]; + range: OFMakeRange(0, self.length)]; } - (OFRange)rangeOfString: (OFString *)string options: (OFStringSearchOptions)options { return [self rangeOfString: string options: options - range: OFRangeMake(0, self.length)]; + range: OFMakeRange(0, self.length)]; } - (OFRange)rangeOfString: (OFString *)string options: (OFStringSearchOptions)options range: (OFRange)range @@ -1839,14 +1839,14 @@ const OFUnichar *searchCharacters; OFUnichar *characters; size_t searchLength; if ((searchLength = string.length) == 0) - return OFRangeMake(0, 0); + return OFMakeRange(0, 0); if (searchLength > range.length) - return OFRangeMake(OFNotFound, 0); + return OFMakeRange(OFNotFound, 0); if (range.length > SIZE_MAX / sizeof(OFUnichar)) @throw [OFOutOfRangeException exception]; pool = objc_autoreleasePoolPush(); @@ -1860,11 +1860,11 @@ if (options & OFStringSearchBackwards) { for (size_t i = range.length - searchLength;; i--) { if (memcmp(characters + i, searchCharacters, searchLength * sizeof(OFUnichar)) == 0) { objc_autoreleasePoolPop(pool); - return OFRangeMake(range.location + i, + return OFMakeRange(range.location + i, searchLength); } /* No match and we're at the last character */ if (i == 0) @@ -1874,11 +1874,11 @@ for (size_t i = 0; i <= range.length - searchLength; i++) { if (memcmp(characters + i, searchCharacters, searchLength * sizeof(OFUnichar)) == 0) { objc_autoreleasePoolPop(pool); - return OFRangeMake(range.location + i, + return OFMakeRange(range.location + i, searchLength); } } } } @finally { @@ -1885,26 +1885,26 @@ OFFreeMemory(characters); } objc_autoreleasePoolPop(pool); - return OFRangeMake(OFNotFound, 0); + return OFMakeRange(OFNotFound, 0); } - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet { return [self indexOfCharacterFromSet: characterSet options: 0 - range: OFRangeMake(0, self.length)]; + range: OFMakeRange(0, self.length)]; } - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet options: (OFStringSearchOptions)options { return [self indexOfCharacterFromSet: characterSet options: options - range: OFRangeMake(0, self.length)]; + range: OFMakeRange(0, self.length)]; } - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet options: (OFStringSearchOptions)options range: (OFRange)range @@ -1979,16 +1979,16 @@ return false; } - (OFString *)substringFromIndex: (size_t)idx { - return [self substringWithRange: OFRangeMake(idx, self.length - idx)]; + return [self substringWithRange: OFMakeRange(idx, self.length - idx)]; } - (OFString *)substringToIndex: (size_t)idx { - return [self substringWithRange: OFRangeMake(0, idx)]; + return [self substringWithRange: OFMakeRange(0, idx)]; } - (OFString *)substringWithRange: (OFRange)range { void *pool; @@ -2130,11 +2130,11 @@ tmp = OFAllocMemory(prefixLength, sizeof(OFUnichar)); @try { void *pool = objc_autoreleasePoolPush(); - [self getCharacters: tmp inRange: OFRangeMake(0, prefixLength)]; + [self getCharacters: tmp inRange: OFMakeRange(0, prefixLength)]; hasPrefix = (memcmp(tmp, prefix.characters, prefixLength * sizeof(OFUnichar)) == 0); objc_autoreleasePoolPop(pool); @@ -2160,11 +2160,11 @@ tmp = OFAllocMemory(suffixLength, sizeof(OFUnichar)); @try { void *pool = objc_autoreleasePoolPush(); [self getCharacters: tmp - inRange: OFRangeMake(length - suffixLength, + inRange: OFMakeRange(length - suffixLength, suffixLength)]; suffixCharacters = suffix.characters; hasSuffix = (memcmp(tmp, suffixCharacters, suffixLength * sizeof(OFUnichar)) == 0); @@ -2220,18 +2220,18 @@ if (memcmp(characters + i, delimiterCharacters, delimiterLength * sizeof(OFUnichar)) != 0) continue; component = [self substringWithRange: - OFRangeMake(last, i - last)]; + OFMakeRange(last, i - last)]; if (!skipEmpty || component.length > 0) [array addObject: component]; i += delimiterLength - 1; last = i + 1; } - component = [self substringWithRange: OFRangeMake(last, length - last)]; + component = [self substringWithRange: OFMakeRange(last, length - last)]; if (!skipEmpty || component.length > 0) [array addObject: component]; [array makeImmutable]; @@ -2265,20 +2265,20 @@ for (size_t i = 0; i < length; i++) { if (characterIsMember(characterSet, @selector(characterIsMember:), characters[i])) { if (!skipEmpty || i != last) { OFString *component = [self substringWithRange: - OFRangeMake(last, i - last)]; + OFMakeRange(last, i - last)]; [array addObject: component]; } last = i + 1; } } if (!skipEmpty || length != last) { OFString *component = [self substringWithRange: - OFRangeMake(last, length - last)]; + OFMakeRange(last, length - last)]; [array addObject: component]; } [array makeImmutable]; @@ -2548,11 +2548,11 @@ OFUnichar *buffer; const OFUnichar *ret; buffer = OFAllocMemory(length, sizeof(OFUnichar)); @try { - [self getCharacters: buffer inRange: OFRangeMake(0, length)]; + [self getCharacters: buffer inRange: OFMakeRange(0, length)]; ret = [[OFData dataWithItemsNoCopy: buffer count: length itemSize: sizeof(OFUnichar) freeWhenDone: true] items]; @@ -2656,11 +2656,11 @@ OFChar32 *buffer; const OFChar32 *ret; buffer = OFAllocMemory(length + 1, sizeof(OFChar32)); @try { - [self getCharacters: buffer inRange: OFRangeMake(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] = OFByteSwap32(buffer[i]); @@ -2784,22 +2784,22 @@ if (characters[i] == '\n' || characters[i] == '\r') { void *pool2 = objc_autoreleasePoolPush(); block([self substringWithRange: - OFRangeMake(last, i - last)], &stop); + OFMakeRange(last, i - last)], &stop); last = i + 1; objc_autoreleasePoolPop(pool2); } lastCarriageReturn = (characters[i] == '\r'); } if (!stop) - block([self substringWithRange: OFRangeMake(last, i - last)], + block([self substringWithRange: OFMakeRange(last, i - last)], &stop); objc_autoreleasePoolPop(pool); } #endif @end Index: src/OFSystemInfo.m ================================================================== --- src/OFSystemInfo.m +++ src/OFSystemInfo.m @@ -398,11 +398,11 @@ OFString *home; if ((home = [env objectForKey: @"HOME"]) == nil) return nil; - [path deleteCharactersInRange: OFRangeMake(0, 1)]; + [path deleteCharactersInRange: OFMakeRange(0, 1)]; [path prependString: home]; } [path makeImmutable]; @@ -487,11 +487,11 @@ OFString *home; if ((home = [env objectForKey: @"HOME"]) == nil) return nil; - [path deleteCharactersInRange: OFRangeMake(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 @@ -889,11 +889,11 @@ - (OFString *)host { if ([_URLEncodedHost hasPrefix: @"["] && [_URLEncodedHost hasSuffix: @"]"]) { OFString *host = [_URLEncodedHost substringWithRange: - OFRangeMake(1, _URLEncodedHost.length - 2)]; + OFMakeRange(1, _URLEncodedHost.length - 2)]; if (!OFURLIsIPv6Host(host)) @throw [OFInvalidArgumentException exception]; return host; Index: src/OFUTF8String.m ================================================================== --- src/OFUTF8String.m +++ src/OFUTF8String.m @@ -930,13 +930,13 @@ if ((length = OFUTF8StringDecode(_s->cString + i, _s->cStringLength - i, &c)) <= 0) @throw [OFInvalidEncodingException exception]; - OFHashAdd(&hash, (c & 0xFF0000) >> 16); - OFHashAdd(&hash, (c & 0x00FF00) >> 8); - OFHashAdd(&hash, c & 0x0000FF); + OFHashAddByte(&hash, (c & 0xFF0000) >> 16); + OFHashAddByte(&hash, (c & 0x00FF00) >> 8); + OFHashAddByte(&hash, c & 0x0000FF); i += length - 1; } OFHashFinalize(&hash); @@ -1004,14 +1004,14 @@ rangeLocation = range.location; rangeLength = range.length; } if (cStringLength == 0) - return OFRangeMake(0, 0); + return OFMakeRange(0, 0); if (cStringLength > rangeLength) - return OFRangeMake(OFNotFound, 0); + return OFMakeRange(OFNotFound, 0); if (options & OFStringSearchBackwards) { for (size_t i = rangeLength - cStringLength;; i--) { if (memcmp(_s->cString + rangeLocation + i, cString, cStringLength) == 0) { @@ -1022,11 +1022,11 @@ return range; } /* Did not match and we're at the last char */ if (i == 0) - return OFRangeMake(OFNotFound, 0); + return OFMakeRange(OFNotFound, 0); } } else { for (size_t i = 0; i <= rangeLength - cStringLength; i++) { if (memcmp(_s->cString + rangeLocation + i, cString, cStringLength) == 0) { @@ -1037,11 +1037,11 @@ return range; } } } - return OFRangeMake(OFNotFound, 0); + return OFMakeRange(OFNotFound, 0); } - (bool)containsString: (OFString *)string { const char *cString = string.UTF8String; Index: src/OFUUID.m ================================================================== --- src/OFUUID.m +++ src/OFUUID.m @@ -185,11 +185,11 @@ unsigned long hash; OFHashInit(&hash); for (size_t i = 0; i < sizeof(_bytes); i++) - OFHashAdd(&hash, _bytes[i]); + OFHashAddByte(&hash, _bytes[i]); OFHashFinalize(&hash); return hash; } Index: src/OFValue.m ================================================================== --- src/OFValue.m +++ src/OFValue.m @@ -130,11 +130,11 @@ [self getValue: value size: size]; OFHashInit(&hash); for (size_t i = 0; i < size; i++) - OFHashAdd(&hash, value[i]); + OFHashAddByte(&hash, value[i]); OFHashFinalize(&hash); } @finally { OFFreeMemory(value); } Index: src/OFZIPArchive.m ================================================================== --- src/OFZIPArchive.m +++ src/OFZIPArchive.m @@ -670,11 +670,11 @@ if (ZIP64Index != OFNotFound) { const uint8_t *ZIP64 = [extraField itemAtIndex: ZIP64Index]; OFRange range = - OFRangeMake(ZIP64Index - 4, ZIP64Size + 4); + OFMakeRange(ZIP64Index - 4, ZIP64Size + 4); if (_uncompressedSize == 0xFFFFFFFF) _uncompressedSize = OFZIPArchiveReadField64( &ZIP64, &ZIP64Size); if (_compressedSize == 0xFFFFFFFF) Index: src/OFZIPArchiveEntry.m ================================================================== --- src/OFZIPArchiveEntry.m +++ src/OFZIPArchiveEntry.m @@ -232,11 +232,11 @@ if (ZIP64Index != OFNotFound) { const uint8_t *ZIP64 = [extraField itemAtIndex: ZIP64Index]; OFRange range = - OFRangeMake(ZIP64Index - 4, ZIP64Size + 4); + OFMakeRange(ZIP64Index - 4, ZIP64Size + 4); if (_uncompressedSize == 0xFFFFFFFF) _uncompressedSize = OFZIPArchiveReadField64( &ZIP64, &ZIP64Size); if (_compressedSize == 0xFFFFFFFF) Index: src/platform/AmigaOS/OFString+PathAdditions.m ================================================================== --- src/platform/AmigaOS/OFString+PathAdditions.m +++ src/platform/AmigaOS/OFString+PathAdditions.m @@ -153,11 +153,11 @@ objc_autoreleasePoolPop(pool); return @""; } components = [components objectsInRange: - OFRangeMake(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: - OFRangeMake(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: - OFRangeMake(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: - OFRangeMake(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: - OFRangeMake(i - 1, 2)]; + OFMakeRange(i - 1, 2)]; done = false; break; } } @@ -358,11 +358,11 @@ *URLEncodedHost = [[components objectAtIndex: 1] stringByURLEncodingWithAllowedCharacters: [OFCharacterSet URLHostAllowedCharacterSet]]; path = [OFString pathWithComponents: [components - objectsInRange: OFRangeMake(2, components.count - 2)]]; + objectsInRange: OFMakeRange(2, components.count - 2)]]; } path = [path stringByReplacingOccurrencesOfString: @"\\" withString: @"/"]; path = [path stringByPrependingString: @"/"]; 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: - OFRangeMake(i - 1, 2)]; + OFMakeRange(i - 1, 2)]; done = false; break; } } Index: tests/OFArrayTests.m ================================================================== --- tests/OFArrayTests.m +++ tests/OFArrayTests.m @@ -184,11 +184,11 @@ TEST(@"-[indexOfObjectIdenticalTo:]", [array2 indexOfObjectIdenticalTo: cArray[1]] == 1) TEST(@"-[objectsInRange:]", - [[array1 objectsInRange: OFRangeMake(1, 2)] isEqual: + [[array1 objectsInRange: OFMakeRange(1, 2)] isEqual: [arrayClass arrayWithObjects: cArray[1], cArray[2], nil]]) TEST(@"-[replaceObject:withObject:]", R([mutableArray1 replaceObject: cArray[1] withObject: cArray[0]]) && [[mutableArray1 objectAtIndex: 0] isEqual: cArray[0]] && @@ -224,11 +224,11 @@ mutableArray2.count == 2 && [[mutableArray2 objectAtIndex: 1] isEqual: cArray[2]]) mutableArray2 = [[array1 mutableCopy] autorelease]; TEST(@"-[removeObjectsInRange:]", - R([mutableArray2 removeObjectsInRange: OFRangeMake(0, 2)]) && + R([mutableArray2 removeObjectsInRange: OFMakeRange(0, 2)]) && mutableArray2.count == 1 && [[mutableArray2 objectAtIndex: 0] isEqual: cArray[2]]) mutableArray2 = [[array1 mutableCopy] autorelease]; [mutableArray2 addObject: @"qux"]; @@ -260,11 +260,11 @@ EXPECT_EXCEPTION(@"Detect out of range in -[objectAtIndex:]", OFOutOfRangeException, [array1 objectAtIndex: array1.count]) EXPECT_EXCEPTION(@"Detect out of range in -[removeObjectsInRange:]", OFOutOfRangeException, [mutableArray1 removeObjectsInRange: - OFRangeMake(0, mutableArray1.count + 1)]) + OFMakeRange(0, mutableArray1.count + 1)]) TEST(@"-[componentsJoinedByString:]", (array2 = [arrayClass arrayWithObjects: @"", @"a", @"b", @"c", nil]) && [[array2 componentsJoinedByString: @" "] isEqual: @" a b c"] && Index: tests/OFCharacterSetTests.m ================================================================== --- tests/OFCharacterSetTests.m +++ tests/OFCharacterSetTests.m @@ -73,11 +73,11 @@ module = @"OFRangeCharacterSet"; TEST(@"+[characterSetWithRange:]", (characterSet = [OFCharacterSet - characterSetWithRange: OFRangeMake('0', 10)]) && + characterSetWithRange: OFMakeRange('0', 10)]) && [characterSet isKindOfClass: [OFRangeCharacterSet class]]) ok = true; for (OFUnichar c = 0; c < 65536; c++) { if (c >= '0' && c <= '9') { Index: tests/OFDataTests.m ================================================================== --- tests/OFDataTests.m +++ tests/OFDataTests.m @@ -74,11 +74,11 @@ TEST(@"-[removeLastItem]", R([mutableData removeLastItem]) && mutableData.count == 5 && memcmp(mutableData.items, "abcde", 5) == 0) TEST(@"-[removeItemsInRange:]", - R([mutableData removeItemsInRange: OFRangeMake(1, 2)]) && + R([mutableData removeItemsInRange: OFMakeRange(1, 2)]) && mutableData.count == 3 && memcmp(mutableData.items, "ade", 3) == 0) TEST(@"-[insertItems:atIndex:count:]", R([mutableData insertItems: "bc" atIndex: 1 count: 2]) && mutableData.count == 5 && @@ -88,51 +88,51 @@ range = [data rangeOfData: [OFData dataWithItems: "aa" count: 1 itemSize: 2] options: 0 - range: OFRangeMake(0, 7)]; + range: OFMakeRange(0, 7)]; TEST(@"-[rangeOfData:options:range:] #1", range.location == 0 && range.length == 1) range = [data rangeOfData: [OFData dataWithItems: "aa" count: 1 itemSize: 2] options: OFDataSearchBackwards - range: OFRangeMake(0, 7)]; + range: OFMakeRange(0, 7)]; TEST(@"-[rangeOfData:options:range:] #2", range.location == 5 && range.length == 1) range = [data rangeOfData: [OFData dataWithItems: "ac" count: 1 itemSize: 2] options: 0 - range: OFRangeMake(0, 7)]; + range: OFMakeRange(0, 7)]; TEST(@"-[rangeOfData:options:range:] #3", range.location == 2 && range.length == 1) range = [data rangeOfData: [OFData dataWithItems: "aabb" count: 2 itemSize: 2] options: 0 - range: OFRangeMake(0, 7)]; + range: OFMakeRange(0, 7)]; TEST(@"-[rangeOfData:options:range:] #4", range.location == 5 && range.length == 2) TEST(@"-[rangeOfData:options:range:] #5", R(range = [data rangeOfData: [OFData dataWithItems: "aa" count: 1 itemSize: 2] options: 0 - range: OFRangeMake(1, 6)]) && + range: OFMakeRange(1, 6)]) && range.location == 5 && range.length == 1) range = [data rangeOfData: [OFData dataWithItems: "aa" count: 1 itemSize: 2] options: OFDataSearchBackwards - range: OFRangeMake(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", @@ -139,32 +139,32 @@ OFInvalidArgumentException, [data rangeOfData: [OFData dataWithItems: "aaa" count: 1 itemSize: 3] options: 0 - range: OFRangeMake(0, 1)]) + range: OFMakeRange(0, 1)]) EXPECT_EXCEPTION( @"-[rangeOfData:options:range:] failing on out of range", OFOutOfRangeException, [data rangeOfData: [OFData dataWithItems: "" count: 0 itemSize: 2] options: 0 - range: OFRangeMake(8, 1)]) + range: OFMakeRange(8, 1)]) TEST(@"-[subdataWithRange:]", - [[data subdataWithRange: OFRangeMake(2, 4)] + [[data subdataWithRange: OFMakeRange(2, 4)] isEqual: [OFData dataWithItems: "accdacaa" count: 4 itemSize: 2]] && - [[mutableData subdataWithRange: OFRangeMake(2, 3)] + [[mutableData subdataWithRange: OFMakeRange(2, 3)] isEqual: [OFData dataWithItems: "cde" count: 3]]) EXPECT_EXCEPTION(@"-[subdataWithRange:] failing on out of range #1", OFOutOfRangeException, - [data subdataWithRange: OFRangeMake(7, 1)]) + [data subdataWithRange: OFMakeRange(7, 1)]) EXPECT_EXCEPTION(@"-[subdataWithRange:] failing on out of range #2", OFOutOfRangeException, - [mutableData subdataWithRange: OFRangeMake(6, 1)]) + [mutableData subdataWithRange: OFMakeRange(6, 1)]) TEST(@"-[stringByMD5Hashing]", [mutableData.stringByMD5Hashing isEqual: @"ab56b4d92b40713acc5af89985d4b786"]) @@ -216,13 +216,13 @@ OFOutOfRangeException, [mutableData addItems: raw[0] count: SIZE_MAX]) EXPECT_EXCEPTION(@"Detect out of range in -[removeItemsInRange:]", OFOutOfRangeException, - [mutableData removeItemsInRange: OFRangeMake(mutableData.count, 1)]) + [mutableData removeItemsInRange: OFMakeRange(mutableData.count, 1)]) OFFreeMemory(raw[0]); OFFreeMemory(raw[1]); objc_autoreleasePoolPop(pool); } @end Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -507,11 +507,11 @@ options: OFStringSearchBackwards].location == OFNotFound) EXPECT_EXCEPTION( @"Detect out of range in -[rangeOfString:options:range:]", OFOutOfRangeException, - [C(@"𝄞öö") rangeOfString: @"ö" options: 0 range: OFRangeMake(3, 1)]) + [C(@"𝄞öö") rangeOfString: @"ö" options: 0 range: OFMakeRange(3, 1)]) characterSet = [OFCharacterSet characterSetWithCharactersInString: @"cđ"]; TEST(@"-[indexOfCharacterFromSet:]", [C(@"abcđabcđe") indexOfCharacterFromSet: characterSet] == 2 && @@ -518,33 +518,33 @@ [C(@"abcđabcđë") indexOfCharacterFromSet: characterSet options: OFStringSearchBackwards] == 7 && [C(@"abcđabcđë") indexOfCharacterFromSet: characterSet options: 0 - range: OFRangeMake(4, 4)] == 6 && + range: OFMakeRange(4, 4)] == 6 && [C(@"abcđabcđëf") indexOfCharacterFromSet: characterSet options: 0 - range: OFRangeMake(8, 2)] == OFNotFound) + range: OFMakeRange(8, 2)] == OFNotFound) EXPECT_EXCEPTION( @"Detect out of range in -[indexOfCharacterFromSet:options:range:]", OFOutOfRangeException, [C(@"𝄞öö") indexOfCharacterFromSet: characterSet options: 0 - range: OFRangeMake(3, 1)]) + range: OFMakeRange(3, 1)]) TEST(@"-[substringWithRange:]", - [[C(@"𝄞öö") substringWithRange: OFRangeMake(1, 1)] isEqual: @"ö"] && - [[C(@"𝄞öö") substringWithRange: OFRangeMake(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: OFRangeMake(2, 2)]) + [C(@"𝄞öö") substringWithRange: OFMakeRange(2, 2)]) EXPECT_EXCEPTION(@"Detect out of range in -[substringWithRange:] #2", OFOutOfRangeException, - [C(@"𝄞öö") substringWithRange: OFRangeMake(4, 0)]) + [C(@"𝄞öö") substringWithRange: OFMakeRange(4, 0)]) TEST(@"-[stringByAppendingString:]", [[C(@"foo") stringByAppendingString: @"bar"] isEqual: @"foobar"]) TEST(@"-[stringByPrependingString:]", @@ -1311,49 +1311,49 @@ [mutableString1 isEqual: @"axc€e"]) TEST(@"-[deleteCharactersInRange:]", (mutableString1 = [mutableStringClass stringWithString: @"𝄞öööbä€"]) && - R([mutableString1 deleteCharactersInRange: OFRangeMake(1, 3)]) && + R([mutableString1 deleteCharactersInRange: OFMakeRange(1, 3)]) && [mutableString1 isEqual: @"𝄞bä€"] && - R([mutableString1 deleteCharactersInRange: OFRangeMake(0, 4)]) && + R([mutableString1 deleteCharactersInRange: OFMakeRange(0, 4)]) && [mutableString1 isEqual: @""]) TEST(@"-[replaceCharactersInRange:withString:]", (mutableString1 = [mutableStringClass stringWithString: @"𝄞öööbä€"]) && - R([mutableString1 replaceCharactersInRange: OFRangeMake(1, 3) + R([mutableString1 replaceCharactersInRange: OFMakeRange(1, 3) withString: @"äöüß"]) && [mutableString1 isEqual: @"𝄞äöüßbä€"] && - R([mutableString1 replaceCharactersInRange: OFRangeMake(4, 2) + R([mutableString1 replaceCharactersInRange: OFMakeRange(4, 2) withString: @"b"]) && [mutableString1 isEqual: @"𝄞äöübä€"] && - R([mutableString1 replaceCharactersInRange: OFRangeMake(0, 7) + R([mutableString1 replaceCharactersInRange: OFMakeRange(0, 7) withString: @""]) && [mutableString1 isEqual: @""]) EXPECT_EXCEPTION(@"Detect OoR in -[deleteCharactersInRange:] #1", OFOutOfRangeException, { mutableString1 = [mutableStringClass stringWithString: @"𝄞öö"]; - [mutableString1 deleteCharactersInRange: OFRangeMake(2, 2)]; + [mutableString1 deleteCharactersInRange: OFMakeRange(2, 2)]; }) EXPECT_EXCEPTION(@"Detect OoR in -[deleteCharactersInRange:] #2", OFOutOfRangeException, - [mutableString1 deleteCharactersInRange: OFRangeMake(4, 0)]) + [mutableString1 deleteCharactersInRange: OFMakeRange(4, 0)]) EXPECT_EXCEPTION(@"Detect OoR in " @"-[replaceCharactersInRange:withString:] #1", OFOutOfRangeException, - [mutableString1 replaceCharactersInRange: OFRangeMake(2, 2) + [mutableString1 replaceCharactersInRange: OFMakeRange(2, 2) withString: @""]) EXPECT_EXCEPTION(@"Detect OoR in " @"-[replaceCharactersInRange:withString:] #2", OFOutOfRangeException, - [mutableString1 replaceCharactersInRange: OFRangeMake(4, 0) + [mutableString1 replaceCharactersInRange: OFMakeRange(4, 0) withString: @""]) TEST(@"-[replaceOccurrencesOfString:withString:]", (mutableString1 = [mutableStringClass stringWithString: @"asd fo asd fofo asd"]) && @@ -1369,11 +1369,11 @@ (mutableString1 = [mutableStringClass stringWithString: @"foofoobarfoobarfoo"]) && R([mutableString1 replaceOccurrencesOfString: @"oo" withString: @"óò" options: 0 - range: OFRangeMake(2, 15)]) && + range: OFMakeRange(2, 15)]) && [mutableString1 isEqual: @"foofóòbarfóòbarfoo"]) TEST(@"-[deleteLeadingWhitespaces]", (mutableString1 = [mutableStringClass stringWithString: whitespace[0]]) && Index: tests/OFValueTests.m ================================================================== --- tests/OFValueTests.m +++ tests/OFValueTests.m @@ -23,14 +23,14 @@ @implementation TestsAppDelegate (OFValueTests) - (void)valueTests { void *pool = objc_autoreleasePoolPush(); - OFRange range = OFRangeMake(1, 64), range2; - OFPoint point = OFPointMake(1.5f, 3.0f), point2; - OFSize size = OFSizeMake(4.5f, 5.0f), size2; - OFRect rect = OFRectMake(1.5f, 3.0f, 4.5f, 6.0f), rect2; + OFRange range = OFMakeRange(1, 64), range2; + OFPoint point = OFMakePoint(1.5f, 3.0f), point2; + OFSize size = OFMakeSize(4.5f, 5.0f), size2; + OFRect rect = OFMakeRect(1.5f, 3.0f, 4.5f, 6.0f), rect2; OFValue *value; void *pointer = &value; TEST(@"+[valueWithBytes:objCType:]", (value = [OFValue valueWithBytes: &range @@ -38,11 +38,11 @@ TEST(@"-[objCType]", strcmp(value.objCType, @encode(OFRange)) == 0) TEST(@"-[getValue:size:]", R([value getValue: &range2 size: sizeof(OFRange)]) && - OFRangeEqual(range2, range)) + OFEqualRanges(range2, range)) EXPECT_EXCEPTION(@"-[getValue:size:] with wrong size throws", OFOutOfRangeException, [value getValue: &range size: sizeof(OFRange) - 1]) @@ -74,19 +74,19 @@ TEST(@"+[valueWithRange:]", (value = [OFValue valueWithRange: range])) TEST(@"-[rangeValue]", - OFRangeEqual(value.rangeValue, range) && + OFEqualRanges(value.rangeValue, range) && (value = [OFValue valueWithBytes: &range objCType: @encode(OFRange)]) && - OFRangeEqual(value.rangeValue, range)) + OFEqualRanges(value.rangeValue, range)) TEST(@"-[getValue:size:] for OFRangeValue", (value = [OFValue valueWithRange: range]) && R([value getValue: &range2 size: sizeof(range2)]) && - OFRangeEqual(range2, range)) + OFEqualRanges(range2, range)) EXPECT_EXCEPTION(@"-[rangeValue] with wrong size throws", OFOutOfRangeException, [[OFValue valueWithBytes: "a" objCType: @encode(char)] rangeValue]) @@ -93,19 +93,19 @@ TEST(@"+[valueWithPoint:]", (value = [OFValue valueWithPoint: point])) TEST(@"-[pointValue]", - OFPointEqual(value.pointValue, point) && + OFEqualPoints(value.pointValue, point) && (value = [OFValue valueWithBytes: &point objCType: @encode(OFPoint)]) && - OFPointEqual(value.pointValue, point)) + OFEqualPoints(value.pointValue, point)) TEST(@"-[getValue:size:] for OFPointValue", (value = [OFValue valueWithPoint: point]) && R([value getValue: &point2 size: sizeof(point2)]) && - OFPointEqual(point2, point)) + OFEqualPoints(point2, point)) EXPECT_EXCEPTION(@"-[pointValue] with wrong size throws", OFOutOfRangeException, [[OFValue valueWithBytes: "a" objCType: @encode(char)] pointValue]) @@ -112,19 +112,19 @@ TEST(@"+[valueWithSize:]", (value = [OFValue valueWithSize: size])) TEST(@"-[sizeValue]", - OFSizeEqual(value.sizeValue, size) && + OFEqualSizes(value.sizeValue, size) && (value = [OFValue valueWithBytes: &size objCType: @encode(OFSize)]) && - OFSizeEqual(value.sizeValue, size)) + OFEqualSizes(value.sizeValue, size)) TEST(@"-[getValue:size:] for OFSizeValue", (value = [OFValue valueWithSize: size]) && R([value getValue: &size2 size: sizeof(size2)]) && - OFSizeEqual(size2, size)) + OFEqualSizes(size2, size)) EXPECT_EXCEPTION(@"-[sizeValue] with wrong size throws", OFOutOfRangeException, [[OFValue valueWithBytes: "a" objCType: @encode(char)] sizeValue]) @@ -131,19 +131,19 @@ TEST(@"+[valueWithRect:]", (value = [OFValue valueWithRect: rect])) TEST(@"-[rectValue]", - OFRectEqual(value.rectValue, rect) && + OFEqualRects(value.rectValue, rect) && (value = [OFValue valueWithBytes: &rect objCType: @encode(OFRect)]) && - OFRectEqual(value.rectValue, rect)) + OFEqualRects(value.rectValue, rect)) TEST(@"-[getValue:size:] for OFRectValue", (value = [OFValue valueWithRect: rect]) && R([value getValue: &rect2 size: sizeof(rect2)]) && - OFRectEqual(rect2, rect)) + OFEqualRects(rect2, rect)) EXPECT_EXCEPTION(@"-[rectValue] with wrong size throws", OFOutOfRangeException, [[OFValue valueWithBytes: "a" objCType: @encode(char)] rectValue]) Index: tests/terminal/TerminalTests.m ================================================================== --- tests/terminal/TerminalTests.m +++ tests/terminal/TerminalTests.m @@ -90,25 +90,25 @@ [OFThread sleepForTimeInterval: 2]; [OFStdOut clear]; [OFThread sleepForTimeInterval: 2]; - [OFStdOut setCursorPosition: OFPointMake(5, 3)]; + [OFStdOut setCursorPosition: OFMakePoint(5, 3)]; [OFStdOut writeString: @"Text at (5, 3)"]; [OFThread sleepForTimeInterval: 2]; - [OFStdOut setRelativeCursorPosition: OFPointMake(-2, 0)]; - [OFThread sleepForTimeInterval: 2]; - [OFStdOut setRelativeCursorPosition: OFPointMake(2, 0)]; - [OFThread sleepForTimeInterval: 2]; - [OFStdOut setRelativeCursorPosition: OFPointMake(0, -2)]; - [OFThread sleepForTimeInterval: 2]; - [OFStdOut setRelativeCursorPosition: OFPointMake(0, 2)]; - [OFThread sleepForTimeInterval: 2]; - [OFStdOut setRelativeCursorPosition: OFPointMake(1, 1)]; - [OFThread sleepForTimeInterval: 2]; - [OFStdOut setRelativeCursorPosition: OFPointMake(-1, -1)]; + [OFStdOut setRelativeCursorPosition: OFMakePoint(-2, 0)]; + [OFThread sleepForTimeInterval: 2]; + [OFStdOut setRelativeCursorPosition: OFMakePoint(2, 0)]; + [OFThread sleepForTimeInterval: 2]; + [OFStdOut setRelativeCursorPosition: OFMakePoint(0, -2)]; + [OFThread sleepForTimeInterval: 2]; + [OFStdOut setRelativeCursorPosition: OFMakePoint(0, 2)]; + [OFThread sleepForTimeInterval: 2]; + [OFStdOut setRelativeCursorPosition: OFMakePoint(1, 1)]; + [OFThread sleepForTimeInterval: 2]; + [OFStdOut setRelativeCursorPosition: OFMakePoint(-1, -1)]; [OFThread sleepForTimeInterval: 2]; [OFStdOut setCursorColumn: 2]; [OFThread sleepForTimeInterval: 2]; Index: utils/ofarc/OFArc.m ================================================================== --- utils/ofarc/OFArc.m +++ utils/ofarc/OFArc.m @@ -335,11 +335,11 @@ case 'c': if (remainingArguments.count < 1) help(OFStdErr, false, 1); files = [remainingArguments objectsInRange: - OFRangeMake(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")]; @@ -392,11 +392,11 @@ sandbox.allowsUnveil = false; [OFApplication of_activateSandbox: sandbox]; #endif files = [remainingArguments objectsInRange: - OFRangeMake(1, remainingArguments.count - 1)]; + OFMakeRange(1, remainingArguments.count - 1)]; archive = [self openArchiveWithPath: remainingArguments.firstObject type: type mode: mode @@ -407,11 +407,11 @@ case 'x': if (remainingArguments.count < 1) help(OFStdErr, false, 1); files = [remainingArguments objectsInRange: - OFRangeMake(1, remainingArguments.count - 1)]; + OFMakeRange(1, remainingArguments.count - 1)]; #ifdef OF_HAVE_SANDBOX if (![remainingArguments.firstObject isEqual: @"-"]) [sandbox unveilPath: remainingArguments.firstObject permissions: @"r"];