Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -163,25 +163,25 @@ */ - (id*)objects; /** * \brief Returns the index of the first object that is equivalent to the - * specified object or OF_INVALID_INDEX if it was not found. + * specified object or OF_NOT_FOUND if it was not found. * * \param object The object whose index is returned * \return The index of the first object equivalent to the specified object - * or OF_INVALID_INDEX if it was not found + * or OF_NOT_FOUND if it was not found */ - (size_t)indexOfObject: (id)object; /** * \brief Returns the index of the first object that has the same address as the - * specified object or OF_INVALID_INDEX if it was not found. + * specified object or OF_NOT_FOUND if it was not found. * * \param object The object whose index is returned * \return The index of the first object that has the same aaddress as - * the specified object or OF_INVALID_INDEX if it was not found + * the specified object or OF_NOT_FOUND if it was not found */ - (size_t)indexOfObjectIdenticalTo: (id)object; /** * \brief Checks whether the array contains an object with the specified Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -282,11 +282,11 @@ for (i = 0; i < count; i++) if ([[self objectAtIndex: i] isEqual: object]) return i; - return OF_INVALID_INDEX; + return OF_NOT_FOUND; } - (size_t)indexOfObjectIdenticalTo: (id)object { size_t i, count = [self count]; @@ -293,21 +293,21 @@ for (i = 0; i < count; i++) if ([self objectAtIndex: i] == object) return i; - return OF_INVALID_INDEX; + return OF_NOT_FOUND; } - (BOOL)containsObject: (id)object { - return ([self indexOfObject: object] != OF_INVALID_INDEX); + return ([self indexOfObject: object] != OF_NOT_FOUND); } - (BOOL)containsObjectIdenticalTo: (id)object { - return ([self indexOfObjectIdenticalTo: object] != OF_INVALID_INDEX); + return ([self indexOfObjectIdenticalTo: object] != OF_NOT_FOUND); } - (id)firstObject { if ([self count] > 0) Index: src/OFArray_adjacent.m ================================================================== --- src/OFArray_adjacent.m +++ src/OFArray_adjacent.m @@ -226,11 +226,11 @@ for (i = 0; i < count; i++) if ([objects[i] isEqual: object]) return i; - return OF_INVALID_INDEX; + return OF_NOT_FOUND; } - (size_t)indexOfObjectIdenticalTo: (id)object { id *objects = [array cArray]; @@ -238,11 +238,11 @@ for (i = 0; i < count; i++) if (objects[i] == object) return i; - return OF_INVALID_INDEX; + return OF_NOT_FOUND; } - (OFArray*)objectsInRange: (of_range_t)range { Index: src/OFArray_subarray.m ================================================================== --- src/OFArray_subarray.m +++ src/OFArray_subarray.m @@ -80,31 +80,31 @@ - (size_t)indexOfObject: (id)object { size_t index = [array indexOfObject: object]; if (index < range.location) - return OF_INVALID_INDEX; + return OF_NOT_FOUND; index -= range.location; if (index >= range.length) - return OF_INVALID_INDEX; + return OF_NOT_FOUND; return index; } - (size_t)indexOfObjectIdenticalTo: (id)object { size_t index = [array indexOfObjectIdenticalTo: object]; if (index < range.location) - return OF_INVALID_INDEX; + return OF_NOT_FOUND; index -= range.location; if (index >= range.length) - return OF_INVALID_INDEX; + return OF_NOT_FOUND; return index; } - (OFArray*)objectsInRange: (of_range_t)range_ Index: src/OFHTTPRequest.m ================================================================== --- src/OFHTTPRequest.m +++ src/OFHTTPRequest.m @@ -411,11 +411,11 @@ @throw [OFInvalidServerReplyException exceptionWithClass: [self class]]; } range = [line rangeOfString: @";"]; - if (range.location != OF_INVALID_INDEX) + if (range.location != OF_NOT_FOUND) line = [line substringWithRange: of_range(0, range.location)]; @try { toRead = Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -98,11 +98,11 @@ # define __bridge # define __autoreleasing #endif #define OF_RETAIN_COUNT_MAX UINT_MAX -#define OF_INVALID_INDEX SIZE_MAX +#define OF_NOT_FOUND SIZE_MAX /** * \brief A result of a comparison. */ typedef enum of_comparison_result_t { Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -617,21 +617,21 @@ /** * \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_INVALID_INDEX as start position if it was not found + * OF_NOT_FOUND as start position if it was not found */ - (of_range_t)rangeOfString: (OFString*)string; /** * \brief Returns the range of the string. * * \param string The string to search * \param options Options modifying search behaviour * \return The range of the first occurrence of the string or a range with - * OF_INVALID_INDEX as start position if it was not found + * OF_NOT_FOUND as start position if it was not found */ - (of_range_t)rangeOfString: (OFString*)string options: (of_string_search_options_t)options; /** @@ -639,11 +639,11 @@ * * \param string The string to search * \param options Options modifying search behaviour * \param range The range in which to search * \return The range of the first occurrence of the string or a range with - * OF_INVALID_INDEX as start position if it was not found + * OF_NOT_FOUND as start position if it was not found */ - (of_range_t)rangeOfString: (OFString*)string options: (of_string_search_options_t)options range: (of_range_t)range; Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -1181,11 +1181,11 @@ if ((searchLength = [string length]) == 0) return of_range(0, 0); if (searchLength > range.length) - return of_range(OF_INVALID_INDEX, 0); + return of_range(OF_NOT_FOUND, 0); if (range.length > SIZE_MAX / sizeof(of_unichar_t)) @throw [OFOutOfRangeException exceptionWithClass: [self class]]; pool = objc_autoreleasePoolPush(); @@ -1229,11 +1229,11 @@ free(unicodeString); } objc_autoreleasePoolPop(pool); - return of_range(OF_INVALID_INDEX, 0); + return of_range(OF_NOT_FOUND, 0); } - (BOOL)containsString: (OFString*)string { void *pool; Index: src/OFString_UTF8.m ================================================================== --- src/OFString_UTF8.m +++ src/OFString_UTF8.m @@ -210,11 +210,11 @@ size_t i; for (i = 0; i <= index; i++) if OF_UNLIKELY ((string[i] & 0xC0) == 0x80) if (++index > length) - return OF_INVALID_INDEX; + return OF_NOT_FOUND; return index; } @implementation OFString_UTF8 @@ -1059,11 +1059,11 @@ if (cStringLength == 0) return of_range(0, 0); if (cStringLength > rangeLength || rangeStart + rangeLength > s->cStringLength) - return of_range(OF_INVALID_INDEX, 0); + return of_range(OF_NOT_FOUND, 0); if (options & OF_STRING_SEARCH_BACKWARDS) { for (i = rangeLength - cStringLength;; i--) { if (!memcmp(s->cString + rangeStart + i, cString, cStringLength)) { @@ -1074,11 +1074,11 @@ return range; } /* Did not match and we're at the last char */ if (i == 0) - return of_range(OF_INVALID_INDEX, 0); + return of_range(OF_NOT_FOUND, 0); } } else { for (i = 0; i <= rangeLength - cStringLength; i++) { if (!memcmp(s->cString + rangeStart + i, cString, cStringLength)) { @@ -1089,11 +1089,11 @@ return range; } } } - return of_range(OF_INVALID_INDEX, 0); + return of_range(OF_NOT_FOUND, 0); } - (BOOL)containsString: (OFString*)string { const char *cString = [string UTF8String]; Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -223,20 +223,20 @@ TEST(@"-[rangeOfString:]", [@"π„žΓΆΓΆ" rangeOfString: @"ΓΆΓΆ"].location == 1 && [@"π„žΓΆΓΆ" rangeOfString: @"ΓΆ"].location == 1 && [@"π„žΓΆΓΆ" rangeOfString: @"π„ž"].location == 0 && - [@"π„žΓΆΓΆ" rangeOfString: @"x"].location == OF_INVALID_INDEX && + [@"π„žΓΆΓΆ" rangeOfString: @"x"].location == OF_NOT_FOUND && [@"π„žΓΆΓΆ" rangeOfString: @"ΓΆΓΆ" options: OF_STRING_SEARCH_BACKWARDS].location == 1 && [@"π„žΓΆΓΆ" rangeOfString: @"ΓΆ" options: OF_STRING_SEARCH_BACKWARDS].location == 2 && [@"π„žΓΆΓΆ" rangeOfString: @"π„ž" options: OF_STRING_SEARCH_BACKWARDS].location == 0 && [@"π„žΓΆΓΆ" rangeOfString: @"x" options: OF_STRING_SEARCH_BACKWARDS].location == - OF_INVALID_INDEX) + OF_NOT_FOUND) TEST(@"-[substringWithRange:]", [[@"π„žΓΆΓΆ" substringWithRange: of_range(1, 1)] isEqual: @"ΓΆ"] && [[@"π„žΓΆΓΆ" substringWithRange: of_range(3, 0)] isEqual: @""])