Index: generators/unicode/TableGenerator.h ================================================================== --- generators/unicode/TableGenerator.h +++ generators/unicode/TableGenerator.h @@ -20,14 +20,14 @@ @interface TableGenerator: OFObject { OFHTTPClient *_HTTPClient; - of_unichar_t _uppercaseTable[0x110000]; - of_unichar_t _lowercaseTable[0x110000]; - of_unichar_t _titlecaseTable[0x110000]; - of_unichar_t _casefoldingTable[0x110000]; + OFUnichar _uppercaseTable[0x110000]; + OFUnichar _lowercaseTable[0x110000]; + OFUnichar _titlecaseTable[0x110000]; + OFUnichar _casefoldingTable[0x110000]; OFString *_decompositionTable[0x110000]; OFString *_decompositionCompatTable[0x110000]; char _uppercaseTableUsed[0x1100]; char _lowercaseTableUsed[0x1100]; char _titlecaseTableUsed[0x1100]; Index: generators/unicode/TableGenerator.m ================================================================== --- generators/unicode/TableGenerator.m +++ generators/unicode/TableGenerator.m @@ -101,11 +101,11 @@ [of_stdout writeString: @"Parsing UnicodeData.txt…"]; while ((line = [response readLine]) != nil) { void *pool2; OFArray OF_GENERIC(OFString *) *components; - of_unichar_t codePoint; + OFUnichar codePoint; if (line.length == 0) continue; pool2 = objc_autoreleasePoolPush(); @@ -114,21 +114,21 @@ if (components.count != 15) { of_log(@"Invalid line: %@\n", line); [OFApplication terminateWithStatus: 1]; } - codePoint = (of_unichar_t)[[components objectAtIndex: 0] + codePoint = (OFUnichar)[[components objectAtIndex: 0] unsignedLongLongValueWithBase: 16]; if (codePoint > 0x10FFFF) @throw [OFOutOfRangeException exception]; - _uppercaseTable[codePoint] = (of_unichar_t)[[components + _uppercaseTable[codePoint] = (OFUnichar)[[components objectAtIndex: 12] unsignedLongLongValueWithBase: 16]; - _lowercaseTable[codePoint] = (of_unichar_t)[[components + _lowercaseTable[codePoint] = (OFUnichar)[[components objectAtIndex: 13] unsignedLongLongValueWithBase: 16]; - _titlecaseTable[codePoint] = (of_unichar_t)[[components + _titlecaseTable[codePoint] = (OFUnichar)[[components objectAtIndex: 14] unsignedLongLongValueWithBase: 16]; if ([[components objectAtIndex: 5] length] > 0) { OFArray *decomposed = [[components objectAtIndex: 5] componentsSeparatedByString: @" "]; @@ -135,18 +135,18 @@ 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]; for (OFString *character in decomposed) { - of_unichar_t unichar = (of_unichar_t)[character + OFUnichar unichar = (OFUnichar)[character unsignedLongLongValueWithBase: 16]; [string appendCharacters: &unichar length: 1]; } @@ -180,11 +180,11 @@ [of_stdout writeString: @"Parsing CaseFolding.txt…"]; while ((line = [response readLine]) != nil) { void *pool2; OFArray OF_GENERIC(OFString *) *components; - of_unichar_t codePoint; + OFUnichar codePoint; if (line.length == 0 || [line hasPrefix: @"#"]) continue; pool2 = objc_autoreleasePoolPush(); @@ -197,17 +197,17 @@ if (![[components objectAtIndex: 1] isEqual: @"S"] && ![[components objectAtIndex: 1] isEqual: @"C"]) continue; - codePoint = (of_unichar_t)[[components objectAtIndex: 0] + codePoint = (OFUnichar)[[components objectAtIndex: 0] unsignedLongLongValueWithBase: 16]; if (codePoint > 0x10FFFF) @throw [OFOutOfRangeException exception]; - _casefoldingTable[codePoint] = (of_unichar_t)[[components + _casefoldingTable[codePoint] = (OFUnichar)[[components objectAtIndex: 2] unsignedLongLongValueWithBase: 16]; objc_autoreleasePoolPop(pool2); } @@ -221,13 +221,13 @@ bool done; do { done = true; - for (of_unichar_t i = 0; i < 0x110000; i++) { + for (OFUnichar i = 0; i < 0x110000; i++) { void *pool; - const of_unichar_t *characters; + const OFUnichar *characters; size_t length; OFMutableString *replacement; bool changed = false; if (table[i] == nil) @@ -293,19 +293,19 @@ [file writeString: COPYRIGHT @"#include \"config.h\"\n" @"\n" @"#import \"OFString.h\"\n\n" - @"static const of_unichar_t emptyPage[0x100] = { 0 };\n" + @"static const OFUnichar emptyPage[0x100] = { 0 };\n" @"static const char *emptyDecompositionPage[0x100] = { NULL };\n" @"\n"]; /* Write uppercasePage%u */ - for (of_unichar_t i = 0; i < 0x110000; i += 0x100) { + for (OFUnichar i = 0; i < 0x110000; i += 0x100) { bool isEmpty = true; - for (of_unichar_t j = i; j < i + 0x100; j++) { + for (OFUnichar j = i; j < i + 0x100; j++) { if (_uppercaseTable[j] != 0) { isEmpty = false; _uppercaseTableSize = i >> 8; _uppercaseTableUsed[_uppercaseTableSize] = 1; break; @@ -313,15 +313,15 @@ } if (!isEmpty) { void *pool2 = objc_autoreleasePoolPush(); - [file writeFormat: @"static const of_unichar_t " + [file writeFormat: @"static const OFUnichar " @"uppercasePage%u[0x100] = {\n", i >> 8]; - for (of_unichar_t j = i; j < i + 0x100; j += 8) + for (OFUnichar j = i; j < i + 0x100; j += 8) [file writeFormat: @"\t%u, %u, %u, %u, %u, %u, %u, %u,\n", _uppercaseTable[j], _uppercaseTable[j + 1], _uppercaseTable[j + 2], @@ -336,14 +336,14 @@ objc_autoreleasePoolPop(pool2); } } /* Write lowercasePage%u */ - for (of_unichar_t i = 0; i < 0x110000; i += 0x100) { + for (OFUnichar i = 0; i < 0x110000; i += 0x100) { bool isEmpty = true; - for (of_unichar_t j = i; j < i + 0x100; j++) { + for (OFUnichar j = i; j < i + 0x100; j++) { if (_lowercaseTable[j] != 0) { isEmpty = false; _lowercaseTableSize = i >> 8; _lowercaseTableUsed[_lowercaseTableSize] = 1; break; @@ -351,15 +351,15 @@ } if (!isEmpty) { void *pool2 = objc_autoreleasePoolPush(); - [file writeFormat: @"static const of_unichar_t " + [file writeFormat: @"static const OFUnichar " @"lowercasePage%u[0x100] = {\n", i >> 8]; - for (of_unichar_t j = i; j < i + 0x100; j += 8) + for (OFUnichar j = i; j < i + 0x100; j += 8) [file writeFormat: @"\t%u, %u, %u, %u, %u, %u, %u, %u,\n", _lowercaseTable[j], _lowercaseTable[j + 1], _lowercaseTable[j + 2], @@ -374,18 +374,18 @@ objc_autoreleasePoolPop(pool2); } } /* Write titlecasePage%u if it does NOT match uppercasePage%u */ - for (of_unichar_t i = 0; i < 0x110000; i += 0x100) { + for (OFUnichar i = 0; i < 0x110000; i += 0x100) { bool isEmpty = true; - for (of_unichar_t j = i; j < i + 0x100; j++) { + for (OFUnichar j = i; j < i + 0x100; j++) { if (_titlecaseTable[j] != 0) { isEmpty = !memcmp(_uppercaseTable + i, _titlecaseTable + i, - 256 * sizeof(of_unichar_t)); + 256 * sizeof(OFUnichar)); _titlecaseTableSize = i >> 8; _titlecaseTableUsed[_titlecaseTableSize] = (isEmpty ? 2 : 1); break; } @@ -392,15 +392,15 @@ } if (!isEmpty) { void *pool2 = objc_autoreleasePoolPush(); - [file writeFormat: @"static const of_unichar_t " + [file writeFormat: @"static const OFUnichar " @"titlecasePage%u[0x100] = {\n", i >> 8]; - for (of_unichar_t j = i; j < i + 0x100; j += 8) + for (OFUnichar j = i; j < i + 0x100; j += 8) [file writeFormat: @"\t%u, %u, %u, %u, %u, %u, %u, %u,\n", _titlecaseTable[j], _titlecaseTable[j + 1], _titlecaseTable[j + 2], @@ -415,18 +415,18 @@ objc_autoreleasePoolPop(pool2); } } /* Write casefoldingPage%u if it does NOT match lowercasePage%u */ - for (of_unichar_t i = 0; i < 0x110000; i += 0x100) { + for (OFUnichar i = 0; i < 0x110000; i += 0x100) { bool isEmpty = true; - for (of_unichar_t j = i; j < i + 0x100; j++) { + for (OFUnichar j = i; j < i + 0x100; j++) { if (_casefoldingTable[j] != 0) { isEmpty = !memcmp(_lowercaseTable + i, _casefoldingTable + i, - 256 * sizeof(of_unichar_t)); + 256 * sizeof(OFUnichar)); _casefoldingTableSize = i >> 8; _casefoldingTableUsed[_casefoldingTableSize] = (isEmpty ? 2 : 1); break; } @@ -433,15 +433,15 @@ } if (!isEmpty) { void *pool2 = objc_autoreleasePoolPush(); - [file writeFormat: @"static const of_unichar_t " + [file writeFormat: @"static const OFUnichar " @"casefoldingPage%u[0x100] = {\n", i >> 8]; - for (of_unichar_t j = i; j < i + 0x100; j += 8) + for (OFUnichar j = i; j < i + 0x100; j += 8) [file writeFormat: @"\t%u, %u, %u, %u, %u, %u, %u, %u,\n", _casefoldingTable[j], _casefoldingTable[j + 1], _casefoldingTable[j + 2], @@ -456,14 +456,14 @@ objc_autoreleasePoolPop(pool2); } } /* Write decompositionPage%u */ - for (of_unichar_t i = 0; i < 0x110000; i += 0x100) { + for (OFUnichar i = 0; i < 0x110000; i += 0x100) { bool isEmpty = true; - for (of_unichar_t j = i; j < i + 0x100; j++) { + for (OFUnichar j = i; j < i + 0x100; j++) { if (_decompositionTable[j] != nil) { isEmpty = false; _decompositionTableSize = i >> 8; _decompositionTableUsed[ _decompositionTableSize] = 1; @@ -476,11 +476,11 @@ [file writeFormat: @"static const char *const " @"decompositionPage%u[0x100] = {\n", i >> 8]; - for (of_unichar_t j = i; j < i + 0x100; j++) { + for (OFUnichar j = i; j < i + 0x100; j++) { if ((j - i) % 2 == 0) [file writeString: @"\t"]; else [file writeString: @" "]; @@ -510,14 +510,14 @@ objc_autoreleasePoolPop(pool2); } } /* Write decompCompatPage%u if it does NOT match decompositionPage%u */ - for (of_unichar_t i = 0; i < 0x110000; i += 0x100) { + for (OFUnichar i = 0; i < 0x110000; i += 0x100) { bool isEmpty = true; - for (of_unichar_t j = i; j < i + 0x100; j++) { + for (OFUnichar j = i; j < i + 0x100; j++) { if (_decompositionCompatTable[j] != 0) { /* * We bulk-compare pointers via memcmp here. * This is safe, as we always set the same * pointer in both tables if both are the same. @@ -539,11 +539,11 @@ [file writeFormat: @"static const char *const " @"decompCompatPage%u[0x100] = {\n", i >> 8]; - for (of_unichar_t j = i; j < i + 0x100; j++) { + for (OFUnichar j = i; j < i + 0x100; j++) { if ((j - i) % 2 == 0) [file writeString: @"\t"]; else [file writeString: @" "]; @@ -586,15 +586,15 @@ _casefoldingTableSize++; _decompositionTableSize++; _decompositionCompatTableSize++; /* Write of_unicode_uppercase_table */ - [file writeFormat: @"const of_unichar_t *const " + [file writeFormat: @"const OFUnichar *const " @"of_unicode_uppercase_table[0x%X] = {\n\t", _uppercaseTableSize]; - for (of_unichar_t i = 0; i < _uppercaseTableSize; i++) { + for (OFUnichar i = 0; i < _uppercaseTableSize; i++) { if (_uppercaseTableUsed[i]) [file writeFormat: @"uppercasePage%u", i]; else [file writeString: @"emptyPage"]; @@ -607,15 +607,15 @@ } [file writeString: @"\n};\n\n"]; /* Write of_unicode_lowercase_table */ - [file writeFormat: @"const of_unichar_t *const " + [file writeFormat: @"const OFUnichar *const " @"of_unicode_lowercase_table[0x%X] = {\n\t", _lowercaseTableSize]; - for (of_unichar_t i = 0; i < _lowercaseTableSize; i++) { + for (OFUnichar i = 0; i < _lowercaseTableSize; i++) { if (_lowercaseTableUsed[i]) [file writeFormat: @"lowercasePage%u", i]; else [file writeString: @"emptyPage"]; @@ -628,15 +628,15 @@ } [file writeString: @"\n};\n\n"]; /* Write of_unicode_titlecase_table */ - [file writeFormat: @"const of_unichar_t *const " + [file writeFormat: @"const OFUnichar *const " @"of_unicode_titlecase_table[0x%X] = {\n\t", _titlecaseTableSize]; - for (of_unichar_t i = 0; i < _titlecaseTableSize; i++) { + for (OFUnichar i = 0; i < _titlecaseTableSize; i++) { if (_titlecaseTableUsed[i] == 1) [file writeFormat: @"titlecasePage%u", i]; else if (_titlecaseTableUsed[i] == 2) [file writeFormat: @"uppercasePage%u", i]; else @@ -651,15 +651,15 @@ } [file writeString: @"\n};\n\n"]; /* Write of_unicode_casefolding_table */ - [file writeFormat: @"const of_unichar_t *const " + [file writeFormat: @"const OFUnichar *const " @"of_unicode_casefolding_table[0x%X] = {\n\t", _casefoldingTableSize]; - for (of_unichar_t i = 0; i < _casefoldingTableSize; i++) { + for (OFUnichar i = 0; i < _casefoldingTableSize; i++) { if (_casefoldingTableUsed[i] == 1) [file writeFormat: @"casefoldingPage%u", i]; else if (_casefoldingTableUsed[i] == 2) [file writeFormat: @"lowercasePage%u", i]; else @@ -678,11 +678,11 @@ /* Write of_unicode_decomposition_table */ [file writeFormat: @"const char *const " @"*of_unicode_decomposition_table[0x%X] = {\n\t", _decompositionTableSize]; - for (of_unichar_t i = 0; i < _decompositionTableSize; i++) { + for (OFUnichar i = 0; i < _decompositionTableSize; i++) { if (_decompositionTableUsed[i]) [file writeFormat: @"decompositionPage%u", i]; else [file writeString: @"emptyDecompositionPage"]; @@ -700,11 +700,11 @@ [file writeFormat: @"const char *const " @"*of_unicode_decomposition_compat_table[0x%X] = {" @"\n\t", _decompositionCompatTableSize]; - for (of_unichar_t i = 0; i < _decompositionCompatTableSize; i++) { + for (OFUnichar i = 0; i < _decompositionCompatTableSize; i++) { if (_decompositionCompatTableUsed[i] == 1) [file writeFormat: @"decompCompatPage%u", i]; else if (_decompositionCompatTableUsed[i] == 2) [file writeFormat: @"decompositionPage%u", i]; else @@ -745,20 +745,20 @@ [file writeString: @"#ifdef __cplusplus\n" @"extern \"C\" {\n" @"#endif\n" - @"extern const of_unichar_t *const _Nonnull\n" + @"extern const OFUnichar *const _Nonnull\n" @" of_unicode_uppercase_table[" @"OF_UNICODE_UPPERCASE_TABLE_SIZE];\n" - @"extern const of_unichar_t *const _Nonnull\n" + @"extern const OFUnichar *const _Nonnull\n" @" of_unicode_lowercase_table[" @"OF_UNICODE_LOWERCASE_TABLE_SIZE];\n" - @"extern const of_unichar_t *const _Nonnull\n" + @"extern const OFUnichar *const _Nonnull\n" @" of_unicode_titlecase_table[" @"OF_UNICODE_TITLECASE_TABLE_SIZE];\n" - @"extern const of_unichar_t *const _Nonnull\n" + @"extern const OFUnichar *const _Nonnull\n" @" of_unicode_casefolding_table[" @"OF_UNICODE_CASEFOLDING_TABLE_SIZE];\n" @"extern const char *const _Nullable *const _Nonnull\n" @" of_unicode_decomposition_table[" @"OF_UNICODE_DECOMPOSITION_TABLE_SIZE];\n" Index: src/Makefile ================================================================== --- src/Makefile +++ src/Makefile @@ -179,11 +179,10 @@ SRCS += OFAdjacentArray.m \ OFAdjacentSubarray.m \ OFBitSetCharacterSet.m \ OFBytesValue.m \ OFCountedMapTableSet.m \ - OFDimensionValue.m \ OFInvertedCharacterSet.m \ OFLHADecompressingStream.m \ OFMapTableDictionary.m \ OFMapTableSet.m \ OFMutableAdjacentArray.m \ @@ -193,12 +192,13 @@ OFNonretainedObjectValue.m \ OFPointValue.m \ OFPointerValue.m \ OFRangeCharacterSet.m \ OFRangeValue.m \ - OFRectangleValue.m \ + OFRectValue.m \ OFSandbox.m \ + OFSizeValue.m \ OFSubarray.m \ OFUTF8String.m \ ${LIBBASES_M} \ ${RUNTIME_AUTORELEASE_M} \ ${RUNTIME_INSTANCE_M} 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 || @@ -223,42 +223,42 @@ { id const *objects; size_t count; if (object == nil) - return OF_NOT_FOUND; + return OFNotFound; objects = _array.items; count = _array.count; for (size_t i = 0; i < count; i++) if ([objects[i] isEqual: object]) return i; - return OF_NOT_FOUND; + return OFNotFound; } - (size_t)indexOfObjectIdenticalTo: (id)object { id const *objects; size_t count; if (object == nil) - return OF_NOT_FOUND; + return OFNotFound; objects = _array.items; count = _array.count; for (size_t i = 0; i < count; i++) if (objects[i] == object) return i; - return OF_NOT_FOUND; + return OFNotFound; } -- (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/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -221,11 +221,11 @@ atexit(atexitHandler); #if defined(OF_WINDOWS) if ([OFSystemInfo isWindowsNT]) { - of_char16_t *env, *env0; + OFChar16 *env, *env0; env = env0 = GetEnvironmentStringsW(); while (*env != 0) { void *pool = objc_autoreleasePoolPush(); OFString *tmp, *key, *value; @@ -245,11 +245,11 @@ objc_autoreleasePoolPop(pool); continue; } pos = [tmp rangeOfString: @"="].location; - if (pos == OF_NOT_FOUND) { + if (pos == OFNotFound) { fprintf(stderr, "Warning: Invalid environment " "variable: %s\n", tmp.UTF8String); continue; } @@ -287,11 +287,11 @@ objc_autoreleasePoolPop(pool); continue; } pos = [tmp rangeOfString: @"="].location; - if (pos == OF_NOT_FOUND) { + if (pos == OFNotFound) { fprintf(stderr, "Warning: Invalid environment " "variable: %s\n", tmp.UTF8String); continue; } @@ -308,11 +308,11 @@ #elif defined(OF_AMIGAOS) void *pool = objc_autoreleasePoolPush(); OFFileManager *fileManager = [OFFileManager defaultManager]; OFArray *envContents = [fileManager contentsOfDirectoryAtPath: @"ENV:"]; - const of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; struct Process *proc; struct LocalVar *firstLocalVar; for (OFString *name in envContents) { void *pool2 = objc_autoreleasePoolPush(); @@ -374,12 +374,11 @@ # else char **env = *_NSGetEnviron(); # endif if (env != NULL) { - const of_string_encoding_t encoding = - [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; for (; *env != NULL; env++) { void *pool = objc_autoreleasePoolPush(); OFString *key, *value; char *sep; @@ -466,11 +465,11 @@ - (void)of_setArgumentCount: (int *)argc andArgumentValues: (char ***)argv { void *pool = objc_autoreleasePoolPush(); OFMutableArray *arguments; - of_string_encoding_t encoding; + OFStringEncoding encoding; _argc = argc; _argv = argv; encoding = [OFLocale encoding]; @@ -605,11 +604,11 @@ #ifdef OF_HAVE_SANDBOX - (void)of_activateSandbox: (OFSandbox *)sandbox { # ifdef OF_HAVE_PLEDGE void *pool = objc_autoreleasePoolPush(); - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; OFArray OF_GENERIC(of_sandbox_unveil_path_t) *unveiledPaths; size_t unveiledPathsCount; const char *promises; if (_activeSandbox != nil && sandbox != _activeSandbox) Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -268,29 +268,29 @@ * * @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. + * specified object or `OFNotFound` 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_NOT_FOUND` if it was not found + * or `OFNotFound` if it was not found */ - (size_t)indexOfObject: (ObjectType)object; /** * @brief Returns the index of the first object that has the same address as the - * specified object or `OF_NOT_FOUND` if it was not found. + * specified object or `OFNotFound` if it was not found. * * @param object The object whose index is returned * @return The index of the first object that has the same address as - * the specified object or `OF_NOT_FOUND` if it was not found + * the specified object or `OFNotFound` if it was not found */ - (size_t)indexOfObjectIdenticalTo: (ObjectType)object; /** * @brief Checks whether the array contains an object equal to the specified @@ -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 @@ -415,11 +415,11 @@ * ---------------------------|------------------------- * `OF_ARRAY_SORT_DESCENDING` | Sort in descending order * @return A sorted copy of the array */ - (OFArray OF_GENERIC(ObjectType) *) - sortedArrayUsingComparator: (of_comparator_t)comparator + sortedArrayUsingComparator: (OFComparator)comparator options: (int)options; #endif /** * @brief Creates a new array with the specified object added. 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]; @@ -304,47 +304,47 @@ - (size_t)indexOfObject: (id)object { size_t i = 0; if (object == nil) - return OF_NOT_FOUND; + return OFNotFound; for (id objectIter in self) { if ([objectIter isEqual: object]) return i; i++; } - return OF_NOT_FOUND; + return OFNotFound; } - (size_t)indexOfObjectIdenticalTo: (id)object { size_t i = 0; if (object == nil) - return OF_NOT_FOUND; + return OFNotFound; for (id objectIter in self) { if (objectIter == object) return i; i++; } - return OF_NOT_FOUND; + return OFNotFound; } - (bool)containsObject: (id)object { - return ([self indexOfObject: object] != OF_NOT_FOUND); + return ([self indexOfObject: object] != OFNotFound); } - (bool)containsObjectIdenticalTo: (id)object { - return ([self indexOfObjectIdenticalTo: object] != OF_NOT_FOUND); + return ([self indexOfObjectIdenticalTo: object] != OFNotFound); } - (id)firstObject { if (self.count > 0) @@ -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 || @@ -721,11 +721,11 @@ [new makeImmutable]; return new; } #ifdef OF_HAVE_BLOCKS -- (OFArray *)sortedArrayUsingComparator: (of_comparator_t)comparator +- (OFArray *)sortedArrayUsingComparator: (OFComparator)comparator options: (int)options { OFMutableArray *new = [[self mutableCopy] autorelease]; [new sortUsingComparator: comparator options: options]; [new makeImmutable]; @@ -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/OFBitSetCharacterSet.m ================================================================== --- src/OFBitSetCharacterSet.m +++ src/OFBitSetCharacterSet.m @@ -30,15 +30,15 @@ { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); - const of_unichar_t *characters = string.characters; + const OFUnichar *characters = string.characters; size_t length = string.length; for (size_t i = 0; i < length; i++) { - of_unichar_t c = characters[i]; + OFUnichar c = characters[i]; if (c / CHAR_BIT >= _size) { size_t newSize; if (UINT32_MAX - c < 1) @@ -71,13 +71,13 @@ free(_bitset); [super dealloc]; } -- (bool)characterIsMember: (of_unichar_t)character +- (bool)characterIsMember: (OFUnichar)character { if (character / CHAR_BIT >= _size) return false; return of_bitset_isset(_bitset, character); } @end 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,19 +78,19 @@ * 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. * * @param character The character that is checked for being a member of the * character set * @return Whether the specified character is a member of the character set. */ -- (bool)characterIsMember: (of_unichar_t)character; +- (bool)characterIsMember: (OFUnichar)character; @end OF_ASSUME_NONNULL_END 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,16 +132,16 @@ - (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 +- (bool)characterIsMember: (OFUnichar)character { OF_UNRECOGNIZED_SELECTOR } - (OFCharacterSet *)invertedSet @@ -169,11 +169,11 @@ - (unsigned int)retainCount { return OF_RETAIN_COUNT_MAX; } -- (bool)characterIsMember: (of_unichar_t)character +- (bool)characterIsMember: (OFUnichar)character { switch (character) { case 0x0009: case 0x0020: case 0x00A0: Index: src/OFCondition.h ================================================================== --- src/OFCondition.h +++ src/OFCondition.h @@ -70,11 +70,11 @@ * to check the condition again after @ref waitForTimeInterval: returned! * * @param timeInterval The time interval until the timeout is reached * @return Whether the condition has been signaled */ -- (bool)waitForTimeInterval: (of_time_interval_t)timeInterval; +- (bool)waitForTimeInterval: (OFTimeInterval)timeInterval; #ifdef OF_AMIGAOS /** * @brief Blocks the current thread until another thread calls @ref signal, * @ref broadcast, the timeout is reached or an Exec Signal is received. @@ -84,11 +84,11 @@ * @param timeInterval The time interval until the timeout is reached * @param signalMask A pointer to a signal mask of Exec Signals to receive. * This is modified and set to the mask of signals received. * @return Whether the condition has been signaled or a signal received */ -- (bool)waitForTimeInterval: (of_time_interval_t)timeInterval +- (bool)waitForTimeInterval: (OFTimeInterval)timeInterval orExecSignal: (ULONG *)signalMask; #endif /** * @brief Blocks the current thread until another thread calls @ref signal, Index: src/OFCondition.m ================================================================== --- src/OFCondition.m +++ src/OFCondition.m @@ -84,11 +84,11 @@ exceptionWithCondition: self errNo: error]; } #endif -- (bool)waitForTimeInterval: (of_time_interval_t)timeInterval +- (bool)waitForTimeInterval: (OFTimeInterval)timeInterval { int error = of_condition_timed_wait(&_condition, &_mutex, timeInterval); if (error == ETIMEDOUT) return false; @@ -100,11 +100,11 @@ return true; } #ifdef OF_AMIGAOS -- (bool)waitForTimeInterval: (of_time_interval_t)timeInterval +- (bool)waitForTimeInterval: (OFTimeInterval)timeInterval orExecSignal: (ULONG *)signalMask { int error = of_condition_timed_wait_or_signal(&_condition, &_mutex, timeInterval, signalMask); Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -177,11 +177,11 @@ [self finishInitialization]; return [self mutableCopy]; } /* From protocol OFComparing, but overridden in OFString */ -- (of_comparison_result_t)compare: (OFString *)string +- (OFComparisonResult)compare: (OFString *)string { [self finishInitialization]; return [self compare: string]; } @@ -211,19 +211,19 @@ return self.UTF8String; } - (size_t)getCString: (char *)cString_ maxLength: (size_t)maxLength - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { [self finishInitialization]; return [self getCString: cString_ maxLength: maxLength encoding: encoding]; } -- (const char *)cStringWithEncoding: (of_string_encoding_t)encoding +- (const char *)cStringWithEncoding: (OFStringEncoding)encoding { [self finishInitialization]; return [self cStringWithEncoding: encoding]; } @@ -237,49 +237,49 @@ { [self finishInitialization]; return self.UTF8StringLength; } -- (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding +- (size_t)cStringLengthWithEncoding: (OFStringEncoding)encoding { [self finishInitialization]; return [self cStringLengthWithEncoding: encoding]; } -- (of_comparison_result_t)caseInsensitiveCompare: (OFString *)string +- (OFComparisonResult)caseInsensitiveCompare: (OFString *)string { [self finishInitialization]; return [self caseInsensitiveCompare: string]; } -- (of_unichar_t)characterAtIndex: (size_t)idx +- (OFUnichar)characterAtIndex: (size_t)idx { [self finishInitialization]; return [self characterAtIndex: idx]; } -- (void)getCharacters: (of_unichar_t *)buffer inRange: (of_range_t)range +- (void)getCharacters: (OFUnichar *)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 @@ -504,23 +504,23 @@ { [self finishInitialization]; return self.doubleValue; } -- (const of_unichar_t *)characters +- (const OFUnichar *)characters { [self finishInitialization]; return self.characters; } -- (const of_char16_t *)UTF16String +- (const OFChar16 *)UTF16String { [self finishInitialization]; return self.UTF16String; } -- (const of_char16_t *)UTF16StringWithByteOrder: (of_byte_order_t)byteOrder +- (const OFChar16 *)UTF16StringWithByteOrder: (OFByteOrder)byteOrder { [self finishInitialization]; return [self UTF16StringWithByteOrder: byteOrder]; } @@ -528,23 +528,23 @@ { [self finishInitialization]; return self.UTF16StringLength; } -- (const of_char32_t *)UTF32String +- (const OFChar32 *)UTF32String { [self finishInitialization]; return self.UTF32String; } -- (const of_char32_t *)UTF32StringWithByteOrder: (of_byte_order_t)byteOrder +- (const OFChar32 *)UTF32StringWithByteOrder: (OFByteOrder)byteOrder { [self finishInitialization]; return [self UTF32StringWithByteOrder: byteOrder]; } -- (OFData *)dataWithEncoding: (of_string_encoding_t)encoding +- (OFData *)dataWithEncoding: (OFStringEncoding)encoding { [self finishInitialization]; return [self dataWithEncoding: encoding]; } @@ -575,11 +575,11 @@ { [self finishInitialization]; [self writeToFile: path]; } -- (void)writeToFile: (OFString *)path encoding: (of_string_encoding_t)encoding +- (void)writeToFile: (OFString *)path encoding: (OFStringEncoding)encoding { [self finishInitialization]; [self writeToFile: path encoding: encoding]; } #endif @@ -588,11 +588,11 @@ { [self finishInitialization]; [self writeToURL: URL]; } -- (void)writeToURL: (OFURL *)URL encoding: (of_string_encoding_t)encoding +- (void)writeToURL: (OFURL *)URL encoding: (OFStringEncoding)encoding { [self finishInitialization]; [self writeToURL: URL encoding: encoding]; } Index: src/OFDNSResolver.h ================================================================== --- src/OFDNSResolver.h +++ src/OFDNSResolver.h @@ -163,11 +163,11 @@ /** * @brief The timeout, in seconds, after which the next name server should be * tried. */ -@property (nonatomic) of_time_interval_t timeout; +@property (nonatomic) OFTimeInterval timeout; /** * @brief The number of attempts before giving up to resolve a host. * * Trying all name servers once is considered a single attempt. @@ -187,11 +187,11 @@ /** * @brief The interval in seconds in which the config should be reloaded. * * Setting this to 0 disables config reloading. */ -@property (nonatomic) of_time_interval_t configReloadInterval; +@property (nonatomic) OFTimeInterval configReloadInterval; /** * @brief Creates a new, autoreleased OFDNSResolver. */ + (instancetype)resolver; Index: src/OFDNSResolver.m ================================================================== --- src/OFDNSResolver.m +++ src/OFDNSResolver.m @@ -645,16 +645,16 @@ OFArray *old = _settings->_searchDomains; _settings->_searchDomains = [searchDomains copy]; [old release]; } -- (of_time_interval_t)timeout +- (OFTimeInterval)timeout { return _settings->_timeout; } -- (void)setTimeout: (of_time_interval_t)timeout +- (void)setTimeout: (OFTimeInterval)timeout { _settings->_timeout = timeout; } - (unsigned int)maxAttempts @@ -687,16 +687,16 @@ - (void)setUsesTCP: (bool)usesTCP { _settings->_usesTCP = usesTCP; } -- (of_time_interval_t)configReloadInterval +- (OFTimeInterval)configReloadInterval { return _settings->_configReloadInterval; } -- (void)setConfigReloadInterval: (of_time_interval_t)configReloadInterval +- (void)setConfigReloadInterval: (OFTimeInterval)configReloadInterval { _settings->_configReloadInterval = configReloadInterval; } - (void)of_sendQueryForContext: (OFDNSResolverContext *)context Index: src/OFDNSResolverSettings.h ================================================================== --- src/OFDNSResolverSettings.h +++ src/OFDNSResolverSettings.h @@ -27,17 +27,17 @@ OFDictionary OF_GENERIC(OFString *, OFArray OF_GENERIC(OFString *) *) *_staticHosts; OFArray OF_GENERIC(OFString *) *_nameServers; OFString *_Nullable _localDomain; OFArray OF_GENERIC(OFString *) *_searchDomains; - of_time_interval_t _timeout; + OFTimeInterval _timeout; unsigned int _maxAttempts, _minNumberOfDotsInAbsoluteName; bool _usesTCP; - of_time_interval_t _configReloadInterval; + OFTimeInterval _configReloadInterval; @protected OFDate *_lastConfigReload; } - (void)reload; @end OF_ASSUME_NONNULL_END Index: src/OFDNSResolverSettings.m ================================================================== --- src/OFDNSResolverSettings.m +++ src/OFDNSResolverSettings.m @@ -85,11 +85,11 @@ return nil; } @catch (OFInvalidFormatException *e) { /* Not an IP address -> we can use it if it contains a dot. */ size_t pos = [hostname rangeOfString: @"."].location; - if (pos == OF_NOT_FOUND) + if (pos == OFNotFound) return nil; return [hostname substringFromIndex: pos + 1]; } } @@ -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 @@ -265,11 +265,11 @@ OFArray *components, *hosts; size_t pos; OFString *address; pos = [line rangeOfString: @"#"].location; - if (pos != OF_NOT_FOUND) + if (pos != OFNotFound) line = [line substringToIndex: pos]; components = [line componentsSeparatedByCharactersInSet: whitespaceCharacterSet options: OF_STRING_SKIP_EMPTY]; @@ -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]; @@ -366,11 +366,11 @@ size_t pos; OFArray *components, *arguments; OFString *option; pos = [line indexOfCharacterFromSet: commentCharacters]; - if (pos != OF_NOT_FOUND) + if (pos != OFNotFound) line = [line substringToIndex: pos]; components = [line componentsSeparatedByCharactersInSet: whitespaceCharacterSet options: OF_STRING_SKIP_EMPTY]; @@ -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; @@ -420,11 +420,11 @@ #endif #ifdef OF_WINDOWS - (void)obtainWindowsSystemConfig { - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; OFMutableArray *nameServers; /* * We need more space than FIXED_INFO in case we have more than one * name server, but we also want it to be properly aligned, meaning we * can't just get a buffer of bytes. Thus, we just get space for 8. @@ -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]; @@ -507,11 +507,11 @@ #ifdef OF_AMIGAOS4 - (void)obtainAmigaOS4SystemConfig { OFMutableArray *nameServers = [OFMutableArray array]; - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; struct List *nameServerList = ObtainDomainNameServerList(); char buffer[MAXHOSTNAMELEN]; if (nameServerList == NULL) @throw [OFOutOfMemoryException exception]; Index: src/OFData+CryptographicHashing.m ================================================================== --- src/OFData+CryptographicHashing.m +++ src/OFData+CryptographicHashing.m @@ -54,11 +54,11 @@ } objc_autoreleasePoolPop(pool); return [OFString stringWithCString: cString - encoding: OF_STRING_ENCODING_ASCII + encoding: OFStringEncodingASCII length: digestSize * 2]; } - (OFString *)stringByMD5Hashing { Index: src/OFData.h ================================================================== --- src/OFData.h +++ src/OFData.h @@ -274,11 +274,11 @@ * @brief Compares the data to other data. * * @param data Data to compare the data to * @return The result of the comparison */ -- (of_comparison_result_t)compare: (OFData *)data; +- (OFComparisonResult)compare: (OFData *)data; /** * @brief Returns a specific item of the OFData. * * @param index The number of the item to return @@ -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 @@ -303,15 +303,15 @@ * Value | Description * ---------------------------|----------------------------- * `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. + * `OFNotFound` 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 @@ -271,11 +271,11 @@ { self = [super init]; @try { size_t count = [string - cStringLengthWithEncoding: OF_STRING_ENCODING_ASCII]; + cStringLengthWithEncoding: OFStringEncodingASCII]; const char *cString; if (count % 2 != 0) @throw [OFInvalidFormatException exception]; @@ -284,12 +284,11 @@ _items = of_alloc(count, 1); _count = count; _itemSize = 1; _freeWhenDone = true; - cString = [string - cStringWithEncoding: OF_STRING_ENCODING_ASCII]; + cString = [string cStringWithEncoding: OFStringEncodingASCII]; for (size_t i = 0; i < count; i++) { uint8_t c1 = cString[2 * i]; uint8_t c2 = cString[2 * i + 1]; uint8_t byte; @@ -333,13 +332,12 @@ self = [(OFMutableData *)self initWithCapacity: string.length / 3]; @try { if (!of_base64_decode((OFMutableData *)self, - [string cStringWithEncoding: OF_STRING_ENCODING_ASCII], - [string cStringLengthWithEncoding: - OF_STRING_ENCODING_ASCII])) + [string cStringWithEncoding: OFStringEncodingASCII], + [string cStringLengthWithEncoding: OFStringEncodingASCII])) @throw [OFInvalidFormatException exception]; } @catch (id e) { [self release]; @throw e; } @@ -447,11 +445,11 @@ return false; return true; } -- (of_comparison_result_t)compare: (OFData *)data +- (OFComparisonResult)compare: (OFData *)data { int comparison; size_t count, minCount; if (![data isKindOfClass: [OFData class]]) @@ -464,21 +462,21 @@ minCount = (_count > count ? count : _count); if ((comparison = memcmp(_items, data.items, minCount * _itemSize)) == 0) { if (_count > count) - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; if (_count < count) - return OF_ORDERED_ASCENDING; + return OFOrderedAscending; - return OF_ORDERED_SAME; + return OFOrderedSame; } if (comparison > 0) - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; else - return OF_ORDERED_ASCENDING; + return OFOrderedAscending; } - (unsigned long)hash { uint32_t hash; @@ -491,11 +489,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 +541,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 +556,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(OFNotFound, 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 +578,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(OFNotFound, 0); } #ifdef OF_HAVE_FILES - (void)writeToFile: (OFString *)path { Index: src/OFDate.h ================================================================== --- src/OFDate.h +++ src/OFDate.h @@ -31,11 +31,11 @@ OF_SUBCLASSING_RESTRICTED #endif @interface OFDate: OFObject { - of_time_interval_t _seconds; + OFTimeInterval _seconds; } #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nonatomic) OFDate *distantFuture; @property (class, readonly, nonatomic) OFDate *distantPast; @@ -122,16 +122,16 @@ @property (readonly, nonatomic) unsigned short localDayOfYear; /** * @brief The seconds since 1970-01-01T00:00:00Z. */ -@property (readonly, nonatomic) of_time_interval_t timeIntervalSince1970; +@property (readonly, nonatomic) OFTimeInterval timeIntervalSince1970; /** * @brief The seconds the date is in the future. */ -@property (readonly, nonatomic) of_time_interval_t timeIntervalSinceNow; +@property (readonly, nonatomic) OFTimeInterval timeIntervalSinceNow; /** * @brief Creates a new OFDate with the current date and time. * * @return A new, autoreleased OFDate with the current date and time @@ -143,19 +143,19 @@ * 1970-01-01T00:00:00Z. * * @param seconds The seconds since 1970-01-01T00:00:00Z * @return A new, autoreleased OFDate with the specified date and time */ -+ (instancetype)dateWithTimeIntervalSince1970: (of_time_interval_t)seconds; ++ (instancetype)dateWithTimeIntervalSince1970: (OFTimeInterval)seconds; /** * @brief Creates a new OFDate with the specified date and time since now. * * @param seconds The seconds since now * @return A new, autoreleased OFDate with the specified date and time */ -+ (instancetype)dateWithTimeIntervalSinceNow: (of_time_interval_t)seconds; ++ (instancetype)dateWithTimeIntervalSinceNow: (OFTimeInterval)seconds; /** * @brief Creates a new OFDate with the specified string in the specified * format. * @@ -215,21 +215,21 @@ * time since 1970-01-01T00:00:00Z. * * @param seconds The seconds since 1970-01-01T00:00:00Z * @return An initialized OFDate with the specified date and time */ -- (instancetype)initWithTimeIntervalSince1970: (of_time_interval_t)seconds +- (instancetype)initWithTimeIntervalSince1970: (OFTimeInterval)seconds OF_DESIGNATED_INITIALIZER; /** * @brief Initializes an already allocated OFDate with the specified date and * time since now. * * @param seconds The seconds since now * @return An initialized OFDate with the specified date and time */ -- (instancetype)initWithTimeIntervalSinceNow: (of_time_interval_t)seconds; +- (instancetype)initWithTimeIntervalSinceNow: (OFTimeInterval)seconds; /** * @brief Initializes an already allocated OFDate with the specified string in * the specified format. * @@ -271,11 +271,11 @@ * @brief Compares the date to another date. * * @param date The date to compare the date to * @return The result of the comparison */ -- (of_comparison_result_t)compare: (OFDate *)date; +- (OFComparisonResult)compare: (OFDate *)date; /** * @brief Creates a string of the date with the specified format. * * See the man page for `strftime` for information on the format. @@ -319,17 +319,17 @@ * @brief Returns the seconds the receiver is after the date. * * @param otherDate Date date to generate the difference with receiver * @return The seconds the receiver is after the date. */ -- (of_time_interval_t)timeIntervalSinceDate: (OFDate *)otherDate; +- (OFTimeInterval)timeIntervalSinceDate: (OFDate *)otherDate; /** * @brief Creates a new date with the specified time interval added. * * @param seconds The seconds after the date * @return A new, autoreleased OFDate */ -- (OFDate *)dateByAddingTimeInterval: (of_time_interval_t)seconds; +- (OFDate *)dateByAddingTimeInterval: (OFTimeInterval)seconds; @end OF_ASSUME_NONNULL_END Index: src/OFDate.m ================================================================== --- src/OFDate.m +++ src/OFDate.m @@ -89,20 +89,20 @@ { distantPast = [[OFDateSingleton alloc] initWithTimeIntervalSince1970: -62167219200.0]; } -static of_time_interval_t +static OFTimeInterval now(void) { struct timeval tv; - of_time_interval_t seconds; + OFTimeInterval seconds; OF_ENSURE(gettimeofday(&tv, NULL) == 0); seconds = tv.tv_sec; - seconds += (of_time_interval_t)tv.tv_usec / 1000000; + seconds += (OFTimeInterval)tv.tv_usec / 1000000; return seconds; } #if (!defined(HAVE_GMTIME_R) || !defined(HAVE_LOCALTIME_R)) && \ @@ -120,11 +120,11 @@ static __time64_t (*func__mktime64)(struct tm *); #endif #ifdef HAVE_GMTIME_R # define GMTIME_RET(field) \ - of_time_interval_t timeInterval = self.timeIntervalSince1970; \ + OFTimeInterval timeInterval = self.timeIntervalSince1970; \ time_t seconds = (time_t)timeInterval; \ struct tm tm; \ \ if (seconds != trunc(timeInterval)) \ @throw [OFOutOfRangeException exception]; \ @@ -132,11 +132,11 @@ if (gmtime_r(&seconds, &tm) == NULL) \ @throw [OFOutOfRangeException exception]; \ \ return tm.field; # define LOCALTIME_RET(field) \ - of_time_interval_t timeInterval = self.timeIntervalSince1970; \ + OFTimeInterval timeInterval = self.timeIntervalSince1970; \ time_t seconds = (time_t)timeInterval; \ struct tm tm; \ \ if (seconds != trunc(timeInterval)) \ @throw [OFOutOfRangeException exception]; \ @@ -146,11 +146,11 @@ \ return tm.field; #else # ifdef OF_HAVE_THREADS # define GMTIME_RET(field) \ - of_time_interval_t timeInterval = self.timeIntervalSince1970; \ + OFTimeInterval timeInterval = self.timeIntervalSince1970; \ time_t seconds = (time_t)timeInterval; \ struct tm *tm; \ \ if (seconds != trunc(timeInterval)) \ @throw [OFOutOfRangeException exception]; \ @@ -164,11 +164,11 @@ return tm->field; \ } @finally { \ [mutex unlock]; \ } # define LOCALTIME_RET(field) \ - of_time_interval_t timeInterval = self.timeIntervalSince1970; \ + OFTimeInterval timeInterval = self.timeIntervalSince1970; \ time_t seconds = (time_t)timeInterval; \ struct tm *tm; \ \ if (seconds != trunc(timeInterval)) \ @throw [OFOutOfRangeException exception]; \ @@ -183,11 +183,11 @@ } @finally { \ [mutex unlock]; \ } # else # define GMTIME_RET(field) \ - of_time_interval_t timeInterval = self.timeIntervalSince1970; \ + OFTimeInterval timeInterval = self.timeIntervalSince1970; \ time_t seconds = (time_t)timeInterval; \ struct tm *tm; \ \ if (seconds != trunc(timeInterval)) \ @throw [OFOutOfRangeException exception]; \ @@ -195,11 +195,11 @@ if ((tm = gmtime(&seconds)) == NULL) \ @throw [OFOutOfRangeException exception]; \ \ return tm->field; # define LOCALTIME_RET(field) \ - of_time_interval_t timeInterval = self.timeIntervalSince1970; \ + OFTimeInterval timeInterval = self.timeIntervalSince1970; \ time_t seconds = (time_t)timeInterval; \ struct tm *tm; \ \ if (seconds != trunc(timeInterval)) \ @throw [OFOutOfRangeException exception]; \ @@ -286,11 +286,11 @@ /* We intentionally don't call into super, so silence the warning. */ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wunknown-pragmas" # pragma clang diagnostic ignored "-Wobjc-designated-initializers" #endif -- (instancetype)initWithTimeIntervalSince1970: (of_time_interval_t)seconds +- (instancetype)initWithTimeIntervalSince1970: (OFTimeInterval)seconds { #if defined(OF_OBJFW_RUNTIME) && UINTPTR_MAX == UINT64_MAX uint64_t value; #endif @@ -321,11 +321,11 @@ #endif @end #if defined(OF_OBJFW_RUNTIME) && UINTPTR_MAX == UINT64_MAX @implementation OFTaggedPointerDate -- (of_time_interval_t)timeIntervalSince1970 +- (OFTimeInterval)timeIntervalSince1970 { uint64_t value = (uint64_t)object_getTaggedPointerValue(self); value |= UINT64_C(4) << 60; @@ -380,17 +380,17 @@ + (instancetype)date { return [[[self alloc] init] autorelease]; } -+ (instancetype)dateWithTimeIntervalSince1970: (of_time_interval_t)seconds ++ (instancetype)dateWithTimeIntervalSince1970: (OFTimeInterval)seconds { return [[[self alloc] initWithTimeIntervalSince1970: seconds] autorelease]; } -+ (instancetype)dateWithTimeIntervalSinceNow: (of_time_interval_t)seconds ++ (instancetype)dateWithTimeIntervalSinceNow: (OFTimeInterval)seconds { return [[[self alloc] initWithTimeIntervalSinceNow: seconds] autorelease]; } @@ -425,20 +425,20 @@ - (instancetype)init { return [self initWithTimeIntervalSince1970: now()]; } -- (instancetype)initWithTimeIntervalSince1970: (of_time_interval_t)seconds +- (instancetype)initWithTimeIntervalSince1970: (OFTimeInterval)seconds { self = [super init]; _seconds = seconds; return self; } -- (instancetype)initWithTimeIntervalSinceNow: (of_time_interval_t)seconds +- (instancetype)initWithTimeIntervalSinceNow: (OFTimeInterval)seconds { return [self initWithTimeIntervalSince1970: now() + seconds]; } - (instancetype)initWithDateString: (OFString *)string @@ -468,11 +468,11 @@ * of_strptime() can never set this to SHRT_MAX, no matter what is * passed to it, so this is a safe way to figure out if the date * contains a time zone. */ short tz = SHRT_MAX; - of_time_interval_t seconds; + OFTimeInterval seconds; if (of_strptime(UTF8String, format.UTF8String, &tm, &tz) != UTF8String + string.UTF8StringLength) @throw [OFInvalidFormatException exception]; @@ -496,11 +496,11 @@ return [self initWithTimeIntervalSince1970: seconds]; } - (instancetype)initWithSerialization: (OFXMLElement *)element { - of_time_interval_t seconds; + OFTimeInterval seconds; @try { void *pool = objc_autoreleasePoolPush(); unsigned long long value; @@ -563,21 +563,21 @@ - (id)copy { return [self retain]; } -- (of_comparison_result_t)compare: (OFDate *)date +- (OFComparisonResult)compare: (OFDate *)date { if (![date isKindOfClass: [OFDate class]]) @throw [OFInvalidArgumentException exception]; if (self.timeIntervalSince1970 < date.timeIntervalSince1970) - return OF_ORDERED_ASCENDING; + return OFOrderedAscending; if (self.timeIntervalSince1970 > date.timeIntervalSince1970) - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; - return OF_ORDERED_SAME; + return OFOrderedSame; } - (OFString *)description { return [self dateStringWithFormat: @"%Y-%m-%dT%H:%M:%SZ"]; @@ -603,11 +603,11 @@ } - (OFData *)messagePackRepresentation { void *pool = objc_autoreleasePoolPush(); - of_time_interval_t timeInterval = self.timeIntervalSince1970; + OFTimeInterval timeInterval = self.timeIntervalSince1970; int64_t seconds = (int64_t)timeInterval; uint32_t nanoseconds = (uint32_t)((timeInterval - trunc(timeInterval)) * 1000000000); OFData *ret; @@ -656,11 +656,11 @@ return [ret autorelease]; } - (unsigned long)microsecond { - of_time_interval_t timeInterval = self.timeIntervalSince1970; + OFTimeInterval timeInterval = self.timeIntervalSince1970; return (unsigned long)((timeInterval - trunc(timeInterval)) * 1000000); } - (unsigned char)second @@ -739,11 +739,11 @@ } - (OFString *)dateStringWithFormat: (OFConstantString *)format { OFString *ret; - of_time_interval_t timeInterval = self.timeIntervalSince1970; + OFTimeInterval timeInterval = self.timeIntervalSince1970; time_t seconds = (time_t)timeInterval; struct tm tm; size_t pageSize; #ifndef OF_WINDOWS char *buffer; @@ -799,11 +799,11 @@ } - (OFString *)localDateStringWithFormat: (OFConstantString *)format { OFString *ret; - of_time_interval_t timeInterval = self.timeIntervalSince1970; + OFTimeInterval timeInterval = self.timeIntervalSince1970; time_t seconds = (time_t)timeInterval; struct tm tm; size_t pageSize; #ifndef OF_WINDOWS char *buffer; @@ -861,11 +861,11 @@ - (OFDate *)earlierDate: (OFDate *)otherDate { if (otherDate == nil) return self; - if ([self compare: otherDate] == OF_ORDERED_DESCENDING) + if ([self compare: otherDate] == OFOrderedDescending) return otherDate; return self; } @@ -872,40 +872,40 @@ - (OFDate *)laterDate: (OFDate *)otherDate { if (otherDate == nil) return self; - if ([self compare: otherDate] == OF_ORDERED_ASCENDING) + if ([self compare: otherDate] == OFOrderedAscending) return otherDate; return self; } -- (of_time_interval_t)timeIntervalSince1970 +- (OFTimeInterval)timeIntervalSince1970 { return _seconds; } -- (of_time_interval_t)timeIntervalSinceDate: (OFDate *)otherDate +- (OFTimeInterval)timeIntervalSinceDate: (OFDate *)otherDate { return self.timeIntervalSince1970 - otherDate.timeIntervalSince1970; } -- (of_time_interval_t)timeIntervalSinceNow +- (OFTimeInterval)timeIntervalSinceNow { struct timeval t; - of_time_interval_t seconds; + OFTimeInterval seconds; OF_ENSURE(gettimeofday(&t, NULL) == 0); seconds = t.tv_sec; - seconds += (of_time_interval_t)t.tv_usec / 1000000; + seconds += (OFTimeInterval)t.tv_usec / 1000000; return self.timeIntervalSince1970 - seconds; } -- (OFDate *)dateByAddingTimeInterval: (of_time_interval_t)seconds +- (OFDate *)dateByAddingTimeInterval: (OFTimeInterval)seconds { return [OFDate dateWithTimeIntervalSince1970: self.timeIntervalSince1970 + seconds]; } @end Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -172,11 +172,11 @@ - (unsigned int)retainCount { return OF_RETAIN_COUNT_MAX; } -- (bool)characterIsMember: (of_unichar_t)character +- (bool)characterIsMember: (OFUnichar)character { if (character < CHAR_MAX && of_ascii_isalnum(character)) return true; switch (character) { DELETED src/OFDimensionValue.h Index: src/OFDimensionValue.h ================================================================== --- src/OFDimensionValue.h +++ src/OFDimensionValue.h @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2008-2021 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#import "OFValue.h" - -OF_ASSUME_NONNULL_BEGIN - -@interface OFDimensionValue: OFValue -{ - of_dimension_t _dimension; -} - -- (instancetype)initWithDimension: (of_dimension_t)dimension; -@end - -OF_ASSUME_NONNULL_END DELETED src/OFDimensionValue.m Index: src/OFDimensionValue.m ================================================================== --- src/OFDimensionValue.m +++ src/OFDimensionValue.m @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2008-2021 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#import "OFDimensionValue.h" -#import "OFMethodSignature.h" -#import "OFString.h" - -#import "OFOutOfRangeException.h" - -@implementation OFDimensionValue -@synthesize dimensionValue = _dimension; - -- (instancetype)initWithDimension: (of_dimension_t)dimension -{ - self = [super init]; - - _dimension = dimension; - - return self; -} - -- (const char *)objCType -{ - return @encode(of_dimension_t); -} - -- (void)getValue: (void *)value size: (size_t)size -{ - if (size != sizeof(_dimension)) - @throw [OFOutOfRangeException exception]; - - memcpy(value, &_dimension, sizeof(_dimension)); -} - -- (OFString *)description -{ - return [OFString stringWithFormat: - @"", - _dimension.width, _dimension.height]; -} -@end Index: src/OFEpollKernelEventObserver.m ================================================================== --- src/OFEpollKernelEventObserver.m +++ src/OFEpollKernelEventObserver.m @@ -185,11 +185,11 @@ events: EPOLLOUT]; [super removeObjectForWriting: object]; } -- (void)observeForTimeInterval: (of_time_interval_t)timeInterval +- (void)observeForTimeInterval: (OFTimeInterval)timeInterval { OFNull *nullObject = [OFNull null]; struct epoll_event eventList[EVENTLIST_SIZE]; int events; Index: src/OFFileURLHandler.m ================================================================== --- src/OFFileURLHandler.m +++ src/OFFileURLHandler.m @@ -87,14 +87,14 @@ #if defined(OF_WINDOWS) || defined(OF_AMIGAOS) typedef struct { of_offset_t st_size; unsigned int st_mode; - of_time_interval_t st_atime, st_mtime, st_ctime; + OFTimeInterval st_atime, st_mtime, st_ctime; # ifdef OF_WINDOWS # define HAVE_STRUCT_STAT_ST_BIRTHTIME - of_time_interval_t st_birthtime; + OFTimeInterval st_birthtime; DWORD fileAttributes; # endif } of_stat_t; #elif defined(HAVE_STAT64) typedef struct stat64 of_stat_t; @@ -132,11 +132,11 @@ static WINAPI BOOLEAN (*func_CreateHardLinkW)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES); #endif #ifdef OF_WINDOWS -static of_time_interval_t +static OFTimeInterval filetimeToTimeInterval(const FILETIME *filetime) { return (double)((int64_t)filetime->dwHighDateTime << 32 | filetime->dwLowDateTime) / 10000000.0 - 11644473600.0; } @@ -260,11 +260,11 @@ # ifdef OF_AMIGAOS4 struct ExamineData *ed; # else struct FileInfoBlock fib; # endif - of_time_interval_t timeInterval; + OFTimeInterval timeInterval; struct Locale *locale; struct DateStamp *date; if ((lock = Lock([path cStringWithEncoding: [OFLocale encoding]], SHARED_LOCK)) == 0) @@ -313,11 +313,11 @@ # else date = &fib.fib_Date; # endif timeInterval += date->ds_Days * 86400.0; timeInterval += date->ds_Minute * 60.0; - timeInterval += date->ds_Tick / (of_time_interval_t)TICKS_PER_SECOND; + timeInterval += date->ds_Tick / (OFTimeInterval)TICKS_PER_SECOND; buffer->st_atime = buffer->st_mtime = buffer->st_ctime = timeInterval; # ifdef OF_AMIGAOS4 FreeDosObject(DOS_EXAMINEDATA, ed); @@ -426,11 +426,11 @@ # ifdef OF_HAVE_THREADS [passwdMutex lock]; @try { # endif - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; struct passwd *passwd = getpwuid(s->st_uid); struct group *group_ = getgrgid(s->st_gid); if (passwd != NULL) { OFString *owner = [OFString @@ -462,11 +462,11 @@ setSymbolicLinkDestinationAttribute(of_mutable_file_attributes_t attributes, OFURL *URL) { OFString *path = URL.fileSystemRepresentation; # ifndef OF_WINDOWS - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; char destinationC[PATH_MAX]; ssize_t length; OFString *destination; of_file_attribute_key_t key; @@ -701,11 +701,11 @@ failedAttribute: attributeKey errNo: errno]; } #elif defined(OF_AMIGAOS) /* AmigaOS does not support access time. */ - of_time_interval_t modificationTime = + OFTimeInterval modificationTime = modificationDate.timeIntervalSince1970; struct Locale *locale; struct DateStamp date; modificationTime -= 252460800; /* 1978-01-01 */ @@ -737,13 +737,12 @@ exceptionWithURL: URL attributes: attributes failedAttribute: attributeKey errNo: retrieveError()]; #else - of_time_interval_t lastAccessTime = - lastAccessDate.timeIntervalSince1970; - of_time_interval_t modificationTime = + OFTimeInterval lastAccessTime = lastAccessDate.timeIntervalSince1970; + OFTimeInterval modificationTime = modificationDate.timeIntervalSince1970; struct timeval times[2] = { { .tv_sec = (time_t)lastAccessTime, .tv_usec = @@ -801,11 +800,11 @@ { #ifdef OF_FILE_MANAGER_SUPPORTS_OWNER OFString *path = URL.fileSystemRepresentation; uid_t uid = -1; gid_t gid = -1; - of_string_encoding_t encoding; + OFStringEncoding encoding; if (owner == nil && group == nil) @throw [OFInvalidArgumentException exception]; encoding = [OFLocale encoding]; @@ -1066,11 +1065,11 @@ errNo: retrieveError()]; } @finally { FindClose(handle); } } else { - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; WIN32_FIND_DATA fd; if ((handle = FindFirstFileA( [path cStringWithEncoding: encoding], &fd)) == INVALID_HANDLE_VALUE) @@ -1106,11 +1105,11 @@ } @finally { FindClose(handle); } } #elif defined(OF_AMIGAOS) - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; BPTR lock; if ((lock = Lock([path cStringWithEncoding: encoding], SHARED_LOCK)) == 0) @throw [OFOpenItemFailedException @@ -1176,11 +1175,11 @@ errNo: retrieveError()]; } @finally { UnLock(lock); } #else - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; DIR *dir; if ((dir = opendir([path cStringWithEncoding: encoding])) == NULL) @throw [OFOpenItemFailedException exceptionWithURL: URL mode: nil errNo: errno]; @@ -1358,11 +1357,11 @@ sourcePath = source.fileSystemRepresentation; destinationPath = destination.fileSystemRepresentation; # ifndef OF_WINDOWS - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; if (link([sourcePath cStringWithEncoding: encoding], [destinationPath cStringWithEncoding: encoding]) != 0) @throw [OFLinkFailedException exceptionWithSourceURL: source @@ -1399,11 +1398,11 @@ @throw [OFInvalidArgumentException exception]; path = URL.fileSystemRepresentation; # ifndef OF_WINDOWS - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; if (symlink([target cStringWithEncoding: encoding], [path cStringWithEncoding: encoding]) != 0) @throw [OFCreateSymbolicLinkFailedException exceptionWithURL: URL @@ -1440,11 +1439,11 @@ errNo: EEXIST]; pool = objc_autoreleasePoolPush(); #ifdef OF_AMIGAOS - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; if (!Rename([source.fileSystemRepresentation cStringWithEncoding: encoding], [destination.fileSystemRepresentation cStringWithEncoding: encoding])) @@ -1459,11 +1458,11 @@ if ([OFSystemInfo isWindowsNT]) status = _wrename(source.fileSystemRepresentation.UTF16String, destination.fileSystemRepresentation.UTF16String); else { # endif - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; status = rename([source.fileSystemRepresentation cStringWithEncoding: encoding], [destination.fileSystemRepresentation cStringWithEncoding: encoding]); Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -319,11 +319,11 @@ else keepAlive = true; } else { if (connectionHeader != nil) keepAlive = ([connectionHeader caseInsensitiveCompare: - @"keep-alive"] == OF_ORDERED_SAME); + @"keep-alive"] == OFOrderedSame); else keepAlive = false; } if (keepAlive) { @@ -346,20 +346,20 @@ newURL = [OFURL URLWithString: location relativeToURL: URL]; newURLScheme = newURL.scheme; if ([newURLScheme caseInsensitiveCompare: @"http"] != - OF_ORDERED_SAME && + OFOrderedSame && [newURLScheme caseInsensitiveCompare: @"https"] != - OF_ORDERED_SAME) + OFOrderedSame) follow = false; if (!_client->_allowsInsecureRedirects && [URL.scheme caseInsensitiveCompare: @"https"] == - OF_ORDERED_SAME && + OFOrderedSame && [newURLScheme caseInsensitiveCompare: @"http"] == - OF_ORDERED_SAME) + OFOrderedSame) follow = false; if (follow && [_client->_delegate respondsToSelector: @selector( client:shouldFollowRedirect:statusCode:request:response:)]) follow = [_client->_delegate client: _client @@ -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; @@ -567,11 +567,11 @@ return ret; } - (OFString *)stream: (OFStream *)stream didWriteString: (OFString *)string - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding bytesWritten: (size_t)bytesWritten exception: (id)exception { OFDictionary OF_GENERIC(OFString *, OFString *) *headers; bool chunked; @@ -699,11 +699,11 @@ OFNumber *URLPort; [_client close]; if ([URL.scheme caseInsensitiveCompare: @"https"] == - OF_ORDERED_SAME) { + OFOrderedSame) { if (of_tls_socket_class == Nil) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; sock = [[[of_tls_socket_class alloc] init] autorelease]; @@ -995,19 +995,19 @@ if (line == nil) return 0; pos = [line rangeOfString: @";"].location; - if (pos != OF_NOT_FOUND) + if (pos != OFNotFound) line = [line substringToIndex: pos]; if (line.length < 1) { /* * We have read the empty string because the socket is * at end of stream. */ - if (_socket.atEndOfStream && pos == OF_NOT_FOUND) + if (_socket.atEndOfStream && pos == OFNotFound) @throw [OFTruncatedDataException exception]; else @throw [OFInvalidServerReplyException exception]; } @@ -1238,12 +1238,12 @@ { void *pool = objc_autoreleasePoolPush(); OFURL *URL = request.URL; OFString *scheme = URL.scheme; - if ([scheme caseInsensitiveCompare: @"http"] != OF_ORDERED_SAME && - [scheme caseInsensitiveCompare: @"https"] != OF_ORDERED_SAME) + if ([scheme caseInsensitiveCompare: @"http"] != OFOrderedSame && + [scheme caseInsensitiveCompare: @"https"] != OFOrderedSame) @throw [OFUnsupportedProtocolException exceptionWithURL: URL]; if (_inProgress) /* TODO: Find a better exception */ @throw [OFAlreadyConnectedException exception]; Index: src/OFHTTPCookie.m ================================================================== --- src/OFHTTPCookie.m +++ src/OFHTTPCookie.m @@ -66,11 +66,11 @@ { OFMutableArray OF_GENERIC(OFHTTPCookie *) *ret = [OFMutableArray array]; void *pool = objc_autoreleasePoolPush(); OFString *string = [headerFields objectForKey: @"Set-Cookie"]; OFString *domain = URL.host; - const of_unichar_t *characters = string.characters; + const OFUnichar *characters = string.characters; size_t length = string.length, last = 0; enum { STATE_PRE_NAME, STATE_NAME, STATE_EXPECT_VALUE, @@ -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, @@ -183,11 +183,11 @@ * meaning RFC 6265 contradicts RFC 2616. * Solve this by special casing this. */ if (characters[i] == ',' && [name caseInsensitiveCompare: @"expires"] == - OF_ORDERED_SAME && value.length == 3 && + OFOrderedSame && value.length == 3 && ([value isEqual: @"Mon"] || [value isEqual: @"Tue"] || [value isEqual: @"Wed"] || [value isEqual: @"Thu"] || [value isEqual: @"Fri"] || @@ -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/OFHTTPCookieManager.m ================================================================== --- src/OFHTTPCookieManager.m +++ src/OFHTTPCookieManager.m @@ -61,11 +61,11 @@ if (![cookie.path hasPrefix: @"/"]) cookie.path = @"/"; if (cookie.secure && - [URL.scheme caseInsensitiveCompare: @"https"] != OF_ORDERED_SAME) { + [URL.scheme caseInsensitiveCompare: @"https"] != OFOrderedSame) { objc_autoreleasePoolPop(pool); return; } cookieDomain = cookie.domain.lowercaseString; @@ -119,11 +119,11 @@ expires = cookie.expires; if (expires != nil && expires.timeIntervalSinceNow <= 0) continue; if (cookie.secure && [URL.scheme caseInsensitiveCompare: - @"https"] != OF_ORDERED_SAME) + @"https"] != OFOrderedSame) continue; pool = objc_autoreleasePoolPush(); cookieDomain = cookie.domain.lowercaseString; Index: src/OFHTTPResponse.h ================================================================== --- src/OFHTTPResponse.h +++ src/OFHTTPResponse.h @@ -64,11 +64,11 @@ * @brief Returns the reply as a string, trying to detect the encoding and * falling back to the specified encoding if not detectable. * * @return The reply as a string */ -- (OFString *)stringWithEncoding: (of_string_encoding_t)encoding; +- (OFString *)stringWithEncoding: (OFStringEncoding)encoding; @end #ifdef __cplusplus extern "C" { #endif Index: src/OFHTTPResponse.m ================================================================== --- src/OFHTTPResponse.m +++ src/OFHTTPResponse.m @@ -114,11 +114,11 @@ default: return @"(unknown)"; } } -static of_string_encoding_t +static OFStringEncoding encodingForContentType(OFString *contentType) { const char *UTF8String = contentType.UTF8String; size_t last, length = contentType.UTF8StringLength; enum { @@ -129,11 +129,11 @@ STATE_PARAM_VALUE, STATE_PARAM_QUOTED_VALUE, STATE_AFTER_PARAM_VALUE } state = STATE_TYPE; OFString *name = nil, *value = nil, *charset = nil; - of_string_encoding_t ret; + OFStringEncoding ret; last = 0; for (size_t i = 0; i < length; i++) { switch (state) { case STATE_TYPE: @@ -199,11 +199,11 @@ case STATE_AFTER_PARAM_VALUE: if (UTF8String[i] == ';') { state = STATE_BEFORE_PARAM_NAME; last = i + 1; } else if (UTF8String[i] != ' ') - return OF_STRING_ENCODING_AUTODETECT; + return OFStringEncodingAutodetect; break; } } if (state == STATE_PARAM_VALUE) { value = [OFString stringWithUTF8String: UTF8String + last @@ -213,13 +213,13 @@ if ([name isEqual: @"charset"]) charset = value; } @try { - ret = of_string_parse_encoding(charset); + ret = OFParseStringEncodingName(charset); } @catch (OFInvalidArgumentException *e) { - ret = OF_STRING_ENCODING_AUTODETECT; + ret = OFStringEncodingAutodetect; } return ret; } @@ -296,25 +296,25 @@ _protocolVersion.minor]; } - (OFString *)string { - return [self stringWithEncoding: OF_STRING_ENCODING_AUTODETECT]; + return [self stringWithEncoding: OFStringEncodingAutodetect]; } -- (OFString *)stringWithEncoding: (of_string_encoding_t)encoding +- (OFString *)stringWithEncoding: (OFStringEncoding)encoding { void *pool = objc_autoreleasePoolPush(); OFString *contentType, *contentLengthString, *ret; OFData *data; - if (encoding == OF_STRING_ENCODING_AUTODETECT && + if (encoding == OFStringEncodingAutodetect && (contentType = [_headers objectForKey: @"Content-Type"]) != nil) encoding = encodingForContentType(contentType); - if (encoding == OF_STRING_ENCODING_AUTODETECT) - encoding = OF_STRING_ENCODING_UTF_8; + if (encoding == OFStringEncodingAutodetect) + encoding = OFStringEncodingUTF8; data = [self readDataUntilEndOfStream]; contentLengthString = [_headers objectForKey: @"Content-Length"]; if (contentLengthString != nil) { Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -352,12 +352,12 @@ OFMutableString *path; size_t pos; @try { OFString *version = [line - substringWithRange: of_range(line.length - 9, 9)]; - of_unichar_t tmp; + substringWithRange: OFMakeRange(line.length - 9, 9)]; + OFUnichar tmp; if (![version hasPrefix: @" HTTP/1."]) return [self sendErrorAndClose: 505]; tmp = [version characterAtIndex: 8]; @@ -368,11 +368,11 @@ } @catch (OFOutOfRangeException *e) { return [self sendErrorAndClose: 400]; } pos = [line rangeOfString: @" "].location; - if (pos == OF_NOT_FOUND) + if (pos == OFNotFound) return [self sendErrorAndClose: 400]; method = [line substringToIndex: pos]; @try { _method = of_http_request_method_from_string(method); @@ -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]; @@ -444,11 +444,11 @@ return false; } pos = [line rangeOfString: @":"].location; - if (pos == OF_NOT_FOUND) + if (pos == OFNotFound) return [self sendErrorAndClose: 400]; key = [line substringToIndex: pos]; value = [line substringFromIndex: pos + 1]; @@ -464,11 +464,11 @@ if ([key isEqual: @"Host"]) { pos = [value rangeOfString: @":" options: OF_STRING_SEARCH_BACKWARDS].location; - if (pos != OF_NOT_FOUND) { + if (pos != OFNotFound) { [_host release]; _host = [[value substringToIndex: pos] retain]; @try { unsigned long long portTmp = @@ -533,11 +533,11 @@ URL.scheme = @"http"; URL.host = _host; if (_port != 80) URL.port = [OFNumber numberWithUnsignedShort: _port]; - if ((pos = [_path rangeOfString: @"?"].location) != OF_NOT_FOUND) { + if ((pos = [_path rangeOfString: @"?"].location) != OFNotFound) { OFString *path, *query; path = [_path substringToIndex: pos]; query = [_path substringFromIndex: pos + 1]; @@ -692,19 +692,19 @@ if (line == nil) return 0; pos = [line rangeOfString: @";"].location; - if (pos != OF_NOT_FOUND) + if (pos != OFNotFound) line = [line substringToIndex: pos]; if (line.length < 1) { /* * We have read the empty string because the socket is * at end of stream. */ - if (_socket.atEndOfStream && pos == OF_NOT_FOUND) + if (_socket.atEndOfStream && pos == OFNotFound) @throw [OFTruncatedDataException exception]; else @throw [OFInvalidFormatException exception]; } Index: src/OFINICategory+Private.h ================================================================== --- src/OFINICategory+Private.h +++ src/OFINICategory+Private.h @@ -23,10 +23,10 @@ OF_DIRECT_MEMBERS @interface OFINICategory () - (instancetype)of_initWithName: (OFString *)name OF_METHOD_FAMILY(init); - (void)of_parseLine: (OFString *)line; - (bool)of_writeToStream: (OFStream *)stream - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding first: (bool)first; @end OF_ASSUME_NONNULL_END 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"]; @@ -154,11 +154,11 @@ OFINICategoryPair *pair = [[[OFINICategoryPair alloc] init] autorelease]; OFString *key, *value; size_t pos; - if ((pos = [line rangeOfString: @"="].location) == OF_NOT_FOUND) + if ((pos = [line rangeOfString: @"="].location) == OFNotFound) @throw [OFInvalidFormatException exception]; key = unescapeString([line substringToIndex: pos] .stringByDeletingEnclosingWhitespaces); value = unescapeString([line substringFromIndex: pos + 1] @@ -466,11 +466,11 @@ objc_autoreleasePoolPop(pool); } - (bool)of_writeToStream: (OFStream *)stream - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding first: (bool)first { if (_lines.count == 0) return false; Index: src/OFINIFile.h ================================================================== --- src/OFINIFile.h +++ src/OFINIFile.h @@ -54,11 +54,11 @@ * @param encoding The encoding of the specified file * * @return A new, autoreleased OFINIFile with the contents of the specified file */ + (instancetype)fileWithPath: (OFString *)path - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; - (instancetype)init OF_UNAVAILABLE; /** * @brief Initializes an already allocated OFINIFile with the contents of the @@ -78,11 +78,11 @@ * @param encoding The encoding of the specified file * * @return An initialized OFINIFile with the contents of the specified file */ - (instancetype)initWithPath: (OFString *)path - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding OF_DESIGNATED_INITIALIZER; /** * @brief Returns an @ref OFINICategory for the category with the specified * name. @@ -106,9 +106,9 @@ * encoding. * * @param path The path of the file to write to * @param encoding The encoding to use */ -- (void)writeToFile: (OFString *)path encoding: (of_string_encoding_t)encoding; +- (void)writeToFile: (OFString *)path encoding: (OFStringEncoding)encoding; @end OF_ASSUME_NONNULL_END Index: src/OFINIFile.m ================================================================== --- src/OFINIFile.m +++ src/OFINIFile.m @@ -27,11 +27,11 @@ #import "OFInvalidFormatException.h" #import "OFOpenItemFailedException.h" OF_DIRECT_MEMBERS @interface OFINIFile () -- (void)of_parseFile: (OFString *)path encoding: (of_string_encoding_t)encoding; +- (void)of_parseFile: (OFString *)path encoding: (OFStringEncoding)encoding; @end static bool isWhitespaceLine(OFString *line) { @@ -52,11 +52,11 @@ { return [[[self alloc] initWithPath: path] autorelease]; } + (instancetype)fileWithPath: (OFString *)path - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return [[[self alloc] initWithPath: path encoding: encoding] autorelease]; } @@ -65,15 +65,15 @@ OF_INVALID_INIT_METHOD } - (instancetype)initWithPath: (OFString *)path { - return [self initWithPath: path encoding: OF_STRING_ENCODING_UTF_8]; + return [self initWithPath: path encoding: OFStringEncodingUTF8]; } - (instancetype)initWithPath: (OFString *)path - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { self = [super init]; @try { _categories = [[OFMutableArray alloc] init]; @@ -109,11 +109,11 @@ objc_autoreleasePoolPop(pool); return category; } -- (void)of_parseFile: (OFString *)path encoding: (of_string_encoding_t)encoding +- (void)of_parseFile: (OFString *)path encoding: (OFStringEncoding)encoding { void *pool = objc_autoreleasePoolPush(); OFFile *file; OFINICategory *category = nil; OFString *line; @@ -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) @@ -154,14 +154,14 @@ objc_autoreleasePoolPop(pool); } - (void)writeToFile: (OFString *)path { - [self writeToFile: path encoding: OF_STRING_ENCODING_UTF_8]; + [self writeToFile: path encoding: OFStringEncodingUTF8]; } -- (void)writeToFile: (OFString *)path encoding: (of_string_encoding_t)encoding +- (void)writeToFile: (OFString *)path encoding: (OFStringEncoding)encoding { void *pool = objc_autoreleasePoolPush(); OFFile *file = [OFFile fileWithPath: path mode: @"w"]; bool first = true; Index: src/OFINIFileSettings.m ================================================================== --- src/OFINIFileSettings.m +++ src/OFINIFileSettings.m @@ -57,11 +57,11 @@ forPath: (OFString *)path OF_DIRECT { size_t pos = [path rangeOfString: @"." options: OF_STRING_SEARCH_BACKWARDS].location; - if (pos == OF_NOT_FOUND) { + if (pos == OFNotFound) { *category = @""; *key = path; return; } Index: src/OFInvertedCharacterSet.h ================================================================== --- src/OFInvertedCharacterSet.h +++ src/OFInvertedCharacterSet.h @@ -18,12 +18,12 @@ OF_ASSUME_NONNULL_BEGIN @interface OFInvertedCharacterSet: OFCharacterSet { OFCharacterSet *_characterSet; - bool (*_characterIsMember)(id, SEL, of_unichar_t); + bool (*_characterIsMember)(id, SEL, OFUnichar); } - (instancetype)initWithCharacterSet: (OFCharacterSet *)characterSet; @end OF_ASSUME_NONNULL_END Index: src/OFInvertedCharacterSet.m ================================================================== --- src/OFInvertedCharacterSet.m +++ src/OFInvertedCharacterSet.m @@ -30,11 +30,11 @@ { self = [super init]; @try { _characterSet = [characterSet retain]; - _characterIsMember = (bool (*)(id, SEL, of_unichar_t)) + _characterIsMember = (bool (*)(id, SEL, OFUnichar)) [_characterSet methodForSelector: @selector(characterIsMember:)]; } @catch (id e) { [self release]; @throw e; @@ -48,11 +48,11 @@ [_characterSet release]; [super dealloc]; } -- (bool)characterIsMember: (of_unichar_t)character +- (bool)characterIsMember: (OFUnichar)character { return !_characterIsMember(_characterSet, @selector(characterIsMember:), character); } Index: src/OFKernelEventObserver.h ================================================================== --- src/OFKernelEventObserver.h +++ src/OFKernelEventObserver.h @@ -211,11 +211,11 @@ * @brief Observes all objects until an event happens on an object or the * timeout is reached. * * @param timeInterval The time to wait for an event, in seconds */ -- (void)observeForTimeInterval: (of_time_interval_t)timeInterval; +- (void)observeForTimeInterval: (OFTimeInterval)timeInterval; /** * @brief Observes all objects until an event happens on an object or the * specified date is reached. * Index: src/OFKernelEventObserver.m ================================================================== --- src/OFKernelEventObserver.m +++ src/OFKernelEventObserver.m @@ -243,11 +243,11 @@ - (void)observe { [self observeForTimeInterval: -1]; } -- (void)observeForTimeInterval: (of_time_interval_t)timeInterval +- (void)observeForTimeInterval: (OFTimeInterval)timeInterval { OF_UNRECOGNIZED_SELECTOR } - (void)observeUntilDate: (OFDate *)date Index: src/OFKqueueKernelEventObserver.m ================================================================== --- src/OFKqueueKernelEventObserver.m +++ src/OFKqueueKernelEventObserver.m @@ -151,11 +151,11 @@ errNo: errno]; [super removeObjectForWriting: object]; } -- (void)observeForTimeInterval: (of_time_interval_t)timeInterval +- (void)observeForTimeInterval: (OFTimeInterval)timeInterval { struct timespec timeout; struct kevent eventList[EVENTLIST_SIZE]; int events; Index: src/OFLHAArchive.h ================================================================== --- src/OFLHAArchive.h +++ src/OFLHAArchive.h @@ -34,18 +34,18 @@ enum { OF_LHA_ARCHIVE_MODE_READ, OF_LHA_ARCHIVE_MODE_WRITE, OF_LHA_ARCHIVE_MODE_APPEND } _mode; - of_string_encoding_t _encoding; + OFStringEncoding _encoding; OFStream *_Nullable _lastReturnedStream; } /** * @brief The encoding to use for the archive. Defaults to ISO 8859-1. */ -@property (nonatomic) of_string_encoding_t encoding; +@property (nonatomic) OFStringEncoding encoding; /** * @brief A stream for reading the current entry. * * @note This is only available in read mode. Index: src/OFLHAArchive.m ================================================================== --- src/OFLHAArchive.m +++ src/OFLHAArchive.m @@ -53,20 +53,20 @@ OF_DIRECT_MEMBERS @interface OFLHAArchiveFileWriteStream: OFStream { OFMutableLHAArchiveEntry *_entry; - of_string_encoding_t _encoding; + OFStringEncoding _encoding; OFSeekableStream *_stream; of_offset_t _headerOffset; uint32_t _bytesWritten; uint16_t _CRC16; } - (instancetype)of_initWithStream: (OFSeekableStream *)stream entry: (OFLHAArchiveEntry *)entry - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; @end @implementation OFLHAArchive @synthesize encoding = _encoding; @@ -110,11 +110,11 @@ if (_mode == OF_LHA_ARCHIVE_MODE_APPEND) [(OFSeekableStream *)_stream seekToOffset: 0 whence: SEEK_END]; - _encoding = OF_STRING_ENCODING_ISO_8859_1; + _encoding = OFStringEncodingISO8859_1; } @catch (id e) { [self release]; @throw e; } @@ -432,11 +432,11 @@ @end @implementation OFLHAArchiveFileWriteStream - (instancetype)of_initWithStream: (OFSeekableStream *)stream entry: (OFLHAArchiveEntry *)entry - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { self = [super init]; @try { _entry = [entry mutableCopy]; Index: src/OFLHAArchiveEntry+Private.h ================================================================== --- src/OFLHAArchiveEntry+Private.h +++ src/OFLHAArchiveEntry+Private.h @@ -19,12 +19,12 @@ OF_DIRECT_MEMBERS @interface OFLHAArchiveEntry () - (instancetype)of_initWithHeader: (char [_Nonnull 21])header stream: (OFStream *)stream - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding OF_METHOD_FAMILY(init); - (void)of_writeToStream: (OFStream *)stream - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; @end OF_ASSUME_NONNULL_END Index: src/OFLHAArchiveEntry.m ================================================================== --- src/OFLHAArchiveEntry.m +++ src/OFLHAArchiveEntry.m @@ -53,11 +53,11 @@ format: @"%Y-%m-%d %H:%M:%S"]; } static void parseFileNameExtension(OFLHAArchiveEntry *entry, OFData *extension, - of_string_encoding_t encoding) + OFStringEncoding encoding) { [entry->_fileName release]; entry->_fileName = nil; entry->_fileName = [[OFString alloc] @@ -66,11 +66,11 @@ length: [extension count] - 1]; } static void parseDirectoryNameExtension(OFLHAArchiveEntry *entry, OFData *extension, - of_string_encoding_t encoding) + OFStringEncoding encoding) { void *pool = objc_autoreleasePoolPush(); OFMutableData *data = [[extension mutableCopy] autorelease]; char *items = data.mutableItems; size_t count = data.count; @@ -97,11 +97,11 @@ objc_autoreleasePoolPop(pool); } static void parseCommentExtension(OFLHAArchiveEntry *entry, OFData *extension, - of_string_encoding_t encoding) + OFStringEncoding encoding) { [entry->_fileComment release]; entry->_fileComment = nil; entry->_fileComment = [[OFString alloc] @@ -110,11 +110,11 @@ length: extension.count - 1]; } static void parsePermissionsExtension(OFLHAArchiveEntry *entry, OFData *extension, - of_string_encoding_t encoding) + OFStringEncoding encoding) { uint16_t mode; if (extension.count != 3) @throw [OFInvalidFormatException exception]; @@ -128,11 +128,11 @@ entry->_mode = [[OFNumber alloc] initWithUnsignedShort: mode]; } static void parseGIDUIDExtension(OFLHAArchiveEntry *entry, OFData *extension, - of_string_encoding_t encoding) + OFStringEncoding encoding) { uint16_t UID, GID; if (extension.count != 5) @throw [OFInvalidFormatException exception]; @@ -153,11 +153,11 @@ entry->_UID = [[OFNumber alloc] initWithUnsignedShort: UID]; } static void parseGroupExtension(OFLHAArchiveEntry *entry, OFData *extension, - of_string_encoding_t encoding) + OFStringEncoding encoding) { [entry->_group release]; entry->_group = nil; entry->_group = [[OFString alloc] @@ -166,11 +166,11 @@ length: extension.count - 1]; } static void parseOwnerExtension(OFLHAArchiveEntry *entry, OFData *extension, - of_string_encoding_t encoding) + OFStringEncoding encoding) { [entry->_owner release]; entry->_owner = nil; entry->_owner = [[OFString alloc] @@ -179,11 +179,11 @@ length: extension.count - 1]; } static void parseModificationDateExtension(OFLHAArchiveEntry *entry, OFData *extension, - of_string_encoding_t encoding) + OFStringEncoding encoding) { uint32_t modificationDate; if (extension.count != 5) @throw [OFInvalidFormatException exception]; @@ -198,13 +198,13 @@ initWithTimeIntervalSince1970: modificationDate]; } static bool parseExtension(OFLHAArchiveEntry *entry, OFData *extension, - of_string_encoding_t encoding, bool allowFileName) + OFStringEncoding encoding, bool allowFileName) { - void (*function)(OFLHAArchiveEntry *, OFData *, of_string_encoding_t) = + void (*function)(OFLHAArchiveEntry *, OFData *, OFStringEncoding) = NULL; switch (*(char *)[extension itemAtIndex: 0]) { case 0x01: if (allowFileName) @@ -240,11 +240,11 @@ return true; } static void readExtensions(OFLHAArchiveEntry *entry, OFStream *stream, - of_string_encoding_t encoding, bool allowFileName) + OFStringEncoding encoding, bool allowFileName) { uint16_t size; while ((size = [stream readLittleEndianInt16]) > 0) { OFData *extension; @@ -265,12 +265,11 @@ } } } static void -getFileNameAndDirectoryName(OFLHAArchiveEntry *entry, - of_string_encoding_t encoding, +getFileNameAndDirectoryName(OFLHAArchiveEntry *entry, OFStringEncoding encoding, const char **fileName, size_t *fileNameLength, const char **directoryName, size_t *directoryNameLength) { OFMutableData *data; char *cString; @@ -331,20 +330,20 @@ return self; } - (instancetype)of_initWithHeader: (char [21])header stream: (OFStream *)stream - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { self = [super init]; @try { uint32_t date; _compressionMethod = [[OFString alloc] initWithCString: header + 2 - encoding: OF_STRING_ENCODING_ASCII + encoding: OFStringEncodingASCII length: 5]; memcpy(&_compressedSize, header + 7, 4); _compressedSize = OF_BSWAP32_IF_BE(_compressedSize); @@ -553,11 +552,11 @@ { return _extensions; } - (void)of_writeToStream: (OFStream *)stream - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { void *pool = objc_autoreleasePoolPush(); OFMutableData *data = [OFMutableData dataWithCapacity: 24]; const char *fileName, *directoryName; size_t fileNameLength, directoryNameLength; @@ -564,11 +563,11 @@ uint16_t tmp16; uint32_t tmp32; size_t headerSize; if ([_compressionMethod cStringLengthWithEncoding: - OF_STRING_ENCODING_ASCII] != 5) + OFStringEncodingASCII] != 5) @throw [OFInvalidArgumentException exception]; getFileNameAndDirectoryName(self, encoding, &fileName, &fileNameLength, &directoryName, &directoryNameLength); @@ -578,11 +577,11 @@ /* Length. Filled in after we're done. */ [data increaseCountBy: 2]; [data addItems: [_compressionMethod - cStringWithEncoding: OF_STRING_ENCODING_ASCII] + cStringWithEncoding: OFStringEncodingASCII] count: 5]; tmp32 = OF_BSWAP32_IF_BE(_compressedSize); [data addItems: &tmp32 count: sizeof(tmp32)]; Index: src/OFLocale.h ================================================================== --- src/OFLocale.h +++ src/OFLocale.h @@ -43,21 +43,21 @@ */ OF_SUBCLASSING_RESTRICTED @interface OFLocale: OFObject { OFString *_Nullable _language, *_Nullable _territory; - of_string_encoding_t _encoding; + OFStringEncoding _encoding; OFString *_decimalPoint; OFMutableArray OF_GENERIC(OFDictionary OF_GENERIC(OFString *, id) *) *_localizedStrings; } #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nullable, nonatomic) OFLocale *currentLocale; @property (class, readonly, nullable, nonatomic) OFString *language; @property (class, readonly, nullable, nonatomic) OFString *territory; -@property (class, readonly, nonatomic) of_string_encoding_t encoding; +@property (class, readonly, nonatomic) OFStringEncoding encoding; @property (class, readonly, nullable, nonatomic) OFString *decimalPoint; #endif /** * @brief The language of the locale for messages. @@ -79,11 +79,11 @@ * This is useful to encode strings correctly for passing them to operating * system calls. * * If the native 8-bit encoding is unknown, UTF-8 is assumed. */ -@property (readonly, nonatomic) of_string_encoding_t encoding; +@property (readonly, nonatomic) OFStringEncoding encoding; /** * @brief The decimal point of the system's locale. */ @property (readonly, nonatomic) OFString *decimalPoint; @@ -125,11 +125,11 @@ * * If the native 8-bit encoding is unknown, UTF-8 is assumed. * * @return The native 8-bit string encoding for the locale */ -+ (of_string_encoding_t)encoding; ++ (OFStringEncoding)encoding; /** * @brief Returns the decimal point of the system's locale. * * @return The decimal point of the system's locale Index: src/OFLocale.m ================================================================== --- src/OFLocale.m +++ src/OFLocale.m @@ -37,18 +37,18 @@ static OFLocale *currentLocale = nil; static OFDictionary *operatorPrecedences = nil; #ifndef OF_AMIGAOS static void -parseLocale(char *locale, of_string_encoding_t *encoding, +parseLocale(char *locale, OFStringEncoding *encoding, OFString **language, OFString **territory) { if ((locale = of_strdup(locale)) == NULL) return; @try { - const of_string_encoding_t enc = OF_STRING_ENCODING_ASCII; + OFStringEncoding enc = OFStringEncodingASCII; char *tmp; /* We don't care for extras behind the @ */ if ((tmp = strrchr(locale, '@')) != NULL) *tmp = '\0'; @@ -57,11 +57,11 @@ if ((tmp = strrchr(locale, '.')) != NULL) { *tmp++ = '\0'; @try { if (encoding != NULL) - *encoding = of_string_parse_encoding( + *encoding = OFParseStringEncodingName( [OFString stringWithCString: tmp encoding: enc]); } @catch (OFInvalidArgumentException *e) { } } @@ -108,11 +108,11 @@ operators = [OFMutableArray array]; for (OFString *token in [condition componentsSeparatedByString: @" " options: OF_STRING_SKIP_EMPTY]) { unsigned precedence; - of_unichar_t c; + OFUnichar c; if ([token isEqual: @"("]) { [operators addObject: @"("]; continue; } @@ -195,20 +195,20 @@ else if ([token isEqual: @"!="]) var = [OFNumber numberWithBool: ![first isEqual: second]]; else if ([token isEqual: @"<"]) var = [OFNumber numberWithBool: [first - compare: second] == OF_ORDERED_ASCENDING]; + compare: second] == OFOrderedAscending]; else if ([token isEqual: @"<="]) var = [OFNumber numberWithBool: [first - compare: second] != OF_ORDERED_DESCENDING]; + compare: second] != OFOrderedDescending]; else if ([token isEqual: @">"]) var = [OFNumber numberWithBool: [first - compare: second] == OF_ORDERED_DESCENDING]; + compare: second] == OFOrderedDescending]; else if ([token isEqual: @">="]) var = [OFNumber numberWithBool: [first - compare: second] != OF_ORDERED_ASCENDING]; + compare: second] != OFOrderedAscending]; else if ([token isEqual: @"+"]) var = [OFNumber numberWithDouble: [first doubleValue] + [second doubleValue]]; else if ([token isEqual: @"%"]) var = [OFNumber numberWithLongLong: @@ -349,11 +349,11 @@ + (OFString *)territory { return currentLocale.territory; } -+ (of_string_encoding_t)encoding ++ (OFStringEncoding)encoding { return currentLocale.encoding; } + (OFString *)decimalPoint @@ -378,11 +378,11 @@ if (currentLocale != nil) @throw [OFInitializationFailedException exceptionWithClass: self.class]; - _encoding = OF_STRING_ENCODING_UTF_8; + _encoding = OFStringEncodingUTF8; _decimalPoint = @"."; _localizedStrings = [[OFMutableArray alloc] init]; if ((locale = setlocale(LC_ALL, "")) != NULL) _decimalPoint = [[OFString alloc] @@ -422,21 +422,21 @@ # elif defined(OF_AMIGAOS4) if (GetVar("Charset", buffer, sizeof(buffer), 0) > 0) { # else if (0) { # endif - of_string_encoding_t ASCII = OF_STRING_ENCODING_ASCII; + OFStringEncoding ASCII = OFStringEncodingASCII; @try { - _encoding = of_string_parse_encoding( + _encoding = OFStringEncodingForName( [OFString stringWithCString: buffer encoding: ASCII]); } @catch (OFInvalidArgumentException *e) { - _encoding = OF_STRING_ENCODING_ISO_8859_1; + _encoding = OFStringEncodingISO8859_1; } } else - _encoding = OF_STRING_ENCODING_ISO_8859_1; + _encoding = OFStringEncodingISO8859_1; /* * Get it via localeconv() instead of from the Locale struct, * to make sure we and printf etc. have the same expectations. */ 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; @@ -215,11 +215,11 @@ * Possible values are: * Value | Description * ---------------------------|------------------------- * `OF_ARRAY_SORT_DESCENDING` | Sort in descending order */ -- (void)sortUsingComparator: (of_comparator_t)comparator options: (int)options; +- (void)sortUsingComparator: (OFComparator)comparator options: (int)options; #endif /** * @brief Reverts the order of the objects in the array. */ Index: src/OFMutableArray.m ================================================================== --- src/OFMutableArray.m +++ src/OFMutableArray.m @@ -32,32 +32,32 @@ } placeholder; @interface OFMutableArrayPlaceholder: OFMutableArray @end -static of_comparison_result_t +static OFComparisonResult compare(id left, id right, SEL selector) { - of_comparison_result_t (*comparator)(id, SEL, id) = - (of_comparison_result_t (*)(id, SEL, id)) + OFComparisonResult (*comparator)(id, SEL, id) = + (OFComparisonResult (*)(id, SEL, id)) [left methodForSelector: selector]; return comparator(left, selector, right); } static void quicksort(OFMutableArray *array, size_t left, size_t right, SEL selector, int options) { - of_comparison_result_t ascending, descending; + OFComparisonResult ascending, descending; if (options & OF_ARRAY_SORT_DESCENDING) { - ascending = OF_ORDERED_DESCENDING; - descending = OF_ORDERED_ASCENDING; + ascending = OFOrderedDescending; + descending = OFOrderedAscending; } else { - ascending = OF_ORDERED_ASCENDING; - descending = OF_ORDERED_DESCENDING; + ascending = OFOrderedAscending; + descending = OFOrderedDescending; } while (left < right) { size_t i = left; size_t j = right - 1; @@ -90,20 +90,20 @@ } #ifdef OF_HAVE_BLOCKS static void quicksortWithBlock(OFMutableArray *array, size_t left, size_t right, - of_comparator_t comparator, int options) + OFComparator comparator, int options) { - of_comparison_result_t ascending, descending; + OFComparisonResult ascending, descending; if (options & OF_ARRAY_SORT_DESCENDING) { - ascending = OF_ORDERED_DESCENDING; - descending = OF_ORDERED_ASCENDING; + ascending = OFOrderedDescending; + descending = OFOrderedAscending; } else { - ascending = OF_ORDERED_ASCENDING; - descending = OF_ORDERED_DESCENDING; + ascending = OFOrderedAscending; + descending = OFOrderedDescending; } while (left < right) { size_t i = left; size_t j = right - 1; @@ -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 { @@ -425,11 +425,11 @@ quicksort(self, 0, count - 1, selector, options); } #ifdef OF_HAVE_BLOCKS -- (void)sortUsingComparator: (of_comparator_t)comparator options: (int)options +- (void)sortUsingComparator: (OFComparator)comparator options: (int)options { size_t count = self.count; if (count == 0 || count == 1) return; 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 @@ -31,11 +31,11 @@ * @brief Sets the character at the specified index. * * @param character The character to set * @param index The index where to set the character */ -- (void)setCharacter: (of_unichar_t)character atIndex: (size_t)index; +- (void)setCharacter: (OFUnichar)character atIndex: (size_t)index; /** * @brief Appends another OFString to the OFMutableString. * * @param string An OFString to append @@ -46,12 +46,11 @@ * @brief Appends the specified characters to the OFMutableString. * * @param characters An array of characters to append * @param length The length of the array of characters */ -- (void)appendCharacters: (const of_unichar_t *)characters - length: (size_t)length; +- (void)appendCharacters: (const OFUnichar *)characters length: (size_t)length; /** * @brief Appends a UTF-8 encoded C string to the OFMutableString. * * @param UTF8String A UTF-8 encoded C string to append @@ -73,11 +72,11 @@ * * @param cString A C string to append * @param encoding The encoding of the C string */ - (void)appendCString: (const char *)cString - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; /** * @brief Appends a C string with the specified encoding and length to the * OFMutableString. * @@ -84,30 +83,30 @@ * @param cString A C string to append * @param encoding The encoding of the C string * @param cStringLength The length of the UTF-8 encoded C string */ - (void)appendCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding length: (size_t)cStringLength; /** * @brief Appends a formatted string to the OFMutableString. * * See `printf` for the format syntax. As an addition, `%@` is available as - * format specifier for objects, `%C` for `of_unichar_t` and `%S` for - * `const of_unichar_t *`. + * format specifier for objects, `%C` for `OFUnichar` and `%S` for + * `const OFUnichar *`. * * @param format A format string which generates the string to append */ - (void)appendFormat: (OFConstantString *)format, ...; /** * @brief Appends a formatted string to the OFMutableString. * * See printf for the format syntax. As an addition, `%@` is available as - * format specifier for objects, `%C` for `of_unichar_t` and `%S` for - * `const of_unichar_t *`. + * format specifier for objects, `%C` for `OFUnichar` and `%S` for + * `const OFUnichar *`. * * @param format A format string which generates the string to append * @param arguments The arguments used in the format string */ - (void)appendFormat: (OFConstantString *)format arguments: (va_list)arguments; @@ -154,19 +153,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 +186,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 @@ -54,18 +54,18 @@ initWithUTF8String: UTF8String length: UTF8StringLength]; } - (instancetype)initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return (id)[[OFMutableUTF8String alloc] initWithCString: cString encoding: encoding]; } - (instancetype)initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding length: (size_t)cStringLength { return (id)[[OFMutableUTF8String alloc] initWithCString: cString encoding: encoding length: cStringLength]; @@ -74,67 +74,67 @@ - (instancetype)initWithString: (OFString *)string { return (id)[[OFMutableUTF8String alloc] initWithString: string]; } -- (instancetype)initWithCharacters: (const of_unichar_t *)characters +- (instancetype)initWithCharacters: (const OFUnichar *)characters length: (size_t)length { return (id)[[OFMutableUTF8String alloc] initWithCharacters: characters length: length]; } -- (instancetype)initWithUTF16String: (const of_char16_t *)string +- (instancetype)initWithUTF16String: (const OFChar16 *)string { return (id)[[OFMutableUTF8String alloc] initWithUTF16String: string]; } -- (instancetype)initWithUTF16String: (const of_char16_t *)string +- (instancetype)initWithUTF16String: (const OFChar16 *)string length: (size_t)length { return (id)[[OFMutableUTF8String alloc] initWithUTF16String: string length: length]; } -- (instancetype)initWithUTF16String: (const of_char16_t *)string - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF16String: (const OFChar16 *)string + byteOrder: (OFByteOrder)byteOrder { return (id)[[OFMutableUTF8String alloc] initWithUTF16String: string byteOrder: byteOrder]; } -- (instancetype)initWithUTF16String: (const of_char16_t *)string +- (instancetype)initWithUTF16String: (const OFChar16 *)string length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder + byteOrder: (OFByteOrder)byteOrder { return (id)[[OFMutableUTF8String alloc] initWithUTF16String: string length: length byteOrder: byteOrder]; } -- (instancetype)initWithUTF32String: (const of_char32_t *)string +- (instancetype)initWithUTF32String: (const OFChar32 *)string { return (id)[[OFMutableUTF8String alloc] initWithUTF32String: string]; } -- (instancetype)initWithUTF32String: (const of_char32_t *)string +- (instancetype)initWithUTF32String: (const OFChar32 *)string length: (size_t)length { return (id)[[OFMutableUTF8String alloc] initWithUTF32String: string length: length]; } -- (instancetype)initWithUTF32String: (const of_char32_t *)string - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF32String: (const OFChar32 *)string + byteOrder: (OFByteOrder)byteOrder { return (id)[[OFMutableUTF8String alloc] initWithUTF32String: string byteOrder: byteOrder]; } -- (instancetype)initWithUTF32String: (const of_char32_t *)string +- (instancetype)initWithUTF32String: (const OFChar32 *)string length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder + byteOrder: (OFByteOrder)byteOrder { return (id)[[OFMutableUTF8String alloc] initWithUTF32String: string length: length byteOrder: byteOrder]; } @@ -164,11 +164,11 @@ { return (id)[[OFMutableUTF8String alloc] initWithContentsOfFile: path]; } - (instancetype)initWithContentsOfFile: (OFString *)path - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return (id)[[OFMutableUTF8String alloc] initWithContentsOfFile: path encoding: encoding]; } @@ -178,11 +178,11 @@ { return (id)[[OFMutableUTF8String alloc] initWithContentsOfURL: URL]; } - (instancetype)initWithContentsOfURL: (OFURL *)URL - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return (id)[[OFMutableUTF8String alloc] initWithContentsOfURL: URL encoding: encoding]; } @@ -226,24 +226,24 @@ return [super alloc]; } #ifdef OF_HAVE_UNICODE_TABLES -- (void)of_convertWithWordStartTable: (const of_unichar_t *const [])startTable - wordMiddleTable: (const of_unichar_t *const [])middleTable +- (void)of_convertWithWordStartTable: (const OFUnichar *const [])startTable + wordMiddleTable: (const OFUnichar *const [])middleTable wordStartTableSize: (size_t)startTableSize wordMiddleTableSize: (size_t)middleTableSize { void *pool = objc_autoreleasePoolPush(); - const of_unichar_t *characters = self.characters; + const OFUnichar *characters = self.characters; size_t length = self.length; bool isStart = true; for (size_t i = 0; i < length; i++) { - const of_unichar_t *const *table; + const OFUnichar *const *table; size_t tableSize; - of_unichar_t c = characters[i]; + OFUnichar c = characters[i]; if (isStart) { table = startTable; tableSize = middleTableSize; } else { @@ -263,18 +263,18 @@ static void convert(OFMutableString *self, char (*startFunction)(char), char (*middleFunction)(char)) { void *pool = objc_autoreleasePoolPush(); - const of_unichar_t *characters = self.characters; + const OFUnichar *characters = self.characters; size_t length = self.length; bool isStart = true; for (size_t i = 0; i < length; i++) { char (*function)(char) = (isStart ? startFunction : middleFunction); - of_unichar_t c = characters[i]; + OFUnichar c = characters[i]; if (c <= 0x7F) [self setCharacter: (int)function(c) atIndex: i]; isStart = of_ascii_isspace(c); @@ -282,25 +282,25 @@ objc_autoreleasePoolPop(pool); } #endif -- (void)setCharacter: (of_unichar_t)character atIndex: (size_t)idx +- (void)setCharacter: (OFUnichar)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 { [self insertString: string atIndex: self.length]; } -- (void)appendCharacters: (const of_unichar_t *)characters +- (void)appendCharacters: (const OFUnichar *)characters length: (size_t)length { void *pool = objc_autoreleasePoolPush(); [self appendString: [OFString stringWithCharacters: characters length: length]]; @@ -322,20 +322,20 @@ length: UTF8StringLength]]; objc_autoreleasePoolPop(pool); } - (void)appendCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { void *pool = objc_autoreleasePoolPush(); [self appendString: [OFString stringWithCString: cString encoding: encoding]]; objc_autoreleasePoolPop(pool); } - (void)appendCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding length: (size_t)cStringLength { void *pool = objc_autoreleasePoolPush(); [self appendString: [OFString stringWithCString: cString encoding: encoding @@ -380,11 +380,11 @@ - (void)reverse { size_t i, j, length = self.length; for (i = 0, j = length - 1; i < length / 2; i++, j--) { - of_unichar_t tmp = [self characterAtIndex: j]; + OFUnichar tmp = [self characterAtIndex: j]; [self setCharacter: [self characterAtIndex: i] atIndex: j]; [self setCharacter: tmp atIndex: i]; } } @@ -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,21 +449,21 @@ 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; + const OFUnichar *characters; + const OFUnichar *searchCharacters = string.characters; size_t searchLength = string.length; size_t replacementLength = replacement.length; if (string == nil || replacement == nil) @throw [OFInvalidArgumentException exception]; @@ -480,14 +480,14 @@ pool2 = objc_autoreleasePoolPush(); characters = self.characters; for (size_t i = range.location; i <= range.length - searchLength; i++) { if (memcmp(characters + i, searchCharacters, - searchLength * sizeof(of_unichar_t)) != 0) + searchLength * sizeof(OFUnichar)) != 0) continue; - [self replaceCharactersInRange: of_range(i, searchLength) + [self replaceCharactersInRange: OFMakeRange(i, searchLength) withString: replacement]; range.length -= searchLength; range.length += replacementLength; @@ -503,29 +503,29 @@ } - (void)deleteLeadingWhitespaces { void *pool = objc_autoreleasePoolPush(); - const of_unichar_t *characters = self.characters; + const OFUnichar *characters = self.characters; size_t i, length = self.length; for (i = 0; i < length; i++) { - of_unichar_t c = characters[i]; + OFUnichar c = characters[i]; if (!of_ascii_isspace(c)) break; } objc_autoreleasePoolPop(pool); - [self deleteCharactersInRange: of_range(0, i)]; + [self deleteCharactersInRange: OFMakeRange(0, i)]; } - (void)deleteTrailingWhitespaces { void *pool; - const of_unichar_t *characters, *p; + const OFUnichar *characters, *p; size_t length, d; length = self.length; if (length == 0) @@ -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 @@ -62,24 +62,24 @@ return self; } #ifdef OF_HAVE_UNICODE_TABLES -- (void)of_convertWithWordStartTable: (const of_unichar_t *const [])startTable - wordMiddleTable: (const of_unichar_t *const [])middleTable +- (void)of_convertWithWordStartTable: (const OFUnichar *const [])startTable + wordMiddleTable: (const OFUnichar *const [])middleTable wordStartTableSize: (size_t)startTableSize wordMiddleTableSize: (size_t)middleTableSize { - of_unichar_t *unicodeString; + OFUnichar *unicodeString; size_t unicodeLen, newCStringLength; size_t i, j; char *newCString; bool isStart = true; if (!_s->isUTF8) { uint8_t t; - const of_unichar_t *const *table; + const OFUnichar *const *table; assert(startTableSize >= 1 && middleTableSize >= 1); _s->hashed = false; @@ -97,19 +97,19 @@ return; } unicodeLen = self.length; - unicodeString = of_alloc(unicodeLen, sizeof(of_unichar_t)); + unicodeString = of_alloc(unicodeLen, sizeof(OFUnichar)); i = j = 0; newCStringLength = 0; while (i < _s->cStringLength) { - const of_unichar_t *const *table; + const OFUnichar *const *table; size_t tableSize; - of_unichar_t c; + OFUnichar c; ssize_t cLen; if (isStart) { table = startTable; tableSize = middleTableSize; @@ -127,11 +127,11 @@ } isStart = of_ascii_isspace(c); if (c >> 8 < tableSize) { - of_unichar_t tc = table[c >> 8][c & 0xFF]; + OFUnichar tc = table[c >> 8][c & 0xFF]; if (tc) c = tc; } unicodeString[j++] = c; @@ -187,14 +187,14 @@ * need to change it. */ } #endif -- (void)setCharacter: (of_unichar_t)character atIndex: (size_t)idx +- (void)setCharacter: (OFUnichar)character atIndex: (size_t)idx { char buffer[4]; - of_unichar_t c; + OFUnichar c; size_t lenNew; ssize_t lenOld; if (_s->isUTF8) idx = of_string_utf8_get_position(_s->cString, idx, @@ -314,22 +314,22 @@ _s->cString[_s->cStringLength] = 0; } - (void)appendCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { [self appendCString: cString encoding: encoding length: strlen(cString)]; } - (void)appendCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding length: (size_t)cStringLength { - if (encoding == OF_STRING_ENCODING_UTF_8) + if (encoding == OFStringEncodingUTF8) [self appendUTF8String: cString length: cStringLength]; else { void *pool = objc_autoreleasePoolPush(); [self appendString: @@ -367,11 +367,11 @@ _s->isUTF8 = true; } else _s->isUTF8 = true; } -- (void)appendCharacters: (const of_unichar_t *)characters +- (void)appendCharacters: (const OFUnichar *)characters length: (size_t)length { char *tmp = of_alloc((length * 4) + 1, 1); @try { @@ -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,14 +127,14 @@ #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)valueWithPoint: (of_point_t)point OF_UNAVAILABLE; -+ (instancetype)valueWithDimension: (of_dimension_t)dimension OF_UNAVAILABLE; -+ (instancetype)valueWithRectangle: (of_rectangle_t)rectangle OF_UNAVAILABLE; ++ (instancetype)valueWithRange: (OFRange)range OF_UNAVAILABLE; ++ (instancetype)valueWithPoint: (OFPoint)point OF_UNAVAILABLE; ++ (instancetype)valueWithSize: (OFSize)size OF_UNAVAILABLE; ++ (instancetype)valueWithRect: (OFRect)rect OF_UNAVAILABLE; #endif /** * @brief Creates a new OFNumber with the specified `bool`. * @@ -360,14 +360,14 @@ * @brief Compares the number to another number. * * @param number The number to compare the number to * @return The result of the comparison */ -- (of_comparison_result_t)compare: (OFNumber *)number; +- (OFComparisonResult)compare: (OFNumber *)number; @end OF_ASSUME_NONNULL_END #if !defined(NSINTEGER_DEFINED) && !__has_feature(modules) /* Required for number literals to work */ @compatibility_alias NSNumber OFNumber; #endif Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -940,45 +940,45 @@ return (number.longLongValue == self.longLongValue); return (number.unsignedLongLongValue == self.unsignedLongLongValue); } -- (of_comparison_result_t)compare: (OFNumber *)number +- (OFComparisonResult)compare: (OFNumber *)number { if (![number isKindOfClass: [OFNumber class]]) @throw [OFInvalidArgumentException exception]; if (isFloat(self) || isFloat(number)) { double double1 = self.doubleValue; double double2 = number.doubleValue; if (double1 > double2) - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; if (double1 < double2) - return OF_ORDERED_ASCENDING; + return OFOrderedAscending; - return OF_ORDERED_SAME; + return OFOrderedSame; } else if (isSigned(self) || isSigned(number)) { long long int1 = self.longLongValue; long long int2 = number.longLongValue; if (int1 > int2) - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; if (int1 < int2) - return OF_ORDERED_ASCENDING; + return OFOrderedAscending; - return OF_ORDERED_SAME; + return OFOrderedSame; } else { unsigned long long uint1 = self.unsignedLongLongValue; unsigned long long uint2 = number.unsignedLongLongValue; if (uint1 > uint2) - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; if (uint1 < uint2) - return OF_ORDERED_ASCENDING; + return OFOrderedAscending; - return OF_ORDERED_SAME; + return OFOrderedSame; } } - (unsigned long)hash { Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -54,63 +54,68 @@ /** * @brief A result of a comparison. */ typedef enum { /** The left object is smaller than the right */ - OF_ORDERED_ASCENDING = -1, + OFOrderedAscending = -1, /** Both objects are equal */ - OF_ORDERED_SAME = 0, + OFOrderedSame = 0, /** The left object is bigger than the right */ - OF_ORDERED_DESCENDING = 1 -} of_comparison_result_t; + OFOrderedDescending = 1 +} OFComparisonResult; #ifdef OF_HAVE_BLOCKS /** * @brief A comparator to compare two objects. * * @param left The left object * @param right The right object * @return The order of the objects */ -typedef of_comparison_result_t (^of_comparator_t)(id _Nonnull left, - id _Nonnull right); +typedef OFComparisonResult (^OFComparator)(id _Nonnull left, id _Nonnull right); #endif /** * @brief An enum for storing endianess. */ typedef enum { /** Most significant byte first (big endian) */ - OF_BYTE_ORDER_BIG_ENDIAN, + OFByteOrderBigEndian, /** Least significant byte first (little endian) */ - OF_BYTE_ORDER_LITTLE_ENDIAN -} of_byte_order_t; + OFByteOrderLittleEndian, + /** Native byte order of the system */ +#ifdef OF_BIG_ENDIAN + OFByteOrderNative = OFByteOrderBigEndian +#else + 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; } /** @@ -119,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) @@ -133,36 +138,36 @@ } /** * @brief A time interval in seconds. */ -typedef double of_time_interval_t; +typedef double OFTimeInterval; /** - * @struct of_point_t OFObject.h ObjFW/OFObject.h + * @struct OFPoint OFObject.h ObjFW/OFObject.h * * @brief A point. */ -struct OF_BOXABLE of_point_t { +struct OF_BOXABLE OFPoint { /** The x coordinate of the point */ float x; /** The y coordinate of the point */ float y; }; -typedef struct of_point_t of_point_t; +typedef struct OFPoint OFPoint; /** - * @brief Creates a new of_point_t. + * @brief Creates a new OFPoint. * * @param x The x coordinate of the point * @param y The x coordinate of the point - * @return An of_point_t with the specified coordinates + * @return An OFPoint with the specified coordinates */ -static OF_INLINE of_point_t OF_CONST_FUNC -of_point(float x, float y) +static OF_INLINE OFPoint OF_CONST_FUNC +OFMakePoint(float x, float y) { - of_point_t point = { x, y }; + OFPoint point = { x, y }; return point; } /** @@ -171,11 +176,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 -of_point_equal(of_point_t point1, of_point_t point2) +OFEqualPoints(OFPoint point1, OFPoint point2) { if (point1.x != point2.x) return false; if (point1.y != point2.y) @@ -183,107 +188,109 @@ return true; } /** - * @struct of_dimension_t OFObject.h ObjFW/OFObject.h - * - * @brief A dimension. - */ -struct OF_BOXABLE of_dimension_t { - /** The width of the dimension */ - float width; - /** The height of the dimension */ - float height; -}; -typedef struct of_dimension_t of_dimension_t; - -/** - * @brief Creates a new of_dimension_t. - * - * @param width The width of the dimension - * @param height The height of the dimension - * @return An of_dimension_t with the specified width and height - */ -static OF_INLINE of_dimension_t OF_CONST_FUNC -of_dimension(float width, float height) -{ - of_dimension_t dimension = { width, height }; - - return dimension; -} - -/** - * @brief Returns whether the two dimensions are equal. - * - * @param dimension1 The first dimension for the comparison - * @param dimension2 The second dimension for the comparison - * @return Whether the two dimensions are equal - */ -static OF_INLINE bool -of_dimension_equal(of_dimension_t dimension1, of_dimension_t dimension2) -{ - if (dimension1.width != dimension2.width) - return false; - - if (dimension1.height != dimension2.height) + * @struct OFSize OFObject.h ObjFW/OFObject.h + * + * @brief A size. + */ +struct OF_BOXABLE OFSize { + /** The width of the size */ + float width; + /** The height of the size */ + float height; +}; +typedef struct OFSize OFSize; + +/** + * @brief Creates a new OFSize. + * + * @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 +OFMakeSize(float width, float height) +{ + OFSize size = { width, height }; + + return size; +} + +/** + * @brief Returns whether the two sizes are equal. + * + * @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 +OFEqualSizes(OFSize size1, OFSize size2) +{ + if (size1.width != size2.width) + return false; + + if (size1.height != size2.height) return false; return true; } /** - * @struct of_rectangle_t OFObject.h ObjFW/OFObject.h + * @struct OFRect OFObject.h ObjFW/OFObject.h * * @brief A rectangle. */ -struct OF_BOXABLE of_rectangle_t { +struct OF_BOXABLE OFRect { /** The point from where the rectangle originates */ - of_point_t origin; + OFPoint origin; /** The size of the rectangle */ - of_dimension_t size; + OFSize size; }; -typedef struct of_rectangle_t of_rectangle_t; +typedef struct OFRect OFRect; /** - * @brief Creates a new of_rectangle_t. + * @brief Creates a new OFRect. * * @param x The x coordinate of the top left corner of the rectangle * @param y The y coordinate of the top left corner of the rectangle * @param width The width of the rectangle * @param height The height of the rectangle - * @return An of_rectangle_t with the specified origin and size - */ -static OF_INLINE of_rectangle_t OF_CONST_FUNC -of_rectangle(float x, float y, float width, float height) -{ - of_rectangle_t rectangle = { - of_point(x, y), - of_dimension(width, height) + * @return An OFRect with the specified origin and size + */ +static OF_INLINE OFRect OF_CONST_FUNC +OFMakeRect(float x, float y, float width, float height) +{ + OFRect rect = { + OFMakePoint(x, y), + OFMakeSize(width, height) }; - return rectangle; + return rect; } /** * @brief Returns whether the two rectangles are equal. * - * @param rectangle1 The first rectangle for the comparison - * @param rectangle2 The second rectangle for the comparison + * @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 -of_rectangle_equal(of_rectangle_t rectangle1, of_rectangle_t rectangle2) +OFEqualRects(OFRect rect1, OFRect rect2) { - if (!of_point_equal(rectangle1.origin, rectangle2.origin)) + if (!OFEqualPoints(rect1.origin, rect2.origin)) return false; - if (!of_dimension_equal(rectangle1.size, rectangle2.size)) + if (!OFEqualSizes(rect1.size, rect2.size)) return false; return true; } + +static const size_t OFNotFound = SIZE_MAX; #ifdef __OBJC__ @class OFMethodSignature; @class OFString; @class OFThread; @@ -816,11 +823,11 @@ * @brief Performs the specified selector after the specified delay. * * @param selector The selector to perform * @param delay The delay after which the selector will be performed */ -- (void)performSelector: (SEL)selector afterDelay: (of_time_interval_t)delay; +- (void)performSelector: (SEL)selector afterDelay: (OFTimeInterval)delay; /** * @brief Performs the specified selector with the specified object after the * specified delay. * @@ -829,11 +836,11 @@ * selector * @param delay The delay after which the selector will be performed */ - (void)performSelector: (SEL)selector withObject: (nullable id)object - afterDelay: (of_time_interval_t)delay; + afterDelay: (OFTimeInterval)delay; /** * @brief Performs the specified selector with the specified objects after the * specified delay. * @@ -845,11 +852,11 @@ * @param delay The delay after which the selector will be performed */ - (void)performSelector: (SEL)selector withObject: (nullable id)object1 withObject: (nullable id)object2 - afterDelay: (of_time_interval_t)delay; + afterDelay: (OFTimeInterval)delay; /** * @brief Performs the specified selector with the specified objects after the * specified delay. * @@ -864,11 +871,11 @@ */ - (void)performSelector: (SEL)selector withObject: (nullable id)object1 withObject: (nullable id)object2 withObject: (nullable id)object3 - afterDelay: (of_time_interval_t)delay; + afterDelay: (OFTimeInterval)delay; /** * @brief Performs the specified selector with the specified objects after the * specified delay. * @@ -886,11 +893,11 @@ - (void)performSelector: (SEL)selector withObject: (nullable id)object1 withObject: (nullable id)object2 withObject: (nullable id)object3 withObject: (nullable id)object4 - afterDelay: (of_time_interval_t)delay; + afterDelay: (OFTimeInterval)delay; # ifdef OF_HAVE_THREADS /** * @brief Performs the specified selector on the specified thread. * @@ -1067,11 +1074,11 @@ * @param thread The thread on which to perform the selector * @param delay The delay after which the selector will be performed */ - (void)performSelector: (SEL)selector onThread: (OFThread *)thread - afterDelay: (of_time_interval_t)delay; + afterDelay: (OFTimeInterval)delay; /** * @brief Performs the specified selector on the specified thread with the * specified object after the specified delay. * @@ -1082,11 +1089,11 @@ * @param delay The delay after which the selector will be performed */ - (void)performSelector: (SEL)selector onThread: (OFThread *)thread withObject: (nullable id)object - afterDelay: (of_time_interval_t)delay; + afterDelay: (OFTimeInterval)delay; /** * @brief Performs the specified selector on the specified thread with the * specified objects after the specified delay. * @@ -1100,11 +1107,11 @@ */ - (void)performSelector: (SEL)selector onThread: (OFThread *)thread withObject: (nullable id)object1 withObject: (nullable id)object2 - afterDelay: (of_time_interval_t)delay; + afterDelay: (OFTimeInterval)delay; /** * @brief Performs the specified selector on the specified thread with the * specified objects after the specified delay. * @@ -1121,11 +1128,11 @@ - (void)performSelector: (SEL)selector onThread: (OFThread *)thread withObject: (nullable id)object1 withObject: (nullable id)object2 withObject: (nullable id)object3 - afterDelay: (of_time_interval_t)delay; + afterDelay: (OFTimeInterval)delay; /** * @brief Performs the specified selector on the specified thread with the * specified objects after the specified delay. * @@ -1145,11 +1152,11 @@ onThread: (OFThread *)thread withObject: (nullable id)object1 withObject: (nullable id)object2 withObject: (nullable id)object3 withObject: (nullable id)object4 - afterDelay: (of_time_interval_t)delay; + afterDelay: (OFTimeInterval)delay; # endif /** * @brief This method is called when @ref resolveClassMethod: or * @ref resolveInstanceMethod: returned false. It should return a target @@ -1225,11 +1232,11 @@ * @brief Compares the object to another object. * * @param object An object to compare the object to * @return The result of the comparison */ -- (of_comparison_result_t)compare: (id )object; +- (OFComparisonResult)compare: (id )object; @end #endif #ifdef __cplusplus extern "C" { Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -239,11 +239,11 @@ static void uncaughtExceptionHandler(id exception) { OFString *description = [exception description]; OFArray *backtrace = nil; - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; fprintf(stderr, "\nRuntime error: Unhandled exception:\n%s\n", [description cStringWithEncoding: encoding]); if ([exception respondsToSelector: @selector(backtrace)]) @@ -405,11 +405,11 @@ } + (OFString *)className { return [OFString stringWithCString: class_getName(self) - encoding: OF_STRING_ENCODING_ASCII]; + encoding: OFStringEncodingASCII]; } + (bool)isSubclassOfClass: (Class)class { for (Class iter = self; iter != Nil; iter = class_getSuperclass(iter)) @@ -560,11 +560,11 @@ } - (OFString *)className { return [OFString stringWithCString: object_getClassName(self) - encoding: OF_STRING_ENCODING_ASCII]; + encoding: OFStringEncodingASCII]; } - (bool)isKindOfClass: (Class)class { for (Class iter = object_getClass(self); iter != Nil; @@ -663,11 +663,11 @@ #endif return imp(self, selector, object1, object2, object3, object4); } -- (void)performSelector: (SEL)selector afterDelay: (of_time_interval_t)delay +- (void)performSelector: (SEL)selector afterDelay: (OFTimeInterval)delay { void *pool = objc_autoreleasePoolPush(); [OFTimer scheduledTimerWithTimeInterval: delay target: self @@ -677,11 +677,11 @@ objc_autoreleasePoolPop(pool); } - (void)performSelector: (SEL)selector withObject: (id)object - afterDelay: (of_time_interval_t)delay + afterDelay: (OFTimeInterval)delay { void *pool = objc_autoreleasePoolPush(); [OFTimer scheduledTimerWithTimeInterval: delay target: self @@ -693,11 +693,11 @@ } - (void)performSelector: (SEL)selector withObject: (id)object1 withObject: (id)object2 - afterDelay: (of_time_interval_t)delay + afterDelay: (OFTimeInterval)delay { void *pool = objc_autoreleasePoolPush(); [OFTimer scheduledTimerWithTimeInterval: delay target: self @@ -711,11 +711,11 @@ - (void)performSelector: (SEL)selector withObject: (id)object1 withObject: (id)object2 withObject: (id)object3 - afterDelay: (of_time_interval_t)delay + afterDelay: (OFTimeInterval)delay { void *pool = objc_autoreleasePoolPush(); [OFTimer scheduledTimerWithTimeInterval: delay target: self @@ -731,11 +731,11 @@ - (void)performSelector: (SEL)selector withObject: (id)object1 withObject: (id)object2 withObject: (id)object3 withObject: (id)object4 - afterDelay: (of_time_interval_t)delay + afterDelay: (OFTimeInterval)delay { void *pool = objc_autoreleasePoolPush(); [OFTimer scheduledTimerWithTimeInterval: delay target: self @@ -955,11 +955,11 @@ objc_autoreleasePoolPop(pool); } - (void)performSelector: (SEL)selector onThread: (OFThread *)thread - afterDelay: (of_time_interval_t)delay + afterDelay: (OFTimeInterval)delay { void *pool = objc_autoreleasePoolPush(); [thread.runLoop addTimer: [OFTimer timerWithTimeInterval: delay target: self @@ -970,11 +970,11 @@ } - (void)performSelector: (SEL)selector onThread: (OFThread *)thread withObject: (id)object - afterDelay: (of_time_interval_t)delay + afterDelay: (OFTimeInterval)delay { void *pool = objc_autoreleasePoolPush(); [thread.runLoop addTimer: [OFTimer timerWithTimeInterval: delay target: self @@ -987,11 +987,11 @@ - (void)performSelector: (SEL)selector onThread: (OFThread *)thread withObject: (id)object1 withObject: (id)object2 - afterDelay: (of_time_interval_t)delay + afterDelay: (OFTimeInterval)delay { void *pool = objc_autoreleasePoolPush(); [thread.runLoop addTimer: [OFTimer timerWithTimeInterval: delay target: self @@ -1006,11 +1006,11 @@ - (void)performSelector: (SEL)selector onThread: (OFThread *)thread withObject: (id)object1 withObject: (id)object2 withObject: (id)object3 - afterDelay: (of_time_interval_t)delay + afterDelay: (OFTimeInterval)delay { void *pool = objc_autoreleasePoolPush(); [thread.runLoop addTimer: [OFTimer timerWithTimeInterval: delay target: self @@ -1027,11 +1027,11 @@ onThread: (OFThread *)thread withObject: (id)object1 withObject: (id)object2 withObject: (id)object3 withObject: (id)object4 - afterDelay: (of_time_interval_t)delay + afterDelay: (OFTimeInterval)delay { void *pool = objc_autoreleasePoolPush(); [thread.runLoop addTimer: [OFTimer timerWithTimeInterval: delay target: self Index: src/OFOptionsParser.h ================================================================== --- src/OFOptionsParser.h +++ src/OFOptionsParser.h @@ -25,11 +25,11 @@ * * @brief An option which can be parsed by an @ref OFOptionsParser. */ struct of_options_parser_option_t { /** The short version (e.g. `-v`) of the option or `\0` for none. */ - of_unichar_t shortOption; + OFUnichar shortOption; /** * The long version (e.g. `--verbose`) of the option or `nil` for none. */ OFString *__unsafe_unretained _Nullable longOption; @@ -70,11 +70,11 @@ { of_options_parser_option_t *_options; OFMapTable *_longOptions; OFArray OF_GENERIC(OFString *) *_arguments; size_t _index, _subIndex; - of_unichar_t _lastOption; + OFUnichar _lastOption; OFString *_Nullable _lastLongOption, *_Nullable _argument; bool _done; } /** @@ -83,11 +83,11 @@ * If @ref nextOption returned `?` or `:`, this returns the option which was * unknown or for which the argument was missing.@n * If this returns `-`, the last option is only available as a long option (see * lastLongOption). */ -@property (readonly, nonatomic) of_unichar_t lastOption; +@property (readonly, nonatomic) OFUnichar lastOption; /** * @brief The long option for the last parsed option, or `nil` if the last * parsed option was not passed as a long option by the user. * @@ -158,9 +158,9 @@ * make sure all options have been parsed, even if you only rely on the * optional pointers specified and don't do any parsing yourself. * * @return The next option */ -- (of_unichar_t)nextOption; +- (OFUnichar)nextOption; @end OF_ASSUME_NONNULL_END Index: src/OFOptionsParser.m ================================================================== --- src/OFOptionsParser.m +++ src/OFOptionsParser.m @@ -153,11 +153,11 @@ [_argument release]; [super dealloc]; } -- (of_unichar_t)nextOption +- (OFUnichar)nextOption { of_options_parser_option_t *iter; OFString *argument; if (_done || _index >= _arguments.count) @@ -190,18 +190,18 @@ _lastOption = '-'; _index++; if ((pos = [argument rangeOfString: @"="].location) != - OF_NOT_FOUND) + OFNotFound) _argument = [[argument 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/OFPointValue.h ================================================================== --- src/OFPointValue.h +++ src/OFPointValue.h @@ -17,12 +17,12 @@ OF_ASSUME_NONNULL_BEGIN @interface OFPointValue: OFValue { - of_point_t _point; + OFPoint _point; } -- (instancetype)initWithPoint: (of_point_t)point; +- (instancetype)initWithPoint: (OFPoint)point; @end OF_ASSUME_NONNULL_END Index: src/OFPointValue.m ================================================================== --- src/OFPointValue.m +++ src/OFPointValue.m @@ -20,11 +20,11 @@ #import "OFOutOfRangeException.h" @implementation OFPointValue @synthesize pointValue = _point; -- (instancetype)initWithPoint: (of_point_t)point +- (instancetype)initWithPoint: (OFPoint)point { self = [super init]; _point = point; @@ -31,11 +31,11 @@ return self; } - (const char *)objCType { - return @encode(of_point_t); + return @encode(OFPoint); } - (void)getValue: (void *)value size: (size_t)size { if (size != sizeof(_point)) @@ -45,8 +45,8 @@ } - (OFString *)description { return [OFString stringWithFormat: - @"", _point.x, _point.y]; + @"", _point.x, _point.y]; } @end Index: src/OFPollKernelEventObserver.m ================================================================== --- src/OFPollKernelEventObserver.m +++ src/OFPollKernelEventObserver.m @@ -160,11 +160,11 @@ removeObject(self, object, object.fileDescriptorForWriting, POLLOUT); [super removeObjectForWriting: object]; } -- (void)observeForTimeInterval: (of_time_interval_t)timeInterval +- (void)observeForTimeInterval: (OFTimeInterval)timeInterval { void *pool; struct pollfd *FDs; int events; size_t nFDs; 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) @@ -41,11 +41,11 @@ } return self; } -- (bool)characterIsMember: (of_unichar_t)character +- (bool)characterIsMember: (OFUnichar)character { return (character >= _range.location && character < _range.location + _range.length); } @end 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 ADDED src/OFRectValue.h Index: src/OFRectValue.h ================================================================== --- src/OFRectValue.h +++ src/OFRectValue.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2008-2021 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#import "OFValue.h" + +OF_ASSUME_NONNULL_BEGIN + +@interface OFRectValue: OFValue +{ + OFRect _rect; +} + +- (instancetype)initWithRect: (OFRect)rect; +@end + +OF_ASSUME_NONNULL_END ADDED src/OFRectValue.m Index: src/OFRectValue.m ================================================================== --- src/OFRectValue.m +++ src/OFRectValue.m @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2008-2021 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#import "OFRectValue.h" +#import "OFMethodSignature.h" +#import "OFString.h" + +#import "OFOutOfRangeException.h" + +@implementation OFRectValue +@synthesize rectValue = _rect; + +- (instancetype)initWithRect: (OFRect)rect +{ + self = [super init]; + + _rect = rect; + + return self; +} + +- (const char *)objCType +{ + return @encode(OFRect); +} + +- (void)getValue: (void *)value size: (size_t)size +{ + if (size != sizeof(_rect)) + @throw [OFOutOfRangeException exception]; + + memcpy(value, &_rect, sizeof(_rect)); +} + +- (OFString *)description +{ + return [OFString stringWithFormat: + @"", + _rect.origin.x, _rect.origin.y, + _rect.size.width, _rect.size.height]; +} +@end DELETED src/OFRectangleValue.h Index: src/OFRectangleValue.h ================================================================== --- src/OFRectangleValue.h +++ src/OFRectangleValue.h @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2008-2021 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#import "OFValue.h" - -OF_ASSUME_NONNULL_BEGIN - -@interface OFRectangleValue: OFValue -{ - of_rectangle_t _rectangle; -} - -- (instancetype)initWithRectangle: (of_rectangle_t)rectangle; -@end - -OF_ASSUME_NONNULL_END DELETED src/OFRectangleValue.m Index: src/OFRectangleValue.m ================================================================== --- src/OFRectangleValue.m +++ src/OFRectangleValue.m @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2008-2021 Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#import "OFRectangleValue.h" -#import "OFMethodSignature.h" -#import "OFString.h" - -#import "OFOutOfRangeException.h" - -@implementation OFRectangleValue -@synthesize rectangleValue = _rectangle; - -- (instancetype)initWithRectangle: (of_rectangle_t)rectangle -{ - self = [super init]; - - _rectangle = rectangle; - - return self; -} - -- (const char *)objCType -{ - return @encode(of_rectangle_t); -} - -- (void)getValue: (void *)value size: (size_t)size -{ - if (size != sizeof(_rectangle)) - @throw [OFOutOfRangeException exception]; - - memcpy(value, &_rectangle, sizeof(_rectangle)); -} - -- (OFString *)description -{ - return [OFString stringWithFormat: - @"", - _rectangle.origin.x, _rectangle.origin.y, - _rectangle.size.width, _rectangle.size.height]; -} -@end Index: src/OFRunLoop+Private.h ================================================================== --- src/OFRunLoop+Private.h +++ src/OFRunLoop+Private.h @@ -53,11 +53,11 @@ block: (nullable of_stream_async_read_block_t)block # endif delegate: (nullable id )delegate; + (void)of_addAsyncReadLineForStream: (OFStream *) stream - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding mode: (of_run_loop_mode_t)mode # ifdef OF_HAVE_BLOCKS block: (nullable of_stream_async_read_line_block_t) block @@ -73,11 +73,11 @@ # endif delegate: (nullable id )delegate; + (void)of_addAsyncWriteForStream: (OFStream *) stream string: (OFString *)string - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding mode: (of_run_loop_mode_t)mode # ifdef OF_HAVE_BLOCKS block: (nullable of_stream_async_write_string_block_t) block Index: src/OFRunLoop.m ================================================================== --- src/OFRunLoop.m +++ src/OFRunLoop.m @@ -112,11 +112,11 @@ { @public # ifdef OF_HAVE_BLOCKS of_stream_async_read_line_block_t _block; # endif - of_string_encoding_t _encoding; + OFStringEncoding _encoding; } @end @interface OFRunLoopWriteDataQueueItem: OFRunLoopQueueItem { @@ -134,11 +134,11 @@ @public # ifdef OF_HAVE_BLOCKS of_stream_async_write_string_block_t _block; # endif OFString *_string; - of_string_encoding_t _encoding; + OFStringEncoding _encoding; size_t _writtenLength; } @end # if !defined(OF_WII) && !defined(OF_NINTENDO_3DS) @@ -1128,11 +1128,11 @@ QUEUE_ITEM } + (void)of_addAsyncReadLineForStream: (OFStream *) stream - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding mode: (of_run_loop_mode_t)mode # ifdef OF_HAVE_BLOCKS block: (of_stream_async_read_line_block_t)block # endif delegate: (id )delegate @@ -1169,11 +1169,11 @@ } + (void)of_addAsyncWriteForStream: (OFStream *) stream string: (OFString *)string - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding mode: (of_run_loop_mode_t)mode # ifdef OF_HAVE_BLOCKS block: (of_stream_async_write_string_block_t)block # endif delegate: (id )delegate @@ -1620,11 +1620,11 @@ } #endif /* Watch for I/O events until the next timer is due */ if (nextTimer != nil || deadline != nil) { - of_time_interval_t timeout; + OFTimeInterval timeout; if (nextTimer != nil && deadline == nil) timeout = nextTimer.timeIntervalSinceNow; else if (nextTimer == nil && deadline != nil) timeout = deadline.timeIntervalSinceNow; Index: src/OFSelectKernelEventObserver.m ================================================================== --- src/OFSelectKernelEventObserver.m +++ src/OFSelectKernelEventObserver.m @@ -167,11 +167,11 @@ FD_CLR((of_socket_t)fd, &_writeFDs); [super removeObjectForWriting: object]; } -- (void)observeForTimeInterval: (of_time_interval_t)timeInterval +- (void)observeForTimeInterval: (OFTimeInterval)timeInterval { fd_set readFDs; fd_set writeFDs; struct timeval timeout; int events; ADDED src/OFSizeValue.h Index: src/OFSizeValue.h ================================================================== --- src/OFSizeValue.h +++ src/OFSizeValue.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2008-2021 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#import "OFValue.h" + +OF_ASSUME_NONNULL_BEGIN + +@interface OFSizeValue: OFValue +{ + OFSize _size; +} + +- (instancetype)initWithSize: (OFSize)size; +@end + +OF_ASSUME_NONNULL_END ADDED src/OFSizeValue.m Index: src/OFSizeValue.m ================================================================== --- src/OFSizeValue.m +++ src/OFSizeValue.m @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2008-2021 Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#import "OFSizeValue.h" +#import "OFMethodSignature.h" +#import "OFString.h" + +#import "OFOutOfRangeException.h" + +@implementation OFSizeValue +@synthesize sizeValue = _size; + +- (instancetype)initWithSize: (OFSize)size +{ + self = [super init]; + + _size = size; + + return self; +} + +- (const char *)objCType +{ + return @encode(OFSize); +} + +- (void)getValue: (void *)value size: (size_t)size +{ + if (size != sizeof(_size)) + @throw [OFOutOfRangeException exception]; + + memcpy(value, &_size, sizeof(_size)); +} + +- (OFString *)description +{ + return [OFString stringWithFormat: + @"", _size.width, _size.height]; +} +@end Index: src/OFSortedList.m ================================================================== --- src/OFSortedList.m +++ src/OFSortedList.m @@ -43,13 +43,13 @@ - (of_list_object_t *)insertObject: (id )object { of_list_object_t *iter; for (iter = _lastListObject; iter != NULL; iter = iter->previous) { - if ([object compare: iter->object] != OF_ORDERED_ASCENDING) + if ([object compare: iter->object] != OFOrderedAscending) return [super insertObject: object afterListObject: iter]; } return [super prependObject: object]; } @end Index: src/OFStdIOStream.h ================================================================== --- src/OFStdIOStream.h +++ src/OFStdIOStream.h @@ -116,19 +116,19 @@ * @brief Moves the cursor to the specified absolute position. Does nothing if * there is no underlying terminal. * * @param position The position to move the cursor to */ -- (void)setCursorPosition: (of_point_t)position; +- (void)setCursorPosition: (OFPoint)position; /** * @brief Moves the cursor to the specified relative position. Does nothing if * there is no underlying terminal. * * @param position The position to move the cursor to */ -- (void)setRelativeCursorPosition: (of_point_t)position; +- (void)setRelativeCursorPosition: (OFPoint)position; @end #ifdef __cplusplus extern "C" { #endif Index: src/OFStdIOStream.m ================================================================== --- src/OFStdIOStream.m +++ src/OFStdIOStream.m @@ -491,11 +491,11 @@ [self writeFormat: @"\033[%uG", column + 1]; #endif } -- (void)setCursorPosition: (of_point_t)position +- (void)setCursorPosition: (OFPoint)position { if (position.x < 0 || position.y < 0) @throw [OFInvalidArgumentException exception]; #ifdef HAVE_ISATTY @@ -505,11 +505,11 @@ [self writeFormat: @"\033[%u;%uH", (unsigned)position.y + 1, (unsigned)position.x + 1]; #endif } -- (void)setRelativeCursorPosition: (of_point_t)position +- (void)setRelativeCursorPosition: (OFPoint)position { #ifdef HAVE_ISATTY if (!isatty(_fd)) return; Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -159,11 +159,11 @@ * @param exception An exception that occurred while writing, or nil on success * @return The string to repeat the write with or nil if it should not repeat */ - (nullable OFString *)stream: (OFStream *)stream didWriteString: (OFString *)string - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding bytesWritten: (size_t)bytesWritten exception: (nullable id)exception; @end /** @@ -790,11 +790,11 @@ * @param encoding The encoding of the string to read from the stream * @param length The length (in bytes) of the string to read from the stream * @return A string with the specified length */ - (OFString *)readStringWithLength: (size_t)length - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; /** * @brief Reads until a newline, `\0` or end of stream occurs. * * @return The line that was read, autoreleased, or `nil` if the end of the @@ -808,11 +808,11 @@ * * @param encoding The encoding used by the stream * @return The line that was read, autoreleased, or `nil` if the end of the * stream has been reached. */ -- (nullable OFString *)readLineWithEncoding: (of_string_encoding_t)encoding; +- (nullable OFString *)readLineWithEncoding: (OFStringEncoding)encoding; #ifdef OF_HAVE_SOCKETS /** * @brief Asynchronously reads until a newline, `\0`, end of stream or an * exception occurs. @@ -829,11 +829,11 @@ * @note The stream must conform to @ref OFReadyForReadingObserving in order * for this to work! * * @param encoding The encoding used by the stream */ -- (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding; +- (void)asyncReadLineWithEncoding: (OFStringEncoding)encoding; /** * @brief Asynchronously reads with the specified encoding until a newline, * `\0`, end of stream or an exception occurs. * @@ -841,11 +841,11 @@ * for this to work! * * @param encoding The encoding used by the stream * @param runLoopMode The run loop mode in which to perform the async read */ -- (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding +- (void)asyncReadLineWithEncoding: (OFStringEncoding)encoding runLoopMode: (of_run_loop_mode_t)runLoopMode; # ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously reads until a newline, `\0`, end of stream or an @@ -874,11 +874,11 @@ * If the block returns true, it will be called again when the next * line has been received. If you want the next block in the queue * to handle the next line, you need to return false from the * block. */ -- (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding +- (void)asyncReadLineWithEncoding: (OFStringEncoding)encoding block: (of_stream_async_read_line_block_t)block; /** * @brief Asynchronously reads with the specified encoding until a newline, * `\0`, end of stream or an exception occurs. @@ -892,11 +892,11 @@ * If the block returns true, it will be called again when the next * line has been received. If you want the next block in the queue * to handle the next line, you need to return false from the * block. */ -- (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding +- (void)asyncReadLineWithEncoding: (OFStringEncoding)encoding runLoopMode: (of_run_loop_mode_t)runLoopMode block: (of_stream_async_read_line_block_t)block; # endif #endif @@ -916,11 +916,11 @@ * * @param encoding The encoding used by the stream * @return The line that was read, autoreleased, or `nil` if the line is not * complete yet */ -- (nullable OFString *)tryReadLineWithEncoding: (of_string_encoding_t)encoding; +- (nullable OFString *)tryReadLineWithEncoding: (OFStringEncoding)encoding; /** * @brief Reads until the specified string or `\0` is found or the end of * stream occurs. * @@ -938,11 +938,11 @@ * @param encoding The encoding used by the stream * @return The line that was read, autoreleased, or `nil` if the end of the * stream has been reached. */ - (nullable OFString *)readTillDelimiter: (OFString *)delimiter - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; /** * @brief Tries to reads until the specified string or `\0` is found or the end * of stream (see @ref readTillDelimiter:) and returns `nil` if not * enough data has been received yet. @@ -962,11 +962,11 @@ * @param encoding The encoding used by the stream * @return The line that was read, autoreleased, or `nil` if the end of the * stream has been reached. */ - (nullable OFString *)tryReadTillDelimiter: (OFString *)delimiter - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; /** * @brief Writes everything in the write buffer to the stream. */ - (void)flushWriteBuffer; @@ -1024,11 +1024,11 @@ * @param string The string which is written into the stream * @param encoding The encoding in which the string should be written to the * stream */ - (void)asyncWriteString: (OFString *)string - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; /** * @brief Asynchronously writes a string in the specified encoding into the * stream. * @@ -1039,11 +1039,11 @@ * @param encoding The encoding in which the string should be written to the * stream * @param runLoopMode The run loop mode in which to perform the async write */ - (void)asyncWriteString: (OFString *)string - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding runLoopMode: (of_run_loop_mode_t)runLoopMode; # ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously writes data into the stream. @@ -1102,11 +1102,11 @@ * @param block The block to call when the string has been written. It should * return the string for the next write with the same callback or * nil if it should not repeat. */ - (void)asyncWriteString: (OFString *)string - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding block: (of_stream_async_write_string_block_t)block; /** * @brief Asynchronously writes a string in the specified encoding into the * stream. @@ -1121,11 +1121,11 @@ * @param block The block to call when the string has been written. It should * return the string for the next write with the same callback or * nil if it should not repeat. */ - (void)asyncWriteString: (OFString *)string - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding runLoopMode: (of_run_loop_mode_t)runLoopMode block: (of_stream_async_write_string_block_t)block; # endif #endif @@ -1341,12 +1341,11 @@ * * @param string The string from which the data is written to the stream * @param encoding The encoding in which to write the string to the stream * @return The number of bytes written */ -- (size_t)writeString: (OFString *)string - encoding: (of_string_encoding_t)encoding; +- (size_t)writeString: (OFString *)string encoding: (OFStringEncoding)encoding; /** * @brief Writes a string into the stream with a trailing newline. * * @param string The string from which the data is written to the stream @@ -1360,19 +1359,18 @@ * * @param string The string from which the data is written to the stream * @param encoding The encoding in which to write the string to the stream * @return The number of bytes written */ -- (size_t)writeLine: (OFString *)string - encoding: (of_string_encoding_t)encoding; +- (size_t)writeLine: (OFString *)string encoding: (OFStringEncoding)encoding; /** * @brief Writes a formatted string into the stream. * * See printf for the format syntax. As an addition, `%@` is available as - * format specifier for objects, `%C` for `of_unichar_t` and `%S` for - * `const of_unichar_t *`. + * format specifier for objects, `%C` for `OFUnichar` and `%S` for + * `const OFUnichar *`. * * @param format A string used as format * @return The number of bytes written */ - (size_t)writeFormat: (OFConstantString *)format, ...; @@ -1379,12 +1377,12 @@ /** * @brief Writes a formatted string into the stream. * * See printf for the format syntax. As an addition, `%@` is available as - * format specifier for objects, `%C` for `of_unichar_t` and `%S` for - * `const of_unichar_t *`. + * format specifier for objects, `%C` for `OFUnichar` and `%S` for + * `const OFUnichar *`. * * @param format A string used as format * @param arguments The arguments used in the format string * @return The number of bytes written */ Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -620,15 +620,15 @@ } - (OFString *)readStringWithLength: (size_t)length { return [self readStringWithLength: length - encoding: OF_STRING_ENCODING_UTF_8]; + encoding: OFStringEncodingUTF8]; } - (OFString *)readStringWithLength: (size_t)length - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { OFString *ret; char *buffer = of_alloc(length + 1, 1); buffer[length] = 0; @@ -640,11 +640,11 @@ } return ret; } -- (OFString *)tryReadLineWithEncoding: (of_string_encoding_t)encoding +- (OFString *)tryReadLineWithEncoding: (OFStringEncoding)encoding { size_t pageSize, bufferLength; char *buffer, *readBuffer; OFString *ret; @@ -789,14 +789,14 @@ return nil; } - (OFString *)readLine { - return [self readLineWithEncoding: OF_STRING_ENCODING_UTF_8]; + return [self readLineWithEncoding: OFStringEncodingUTF8]; } -- (OFString *)readLineWithEncoding: (of_string_encoding_t)encoding +- (OFString *)readLineWithEncoding: (OFStringEncoding)encoding { OFString *line = nil; while ((line = [self tryReadLineWithEncoding: encoding]) == nil) if (self.atEndOfStream) @@ -806,21 +806,21 @@ } #ifdef OF_HAVE_SOCKETS - (void)asyncReadLine { - [self asyncReadLineWithEncoding: OF_STRING_ENCODING_UTF_8 + [self asyncReadLineWithEncoding: OFStringEncodingUTF8 runLoopMode: of_run_loop_mode_default]; } -- (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding +- (void)asyncReadLineWithEncoding: (OFStringEncoding)encoding { [self asyncReadLineWithEncoding: encoding runLoopMode: of_run_loop_mode_default]; } -- (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding +- (void)asyncReadLineWithEncoding: (OFStringEncoding)encoding runLoopMode: (of_run_loop_mode_t)runLoopMode { OFStream *stream = (OFStream *)self; @@ -834,24 +834,24 @@ } # ifdef OF_HAVE_BLOCKS - (void)asyncReadLineWithBlock: (of_stream_async_read_line_block_t)block { - [self asyncReadLineWithEncoding: OF_STRING_ENCODING_UTF_8 + [self asyncReadLineWithEncoding: OFStringEncodingUTF8 runLoopMode: of_run_loop_mode_default block: block]; } -- (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding +- (void)asyncReadLineWithEncoding: (OFStringEncoding)encoding block: (of_stream_async_read_line_block_t)block { [self asyncReadLineWithEncoding: encoding runLoopMode: of_run_loop_mode_default block: block]; } -- (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding +- (void)asyncReadLineWithEncoding: (OFStringEncoding)encoding runLoopMode: (of_run_loop_mode_t)runLoopMode block: (of_stream_async_read_line_block_t)block { OFStream *stream = (OFStream *)self; @@ -865,15 +865,15 @@ # endif #endif - (OFString *)tryReadLine { - return [self tryReadLineWithEncoding: OF_STRING_ENCODING_UTF_8]; + return [self tryReadLineWithEncoding: OFStringEncodingUTF8]; } - (OFString *)tryReadTillDelimiter: (OFString *)delimiter - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { const char *delimiterCString; size_t j, delimiterLength, pageSize, bufferLength; char *buffer, *readBuffer; OFString *ret; @@ -1032,15 +1032,15 @@ - (OFString *)readTillDelimiter: (OFString *)delimiter { return [self readTillDelimiter: delimiter - encoding: OF_STRING_ENCODING_UTF_8]; + encoding: OFStringEncodingUTF8]; } - (OFString *)readTillDelimiter: (OFString *)delimiter - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { OFString *ret = nil; while ((ret = [self tryReadTillDelimiter: delimiter encoding: encoding]) == nil) @@ -1051,11 +1051,11 @@ } - (OFString *)tryReadTillDelimiter: (OFString *)delimiter { return [self tryReadTillDelimiter: delimiter - encoding: OF_STRING_ENCODING_UTF_8]; + encoding: OFStringEncodingUTF8]; } - (void)flushWriteBuffer { if (_writeBuffer == NULL) @@ -1115,24 +1115,24 @@ } - (void)asyncWriteString: (OFString *)string { [self asyncWriteString: string - encoding: OF_STRING_ENCODING_UTF_8 + encoding: OFStringEncodingUTF8 runLoopMode: of_run_loop_mode_default]; } - (void)asyncWriteString: (OFString *)string - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { [self asyncWriteString: string encoding: encoding runLoopMode: of_run_loop_mode_default]; } - (void)asyncWriteString: (OFString *)string - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding runLoopMode: (of_run_loop_mode_t)runLoopMode { OFStream *stream = (OFStream *)self; @@ -1171,27 +1171,27 @@ - (void)asyncWriteString: (OFString *)string block: (of_stream_async_write_string_block_t)block { [self asyncWriteString: string - encoding: OF_STRING_ENCODING_UTF_8 + encoding: OFStringEncodingUTF8 runLoopMode: of_run_loop_mode_default block: block]; } - (void)asyncWriteString: (OFString *)string - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding block: (of_stream_async_write_string_block_t)block { [self asyncWriteString: string encoding: encoding runLoopMode: of_run_loop_mode_default block: block]; } - (void)asyncWriteString: (OFString *)string - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding runLoopMode: (of_run_loop_mode_t)runLoopMode block: (of_stream_async_write_string_block_t)block { OFStream *stream = (OFStream *)self; @@ -1559,15 +1559,14 @@ return length; } - (size_t)writeString: (OFString *)string { - return [self writeString: string encoding: OF_STRING_ENCODING_UTF_8]; + return [self writeString: string encoding: OFStringEncodingUTF8]; } -- (size_t)writeString: (OFString *)string - encoding: (of_string_encoding_t)encoding +- (size_t)writeString: (OFString *)string encoding: (OFStringEncoding)encoding { void *pool; size_t length; if (string == nil) @@ -1584,14 +1583,14 @@ return length; } - (size_t)writeLine: (OFString *)string { - return [self writeLine: string encoding: OF_STRING_ENCODING_UTF_8]; + return [self writeLine: string encoding: OFStringEncodingUTF8]; } -- (size_t)writeLine: (OFString *)string encoding: (of_string_encoding_t)encoding +- (size_t)writeLine: (OFString *)string encoding: (OFStringEncoding)encoding { size_t stringLength = [string cStringLengthWithEncoding: encoding]; char *buffer; buffer = of_alloc(stringLength + 1, 1); Index: src/OFString+CryptographicHashing.m ================================================================== --- src/OFString+CryptographicHashing.m +++ src/OFString+CryptographicHashing.m @@ -52,11 +52,11 @@ } objc_autoreleasePoolPop(pool); return [OFString stringWithCString: cString - encoding: OF_STRING_ENCODING_ASCII + encoding: OFStringEncodingASCII length: digestSize * 2]; } - (OFString *)stringByMD5Hashing { Index: src/OFString+JSONParsing.m ================================================================== --- src/OFString+JSONParsing.m +++ src/OFString+JSONParsing.m @@ -107,14 +107,14 @@ skipWhitespaces(pointer, stop, line); skipComment(pointer, stop, line); } } -static inline of_char16_t +static inline OFChar16 parseUnicodeEscape(const char *pointer, const char *stop) { - of_char16_t ret = 0; + OFChar16 ret = 0; if (pointer + 5 >= stop) return 0xFFFF; if (pointer[0] != '\\' || pointer[1] != 'u') @@ -187,12 +187,12 @@ buffer[i++] = '\t'; (*pointer)++; break; /* Parse Unicode escape sequence */ case 'u':; - of_char16_t c1, c2; - of_unichar_t c; + OFChar16 c1, c2; + OFUnichar c; size_t l; c1 = parseUnicodeEscape(*pointer - 1, stop); if (c1 == 0xFFFF) { free(buffer); @@ -305,12 +305,12 @@ **pointer == '_' || **pointer == '$' || (**pointer & 0x80)) { buffer[i++] = **pointer; (*pointer)++; } else if (**pointer == '\\') { - of_char16_t c1, c2; - of_unichar_t c; + OFChar16 c1, c2; + OFUnichar c; size_t l; if (++(*pointer) >= stop || **pointer != 'u') { free(buffer); return nil; Index: src/OFString+URLEncoding.m ================================================================== --- src/OFString+URLEncoding.m +++ src/OFString+URLEncoding.m @@ -32,18 +32,18 @@ - (OFString *)stringByURLEncodingWithAllowedCharacters: (OFCharacterSet *)allowedCharacters { OFMutableString *ret = [OFMutableString string]; void *pool = objc_autoreleasePoolPush(); - const of_unichar_t *characters = self.characters; + const OFUnichar *characters = self.characters; size_t length = self.length; - bool (*characterIsMember)(id, SEL, of_unichar_t) = - (bool (*)(id, SEL, of_unichar_t))[allowedCharacters + bool (*characterIsMember)(id, SEL, OFUnichar) = + (bool (*)(id, SEL, OFUnichar))[allowedCharacters methodForSelector: @selector(characterIsMember:)]; for (size_t i = 0; i < length; i++) { - of_unichar_t c = characters[i]; + OFUnichar c = characters[i]; if (characterIsMember(allowedCharacters, @selector(characterIsMember:), c)) [ret appendCharacters: &c length: 1]; else { Index: src/OFString+XMLUnescaping.m ================================================================== --- src/OFString+XMLUnescaping.m +++ src/OFString+XMLUnescaping.m @@ -25,11 +25,11 @@ int _OFString_XMLUnescaping_reference; static OF_INLINE OFString * parseNumericEntity(const char *entity, size_t length) { - of_unichar_t c; + OFUnichar c; size_t i; char buffer[5]; if (length == 1 || *entity != '#') return nil; @@ -100,31 +100,31 @@ const char *entity = string + last; size_t entityLength = i - last; if (entityLength == 2 && memcmp(entity, "lt", 2) == 0) [ret appendCString: "<" - encoding: OF_STRING_ENCODING_ASCII + encoding: OFStringEncodingASCII length: 1]; else if (entityLength == 2 && memcmp(entity, "gt", 2) == 0) [ret appendCString: ">" - encoding: OF_STRING_ENCODING_ASCII + encoding: OFStringEncodingASCII length: 1]; else if (entityLength == 4 && memcmp(entity, "quot", 4) == 0) [ret appendCString: "\"" - encoding: OF_STRING_ENCODING_ASCII + encoding: OFStringEncodingASCII length: 1]; else if (entityLength == 4 && memcmp(entity, "apos", 4) == 0) [ret appendCString: "'" - encoding: OF_STRING_ENCODING_ASCII + encoding: OFStringEncodingASCII length: 1]; else if (entityLength == 3 && memcmp(entity, "amp", 3) == 0) [ret appendCString: "&" - encoding: OF_STRING_ENCODING_ASCII + encoding: OFStringEncodingASCII length: 1]; else if (entity[0] == '#') { void *pool2; OFString *tmp; Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -52,57 +52,57 @@ #else typedef void OFString; #endif #if defined(__cplusplus) && __cplusplus >= 201103L -typedef char16_t of_char16_t; -typedef char32_t of_char32_t; +typedef char16_t OFChar16; +typedef char32_t OFChar32; #else -typedef uint_least16_t of_char16_t; -typedef uint_least32_t of_char32_t; +typedef uint_least16_t OFChar16; +typedef uint_least32_t OFChar32; #endif -typedef of_char32_t of_unichar_t; +typedef OFChar32 OFUnichar; /** * @brief The encoding of a string. */ -typedef enum of_string_encoding_t { +typedef enum OFStringEncoding { /* * UTF-8 *has* to be 0, so that if the current @ref OFLocale is * `nil`, `[OFLocale encoding]` returns UTF-8. */ /** UTF-8 */ - OF_STRING_ENCODING_UTF_8, + OFStringEncodingUTF8, /** ASCII */ - OF_STRING_ENCODING_ASCII, + OFStringEncodingASCII, /** ISO 8859-1 */ - OF_STRING_ENCODING_ISO_8859_1, + OFStringEncodingISO8859_1, /** ISO 8859-2 */ - OF_STRING_ENCODING_ISO_8859_2, + OFStringEncodingISO8859_2, /** ISO 8859-3 */ - OF_STRING_ENCODING_ISO_8859_3, + OFStringEncodingISO8859_3, /** ISO 8859-15 */ - OF_STRING_ENCODING_ISO_8859_15, + OFStringEncodingISO8859_15, /** Windows-1251 */ - OF_STRING_ENCODING_WINDOWS_1251, + OFStringEncodingWindows1251, /** Windows-1252 */ - OF_STRING_ENCODING_WINDOWS_1252, + OFStringEncodingWindows1252, /** Codepage 437 */ - OF_STRING_ENCODING_CODEPAGE_437, + OFStringEncodingCodepage437, /** Codepage 850 */ - OF_STRING_ENCODING_CODEPAGE_850, + OFStringEncodingCodepage850, /** Codepage 858 */ - OF_STRING_ENCODING_CODEPAGE_858, + OFStringEncodingCodepage858, /** Mac OS Roman */ - OF_STRING_ENCODING_MAC_ROMAN, + OFStringEncodingMacRoman, /** KOI8-R */ - OF_STRING_ENCODING_KOI8_R, + OFStringEncodingKOI8R, /** KOI8-U */ - OF_STRING_ENCODING_KOI8_U, + OFStringEncodingKOI8U, /** Try to automatically detect the encoding */ - OF_STRING_ENCODING_AUTODETECT = 0xFF -} of_string_encoding_t; + OFStringEncodingAutodetect = 0xFF +} OFStringEncoding; enum { OF_STRING_SEARCH_BACKWARDS = 1, OF_STRING_SKIP_EMPTY = 2 }; @@ -215,21 +215,21 @@ * * The result is valid until the autorelease pool is released. If you want to * use the result outside the scope of the current autorelease pool, you have to * copy it. */ -@property (readonly, nonatomic) const of_unichar_t *characters +@property (readonly, nonatomic) const OFUnichar *characters OF_RETURNS_INNER_POINTER; /** * @brief The string in UTF-16 encoding with native byte order. * * The result is valid until the autorelease pool is released. If you want to * use the result outside the scope of the current autorelease pool, you have to * copy it. */ -@property (readonly, nonatomic) const of_char16_t *UTF16String +@property (readonly, nonatomic) const OFChar16 *UTF16String OF_RETURNS_INNER_POINTER; /** * @brief The length of the string in UTF-16 characters. */ @@ -240,11 +240,11 @@ * * The result is valid until the autorelease pool is released. If you want to * use the result outside the scope of the current autorelease pool, you have to * copy it. */ -@property (readonly, nonatomic) const of_char32_t *UTF32String +@property (readonly, nonatomic) const OFChar32 *UTF32String OF_RETURNS_INNER_POINTER; /** * @brief The string with leading whitespaces deleted. */ @@ -349,11 +349,11 @@ * @param cString A C string to initialize the OFString with * @param encoding The encoding of the C string * @return A new autoreleased OFString */ + (instancetype)stringWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; /** * @brief Creates a new OFString from a C string with the specified encoding * and length. * @@ -361,11 +361,11 @@ * @param encoding The encoding of the C string * @param cStringLength The length of the C string * @return A new autoreleased OFString */ + (instancetype)stringWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding length: (size_t)cStringLength; /** * @brief Creates a new OFString from OFData with the specified encoding. * @@ -372,11 +372,11 @@ * @param data OFData with the contents of the string * @param encoding The encoding in which the string is stored in the OFData * @return An new autoreleased OFString */ + (instancetype)stringWithData: (OFData *)data - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; /** * @brief Creates a new OFString from another string. * * @param string A string to initialize the OFString with @@ -390,30 +390,30 @@ * * @param characters An array of Unicode characters * @param length The length of the Unicode character array * @return A new autoreleased OFString */ -+ (instancetype)stringWithCharacters: (const of_unichar_t *)characters ++ (instancetype)stringWithCharacters: (const OFUnichar *)characters length: (size_t)length; /** * @brief Creates a new OFString from a UTF-16 encoded string. * * @param string The UTF-16 string * @return A new autoreleased OFString */ -+ (instancetype)stringWithUTF16String: (const of_char16_t *)string; ++ (instancetype)stringWithUTF16String: (const OFChar16 *)string; /** * @brief Creates a new OFString from a UTF-16 encoded string with the * specified length. * * @param string The UTF-16 string * @param length The length of the UTF-16 string * @return A new autoreleased OFString */ -+ (instancetype)stringWithUTF16String: (const of_char16_t *)string ++ (instancetype)stringWithUTF16String: (const OFChar16 *)string length: (size_t)length; /** * @brief Creates a new OFString from a UTF-16 encoded string, assuming the * specified byte order if no byte order mark is found. @@ -420,12 +420,12 @@ * * @param string The UTF-16 string * @param byteOrder The byte order to assume if there is no byte order mark * @return A new autoreleased OFString */ -+ (instancetype)stringWithUTF16String: (const of_char16_t *)string - byteOrder: (of_byte_order_t)byteOrder; ++ (instancetype)stringWithUTF16String: (const OFChar16 *)string + byteOrder: (OFByteOrder)byteOrder; /** * @brief Creates a new OFString from a UTF-16 encoded string with the * specified length, assuming the specified byte order if no byte order * mark is found. @@ -433,31 +433,31 @@ * @param string The UTF-16 string * @param length The length of the UTF-16 string * @param byteOrder The byte order to assume if there is no byte order mark * @return A new autoreleased OFString */ -+ (instancetype)stringWithUTF16String: (const of_char16_t *)string ++ (instancetype)stringWithUTF16String: (const OFChar16 *)string length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder; + byteOrder: (OFByteOrder)byteOrder; /** * @brief Creates a new OFString from a UTF-32 encoded string. * * @param string The UTF-32 string * @return A new autoreleased OFString */ -+ (instancetype)stringWithUTF32String: (const of_char32_t *)string; ++ (instancetype)stringWithUTF32String: (const OFChar32 *)string; /** * @brief Creates a new OFString from a UTF-32 encoded string with the * specified length. * * @param string The UTF-32 string * @param length The length of the UTF-32 string * @return A new autoreleased OFString */ -+ (instancetype)stringWithUTF32String: (const of_char32_t *)string ++ (instancetype)stringWithUTF32String: (const OFChar32 *)string length: (size_t)length; /** * @brief Creates a new OFString from a UTF-32 encoded string, assuming the * specified byte order if no byte order mark is found. @@ -464,12 +464,12 @@ * * @param string The UTF-32 string * @param byteOrder The byte order to assume if there is no byte order mark * @return A new autoreleased OFString */ -+ (instancetype)stringWithUTF32String: (const of_char32_t *)string - byteOrder: (of_byte_order_t)byteOrder; ++ (instancetype)stringWithUTF32String: (const OFChar32 *)string + byteOrder: (OFByteOrder)byteOrder; /** * @brief Creates a new OFString from a UTF-32 encoded string with the * specified length, assuming the specified byte order if no byte order * mark is found. @@ -477,20 +477,20 @@ * @param string The UTF-32 string * @param length The length of the UTF-32 string * @param byteOrder The byte order to assume if there is no byte order mark * @return A new autoreleased OFString */ -+ (instancetype)stringWithUTF32String: (const of_char32_t *)string ++ (instancetype)stringWithUTF32String: (const OFChar32 *)string length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder; + byteOrder: (OFByteOrder)byteOrder; /** * @brief Creates a new OFString from a format string. * * See printf for the format syntax. As an addition, `%@` is available as - * format specifier for objects, `%C` for `of_unichar_t` and `%S` for - * `const of_unichar_t *`. + * format specifier for objects, `%C` for `OFUnichar` and `%S` for + * `const OFUnichar *`. * * @param format A string used as format to initialize the OFString * @return A new autoreleased OFString */ + (instancetype)stringWithFormat: (OFConstantString *)format, ...; @@ -512,11 +512,11 @@ * @param path The path to the file * @param encoding The encoding of the file * @return A new autoreleased OFString */ + (instancetype)stringWithContentsOfFile: (OFString *)path - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; # endif /** * @brief Creates a new OFString with the contents of the specified URL. * @@ -538,11 +538,11 @@ * @param URL The URL to the contents for the string * @param encoding The encoding to assume * @return A new autoreleased OFString */ + (instancetype)stringWithContentsOfURL: (OFURL *)URL - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; /** * @brief Initializes an already allocated OFString from a UTF-8 encoded C * string. * @@ -606,11 +606,11 @@ * @param cString A C string to initialize the OFString with * @param encoding The encoding of the C string * @return An initialized OFString */ - (instancetype)initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; /** * @brief Initializes an already allocated OFString from a C string with the * specified encoding and length. * @@ -618,11 +618,11 @@ * @param encoding The encoding of the C string * @param cStringLength The length of the C string * @return An initialized OFString */ - (instancetype)initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding length: (size_t)cStringLength; /** * @brief Initializes an already allocated OFString from OFData with the * specified encoding. @@ -630,11 +630,11 @@ * @param data OFData with the contents of the string * @param encoding The encoding in which the string is stored in the OFData * @return An initialized OFString */ - (instancetype)initWithData: (OFData *)data - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; /** * @brief Initializes an already allocated OFString with another string. * * @param string A string to initialize the OFString with @@ -648,30 +648,30 @@ * * @param characters An array of Unicode characters * @param length The length of the Unicode character array * @return An initialized OFString */ -- (instancetype)initWithCharacters: (const of_unichar_t *)characters +- (instancetype)initWithCharacters: (const OFUnichar *)characters length: (size_t)length; /** * @brief Initializes an already allocated OFString with a UTF-16 string. * * @param string The UTF-16 string * @return An initialized OFString */ -- (instancetype)initWithUTF16String: (const of_char16_t *)string; +- (instancetype)initWithUTF16String: (const OFChar16 *)string; /** * @brief Initializes an already allocated OFString with a UTF-16 string with * the specified length. * * @param string The UTF-16 string * @param length The length of the UTF-16 string * @return An initialized OFString */ -- (instancetype)initWithUTF16String: (const of_char16_t *)string +- (instancetype)initWithUTF16String: (const OFChar16 *)string length: (size_t)length; /** * @brief Initializes an already allocated OFString with a UTF-16 string, * assuming the specified byte order if no byte order mark is found. @@ -678,12 +678,12 @@ * * @param string The UTF-16 string * @param byteOrder The byte order to assume if there is no byte order mark * @return An initialized OFString */ -- (instancetype)initWithUTF16String: (const of_char16_t *)string - byteOrder: (of_byte_order_t)byteOrder; +- (instancetype)initWithUTF16String: (const OFChar16 *)string + byteOrder: (OFByteOrder)byteOrder; /** * @brief Initializes an already allocated OFString with a UTF-16 string with * the specified length, assuming the specified byte order if no byte * order mark is found. @@ -691,31 +691,31 @@ * @param string The UTF-16 string * @param length The length of the UTF-16 string * @param byteOrder The byte order to assume if there is no byte order mark * @return An initialized OFString */ -- (instancetype)initWithUTF16String: (const of_char16_t *)string +- (instancetype)initWithUTF16String: (const OFChar16 *)string length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder; + byteOrder: (OFByteOrder)byteOrder; /** * @brief Initializes an already allocated OFString with a UTF-32 string. * * @param string The UTF-32 string * @return An initialized OFString */ -- (instancetype)initWithUTF32String: (const of_char32_t *)string; +- (instancetype)initWithUTF32String: (const OFChar32 *)string; /** * @brief Initializes an already allocated OFString with a UTF-32 string with * the specified length * * @param string The UTF-32 string * @param length The length of the UTF-32 string * @return An initialized OFString */ -- (instancetype)initWithUTF32String: (const of_char32_t *)string +- (instancetype)initWithUTF32String: (const OFChar32 *)string length: (size_t)length; /** * @brief Initializes an already allocated OFString with a UTF-32 string, * assuming the specified byte order if no byte order mark is found. @@ -722,12 +722,12 @@ * * @param string The UTF-32 string * @param byteOrder The byte order to assume if there is no byte order mark * @return An initialized OFString */ -- (instancetype)initWithUTF32String: (const of_char32_t *)string - byteOrder: (of_byte_order_t)byteOrder; +- (instancetype)initWithUTF32String: (const OFChar32 *)string + byteOrder: (OFByteOrder)byteOrder; /** * @brief Initializes an already allocated OFString with a UTF-32 string with * the specified length, assuming the specified byte order if no byte * order mark is found. @@ -735,20 +735,20 @@ * @param string The UTF-32 string * @param length The length of the UTF-32 string * @param byteOrder The byte order to assume if there is no byte order mark * @return An initialized OFString */ -- (instancetype)initWithUTF32String: (const of_char32_t *)string +- (instancetype)initWithUTF32String: (const OFChar32 *)string length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder; + byteOrder: (OFByteOrder)byteOrder; /** * @brief Initializes an already allocated OFString with a format string. * * See printf for the format syntax. As an addition, `%@` is available as - * format specifier for objects, `%C` for `of_unichar_t` and `%S` for - * `const of_unichar_t *`. + * format specifier for objects, `%C` for `OFUnichar` and `%S` for + * `const OFUnichar *`. * * @param format A string used as format to initialize the OFString * @return An initialized OFString */ - (instancetype)initWithFormat: (OFConstantString *)format, ...; @@ -755,12 +755,12 @@ /** * @brief Initializes an already allocated OFString with a format string. * * See printf for the format syntax. As an addition, `%@` is available as - * format specifier for objects, `%C` for `of_unichar_t` and `%S` for - * `const of_unichar_t *`. + * format specifier for objects, `%C` for `OFUnichar` and `%S` for + * `const OFUnichar *`. * * @param format A string used as format to initialize the OFString * @param arguments The arguments used in the format string * @return An initialized OFString */ @@ -784,11 +784,11 @@ * @param path The path to the file * @param encoding The encoding of the file * @return An initialized OFString */ - (instancetype)initWithContentsOfFile: (OFString *)path - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; # endif /** * @brief Initializes an already allocated OFString with the contents of the * specified URL. @@ -811,11 +811,11 @@ * @param URL The URL to the contents for the string * @param encoding The encoding to assume * @return An initialized OFString */ - (instancetype)initWithContentsOfURL: (OFURL *)URL - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; /** * @brief Writes the OFString into the specified C string with the specified * encoding. * @@ -826,11 +826,11 @@ * @return The number of bytes written into the C string, without the * terminating zero */ - (size_t)getCString: (char *)cString maxLength: (size_t)maxLength - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; /** * @brief Writes the OFString into the specified C string with the specified * encoding, replacing characters that cannot be represented in the * specified encoding with a question mark. @@ -842,11 +842,11 @@ * @return The number of bytes written into the C string, without the * terminating zero */ - (size_t)getLossyCString: (char *)cString maxLength: (size_t)maxLength - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; /** * @brief Returns the OFString as a C string in the specified encoding. * * The result is valid until the autorelease pool is released. If you want to @@ -854,11 +854,11 @@ * copy it. * * @param encoding The encoding for the C string * @return The OFString as a C string in the specified encoding */ -- (const char *)cStringWithEncoding: (of_string_encoding_t)encoding +- (const char *)cStringWithEncoding: (OFStringEncoding)encoding OF_RETURNS_INNER_POINTER; /** * @brief Returns the OFString as a C string in the specified encoding, * replacing characters that cannot be represented in the specified @@ -869,63 +869,63 @@ * copy it. * * @param encoding The encoding for the C string * @return The OFString as a C string in the specified encoding */ -- (const char *)lossyCStringWithEncoding: (of_string_encoding_t)encoding +- (const char *)lossyCStringWithEncoding: (OFStringEncoding)encoding OF_RETURNS_INNER_POINTER; /** * @brief Returns the number of bytes the string needs in the specified * encoding. * * @param encoding The encoding for the string * @return The number of bytes the string needs in the specified encoding. */ -- (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding; +- (size_t)cStringLengthWithEncoding: (OFStringEncoding)encoding; /** * @brief Compares the string to another string. * * @param string The string to compare the string to * @return The result of the comparison */ -- (of_comparison_result_t)compare: (OFString *)string; +- (OFComparisonResult)compare: (OFString *)string; /** * @brief Compares the string to another string without caring about the case. * * @param string The string to compare the string to * @return The result of the comparison */ -- (of_comparison_result_t)caseInsensitiveCompare: (OFString *)string; +- (OFComparisonResult)caseInsensitiveCompare: (OFString *)string; /** * @brief Returns the Unicode character at the specified index. * * @param index The index of the Unicode character to return * @return The Unicode character at the specified index */ -- (of_unichar_t)characterAtIndex: (size_t)index; +- (OFUnichar)characterAtIndex: (size_t)index; /** * @brief Copies the Unicode characters in the specified range to the specified * 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: (OFUnichar *)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 + * `OFNotFound` 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 @@ -933,13 +933,13 @@ * Possible values are: * Value | Description * -----------------------------|------------------------------- * `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 + * `OFNotFound` 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 @@ -948,22 +948,22 @@ * Value | Description * -----------------------------|------------------------------- * `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 + * `OFNotFound` 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 * @return The index of the first occurrence of a character from the set or - * `OF_NOT_FOUND` if it was not found + * `OFNotFound` if it was not found */ - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet; /** * @brief Returns the index of the first character from the set. @@ -973,11 +973,11 @@ * Possible values are: * Value | Description * -----------------------------|------------------------------- * `OF_STRING_SEARCH_BACKWARDS` | Search backwards in the string * @return The index of the first occurrence of a character from the set or - * `OF_NOT_FOUND` if it was not found + * `OFNotFound` if it was not found */ - (size_t)indexOfCharacterFromSet: (OFCharacterSet *)characterSet options: (int)options; /** @@ -989,15 +989,15 @@ * Value | Description * -----------------------------|------------------------------- * `OF_STRING_SEARCH_BACKWARDS` | Search backwards in the string * @param range The range in which to search * @return The index of the first occurrence of a character from the set or - * `OF_NOT_FOUND` if it was not found + * `OFNotFound` 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 @@ -1206,11 +1206,11 @@ * copy it. * * @param byteOrder The byte order for the UTF-16 encoding * @return The string in UTF-16 encoding with the specified byte order */ -- (const of_char16_t *)UTF16StringWithByteOrder: (of_byte_order_t)byteOrder +- (const OFChar16 *)UTF16StringWithByteOrder: (OFByteOrder)byteOrder OF_RETURNS_INNER_POINTER; /** * @brief Returns the string in UTF-32 encoding with the specified byte order. * @@ -1219,20 +1219,20 @@ * copy it. * * @param byteOrder The byte order for the UTF-32 encoding * @return The string in UTF-32 encoding with the specified byte order */ -- (const of_char32_t *)UTF32StringWithByteOrder: (of_byte_order_t)byteOrder +- (const OFChar32 *)UTF32StringWithByteOrder: (OFByteOrder)byteOrder OF_RETURNS_INNER_POINTER; /** * @brief Returns the string as OFData with the specified encoding. * * @param encoding The encoding to use for the returned OFData * @return The string as OFData with the specified encoding */ -- (OFData *)dataWithEncoding: (of_string_encoding_t)encoding; +- (OFData *)dataWithEncoding: (OFStringEncoding)encoding; # ifdef OF_HAVE_FILES /** * @brief Writes the string into the specified file using UTF-8 encoding. * @@ -1245,11 +1245,11 @@ * encoding. * * @param path The path of the file to write to * @param encoding The encoding to use to write the string into the file */ -- (void)writeToFile: (OFString *)path encoding: (of_string_encoding_t)encoding; +- (void)writeToFile: (OFString *)path encoding: (OFStringEncoding)encoding; # endif /** * @brief Writes the string to the specified URL using UTF-8 encoding. * @@ -1261,11 +1261,11 @@ * @brief Writes the string to the specified URL using the specified encoding. * * @param URL The URL to write to * @param encoding The encoding to use to write the string to the URL */ -- (void)writeToURL: (OFURL *)URL encoding: (of_string_encoding_t)encoding; +- (void)writeToURL: (OFURL *)URL encoding: (OFStringEncoding)encoding; # ifdef OF_HAVE_BLOCKS /** * Enumerates all lines in the receiver using the specified block. * @@ -1277,16 +1277,34 @@ #endif #ifdef __cplusplus extern "C" { #endif -extern of_string_encoding_t of_string_parse_encoding(OFString *); -extern OFString *_Nullable of_string_name_of_encoding(of_string_encoding_t); -extern size_t of_string_utf8_encode(of_unichar_t, char *); -extern ssize_t of_string_utf8_decode(const char *, size_t, of_unichar_t *); -extern size_t of_string_utf16_length(const of_char16_t *); -extern size_t of_string_utf32_length(const of_char32_t *); +/** + * @brief Parses the specified string encoding name and returns the + * OFStringEncoding for it. + * + * Throws @ref OFInvalidArgumentException if the specified name is not a valid + * encoding name. + * + * @param name The name to parse as a string encoding + * @return The OFStringEncoding for the specified name + */ +extern OFStringEncoding OFParseStringEncodingName(OFString *name); + +/** + * @brief Returns the name of the specified OFStringEncoding. + * + * @param encoding The encoding for which to return the name + * @return The name of the specified OFStringEncoding + */ +extern OFString *_Nullable OFStringEncodingName(OFStringEncoding encoding); + +extern size_t of_string_utf8_encode(OFUnichar, char *); +extern ssize_t of_string_utf8_decode(const char *, size_t, OFUnichar *); +extern size_t of_string_utf16_length(const OFChar16 *); +extern size_t of_string_utf32_length(const OFChar32 *); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -87,42 +87,42 @@ #endif @interface OFString () - (size_t)of_getCString: (char *)cString maxLength: (size_t)maxLength - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding lossy: (bool)lossy OF_DIRECT; -- (const char *)of_cStringWithEncoding: (of_string_encoding_t)encoding +- (const char *)of_cStringWithEncoding: (OFStringEncoding)encoding lossy: (bool)lossy OF_DIRECT; - (OFString *)of_JSONRepresentationWithOptions: (int)options depth: (size_t)depth; @end @interface OFStringPlaceholder: OFString @end -extern bool of_unicode_to_iso_8859_2(const of_unichar_t *, unsigned char *, - size_t, bool); -extern bool of_unicode_to_iso_8859_3(const of_unichar_t *, unsigned char *, - size_t, bool); -extern bool of_unicode_to_iso_8859_15(const of_unichar_t *, unsigned char *, - size_t, bool); -extern bool of_unicode_to_windows_1251(const of_unichar_t *, unsigned char *, - size_t, bool); -extern bool of_unicode_to_windows_1252(const of_unichar_t *, unsigned char *, - size_t, bool); -extern bool of_unicode_to_codepage_437(const of_unichar_t *, unsigned char *, - size_t, bool); -extern bool of_unicode_to_codepage_850(const of_unichar_t *, unsigned char *, - size_t, bool); -extern bool of_unicode_to_codepage_858(const of_unichar_t *, unsigned char *, - size_t, bool); -extern bool of_unicode_to_mac_roman(const of_unichar_t *, unsigned char *, - size_t, bool); -extern bool of_unicode_to_koi8_r(const of_unichar_t *, unsigned char *, - size_t, bool); -extern bool of_unicode_to_koi8_u(const of_unichar_t *, unsigned char *, +extern bool of_unicode_to_iso_8859_2(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool of_unicode_to_iso_8859_3(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool of_unicode_to_iso_8859_15(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool of_unicode_to_windows_1251(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool of_unicode_to_windows_1252(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool of_unicode_to_codepage_437(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool of_unicode_to_codepage_850(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool of_unicode_to_codepage_858(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool of_unicode_to_mac_roman(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool of_unicode_to_koi8_r(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool of_unicode_to_koi8_u(const OFUnichar *, unsigned char *, size_t, bool); /* References for static linking */ void _references_to_categories_of_OFString(void) @@ -143,106 +143,106 @@ _reference_to_OFConstantString(void) { [OFConstantString class]; } -of_string_encoding_t -of_string_parse_encoding(OFString *string) +OFStringEncoding +OFParseStringEncodingName(OFString *string) { void *pool = objc_autoreleasePoolPush(); - of_string_encoding_t encoding; + OFStringEncoding encoding; string = string.lowercaseString; if ([string isEqual: @"utf8"] || [string isEqual: @"utf-8"]) - encoding = OF_STRING_ENCODING_UTF_8; + encoding = OFStringEncodingUTF8; else if ([string isEqual: @"ascii"] || [string isEqual: @"us-ascii"]) - encoding = OF_STRING_ENCODING_ASCII; + encoding = OFStringEncodingASCII; else if ([string isEqual: @"iso-8859-1"] || [string isEqual: @"iso_8859-1"]) - encoding = OF_STRING_ENCODING_ISO_8859_1; + encoding = OFStringEncodingISO8859_1; else if ([string isEqual: @"iso-8859-2"] || [string isEqual: @"iso_8859-2"]) - encoding = OF_STRING_ENCODING_ISO_8859_2; + encoding = OFStringEncodingISO8859_2; else if ([string isEqual: @"iso-8859-3"] || [string isEqual: @"iso_8859-3"]) - encoding = OF_STRING_ENCODING_ISO_8859_3; + encoding = OFStringEncodingISO8859_3; else if ([string isEqual: @"iso-8859-15"] || [string isEqual: @"iso_8859-15"]) - encoding = OF_STRING_ENCODING_ISO_8859_15; + encoding = OFStringEncodingISO8859_15; else if ([string isEqual: @"windows-1251"] || [string isEqual: @"cp1251"] || [string isEqual: @"cp-1251"] || [string isEqual: @"1251"]) - encoding = OF_STRING_ENCODING_WINDOWS_1251; + encoding = OFStringEncodingWindows1251; else if ([string isEqual: @"windows-1252"] || [string isEqual: @"cp1252"] || [string isEqual: @"cp-1252"] || [string isEqual: @"1252"]) - encoding = OF_STRING_ENCODING_WINDOWS_1252; + encoding = OFStringEncodingWindows1252; else if ([string isEqual: @"cp437"] || [string isEqual: @"cp-437"] || [string isEqual: @"ibm437"] || [string isEqual: @"437"]) - encoding = OF_STRING_ENCODING_CODEPAGE_437; + encoding = OFStringEncodingCodepage437; else if ([string isEqual: @"cp850"] || [string isEqual: @"cp-850"] || [string isEqual: @"ibm850"] || [string isEqual: @"850"]) - encoding = OF_STRING_ENCODING_CODEPAGE_850; + encoding = OFStringEncodingCodepage850; else if ([string isEqual: @"cp858"] || [string isEqual: @"cp-858"] || [string isEqual: @"ibm858"] || [string isEqual: @"858"]) - encoding = OF_STRING_ENCODING_CODEPAGE_858; + encoding = OFStringEncodingCodepage858; else if ([string isEqual: @"macintosh"] || [string isEqual: @"mac"]) - encoding = OF_STRING_ENCODING_MAC_ROMAN; + encoding = OFStringEncodingMacRoman; else if ([string isEqual: @"koi8-r"]) - encoding = OF_STRING_ENCODING_KOI8_R; + encoding = OFStringEncodingKOI8R; else if ([string isEqual: @"koi8-u"]) - encoding = OF_STRING_ENCODING_KOI8_U; + encoding = OFStringEncodingKOI8U; else @throw [OFInvalidArgumentException exception]; objc_autoreleasePoolPop(pool); return encoding; } OFString * -of_string_name_of_encoding(of_string_encoding_t encoding) +OFStringEncodingName(OFStringEncoding encoding) { switch (encoding) { - case OF_STRING_ENCODING_UTF_8: + case OFStringEncodingUTF8: return @"UTF-8"; - case OF_STRING_ENCODING_ASCII: + case OFStringEncodingASCII: return @"ASCII"; - case OF_STRING_ENCODING_ISO_8859_1: + case OFStringEncodingISO8859_1: return @"ISO 8859-1"; - case OF_STRING_ENCODING_ISO_8859_2: + case OFStringEncodingISO8859_2: return @"ISO 8859-2"; - case OF_STRING_ENCODING_ISO_8859_3: + case OFStringEncodingISO8859_3: return @"ISO 8859-3"; - case OF_STRING_ENCODING_ISO_8859_15: + case OFStringEncodingISO8859_15: return @"ISO 8859-15"; - case OF_STRING_ENCODING_WINDOWS_1251: + case OFStringEncodingWindows1251: return @"Windows-1251"; - case OF_STRING_ENCODING_WINDOWS_1252: + case OFStringEncodingWindows1252: return @"Windows-1252"; - case OF_STRING_ENCODING_CODEPAGE_437: + case OFStringEncodingCodepage437: return @"Codepage 437"; - case OF_STRING_ENCODING_CODEPAGE_850: + case OFStringEncodingCodepage850: return @"Codepage 850"; - case OF_STRING_ENCODING_CODEPAGE_858: + case OFStringEncodingCodepage858: return @"Codepage 858"; - case OF_STRING_ENCODING_MAC_ROMAN: + case OFStringEncodingMacRoman: return @"Mac Roman"; - case OF_STRING_ENCODING_KOI8_R: + case OFStringEncodingKOI8R: return @"KOI8-R"; - case OF_STRING_ENCODING_KOI8_U: + case OFStringEncodingKOI8U: return @"KOI8-U"; - case OF_STRING_ENCODING_AUTODETECT: + case OFStringEncodingAutodetect: return @"autodetect"; } return nil; } size_t -of_string_utf8_encode(of_unichar_t character, char *buffer) +of_string_utf8_encode(OFUnichar character, char *buffer) { if (character < 0x80) { buffer[0] = character; return 1; } else if (character < 0x800) { @@ -264,11 +264,11 @@ return 0; } ssize_t -of_string_utf8_decode(const char *buffer_, size_t length, of_unichar_t *ret) +of_string_utf8_decode(const char *buffer_, size_t length, OFUnichar *ret) { const unsigned char *buffer = (const unsigned char *)buffer_; if (!(*buffer & 0x80)) { *ret = buffer[0]; @@ -314,11 +314,11 @@ return 0; } size_t -of_string_utf16_length(const of_char16_t *string) +of_string_utf16_length(const OFChar16 *string) { size_t length = 0; while (*string++ != 0) length++; @@ -325,11 +325,11 @@ return length; } size_t -of_string_utf32_length(const of_char32_t *string) +of_string_utf32_length(const OFChar32 *string) { size_t length = 0; while (*string++ != 0) length++; @@ -341,15 +341,15 @@ static OFString * decomposedString(OFString *self, const char *const *const *table, size_t size) { OFMutableString *ret = [OFMutableString string]; void *pool = objc_autoreleasePoolPush(); - const of_unichar_t *characters = self.characters; + const OFUnichar *characters = self.characters; size_t length = self.length; for (size_t i = 0; i < length; i++) { - of_unichar_t c = characters[i]; + OFUnichar c = characters[i]; const char *const *page; if (c >= size) { [ret appendCharacters: &c length: 1]; continue; @@ -419,13 +419,13 @@ length: UTF8StringLength freeWhenDone: freeWhenDone]; } - (instancetype)initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { - if (encoding == OF_STRING_ENCODING_UTF_8) { + if (encoding == OFStringEncodingUTF8) { OFUTF8String *string; size_t length; void *storage; length = strlen(cString); @@ -440,14 +440,14 @@ return (id)[[OFUTF8String alloc] initWithCString: cString encoding: encoding]; } - (instancetype)initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding length: (size_t)cStringLength { - if (encoding == OF_STRING_ENCODING_UTF_8) { + if (encoding == OFStringEncodingUTF8) { OFUTF8String *string; void *storage; string = of_alloc_object([OFUTF8String class], cStringLength + 1, 1, &storage); @@ -461,11 +461,11 @@ encoding: encoding length: cStringLength]; } - (instancetype)initWithData: (OFData *)data - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return (id)[[OFUTF8String alloc] initWithData: data encoding: encoding]; } @@ -472,67 +472,67 @@ - (instancetype)initWithString: (OFString *)string { return (id)[[OFUTF8String alloc] initWithString: string]; } -- (instancetype)initWithCharacters: (const of_unichar_t *)string +- (instancetype)initWithCharacters: (const OFUnichar *)string length: (size_t)length { return (id)[[OFUTF8String alloc] initWithCharacters: string length: length]; } -- (instancetype)initWithUTF16String: (const of_char16_t *)string +- (instancetype)initWithUTF16String: (const OFChar16 *)string { return (id)[[OFUTF8String alloc] initWithUTF16String: string]; } -- (instancetype)initWithUTF16String: (const of_char16_t *)string +- (instancetype)initWithUTF16String: (const OFChar16 *)string length: (size_t)length { return (id)[[OFUTF8String alloc] initWithUTF16String: string length: length]; } -- (instancetype)initWithUTF16String: (const of_char16_t *)string - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF16String: (const OFChar16 *)string + byteOrder: (OFByteOrder)byteOrder { return (id)[[OFUTF8String alloc] initWithUTF16String: string byteOrder: byteOrder]; } -- (instancetype)initWithUTF16String: (const of_char16_t *)string +- (instancetype)initWithUTF16String: (const OFChar16 *)string length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder + byteOrder: (OFByteOrder)byteOrder { return (id)[[OFUTF8String alloc] initWithUTF16String: string length: length byteOrder: byteOrder]; } -- (instancetype)initWithUTF32String: (const of_char32_t *)string +- (instancetype)initWithUTF32String: (const OFChar32 *)string { return (id)[[OFUTF8String alloc] initWithUTF32String: string]; } -- (instancetype)initWithUTF32String: (const of_char32_t *)string +- (instancetype)initWithUTF32String: (const OFChar32 *)string length: (size_t)length { return (id)[[OFUTF8String alloc] initWithUTF32String: string length: length]; } -- (instancetype)initWithUTF32String: (const of_char32_t *)string - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF32String: (const OFChar32 *)string + byteOrder: (OFByteOrder)byteOrder { return (id)[[OFUTF8String alloc] initWithUTF32String: string byteOrder: byteOrder]; } -- (instancetype)initWithUTF32String: (const of_char32_t *)string +- (instancetype)initWithUTF32String: (const OFChar32 *)string length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder + byteOrder: (OFByteOrder)byteOrder { return (id)[[OFUTF8String alloc] initWithUTF32String: string length: length byteOrder: byteOrder]; } @@ -562,11 +562,11 @@ { return (id)[[OFUTF8String alloc] initWithContentsOfFile: path]; } - (instancetype)initWithContentsOfFile: (OFString *)path - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return (id)[[OFUTF8String alloc] initWithContentsOfFile: path encoding: encoding]; } #endif @@ -575,11 +575,11 @@ { return (id)[[OFUTF8String alloc] initWithContentsOfURL: URL]; } - (instancetype)initWithContentsOfURL: (OFURL *)URL - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return (id)[[OFUTF8String alloc] initWithContentsOfURL: URL encoding: encoding]; } @@ -666,27 +666,27 @@ length: UTF8StringLength freeWhenDone: freeWhenDone] autorelease]; } + (instancetype)stringWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return [[[self alloc] initWithCString: cString encoding: encoding] autorelease]; } + (instancetype)stringWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding length: (size_t)cStringLength { return [[[self alloc] initWithCString: cString encoding: encoding length: cStringLength] autorelease]; } + (instancetype)stringWithData: (OFData *)data - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return [[[self alloc] initWithData: data encoding: encoding] autorelease]; } @@ -693,67 +693,67 @@ + (instancetype)stringWithString: (OFString *)string { return [[[self alloc] initWithString: string] autorelease]; } -+ (instancetype)stringWithCharacters: (const of_unichar_t *)string ++ (instancetype)stringWithCharacters: (const OFUnichar *)string length: (size_t)length { return [[[self alloc] initWithCharacters: string length: length] autorelease]; } -+ (instancetype)stringWithUTF16String: (const of_char16_t *)string ++ (instancetype)stringWithUTF16String: (const OFChar16 *)string { return [[[self alloc] initWithUTF16String: string] autorelease]; } -+ (instancetype)stringWithUTF16String: (const of_char16_t *)string ++ (instancetype)stringWithUTF16String: (const OFChar16 *)string length: (size_t)length { return [[[self alloc] initWithUTF16String: string length: length] autorelease]; } -+ (instancetype)stringWithUTF16String: (const of_char16_t *)string - byteOrder: (of_byte_order_t)byteOrder ++ (instancetype)stringWithUTF16String: (const OFChar16 *)string + byteOrder: (OFByteOrder)byteOrder { return [[[self alloc] initWithUTF16String: string byteOrder: byteOrder] autorelease]; } -+ (instancetype)stringWithUTF16String: (const of_char16_t *)string ++ (instancetype)stringWithUTF16String: (const OFChar16 *)string length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder + byteOrder: (OFByteOrder)byteOrder { return [[[self alloc] initWithUTF16String: string length: length byteOrder: byteOrder] autorelease]; } -+ (instancetype)stringWithUTF32String: (const of_char32_t *)string ++ (instancetype)stringWithUTF32String: (const OFChar32 *)string { return [[[self alloc] initWithUTF32String: string] autorelease]; } -+ (instancetype)stringWithUTF32String: (const of_char32_t *)string ++ (instancetype)stringWithUTF32String: (const OFChar32 *)string length: (size_t)length { return [[[self alloc] initWithUTF32String: string length: length] autorelease]; } -+ (instancetype)stringWithUTF32String: (const of_char32_t *)string - byteOrder: (of_byte_order_t)byteOrder ++ (instancetype)stringWithUTF32String: (const OFChar32 *)string + byteOrder: (OFByteOrder)byteOrder { return [[[self alloc] initWithUTF32String: string byteOrder: byteOrder] autorelease]; } -+ (instancetype)stringWithUTF32String: (const of_char32_t *)string ++ (instancetype)stringWithUTF32String: (const OFChar32 *)string length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder + byteOrder: (OFByteOrder)byteOrder { return [[[self alloc] initWithUTF32String: string length: length byteOrder: byteOrder] autorelease]; } @@ -776,11 +776,11 @@ { return [[[self alloc] initWithContentsOfFile: path] autorelease]; } + (instancetype)stringWithContentsOfFile: (OFString *)path - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return [[[self alloc] initWithContentsOfFile: path encoding: encoding] autorelease]; } #endif @@ -789,11 +789,11 @@ { return [[[self alloc] initWithContentsOfURL: URL] autorelease]; } + (instancetype)stringWithContentsOfURL: (OFURL *)URL - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return [[[self alloc] initWithContentsOfURL: URL encoding: encoding] autorelease]; } @@ -814,19 +814,19 @@ } - (instancetype)initWithUTF8String: (const char *)UTF8String { return [self initWithCString: UTF8String - encoding: OF_STRING_ENCODING_UTF_8 + encoding: OFStringEncodingUTF8 length: strlen(UTF8String)]; } - (instancetype)initWithUTF8String: (const char *)UTF8String length: (size_t)UTF8StringLength { return [self initWithCString: UTF8String - encoding: OF_STRING_ENCODING_UTF_8 + encoding: OFStringEncodingUTF8 length: UTF8StringLength]; } - (instancetype)initWithUTF8StringNoCopy: (char *)UTF8String freeWhenDone: (bool)freeWhenDone @@ -850,26 +850,26 @@ return ret; } - (instancetype)initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return [self initWithCString: cString encoding: encoding length: strlen(cString)]; } - (instancetype)initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding length: (size_t)cStringLength { OF_INVALID_INIT_METHOD } - (instancetype)initWithData: (OFData *)data - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { @try { if (data.itemSize != 1) @throw [OFInvalidArgumentException exception]; } @catch (id e) { @@ -887,72 +887,72 @@ - (instancetype)initWithString: (OFString *)string { OF_INVALID_INIT_METHOD } -- (instancetype)initWithCharacters: (const of_unichar_t *)string +- (instancetype)initWithCharacters: (const OFUnichar *)string length: (size_t)length { OF_INVALID_INIT_METHOD } -- (instancetype)initWithUTF16String: (const of_char16_t *)string +- (instancetype)initWithUTF16String: (const OFChar16 *)string { return [self initWithUTF16String: string length: of_string_utf16_length(string) - byteOrder: OF_BYTE_ORDER_NATIVE]; + byteOrder: OFByteOrderNative]; } -- (instancetype)initWithUTF16String: (const of_char16_t *)string +- (instancetype)initWithUTF16String: (const OFChar16 *)string length: (size_t)length { return [self initWithUTF16String: string length: length - byteOrder: OF_BYTE_ORDER_NATIVE]; + byteOrder: OFByteOrderNative]; } -- (instancetype)initWithUTF16String: (const of_char16_t *)string - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF16String: (const OFChar16 *)string + byteOrder: (OFByteOrder)byteOrder { return [self initWithUTF16String: string length: of_string_utf16_length(string) byteOrder: byteOrder]; } -- (instancetype)initWithUTF16String: (const of_char16_t *)string +- (instancetype)initWithUTF16String: (const OFChar16 *)string length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder + byteOrder: (OFByteOrder)byteOrder { OF_INVALID_INIT_METHOD } -- (instancetype)initWithUTF32String: (const of_char32_t *)string +- (instancetype)initWithUTF32String: (const OFChar32 *)string { return [self initWithUTF32String: string length: of_string_utf32_length(string) - byteOrder: OF_BYTE_ORDER_NATIVE]; + byteOrder: OFByteOrderNative]; } -- (instancetype)initWithUTF32String: (const of_char32_t *)string +- (instancetype)initWithUTF32String: (const OFChar32 *)string length: (size_t)length { return [self initWithUTF32String: string length: length - byteOrder: OF_BYTE_ORDER_NATIVE]; + byteOrder: OFByteOrderNative]; } -- (instancetype)initWithUTF32String: (const of_char32_t *)string - byteOrder: (of_byte_order_t)byteOrder +- (instancetype)initWithUTF32String: (const OFChar32 *)string + byteOrder: (OFByteOrder)byteOrder { return [self initWithUTF32String: string length: of_string_utf32_length(string) byteOrder: byteOrder]; } -- (instancetype)initWithUTF32String: (const of_char32_t *)string +- (instancetype)initWithUTF32String: (const OFChar32 *)string length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder + byteOrder: (OFByteOrder)byteOrder { OF_INVALID_INIT_METHOD } - (instancetype)initWithFormat: (OFConstantString *)format, ... @@ -975,15 +975,15 @@ #ifdef OF_HAVE_FILES - (instancetype)initWithContentsOfFile: (OFString *)path { return [self initWithContentsOfFile: path - encoding: OF_STRING_ENCODING_UTF_8]; + encoding: OFStringEncodingUTF8]; } - (instancetype)initWithContentsOfFile: (OFString *)path - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { char *tmp; unsigned long long fileSize; @try { @@ -1030,11 +1030,11 @@ } @catch (id e) { [self release]; @throw e; } - if (encoding == OF_STRING_ENCODING_UTF_8) { + if (encoding == OFStringEncodingUTF8) { @try { self = [self initWithUTF8StringNoCopy: tmp length: (size_t)fileSize freeWhenDone: true]; } @catch (id e) { @@ -1056,15 +1056,15 @@ #endif - (instancetype)initWithContentsOfURL: (OFURL *)URL { return [self initWithContentsOfURL: URL - encoding: OF_STRING_ENCODING_AUTODETECT]; + encoding: OFStringEncodingAutodetect]; } - (instancetype)initWithContentsOfURL: (OFURL *)URL - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { void *pool = objc_autoreleasePoolPush(); OFData *data; @try { @@ -1113,18 +1113,18 @@ return self; } - (size_t)of_getCString: (char *)cString maxLength: (size_t)maxLength - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding lossy: (bool)lossy { - const of_unichar_t *characters = self.characters; + const OFUnichar *characters = self.characters; size_t i, length = self.length; switch (encoding) { - case OF_STRING_ENCODING_UTF_8:; + case OFStringEncodingUTF8:; size_t j = 0; for (i = 0; i < length; i++) { char buffer[4]; size_t len = of_string_utf8_encode(characters[i], @@ -1157,11 +1157,11 @@ } cString[j] = '\0'; return j; - case OF_STRING_ENCODING_ASCII: + case OFStringEncodingASCII: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; for (i = 0; i < length; i++) { if OF_UNLIKELY (characters[i] > 0x80) { @@ -1175,11 +1175,11 @@ } cString[i] = '\0'; return length; - case OF_STRING_ENCODING_ISO_8859_1: + case OFStringEncodingISO8859_1: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; for (i = 0; i < length; i++) { if OF_UNLIKELY (characters[i] > 0xFF) { @@ -1194,11 +1194,11 @@ cString[i] = '\0'; return length; #ifdef HAVE_ISO_8859_2 - case OF_STRING_ENCODING_ISO_8859_2: + case OFStringEncodingISO8859_2: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!of_unicode_to_iso_8859_2(characters, (unsigned char *)cString, length, lossy)) @@ -1207,11 +1207,11 @@ cString[length] = '\0'; return length; #endif #ifdef HAVE_ISO_8859_3 - case OF_STRING_ENCODING_ISO_8859_3: + case OFStringEncodingISO8859_3: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!of_unicode_to_iso_8859_3(characters, (unsigned char *)cString, length, lossy)) @@ -1220,11 +1220,11 @@ cString[length] = '\0'; return length; #endif #ifdef HAVE_ISO_8859_15 - case OF_STRING_ENCODING_ISO_8859_15: + case OFStringEncodingISO8859_15: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!of_unicode_to_iso_8859_15(characters, (unsigned char *)cString, length, lossy)) @@ -1233,11 +1233,11 @@ cString[length] = '\0'; return length; #endif #ifdef HAVE_WINDOWS_1251 - case OF_STRING_ENCODING_WINDOWS_1251: + case OFStringEncodingWindows1251: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!of_unicode_to_windows_1251(characters, (unsigned char *)cString, length, lossy)) @@ -1246,11 +1246,11 @@ cString[length] = '\0'; return length; #endif #ifdef HAVE_WINDOWS_1252 - case OF_STRING_ENCODING_WINDOWS_1252: + case OFStringEncodingWindows1252: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!of_unicode_to_windows_1252(characters, (unsigned char *)cString, length, lossy)) @@ -1259,11 +1259,11 @@ cString[length] = '\0'; return length; #endif #ifdef HAVE_CODEPAGE_437 - case OF_STRING_ENCODING_CODEPAGE_437: + case OFStringEncodingCodepage437: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!of_unicode_to_codepage_437(characters, (unsigned char *)cString, length, lossy)) @@ -1272,11 +1272,11 @@ cString[length] = '\0'; return length; #endif #ifdef HAVE_CODEPAGE_850 - case OF_STRING_ENCODING_CODEPAGE_850: + case OFStringEncodingCodepage850: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!of_unicode_to_codepage_850(characters, (unsigned char *)cString, length, lossy)) @@ -1285,11 +1285,11 @@ cString[length] = '\0'; return length; #endif #ifdef HAVE_CODEPAGE_858 - case OF_STRING_ENCODING_CODEPAGE_858: + case OFStringEncodingCodepage858: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!of_unicode_to_codepage_858(characters, (unsigned char *)cString, length, lossy)) @@ -1298,11 +1298,11 @@ cString[length] = '\0'; return length; #endif #ifdef HAVE_MAC_ROMAN - case OF_STRING_ENCODING_MAC_ROMAN: + case OFStringEncodingMacRoman: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!of_unicode_to_mac_roman(characters, (unsigned char *)cString, length, lossy)) @@ -1311,11 +1311,11 @@ cString[length] = '\0'; return length; #endif #ifdef HAVE_KOI8_R - case OF_STRING_ENCODING_KOI8_R: + case OFStringEncodingKOI8R: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!of_unicode_to_koi8_r(characters, (unsigned char *)cString, length, lossy)) @@ -1324,11 +1324,11 @@ cString[length] = '\0'; return length; #endif #ifdef HAVE_KOI8_U - case OF_STRING_ENCODING_KOI8_U: + case OFStringEncodingKOI8U: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; if (!of_unicode_to_koi8_u(characters, (unsigned char *)cString, length, lossy)) @@ -1344,44 +1344,44 @@ } } - (size_t)getCString: (char *)cString maxLength: (size_t)maxLength - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return [self of_getCString: cString maxLength: maxLength encoding: encoding lossy: false]; } - (size_t)getLossyCString: (char *)cString maxLength: (size_t)maxLength - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return [self of_getCString: cString maxLength: maxLength encoding: encoding lossy: true]; } -- (const char *)of_cStringWithEncoding: (of_string_encoding_t)encoding +- (const char *)of_cStringWithEncoding: (OFStringEncoding)encoding lossy: (bool)lossy { size_t length = self.length; char *cString; size_t cStringLength; switch (encoding) { - case OF_STRING_ENCODING_UTF_8: + case OFStringEncodingUTF8: cString = of_alloc((length * 4) + 1, 1); @try { cStringLength = [self of_getCString: cString maxLength: (length * 4) + 1 - encoding: OF_STRING_ENCODING_UTF_8 + encoding: OFStringEncodingUTF8 lossy: lossy]; } @catch (id e) { free(cString); @throw e; } @@ -1391,23 +1391,23 @@ } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only tried to make it smaller */ } break; - case OF_STRING_ENCODING_ASCII: - case OF_STRING_ENCODING_ISO_8859_1: - case OF_STRING_ENCODING_ISO_8859_2: - case OF_STRING_ENCODING_ISO_8859_3: - case OF_STRING_ENCODING_ISO_8859_15: - case OF_STRING_ENCODING_WINDOWS_1251: - case OF_STRING_ENCODING_WINDOWS_1252: - case OF_STRING_ENCODING_CODEPAGE_437: - case OF_STRING_ENCODING_CODEPAGE_850: - case OF_STRING_ENCODING_CODEPAGE_858: - case OF_STRING_ENCODING_MAC_ROMAN: - case OF_STRING_ENCODING_KOI8_R: - case OF_STRING_ENCODING_KOI8_U: + case OFStringEncodingASCII: + case OFStringEncodingISO8859_1: + case OFStringEncodingISO8859_2: + case OFStringEncodingISO8859_3: + case OFStringEncodingISO8859_15: + case OFStringEncodingWindows1251: + case OFStringEncodingWindows1252: + case OFStringEncodingCodepage437: + case OFStringEncodingCodepage850: + case OFStringEncodingCodepage858: + case OFStringEncodingMacRoman: + case OFStringEncodingKOI8R: + case OFStringEncodingKOI8U: cString = of_alloc(length + 1, 1); @try { cStringLength = [self of_getCString: cString maxLength: length + 1 @@ -1431,35 +1431,35 @@ free(cString); @throw e; } } -- (const char *)cStringWithEncoding: (of_string_encoding_t)encoding +- (const char *)cStringWithEncoding: (OFStringEncoding)encoding { return [self of_cStringWithEncoding: encoding lossy: false]; } -- (const char *)lossyCStringWithEncoding: (of_string_encoding_t)encoding +- (const char *)lossyCStringWithEncoding: (OFStringEncoding)encoding { return [self of_cStringWithEncoding: encoding lossy: true]; } - (const char *)UTF8String { - return [self cStringWithEncoding: OF_STRING_ENCODING_UTF_8]; + return [self cStringWithEncoding: OFStringEncodingUTF8]; } - (size_t)length { OF_UNRECOGNIZED_SELECTOR } -- (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding +- (size_t)cStringLengthWithEncoding: (OFStringEncoding)encoding { switch (encoding) { - case OF_STRING_ENCODING_UTF_8:; - const of_unichar_t *characters; + case OFStringEncodingUTF8:; + const OFUnichar *characters; size_t length, UTF8StringLength = 0; characters = self.characters; length = self.length; @@ -1473,51 +1473,51 @@ UTF8StringLength += len; } return UTF8StringLength; - case OF_STRING_ENCODING_ASCII: - case OF_STRING_ENCODING_ISO_8859_1: - case OF_STRING_ENCODING_ISO_8859_2: - case OF_STRING_ENCODING_ISO_8859_3: - case OF_STRING_ENCODING_ISO_8859_15: - case OF_STRING_ENCODING_WINDOWS_1251: - case OF_STRING_ENCODING_WINDOWS_1252: - case OF_STRING_ENCODING_CODEPAGE_437: - case OF_STRING_ENCODING_CODEPAGE_850: - case OF_STRING_ENCODING_CODEPAGE_858: - case OF_STRING_ENCODING_MAC_ROMAN: - case OF_STRING_ENCODING_KOI8_R: - case OF_STRING_ENCODING_KOI8_U: + case OFStringEncodingASCII: + case OFStringEncodingISO8859_1: + case OFStringEncodingISO8859_2: + case OFStringEncodingISO8859_3: + case OFStringEncodingISO8859_15: + case OFStringEncodingWindows1251: + case OFStringEncodingWindows1252: + case OFStringEncodingCodepage437: + case OFStringEncodingCodepage850: + case OFStringEncodingCodepage858: + case OFStringEncodingMacRoman: + case OFStringEncodingKOI8R: + case OFStringEncodingKOI8U: return self.length; default: @throw [OFInvalidEncodingException exception]; } } - (size_t)UTF8StringLength { - return [self cStringLengthWithEncoding: OF_STRING_ENCODING_UTF_8]; + return [self cStringLengthWithEncoding: OFStringEncodingUTF8]; } -- (of_unichar_t)characterAtIndex: (size_t)idx +- (OFUnichar)characterAtIndex: (size_t)idx { OF_UNRECOGNIZED_SELECTOR } -- (void)getCharacters: (of_unichar_t *)buffer - inRange: (of_range_t)range +- (void)getCharacters: (OFUnichar *)buffer + inRange: (OFRange)range { for (size_t i = 0; i < range.length; i++) buffer[i] = [self characterAtIndex: range.location + i]; } - (bool)isEqual: (id)object { void *pool; OFString *string; - const of_unichar_t *characters, *otherCharacters; + const OFUnichar *characters, *otherCharacters; size_t length; if (object == self) return true; @@ -1534,11 +1534,11 @@ characters = self.characters; otherCharacters = string.characters; if (memcmp(characters, otherCharacters, - length * sizeof(of_unichar_t)) != 0) { + length * sizeof(OFUnichar)) != 0) { objc_autoreleasePoolPop(pool); return false; } objc_autoreleasePoolPop(pool); @@ -1554,18 +1554,18 @@ - (id)mutableCopy { return [[OFMutableString alloc] initWithString: self]; } -- (of_comparison_result_t)compare: (OFString *)string +- (OFComparisonResult)compare: (OFString *)string { void *pool; - const of_unichar_t *characters, *otherCharacters; + const OFUnichar *characters, *otherCharacters; size_t minimumLength; if (string == self) - return OF_ORDERED_SAME; + return OFOrderedSame; if (![string isKindOfClass: [OFString class]]) @throw [OFInvalidArgumentException exception]; minimumLength = (self.length > string.length @@ -1577,59 +1577,59 @@ otherCharacters = string.characters; for (size_t i = 0; i < minimumLength; i++) { if (characters[i] > otherCharacters[i]) { objc_autoreleasePoolPop(pool); - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; } if (characters[i] < otherCharacters[i]) { objc_autoreleasePoolPop(pool); - return OF_ORDERED_ASCENDING; + return OFOrderedAscending; } } objc_autoreleasePoolPop(pool); if (self.length > string.length) - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; if (self.length < string.length) - return OF_ORDERED_ASCENDING; + return OFOrderedAscending; - return OF_ORDERED_SAME; + return OFOrderedSame; } -- (of_comparison_result_t)caseInsensitiveCompare: (OFString *)string +- (OFComparisonResult)caseInsensitiveCompare: (OFString *)string { void *pool = objc_autoreleasePoolPush(); - const of_unichar_t *characters, *otherCharacters; + const OFUnichar *characters, *otherCharacters; size_t length, otherLength, minimumLength; if (string == self) - return OF_ORDERED_SAME; + return OFOrderedSame; characters = self.characters; otherCharacters = string.characters; length = self.length; otherLength = string.length; minimumLength = (length > otherLength ? otherLength : length); for (size_t i = 0; i < minimumLength; i++) { - of_unichar_t c = characters[i]; - of_unichar_t oc = otherCharacters[i]; + OFUnichar c = characters[i]; + OFUnichar oc = otherCharacters[i]; #ifdef OF_HAVE_UNICODE_TABLES if (c >> 8 < OF_UNICODE_CASEFOLDING_TABLE_SIZE) { - of_unichar_t tc = + OFUnichar tc = of_unicode_casefolding_table[c >> 8][c & 0xFF]; if (tc) c = tc; } if (oc >> 8 < OF_UNICODE_CASEFOLDING_TABLE_SIZE) { - of_unichar_t tc = + OFUnichar tc = of_unicode_casefolding_table[oc >> 8][oc & 0xFF]; if (tc) oc = tc; } @@ -1638,38 +1638,38 @@ oc = of_ascii_toupper(oc); #endif if (c > oc) { objc_autoreleasePoolPop(pool); - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; } if (c < oc) { objc_autoreleasePoolPop(pool); - return OF_ORDERED_ASCENDING; + return OFOrderedAscending; } } objc_autoreleasePoolPop(pool); if (length > otherLength) - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; if (length < otherLength) - return OF_ORDERED_ASCENDING; + return OFOrderedAscending; - return OF_ORDERED_SAME; + return OFOrderedSame; } - (unsigned long)hash { - const of_unichar_t *characters = self.characters; + const OFUnichar *characters = self.characters; size_t length = self.length; uint32_t hash; OF_HASH_INIT(hash); for (size_t i = 0; i < length; i++) { - const of_unichar_t c = characters[i]; + const OFUnichar c = characters[i]; OF_HASH_ADD(hash, (c & 0xFF0000) >> 16); OF_HASH_ADD(hash, (c & 0x00FF00) >> 8); OF_HASH_ADD(hash, c & 0x0000FF); } @@ -1796,56 +1796,56 @@ [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; + const OFUnichar *searchCharacters; + OFUnichar *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(OFNotFound, 0); - if (range.length > SIZE_MAX / sizeof(of_unichar_t)) + if (range.length > SIZE_MAX / sizeof(OFUnichar)) @throw [OFOutOfRangeException exception]; pool = objc_autoreleasePoolPush(); searchCharacters = string.characters; - characters = of_alloc(range.length, sizeof(of_unichar_t)); + characters = of_alloc(range.length, sizeof(OFUnichar)); @try { [self getCharacters: characters inRange: range]; 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) { + searchLength * sizeof(OFUnichar)) == 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) @@ -1853,13 +1853,13 @@ } } else { for (size_t i = 0; i <= range.length - searchLength; i++) { if (memcmp(characters + i, searchCharacters, - searchLength * sizeof(of_unichar_t)) == 0) { + searchLength * sizeof(OFUnichar)) == 0) { objc_autoreleasePoolPop(pool); - return of_range(range.location + i, + return OFMakeRange(range.location + i, searchLength); } } } } @finally { @@ -1866,44 +1866,44 @@ free(characters); } objc_autoreleasePoolPop(pool); - return of_range(OF_NOT_FOUND, 0); + return OFMakeRange(OFNotFound, 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 + bool (*characterIsMember)(id, SEL, OFUnichar) = + (bool (*)(id, SEL, OFUnichar))[characterSet methodForSelector: @selector(characterIsMember:)]; - of_unichar_t *characters; + OFUnichar *characters; if (range.length == 0) - return OF_NOT_FOUND; + return OFNotFound; - if (range.length > SIZE_MAX / sizeof(of_unichar_t)) + if (range.length > SIZE_MAX / sizeof(OFUnichar)) @throw [OFOutOfRangeException exception]; - characters = of_alloc(range.length, sizeof(of_unichar_t)); + characters = of_alloc(range.length, sizeof(OFUnichar)); @try { [self getCharacters: characters inRange: range]; if (options & OF_STRING_SEARCH_BACKWARDS) { for (size_t i = range.length - 1;; i--) { @@ -1925,17 +1925,17 @@ } } @finally { free(characters); } - return OF_NOT_FOUND; + return OFNotFound; } - (bool)containsString: (OFString *)string { void *pool; - const of_unichar_t *characters, *searchCharacters; + const OFUnichar *characters, *searchCharacters; size_t length, searchLength; if ((searchLength = string.length) == 0) return true; @@ -1947,11 +1947,11 @@ characters = self.characters; searchCharacters = string.characters; for (size_t i = 0; i <= length - searchLength; i++) { if (memcmp(characters + i, searchCharacters, - searchLength * sizeof(of_unichar_t)) == 0) { + searchLength * sizeof(OFUnichar)) == 0) { objc_autoreleasePoolPop(pool); return true; } } @@ -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 @@ -2100,25 +2100,25 @@ return new; } - (bool)hasPrefix: (OFString *)prefix { - of_unichar_t *tmp; + OFUnichar *tmp; size_t prefixLength; bool hasPrefix; if ((prefixLength = prefix.length) > self.length) return false; - tmp = of_alloc(prefixLength, sizeof(of_unichar_t)); + tmp = of_alloc(prefixLength, sizeof(OFUnichar)); @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); + prefixLength * sizeof(OFUnichar)) == 0); objc_autoreleasePoolPop(pool); } @finally { free(tmp); } @@ -2126,31 +2126,31 @@ return hasPrefix; } - (bool)hasSuffix: (OFString *)suffix { - of_unichar_t *tmp; - const of_unichar_t *suffixCharacters; + OFUnichar *tmp; + const OFUnichar *suffixCharacters; size_t length, suffixLength; bool hasSuffix; if ((suffixLength = suffix.length) > self.length) return false; length = self.length; - tmp = of_alloc(suffixLength, sizeof(of_unichar_t)); + tmp = of_alloc(suffixLength, sizeof(OFUnichar)); @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); + suffixLength * sizeof(OFUnichar)) == 0); objc_autoreleasePoolPop(pool); } @finally { free(tmp); } @@ -2166,11 +2166,11 @@ - (OFArray *)componentsSeparatedByString: (OFString *)delimiter options: (int)options { void *pool; OFMutableArray *array; - const of_unichar_t *characters, *delimiterCharacters; + const OFUnichar *characters, *delimiterCharacters; bool skipEmpty = (options & OF_STRING_SKIP_EMPTY); size_t length = self.length; size_t delimiterLength = delimiter.length; size_t last; OFString *component; @@ -2197,21 +2197,22 @@ } last = 0; for (size_t i = 0; i <= length - delimiterLength; i++) { if (memcmp(characters + i, delimiterCharacters, - delimiterLength * sizeof(of_unichar_t)) != 0) + delimiterLength * sizeof(OFUnichar)) != 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]; @@ -2232,33 +2233,33 @@ options: (int)options { OFMutableArray *array = [OFMutableArray array]; void *pool = objc_autoreleasePoolPush(); bool skipEmpty = (options & OF_STRING_SKIP_EMPTY); - const of_unichar_t *characters = self.characters; + const OFUnichar *characters = self.characters; size_t length = self.length; - bool (*characterIsMember)(id, SEL, of_unichar_t) = - (bool (*)(id, SEL, of_unichar_t))[characterSet + bool (*characterIsMember)(id, SEL, OFUnichar) = + (bool (*)(id, SEL, OFUnichar))[characterSet methodForSelector: @selector(characterIsMember:)]; size_t last; last = 0; 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]; @@ -2419,19 +2420,19 @@ - (float)floatValue { void *pool = objc_autoreleasePoolPush(); OFString *stripped = self.stringByDeletingEnclosingWhitespaces; - if ([stripped caseInsensitiveCompare: @"INF"] == OF_ORDERED_SAME || - [stripped caseInsensitiveCompare: @"INFINITY"] == OF_ORDERED_SAME) + if ([stripped caseInsensitiveCompare: @"INF"] == OFOrderedSame || + [stripped caseInsensitiveCompare: @"INFINITY"] == OFOrderedSame) return INFINITY; - if ([stripped caseInsensitiveCompare: @"-INF"] == OF_ORDERED_SAME || - [stripped caseInsensitiveCompare: @"-INFINITY"] == OF_ORDERED_SAME) + if ([stripped caseInsensitiveCompare: @"-INF"] == OFOrderedSame || + [stripped caseInsensitiveCompare: @"-INFINITY"] == OFOrderedSame) return -INFINITY; - if ([stripped caseInsensitiveCompare: @"NAN"] == OF_ORDERED_SAME) + if ([stripped caseInsensitiveCompare: @"NAN"] == OFOrderedSame) return NAN; - if ([stripped caseInsensitiveCompare: @"-NAN"] == OF_ORDERED_SAME) + if ([stripped caseInsensitiveCompare: @"-NAN"] == OFOrderedSame) return -NAN; #ifdef HAVE_STRTOF_L const char *UTF8String = self.UTF8String; #else @@ -2472,19 +2473,19 @@ - (double)doubleValue { void *pool = objc_autoreleasePoolPush(); OFString *stripped = self.stringByDeletingEnclosingWhitespaces; - if ([stripped caseInsensitiveCompare: @"INF"] == OF_ORDERED_SAME || - [stripped caseInsensitiveCompare: @"INFINITY"] == OF_ORDERED_SAME) + if ([stripped caseInsensitiveCompare: @"INF"] == OFOrderedSame || + [stripped caseInsensitiveCompare: @"INFINITY"] == OFOrderedSame) return INFINITY; - if ([stripped caseInsensitiveCompare: @"-INF"] == OF_ORDERED_SAME || - [stripped caseInsensitiveCompare: @"-INFINITY"] == OF_ORDERED_SAME) + if ([stripped caseInsensitiveCompare: @"-INF"] == OFOrderedSame || + [stripped caseInsensitiveCompare: @"-INFINITY"] == OFOrderedSame) return -INFINITY; - if ([stripped caseInsensitiveCompare: @"NAN"] == OF_ORDERED_SAME) + if ([stripped caseInsensitiveCompare: @"NAN"] == OFOrderedSame) return NAN; - if ([stripped caseInsensitiveCompare: @"-NAN"] == OF_ORDERED_SAME) + if ([stripped caseInsensitiveCompare: @"-NAN"] == OFOrderedSame) return -NAN; #ifdef HAVE_STRTOD_L const char *UTF8String = self.UTF8String; #else @@ -2520,49 +2521,49 @@ objc_autoreleasePoolPop(pool); return value; } -- (const of_unichar_t *)characters +- (const OFUnichar *)characters { size_t length = self.length; - of_unichar_t *buffer; + OFUnichar *buffer; - buffer = of_alloc(length, sizeof(of_unichar_t)); + buffer = of_alloc(length, sizeof(OFUnichar)); @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) + itemSize: sizeof(OFUnichar) freeWhenDone: true] items]; } @catch (id e) { free(buffer); @throw e; } } -- (const of_char16_t *)UTF16String +- (const OFChar16 *)UTF16String { - return [self UTF16StringWithByteOrder: OF_BYTE_ORDER_NATIVE]; + return [self UTF16StringWithByteOrder: OFByteOrderNative]; } -- (const of_char16_t *)UTF16StringWithByteOrder: (of_byte_order_t)byteOrder +- (const OFChar16 *)UTF16StringWithByteOrder: (OFByteOrder)byteOrder { void *pool = objc_autoreleasePoolPush(); - const of_unichar_t *characters = self.characters; + const OFUnichar *characters = self.characters; size_t length = self.length; - of_char16_t *buffer; + OFChar16 *buffer; size_t j; - bool swap = (byteOrder != OF_BYTE_ORDER_NATIVE); + bool swap = (byteOrder != OFByteOrderNative); /* Allocate memory for the worst case */ - buffer = of_alloc((length + 1) * 2, sizeof(of_char16_t)); + buffer = of_alloc((length + 1) * 2, sizeof(OFChar16)); j = 0; for (size_t i = 0; i < length; i++) { - of_unichar_t c = characters[i]; + OFUnichar c = characters[i]; if (c > 0x10FFFF) { free(buffer); @throw [OFInvalidEncodingException exception]; } @@ -2584,31 +2585,31 @@ } } buffer[j] = 0; @try { - buffer = of_realloc(buffer, j + 1, sizeof(of_char16_t)); + buffer = of_realloc(buffer, j + 1, sizeof(OFChar16)); } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only tried to make it smaller */ } objc_autoreleasePoolPop(pool); @try { return [[OFData dataWithItemsNoCopy: buffer count: j + 1 - itemSize: sizeof(of_char16_t) + itemSize: sizeof(OFChar16) freeWhenDone: true] items]; } @catch (id e) { free(buffer); @throw e; } } - (size_t)UTF16StringLength { - const of_unichar_t *characters = self.characters; + const OFUnichar *characters = self.characters; size_t length, UTF16StringLength; length = UTF16StringLength = self.length; for (size_t i = 0; i < length; i++) @@ -2616,40 +2617,40 @@ UTF16StringLength++; return UTF16StringLength; } -- (const of_char32_t *)UTF32String +- (const OFChar32 *)UTF32String { - return [self UTF32StringWithByteOrder: OF_BYTE_ORDER_NATIVE]; + return [self UTF32StringWithByteOrder: OFByteOrderNative]; } -- (const of_char32_t *)UTF32StringWithByteOrder: (of_byte_order_t)byteOrder +- (const OFChar32 *)UTF32StringWithByteOrder: (OFByteOrder)byteOrder { size_t length = self.length; - of_char32_t *buffer; + OFChar32 *buffer; - buffer = of_alloc(length + 1, sizeof(of_char32_t)); + buffer = of_alloc(length + 1, sizeof(OFChar32)); @try { - [self getCharacters: buffer inRange: of_range(0, length)]; + [self getCharacters: buffer inRange: OFMakeRange(0, length)]; buffer[length] = 0; - if (byteOrder != OF_BYTE_ORDER_NATIVE) + if (byteOrder != OFByteOrderNative) for (size_t i = 0; i < length; i++) buffer[i] = OF_BSWAP32(buffer[i]); return [[OFData dataWithItemsNoCopy: buffer count: length + 1 - itemSize: sizeof(of_char32_t) + itemSize: sizeof(OFChar32) freeWhenDone: true] items]; } @catch (id e) { free(buffer); @throw e; } } -- (OFData *)dataWithEncoding: (of_string_encoding_t)encoding +- (OFData *)dataWithEncoding: (OFStringEncoding)encoding { void *pool = objc_autoreleasePoolPush(); OFData *data = [OFData dataWithItems: [self cStringWithEncoding: encoding] count: [self cStringLengthWithEncoding: encoding]]; @@ -2687,11 +2688,11 @@ return self; return [OFString stringWithUTF16String: buffer length: length - 1]; } else { - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; char buffer[512]; size_t length; if ((length = ExpandEnvironmentStringsA( [self cStringWithEncoding: encoding], buffer, @@ -2706,14 +2707,14 @@ #endif #ifdef OF_HAVE_FILES - (void)writeToFile: (OFString *)path { - [self writeToFile: path encoding: OF_STRING_ENCODING_UTF_8]; + [self writeToFile: path encoding: OFStringEncodingUTF8]; } -- (void)writeToFile: (OFString *)path encoding: (of_string_encoding_t)encoding +- (void)writeToFile: (OFString *)path encoding: (OFStringEncoding)encoding { void *pool = objc_autoreleasePoolPush(); OFFile *file = [OFFile fileWithPath: path mode: @"w"]; [file writeString: self encoding: encoding]; objc_autoreleasePoolPop(pool); @@ -2720,14 +2721,14 @@ } #endif - (void)writeToURL: (OFURL *)URL { - [self writeToURL: URL encoding: OF_STRING_ENCODING_UTF_8]; + [self writeToURL: URL encoding: OFStringEncodingUTF8]; } -- (void)writeToURL: (OFURL *)URL encoding: (of_string_encoding_t)encoding +- (void)writeToURL: (OFURL *)URL encoding: (OFStringEncoding)encoding { void *pool = objc_autoreleasePoolPush(); OFURLHandler *URLHandler; OFStream *stream; @@ -2742,11 +2743,11 @@ #ifdef OF_HAVE_BLOCKS - (void)enumerateLinesUsingBlock: (of_string_line_enumeration_block_t)block { void *pool = objc_autoreleasePoolPush(); - const of_unichar_t *characters = self.characters; + const OFUnichar *characters = self.characters; size_t i, last = 0, length = self.length; bool stop = false, lastCarriageReturn = false; for (i = 0; i < length && !stop; i++) { if (lastCarriageReturn && characters[i] == '\n') { @@ -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]; @@ -75,36 +75,36 @@ - (size_t)indexOfObject: (id)object { size_t idx = [_array indexOfObject: object]; if (idx < _range.location) - return OF_NOT_FOUND; + return OFNotFound; idx -= _range.location; if (idx >= _range.length) - return OF_NOT_FOUND; + return OFNotFound; return idx; } - (size_t)indexOfObjectIdenticalTo: (id)object { size_t idx = [_array indexOfObjectIdenticalTo: object]; if (idx < _range.location) - return OF_NOT_FOUND; + return OFNotFound; idx -= _range.location; if (idx >= _range.length) - return OF_NOT_FOUND; + return OFNotFound; 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 @@ -162,11 +162,11 @@ #elif defined(OF_WINDOWS) # ifdef OF_HAVE_FILES void *pool = objc_autoreleasePoolPush(); @try { - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; char systemDir[PATH_MAX]; UINT systemDirLen; OFString *systemDirString; const char *path; void *buffer; @@ -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]; @@ -539,11 +539,11 @@ buffer[0] = regs.ebx; buffer[1] = regs.edx; buffer[2] = regs.ecx; return [OFString stringWithCString: (char *)buffer - encoding: OF_STRING_ENCODING_ASCII + encoding: OFStringEncodingASCII length: 12]; #else return nil; #endif } @@ -563,11 +563,11 @@ buffer[i++] = regs.ecx; buffer[i++] = regs.edx; } return [OFString stringWithCString: (char *)buffer - encoding: OF_STRING_ENCODING_ASCII]; + encoding: OFStringEncodingASCII]; #elif defined(OF_AMIGAOS4) CONST_STRPTR model, version; GetCPUInfoTags(GCIT_ModelString, &model, GCIT_VersionString, &version, TAG_END); @@ -574,11 +574,11 @@ if (version != NULL) return [OFString stringWithFormat: @"%s V%s", model, version]; else return [OFString stringWithCString: model - encoding: OF_STRING_ENCODING_ASCII]; + encoding: OFStringEncodingASCII]; #else return nil; #endif } Index: src/OFTarArchive.h ================================================================== --- src/OFTarArchive.h +++ src/OFTarArchive.h @@ -34,18 +34,18 @@ enum { OF_TAR_ARCHIVE_MODE_READ, OF_TAR_ARCHIVE_MODE_WRITE, OF_TAR_ARCHIVE_MODE_APPEND } _mode; - of_string_encoding_t _encoding; + OFStringEncoding _encoding; OFStream *_Nullable _lastReturnedStream; } /** * @brief The encoding to use for the archive. Defaults to UTF-8. */ -@property (nonatomic) of_string_encoding_t encoding; +@property (nonatomic) OFStringEncoding encoding; /** * @brief A stream for reading the current entry. * * @note This is only available in read mode. Index: src/OFTarArchive.m ================================================================== --- src/OFTarArchive.m +++ src/OFTarArchive.m @@ -114,11 +114,11 @@ [(OFSeekableStream *)stream seekToOffset: -1024 whence: SEEK_END]; } - _encoding = OF_STRING_ENCODING_UTF_8; + _encoding = OFStringEncodingUTF8; } @catch (id e) { [self release]; @throw e; } Index: src/OFTarArchiveEntry+Private.h ================================================================== --- src/OFTarArchiveEntry+Private.h +++ src/OFTarArchiveEntry+Private.h @@ -21,12 +21,12 @@ @class OFStream; OF_DIRECT_MEMBERS @interface OFTarArchiveEntry () - (instancetype)of_initWithHeader: (unsigned char [_Nonnull 512])header - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding OF_METHOD_FAMILY(init); - (void)of_writeToStream: (OFStream *)stream - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; @end OF_ASSUME_NONNULL_END Index: src/OFTarArchiveEntry.m ================================================================== --- src/OFTarArchiveEntry.m +++ src/OFTarArchiveEntry.m @@ -23,11 +23,11 @@ #import "OFOutOfRangeException.h" static OFString * stringFromBuffer(const unsigned char *buffer, size_t length, - of_string_encoding_t encoding) + OFStringEncoding encoding) { for (size_t i = 0; i < length; i++) if (buffer[i] == '\0') length = i; @@ -36,11 +36,11 @@ length: length]; } static void stringToBuffer(unsigned char *buffer, OFString *string, size_t length, - of_string_encoding_t encoding) + OFStringEncoding encoding) { size_t cStringLength = [string cStringLengthWithEncoding: encoding]; if (cStringLength > length) @throw [OFOutOfRangeException exception]; @@ -63,11 +63,11 @@ if (buffer[0] == 0x80) { for (size_t i = 1; i < length; i++) value = (value << 8) | buffer[i]; } else value = [stringFromBuffer(buffer, length, - OF_STRING_ENCODING_ASCII) unsignedLongLongValueWithBase: 8]; + OFStringEncodingASCII) unsignedLongLongValueWithBase: 8]; if (value > max) @throw [OFOutOfRangeException exception]; return value; @@ -83,11 +83,11 @@ { OF_INVALID_INIT_METHOD } - (instancetype)of_initWithHeader: (unsigned char [512])header - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); @@ -102,11 +102,11 @@ header + 116, 8, ULONG_MAX); _size = (unsigned long long)octalValueFromBuffer( header + 124, 12, ULLONG_MAX); _modificationDate = [[OFDate alloc] initWithTimeIntervalSince1970: - (of_time_interval_t)octalValueFromBuffer( + (OFTimeInterval)octalValueFromBuffer( header + 136, 12, ULLONG_MAX)]; _type = header[156]; targetFileName = stringFromBuffer(header + 157, 100, encoding); if (targetFileName.length > 0) @@ -288,33 +288,33 @@ return [ret autorelease]; } - (void)of_writeToStream: (OFStream *)stream - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { unsigned char buffer[512]; unsigned long long modificationDate; uint16_t checksum = 0; stringToBuffer(buffer, _fileName, 100, encoding); stringToBuffer(buffer + 100, [OFString stringWithFormat: @"%06" PRIo16 " ", _mode], 8, - OF_STRING_ENCODING_ASCII); + OFStringEncodingASCII); stringToBuffer(buffer + 108, [OFString stringWithFormat: @"%06" PRIo16 " ", _UID], 8, - OF_STRING_ENCODING_ASCII); + OFStringEncodingASCII); stringToBuffer(buffer + 116, [OFString stringWithFormat: @"%06" PRIo16 " ", _GID], 8, - OF_STRING_ENCODING_ASCII); + OFStringEncodingASCII); stringToBuffer(buffer + 124, [OFString stringWithFormat: @"%011" PRIo64 " ", _size], 12, - OF_STRING_ENCODING_ASCII); + OFStringEncodingASCII); modificationDate = _modificationDate.timeIntervalSince1970; stringToBuffer(buffer + 136, [OFString stringWithFormat: @"%011llo", modificationDate], - 12, OF_STRING_ENCODING_ASCII); + 12, OFStringEncodingASCII); /* * During checksumming, the checksum field is expected to be set to 8 * spaces. */ @@ -327,21 +327,21 @@ memcpy(buffer + 257, "ustar\0" "00", 8); stringToBuffer(buffer + 265, _owner, 32, encoding); stringToBuffer(buffer + 297, _group, 32, encoding); stringToBuffer(buffer + 329, [OFString stringWithFormat: @"%06" PRIo32 " ", _deviceMajor], 8, - OF_STRING_ENCODING_ASCII); + OFStringEncodingASCII); stringToBuffer(buffer + 337, [OFString stringWithFormat: @"%06" PRIo32 " ", _deviceMinor], 8, - OF_STRING_ENCODING_ASCII); + OFStringEncodingASCII); memset(buffer + 345, '\0', 155 + 12); /* Fill in the checksum */ for (size_t i = 0; i < 500; i++) checksum += buffer[i]; stringToBuffer(buffer + 148, [OFString stringWithFormat: @"%06" PRIo16, checksum], 7, - OF_STRING_ENCODING_ASCII); + OFStringEncodingASCII); [stream writeBuffer: buffer length: sizeof(buffer)]; } @end Index: src/OFThread.h ================================================================== --- src/OFThread.h +++ src/OFThread.h @@ -215,11 +215,11 @@ * @brief Suspends execution of the current thread for the specified time * interval. * * @param timeInterval The number of seconds to sleep */ -+ (void)sleepForTimeInterval: (of_time_interval_t)timeInterval; ++ (void)sleepForTimeInterval: (OFTimeInterval)timeInterval; /** * @brief Suspends execution of the current thread until the specified date. * * @param date The date to wait for Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -233,11 +233,11 @@ return DNSResolver; # endif } #endif -+ (void)sleepForTimeInterval: (of_time_interval_t)timeInterval ++ (void)sleepForTimeInterval: (OFTimeInterval)timeInterval { if (timeInterval < 0) return; #if defined(OF_WINDOWS) Index: src/OFTimer.h ================================================================== --- src/OFTimer.h +++ src/OFTimer.h @@ -42,11 +42,11 @@ */ OF_SUBCLASSING_RESTRICTED @interface OFTimer: OFObject { OFDate *_fireDate; - of_time_interval_t _interval; + OFTimeInterval _interval; id _target; id _Nullable _object1, _object2, _object3, _object4; SEL _selector; unsigned char _arguments; bool _repeats; @@ -64,11 +64,11 @@ /** * @brief The time interval in which the timer will repeat, if it is a * repeating timer. */ -@property (readonly, nonatomic) of_time_interval_t timeInterval; +@property (readonly, nonatomic) OFTimeInterval timeInterval; /** * @brief Whether the timer is repeating. */ @property (readonly, nonatomic, getter=isRepeating) bool repeating; @@ -95,11 +95,11 @@ * @param target The target on which to call the selector * @param selector The selector to call on the target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)scheduledTimerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector repeats: (bool)repeats; /** @@ -110,11 +110,11 @@ * @param selector The selector to call on the target * @param object An object to pass when calling the selector on the target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)scheduledTimerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (nullable id)object repeats: (bool)repeats; @@ -129,11 +129,11 @@ * @param object2 The second object to pass when calling the selector on the * target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)scheduledTimerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (nullable id)object1 object: (nullable id)object2 repeats: (bool)repeats; @@ -151,11 +151,11 @@ * @param object3 The third object to pass when calling the selector on the * target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)scheduledTimerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (nullable id)object1 object: (nullable id)object2 object: (nullable id)object3 @@ -176,11 +176,11 @@ * @param object4 The fourth object to pass when calling the selector on the * target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)scheduledTimerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (nullable id)object1 object: (nullable id)object2 object: (nullable id)object3 @@ -194,11 +194,11 @@ * @param timeInterval The time interval after which the timer should be fired * @param repeats Whether the timer repeats after it has been executed * @param block The block to invoke when the timer fires * @return A new, autoreleased timer */ -+ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)scheduledTimerWithTimeInterval: (OFTimeInterval)timeInterval repeats: (bool)repeats block: (of_timer_block_t)block; #endif /** @@ -208,11 +208,11 @@ * @param target The target on which to call the selector * @param selector The selector to call on the target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)timerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector repeats: (bool)repeats; /** @@ -223,11 +223,11 @@ * @param selector The selector to call on the target * @param object An object to pass when calling the selector on the target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)timerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (nullable id)object repeats: (bool)repeats; @@ -242,11 +242,11 @@ * @param object2 The second object to pass when calling the selector on the * target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)timerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (nullable id)object1 object: (nullable id)object2 repeats: (bool)repeats; @@ -264,11 +264,11 @@ * @param object3 The third object to pass when calling the selector on the * target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)timerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (nullable id)object1 object: (nullable id)object2 object: (nullable id)object3 @@ -289,11 +289,11 @@ * @param object4 The fourth object to pass when calling the selector on the * target * @param repeats Whether the timer repeats after it has been executed * @return A new, autoreleased timer */ -+ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)timerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (nullable id)object1 object: (nullable id)object2 object: (nullable id)object3 @@ -307,11 +307,11 @@ * @param timeInterval The time interval after which the timer should be fired * @param repeats Whether the timer repeats after it has been executed * @param block The block to invoke when the timer fires * @return A new, autoreleased timer */ -+ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)timerWithTimeInterval: (OFTimeInterval)timeInterval repeats: (bool)repeats block: (of_timer_block_t)block; #endif - (instancetype)init OF_UNAVAILABLE; @@ -327,11 +327,11 @@ * @param selector The selector to call on the target * @param repeats Whether the timer repeats after it has been executed * @return An initialized timer */ - (instancetype)initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval + interval: (OFTimeInterval)interval target: (id)target selector: (SEL)selector repeats: (bool)repeats; /** @@ -346,11 +346,11 @@ * @param object An object to pass when calling the selector on the target * @param repeats Whether the timer repeats after it has been executed * @return An initialized timer */ - (instancetype)initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval + interval: (OFTimeInterval)interval target: (id)target selector: (SEL)selector object: (nullable id)object repeats: (bool)repeats; @@ -369,11 +369,11 @@ * target * @param repeats Whether the timer repeats after it has been executed * @return An initialized timer */ - (instancetype)initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval + interval: (OFTimeInterval)interval target: (id)target selector: (SEL)selector object: (nullable id)object1 object: (nullable id)object2 repeats: (bool)repeats; @@ -395,11 +395,11 @@ * target * @param repeats Whether the timer repeats after it has been executed * @return An initialized timer */ - (instancetype)initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval + interval: (OFTimeInterval)interval target: (id)target selector: (SEL)selector object: (nullable id)object1 object: (nullable id)object2 object: (nullable id)object3 @@ -424,11 +424,11 @@ * target * @param repeats Whether the timer repeats after it has been executed * @return An initialized timer */ - (instancetype)initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval + interval: (OFTimeInterval)interval target: (id)target selector: (SEL)selector object: (nullable id)object1 object: (nullable id)object2 object: (nullable id)object3 @@ -446,11 +446,11 @@ * @param repeats Whether the timer repeats after it has been executed * @param block The block to invoke when the timer fires * @return An initialized timer */ - (instancetype)initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval + interval: (OFTimeInterval)interval repeats: (bool)repeats block: (of_timer_block_t)block; #endif /** @@ -457,11 +457,11 @@ * @brief Compares the timer to another timer. * * @param timer The timer to compare the string to * @return The result of the comparison */ -- (of_comparison_result_t)compare: (OFTimer *)timer; +- (OFComparisonResult)compare: (OFTimer *)timer; /** * @brief Fires the timer, meaning it will execute the specified selector on the * target. */ Index: src/OFTimer.m ================================================================== --- src/OFTimer.m +++ src/OFTimer.m @@ -31,11 +31,11 @@ #import "OFInvalidArgumentException.h" @implementation OFTimer @synthesize timeInterval = _interval, repeating = _repeats, valid = _valid; -+ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)scheduledTimerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector repeats: (bool)repeats { void *pool = objc_autoreleasePoolPush(); @@ -52,11 +52,11 @@ objc_autoreleasePoolPop(pool); return [timer autorelease]; } -+ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)scheduledTimerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (id)object repeats: (bool)repeats { @@ -75,11 +75,11 @@ objc_autoreleasePoolPop(pool); return [timer autorelease]; } -+ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)scheduledTimerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 repeats: (bool)repeats @@ -100,11 +100,11 @@ objc_autoreleasePoolPop(pool); return [timer autorelease]; } -+ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)scheduledTimerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 object: (id)object3 @@ -127,11 +127,11 @@ objc_autoreleasePoolPop(pool); return [timer autorelease]; } -+ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)scheduledTimerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 object: (id)object3 @@ -157,11 +157,11 @@ return [timer autorelease]; } #ifdef OF_HAVE_BLOCKS -+ (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)scheduledTimerWithTimeInterval: (OFTimeInterval)timeInterval repeats: (bool)repeats block: (of_timer_block_t)block { void *pool = objc_autoreleasePoolPush(); OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: timeInterval]; @@ -177,11 +177,11 @@ return [timer autorelease]; } #endif -+ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)timerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector repeats: (bool)repeats { void *pool = objc_autoreleasePoolPush(); @@ -196,11 +196,11 @@ objc_autoreleasePoolPop(pool); return [timer autorelease]; } -+ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)timerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (id)object repeats: (bool)repeats { @@ -217,11 +217,11 @@ objc_autoreleasePoolPop(pool); return [timer autorelease]; } -+ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)timerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 repeats: (bool)repeats @@ -240,11 +240,11 @@ objc_autoreleasePoolPop(pool); return [timer autorelease]; } -+ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)timerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 object: (id)object3 @@ -265,11 +265,11 @@ objc_autoreleasePoolPop(pool); return [timer autorelease]; } -+ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)timerWithTimeInterval: (OFTimeInterval)timeInterval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 object: (id)object3 @@ -293,11 +293,11 @@ return [timer autorelease]; } #ifdef OF_HAVE_BLOCKS -+ (instancetype)timerWithTimeInterval: (of_time_interval_t)timeInterval ++ (instancetype)timerWithTimeInterval: (OFTimeInterval)timeInterval repeats: (bool)repeats block: (of_timer_block_t)block { void *pool = objc_autoreleasePoolPush(); OFDate *fireDate = [OFDate dateWithTimeIntervalSinceNow: timeInterval]; @@ -317,11 +317,11 @@ { OF_INVALID_INIT_METHOD } - (instancetype)of_initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval + interval: (OFTimeInterval)interval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 object: (id)object3 @@ -354,11 +354,11 @@ return self; } - (instancetype)initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval + interval: (OFTimeInterval)interval target: (id)target selector: (SEL)selector repeats: (bool)repeats { return [self of_initWithFireDate: fireDate @@ -372,11 +372,11 @@ arguments: 0 repeats: repeats]; } - (instancetype)initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval + interval: (OFTimeInterval)interval target: (id)target selector: (SEL)selector object: (id)object repeats: (bool)repeats { @@ -391,11 +391,11 @@ arguments: 1 repeats: repeats]; } - (instancetype)initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval + interval: (OFTimeInterval)interval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 repeats: (bool)repeats @@ -411,11 +411,11 @@ arguments: 2 repeats: repeats]; } - (instancetype)initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval + interval: (OFTimeInterval)interval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 object: (id)object3 @@ -432,11 +432,11 @@ arguments: 3 repeats: repeats]; } - (instancetype)initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval + interval: (OFTimeInterval)interval target: (id)target selector: (SEL)selector object: (id)object1 object: (id)object2 object: (id)object3 @@ -455,11 +455,11 @@ repeats: repeats]; } #ifdef OF_HAVE_BLOCKS - (instancetype)initWithFireDate: (OFDate *)fireDate - interval: (of_time_interval_t)interval + interval: (OFTimeInterval)interval repeats: (bool)repeats block: (of_timer_block_t)block { self = [super init]; @@ -504,11 +504,11 @@ #endif [super dealloc]; } -- (of_comparison_result_t)compare: (OFTimer *)timer +- (OFComparisonResult)compare: (OFTimer *)timer { if (![timer isKindOfClass: [OFTimer class]]) @throw [OFInvalidArgumentException exception]; return [_fireDate compare: timer->_fireDate]; @@ -538,11 +538,11 @@ OF_ENSURE(_arguments <= 4); if (_repeats && _valid) { int64_t missedIntervals = -_fireDate.timeIntervalSinceNow / _interval; - of_time_interval_t newFireDate; + OFTimeInterval newFireDate; OFRunLoop *runLoop; /* In case the clock was changed backwards */ if (missedIntervals < 0) missedIntervals = 0; Index: src/OFURL.m ================================================================== --- src/OFURL.m +++ src/OFURL.m @@ -99,11 +99,11 @@ OF_DIRECT_MEMBERS @interface OFInvertedCharacterSetWithoutPercent: OFCharacterSet { OFCharacterSet *_characterSet; - bool (*_characterIsMember)(id, SEL, of_unichar_t); + bool (*_characterIsMember)(id, SEL, OFUnichar); } - (instancetype)initWithCharacterSet: (OFCharacterSet *)characterSet; @end @@ -148,11 +148,11 @@ return OF_RETAIN_COUNT_MAX; } @end @implementation OFURLAllowedCharacterSet -- (bool)characterIsMember: (of_unichar_t)character +- (bool)characterIsMember: (OFUnichar)character { if (character < CHAR_MAX && of_ascii_isalnum(character)) return true; switch (character) { @@ -177,11 +177,11 @@ } } @end @implementation OFURLSchemeAllowedCharacterSet -- (bool)characterIsMember: (of_unichar_t)character +- (bool)characterIsMember: (OFUnichar)character { if (character < CHAR_MAX && of_ascii_isalnum(character)) return true; switch (character) { @@ -194,11 +194,11 @@ } } @end @implementation OFURLPathAllowedCharacterSet -- (bool)characterIsMember: (of_unichar_t)character +- (bool)characterIsMember: (OFUnichar)character { if (character < CHAR_MAX && of_ascii_isalnum(character)) return true; switch (character) { @@ -226,11 +226,11 @@ } } @end @implementation OFURLQueryOrFragmentAllowedCharacterSet -- (bool)characterIsMember: (of_unichar_t)character +- (bool)characterIsMember: (OFUnichar)character { if (character < CHAR_MAX && of_ascii_isalnum(character)) return true; switch (character) { @@ -259,11 +259,11 @@ } } @end @implementation OFURLQueryKeyValueAllowedCharacterSet -- (bool)characterIsMember: (of_unichar_t)character +- (bool)characterIsMember: (OFUnichar)character { if (character < CHAR_MAX && of_ascii_isalnum(character)) return true; switch (character) { @@ -296,11 +296,11 @@ { self = [super init]; @try { _characterSet = [characterSet retain]; - _characterIsMember = (bool (*)(id, SEL, of_unichar_t)) + _characterIsMember = (bool (*)(id, SEL, OFUnichar)) [_characterSet methodForSelector: @selector(characterIsMember:)]; } @catch (id e) { [self release]; @throw e; @@ -314,11 +314,11 @@ [_characterSet release]; [super dealloc]; } -- (bool)characterIsMember: (of_unichar_t)character +- (bool)characterIsMember: (OFUnichar)character { return (character != '%' && !_characterIsMember(_characterSet, @selector(characterIsMember:), character)); } @end @@ -329,11 +329,11 @@ void *pool = objc_autoreleasePoolPush(); characterSet = [[[OFInvertedCharacterSetWithoutPercent alloc] initWithCharacterSet: characterSet] autorelease]; - if ([string indexOfCharacterFromSet: characterSet] != OF_NOT_FOUND) + if ([string indexOfCharacterFromSet: characterSet] != OFNotFound) @throw [OFInvalidFormatException exception]; objc_autoreleasePoolPop(pool); } @@ -674,15 +674,15 @@ 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) + if (range.location == OFNotFound) @throw [OFInvalidFormatException exception]; range.location++; range.length = path.length - range.location; @@ -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 @@ -37,31 +37,31 @@ #import "OFOutOfRangeException.h" #import "of_asprintf.h" #import "unicode.h" -extern const of_char16_t of_iso_8859_2_table[]; +extern const OFChar16 of_iso_8859_2_table[]; extern const size_t of_iso_8859_2_table_offset; -extern const of_char16_t of_iso_8859_3_table[]; +extern const OFChar16 of_iso_8859_3_table[]; extern const size_t of_iso_8859_3_table_offset; -extern const of_char16_t of_iso_8859_15_table[]; +extern const OFChar16 of_iso_8859_15_table[]; extern const size_t of_iso_8859_15_table_offset; -extern const of_char16_t of_windows_1251_table[]; +extern const OFChar16 of_windows_1251_table[]; extern const size_t of_windows_1251_table_offset; -extern const of_char16_t of_windows_1252_table[]; +extern const OFChar16 of_windows_1252_table[]; extern const size_t of_windows_1252_table_offset; -extern const of_char16_t of_codepage_437_table[]; +extern const OFChar16 of_codepage_437_table[]; extern const size_t of_codepage_437_table_offset; -extern const of_char16_t of_codepage_850_table[]; +extern const OFChar16 of_codepage_850_table[]; extern const size_t of_codepage_850_table_offset; -extern const of_char16_t of_codepage_858_table[]; +extern const OFChar16 of_codepage_858_table[]; extern const size_t of_codepage_858_table_offset; -extern const of_char16_t of_mac_roman_table[]; +extern const OFChar16 of_mac_roman_table[]; extern const size_t of_mac_roman_table_offset; -extern const of_char16_t of_koi8_r_table[]; +extern const OFChar16 of_koi8_r_table[]; extern const size_t of_koi8_r_table_offset; -extern const of_char16_t of_koi8_u_table[]; +extern const OFChar16 of_koi8_u_table[]; extern const size_t of_koi8_u_table_offset; static inline int memcasecmp(const char *first, const char *second, size_t length) { @@ -71,16 +71,16 @@ f = of_ascii_toupper(f); s = of_ascii_toupper(s); if (f > s) - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; if (f < s) - return OF_ORDERED_ASCENDING; + return OFOrderedAscending; } - return OF_ORDERED_SAME; + return OFOrderedSame; } int of_string_utf8_check(const char *UTF8String, size_t UTF8Length, size_t *length) { @@ -225,20 +225,20 @@ return self; } - (instancetype)initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding length: (size_t)cStringLength { self = [super init]; @try { - const of_char16_t *table; + const OFChar16 *table; size_t tableOffset, j; - if (encoding == OF_STRING_ENCODING_UTF_8 && + if (encoding == OFStringEncodingUTF8 && cStringLength >= 3 && memcmp(cString, "\xEF\xBB\xBF", 3) == 0) { cString += 3; cStringLength -= 3; } @@ -247,16 +247,16 @@ _s->cString = of_alloc(cStringLength + 1, 1); _s->cStringLength = cStringLength; _s->freeWhenDone = true; - if (encoding == OF_STRING_ENCODING_UTF_8 || - encoding == OF_STRING_ENCODING_ASCII) { + if (encoding == OFStringEncodingUTF8 || + encoding == OFStringEncodingASCII) { switch (of_string_utf8_check(cString, cStringLength, &_s->length)) { case 1: - if (encoding == OF_STRING_ENCODING_ASCII) + if (encoding == OFStringEncodingASCII) @throw [OFInvalidEncodingException exception]; _s->isUTF8 = true; break; @@ -271,11 +271,11 @@ } /* All other encodings we support are single byte encodings */ _s->length = cStringLength; - if (encoding == OF_STRING_ENCODING_ISO_8859_1) { + if (encoding == OFStringEncodingISO8859_1) { j = 0; for (size_t i = 0; i < cStringLength; i++) { char buffer[4]; size_t bytes; @@ -310,51 +310,51 @@ case encoding: \ table = var; \ tableOffset = var##_offset; \ break; #ifdef HAVE_ISO_8859_2 - CASE(OF_STRING_ENCODING_ISO_8859_2, of_iso_8859_2_table) + CASE(OFStringEncodingISO8859_2, of_iso_8859_2_table) #endif #ifdef HAVE_ISO_8859_3 - CASE(OF_STRING_ENCODING_ISO_8859_3, of_iso_8859_3_table) + CASE(OFStringEncodingISO8859_3, of_iso_8859_3_table) #endif #ifdef HAVE_ISO_8859_15 - CASE(OF_STRING_ENCODING_ISO_8859_15, of_iso_8859_15_table) + CASE(OFStringEncodingISO8859_15, of_iso_8859_15_table) #endif #ifdef HAVE_WINDOWS_1251 - CASE(OF_STRING_ENCODING_WINDOWS_1251, of_windows_1251_table) + CASE(OFStringEncodingWindows1251, of_windows_1251_table) #endif #ifdef HAVE_WINDOWS_1252 - CASE(OF_STRING_ENCODING_WINDOWS_1252, of_windows_1252_table) + CASE(OFStringEncodingWindows1252, of_windows_1252_table) #endif #ifdef HAVE_CODEPAGE_437 - CASE(OF_STRING_ENCODING_CODEPAGE_437, of_codepage_437_table) + CASE(OFStringEncodingCodepage437, of_codepage_437_table) #endif #ifdef HAVE_CODEPAGE_850 - CASE(OF_STRING_ENCODING_CODEPAGE_850, of_codepage_850_table) + CASE(OFStringEncodingCodepage850, of_codepage_850_table) #endif #ifdef HAVE_CODEPAGE_858 - CASE(OF_STRING_ENCODING_CODEPAGE_858, of_codepage_858_table) + CASE(OFStringEncodingCodepage858, of_codepage_858_table) #endif #ifdef HAVE_MAC_ROMAN - CASE(OF_STRING_ENCODING_MAC_ROMAN, of_mac_roman_table) + CASE(OFStringEncodingMacRoman, of_mac_roman_table) #endif #ifdef HAVE_KOI8_R - CASE(OF_STRING_ENCODING_KOI8_R, of_koi8_r_table) + CASE(OFStringEncodingKOI8R, of_koi8_r_table) #endif #ifdef HAVE_KOI8_U - CASE(OF_STRING_ENCODING_KOI8_U, of_koi8_u_table) + CASE(OFStringEncodingKOI8U, of_koi8_u_table) #endif #undef CASE default: @throw [OFInvalidEncodingException exception]; } j = 0; for (size_t i = 0; i < cStringLength; i++) { unsigned char character = (unsigned char)cString[i]; - of_unichar_t unichar; + OFUnichar unichar; char buffer[4]; size_t byteLength; if (character < tableOffset) { _s->cString[j++] = cString[i]; @@ -459,11 +459,11 @@ } return self; } -- (instancetype)initWithCharacters: (const of_unichar_t *)characters +- (instancetype)initWithCharacters: (const OFUnichar *)characters length: (size_t)length { self = [super init]; @try { @@ -503,13 +503,13 @@ } return self; } -- (instancetype)initWithUTF16String: (const of_char16_t *)string +- (instancetype)initWithUTF16String: (const OFChar16 *)string length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder + byteOrder: (OFByteOrder)byteOrder { self = [super init]; @try { size_t j; @@ -520,11 +520,11 @@ length--; } else if (length > 0 && *string == 0xFFFE) { swap = true; string++; length--; - } else if (byteOrder != OF_BYTE_ORDER_NATIVE) + } else if (byteOrder != OFByteOrderNative) swap = true; _s = &_storage; _s->cString = of_alloc((length * 4) + 1, 1); @@ -531,20 +531,20 @@ _s->length = length; _s->freeWhenDone = true; j = 0; for (size_t i = 0; i < length; i++) { - of_unichar_t character = + OFUnichar character = (swap ? OF_BSWAP16(string[i]) : string[i]); size_t len; /* Missing high surrogate */ if ((character & 0xFC00) == 0xDC00) @throw [OFInvalidEncodingException exception]; if ((character & 0xFC00) == 0xD800) { - of_char16_t nextCharacter; + OFChar16 nextCharacter; if (length <= i + 1) @throw [OFInvalidEncodingException exception]; @@ -588,13 +588,13 @@ } return self; } -- (instancetype)initWithUTF32String: (const of_char32_t *)characters +- (instancetype)initWithUTF32String: (const OFChar32 *)characters length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder + byteOrder: (OFByteOrder)byteOrder { self = [super init]; @try { size_t j; @@ -605,11 +605,11 @@ length--; } else if (length > 0 && *characters == 0xFFFE0000) { swap = true; characters++; length--; - } else if (byteOrder != OF_BYTE_ORDER_NATIVE) + } else if (byteOrder != OFByteOrderNative) swap = true; _s = &_storage; _s->cString = of_alloc((length * 4) + 1, 1); @@ -709,18 +709,18 @@ [super dealloc]; } - (size_t)getCString: (char *)cString maxLength: (size_t)maxLength - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { switch (encoding) { - case OF_STRING_ENCODING_ASCII: + case OFStringEncodingASCII: if (_s->isUTF8) @throw [OFInvalidEncodingException exception]; /* intentional fall-through */ - case OF_STRING_ENCODING_UTF_8: + case OFStringEncodingUTF8: if (_s->cStringLength + 1 > maxLength) @throw [OFOutOfRangeException exception]; memcpy(cString, _s->cString, _s->cStringLength + 1); @@ -730,18 +730,18 @@ maxLength: maxLength encoding: encoding]; } } -- (const char *)cStringWithEncoding: (of_string_encoding_t)encoding +- (const char *)cStringWithEncoding: (OFStringEncoding)encoding { switch (encoding) { - case OF_STRING_ENCODING_ASCII: + case OFStringEncodingASCII: if (_s->isUTF8) @throw [OFInvalidEncodingException exception]; /* intentional fall-through */ - case OF_STRING_ENCODING_UTF_8: + case OFStringEncodingUTF8: return _s->cString; default: return [super cStringWithEncoding: encoding]; } } @@ -754,15 +754,15 @@ - (size_t)length { return _s->length; } -- (size_t)cStringLengthWithEncoding: (of_string_encoding_t)encoding +- (size_t)cStringLengthWithEncoding: (OFStringEncoding)encoding { switch (encoding) { - case OF_STRING_ENCODING_UTF_8: - case OF_STRING_ENCODING_ASCII: + case OFStringEncodingUTF8: + case OFStringEncodingASCII: return _s->cStringLength; default: return [super cStringLengthWithEncoding: encoding]; } } @@ -797,17 +797,17 @@ return false; return true; } -- (of_comparison_result_t)compare: (OFString *)string +- (OFComparisonResult)compare: (OFString *)string { size_t otherCStringLength, minimumCStringLength; int compare; if (string == self) - return OF_ORDERED_SAME; + return OFOrderedSame; if (![string isKindOfClass: [OFString class]]) @throw [OFInvalidArgumentException exception]; otherCStringLength = string.UTF8StringLength; @@ -815,33 +815,33 @@ ? otherCStringLength : _s->cStringLength); if ((compare = memcmp(_s->cString, string.UTF8String, minimumCStringLength)) == 0) { if (_s->cStringLength > otherCStringLength) - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; if (_s->cStringLength < otherCStringLength) - return OF_ORDERED_ASCENDING; - return OF_ORDERED_SAME; + return OFOrderedAscending; + return OFOrderedSame; } if (compare > 0) - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; else - return OF_ORDERED_ASCENDING; + return OFOrderedAscending; } -- (of_comparison_result_t)caseInsensitiveCompare: (OFString *)string +- (OFComparisonResult)caseInsensitiveCompare: (OFString *)string { const char *otherCString; size_t otherCStringLength, minimumCStringLength; #ifdef OF_HAVE_UNICODE_TABLES size_t i, j; #endif int compare; if (string == self) - return OF_ORDERED_SAME; + return OFOrderedSame; otherCString = string.UTF8String; otherCStringLength = string.UTF8StringLength; #ifdef OF_HAVE_UNICODE_TABLES @@ -851,27 +851,27 @@ ? otherCStringLength : _s->cStringLength); if ((compare = memcasecmp(_s->cString, otherCString, minimumCStringLength)) == 0) { if (_s->cStringLength > otherCStringLength) - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; if (_s->cStringLength < otherCStringLength) - return OF_ORDERED_ASCENDING; - return OF_ORDERED_SAME; + return OFOrderedAscending; + return OFOrderedSame; } if (compare > 0) - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; else - return OF_ORDERED_ASCENDING; + return OFOrderedAscending; #ifdef OF_HAVE_UNICODE_TABLES } i = j = 0; while (i < _s->cStringLength && j < otherCStringLength) { - of_unichar_t c1, c2; + OFUnichar c1, c2; ssize_t l1, l2; l1 = of_string_utf8_decode(_s->cString + i, _s->cStringLength - i, &c1); l2 = of_string_utf8_decode(otherCString + j, @@ -879,41 +879,41 @@ if (l1 <= 0 || l2 <= 0 || c1 > 0x10FFFF || c2 > 0x10FFFF) @throw [OFInvalidEncodingException exception]; if (c1 >> 8 < OF_UNICODE_CASEFOLDING_TABLE_SIZE) { - of_unichar_t tc = + OFUnichar tc = of_unicode_casefolding_table[c1 >> 8][c1 & 0xFF]; if (tc) c1 = tc; } if (c2 >> 8 < OF_UNICODE_CASEFOLDING_TABLE_SIZE) { - of_unichar_t tc = + OFUnichar tc = of_unicode_casefolding_table[c2 >> 8][c2 & 0xFF]; if (tc) c2 = tc; } if (c1 > c2) - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; if (c1 < c2) - return OF_ORDERED_ASCENDING; + return OFOrderedAscending; i += l1; j += l2; } if (_s->cStringLength - i > otherCStringLength - j) - return OF_ORDERED_DESCENDING; + return OFOrderedDescending; else if (_s->cStringLength - i < otherCStringLength - j) - return OF_ORDERED_ASCENDING; + return OFOrderedAscending; #endif - return OF_ORDERED_SAME; + return OFOrderedSame; } - (unsigned long)hash { uint32_t hash; @@ -922,11 +922,11 @@ return _s->hash; OF_HASH_INIT(hash); for (size_t i = 0; i < _s->cStringLength; i++) { - of_unichar_t c; + OFUnichar c; ssize_t length; if ((length = of_string_utf8_decode(_s->cString + i, _s->cStringLength - i, &c)) <= 0) @throw [OFInvalidEncodingException exception]; @@ -944,13 +944,13 @@ _s->hashed = true; return hash; } -- (of_unichar_t)characterAtIndex: (size_t)idx +- (OFUnichar)characterAtIndex: (size_t)idx { - of_unichar_t character; + OFUnichar character; if (idx >= _s->length) @throw [OFOutOfRangeException exception]; if (!_s->isUTF8) @@ -963,29 +963,29 @@ @throw [OFInvalidEncodingException exception]; return character; } -- (void)getCharacters: (of_unichar_t *)buffer inRange: (of_range_t)range +- (void)getCharacters: (OFUnichar *)buffer inRange: (OFRange)range { /* TODO: Could be slightly optimized */ void *pool = objc_autoreleasePoolPush(); - const of_unichar_t *characters = self.characters; + const OFUnichar *characters = self.characters; if (range.length > SIZE_MAX - range.location || range.location + range.length > _s->length) @throw [OFOutOfRangeException exception]; memcpy(buffer, characters + range.location, - range.length * sizeof(of_unichar_t)); + range.length * sizeof(OFUnichar)); 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(OFNotFound, 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(OFNotFound, 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(OFNotFound, 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) @@ -1150,17 +1150,17 @@ objc_autoreleasePoolPop(pool); return array; } -- (const of_unichar_t *)characters +- (const OFUnichar *)characters { - of_unichar_t *buffer = of_alloc(_s->length, sizeof(of_unichar_t)); + OFUnichar *buffer = of_alloc(_s->length, sizeof(OFUnichar)); size_t i = 0, j = 0; while (i < _s->cStringLength) { - of_unichar_t c; + OFUnichar c; ssize_t cLen; cLen = of_string_utf8_decode(_s->cString + i, _s->cStringLength - i, &c); @@ -1173,21 +1173,21 @@ i += cLen; } return [[OFData dataWithItemsNoCopy: buffer count: _s->length - itemSize: sizeof(of_unichar_t) + itemSize: sizeof(OFUnichar) freeWhenDone: true] items]; } -- (const of_char32_t *)UTF32StringWithByteOrder: (of_byte_order_t)byteOrder +- (const OFChar32 *)UTF32StringWithByteOrder: (OFByteOrder)byteOrder { - of_char32_t *buffer = of_alloc(_s->length + 1, sizeof(of_char32_t)); + OFChar32 *buffer = of_alloc(_s->length + 1, sizeof(OFChar32)); size_t i = 0, j = 0; while (i < _s->cStringLength) { - of_char32_t c; + OFChar32 c; ssize_t cLen; cLen = of_string_utf8_decode(_s->cString + i, _s->cStringLength - i, &c); @@ -1194,11 +1194,11 @@ if (cLen <= 0 || c > 0x10FFFF) { free(buffer); @throw [OFInvalidEncodingException exception]; } - if (byteOrder != OF_BYTE_ORDER_NATIVE) + if (byteOrder != OFByteOrderNative) buffer[j++] = OF_BSWAP32(c); else buffer[j++] = c; i += cLen; @@ -1205,11 +1205,11 @@ } buffer[j] = 0; return [[OFData dataWithItemsNoCopy: buffer count: _s->length + 1 - itemSize: sizeof(of_char32_t) + itemSize: sizeof(OFChar32) freeWhenDone: true] items]; } #ifdef OF_HAVE_BLOCKS - (void)enumerateLinesUsingBlock: (of_string_line_enumeration_block_t)block Index: src/OFValue.h ================================================================== --- src/OFValue.h +++ src/OFValue.h @@ -45,36 +45,36 @@ * If the value is not pointer-sized, @ref OFOutOfRangeException is thrown. */ @property (readonly, nonatomic) id nonretainedObjectValue; /** - * @brief The value as a range. - * - * If the value is not range-sized, @ref OFOutOfRangeException is thrown. - */ -@property (readonly, nonatomic) of_range_t rangeValue; - -/** - * @brief The value as a point. - * - * If the value is not point-sized, @ref OFOutOfRangeException is thrown. - */ -@property (readonly, nonatomic) of_point_t pointValue; - -/** - * @brief The value as a dimension. - * - * If the value is not dimension-sized, @ref OFOutOfRangeException is thrown. - */ -@property (readonly, nonatomic) of_dimension_t dimensionValue; - -/** - * @brief The value as a rectangle. - * - * If the value is not rectangle-sized, @ref OFOutOfRangeException is thrown. - */ -@property (readonly, nonatomic) of_rectangle_t rectangleValue; + * @brief The value as an OFRange. + * + * If the value is not OFRange-sized, @ref OFOutOfRangeException is thrown. + */ +@property (readonly, nonatomic) OFRange rangeValue; + +/** + * @brief The value as an OFPoint. + * + * If the value is not OFPoint-sized, @ref OFOutOfRangeException is thrown. + */ +@property (readonly, nonatomic) OFPoint pointValue; + +/** + * @brief The value as an OFSize. + * + * If the value is not OFSize-sized, @ref OFOutOfRangeException is thrown. + */ +@property (readonly, nonatomic) OFSize sizeValue; + +/** + * @brief The value as a OFRect. + * + * If the value is not OFRect-sized, @ref OFOutOfRangeException is thrown. + */ +@property (readonly, nonatomic) OFRect rectValue; /** * @brief Creates a new, autorelease OFValue with the specified bytes of the * specified type. * @@ -111,37 +111,36 @@ * @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 * @return A new, autoreleased OFValue */ -+ (instancetype)valueWithPoint: (of_point_t)point; ++ (instancetype)valueWithPoint: (OFPoint)point; /** - * @brief Creates a new, autoreleased OFValue containing the specified - * dimension. + * @brief Creates a new, autoreleased OFValue containing the specified size. * - * @param dimension The dimension the OFValue should contain + * @param size The size the OFValue should contain * @return A new, autoreleased OFValue */ -+ (instancetype)valueWithDimension: (of_dimension_t)dimension; ++ (instancetype)valueWithSize: (OFSize)size; /** * @brief Creates a new, autoreleased OFValue containing the specified * rectangle. * - * @param rectangle The rectangle the OFValue should contain + * @param rect The rectangle the OFValue should contain * @return A new, autoreleased OFValue */ -+ (instancetype)valueWithRectangle: (of_rectangle_t)rectangle; ++ (instancetype)valueWithRect: (OFRect)rect; /** * @brief Initializes an already allocated OFValue with the specified bytes of * the specified type. * Index: src/OFValue.m ================================================================== --- src/OFValue.m +++ src/OFValue.m @@ -13,17 +13,17 @@ * file. */ #import "OFValue.h" #import "OFBytesValue.h" -#import "OFDimensionValue.h" #import "OFMethodSignature.h" #import "OFNonretainedObjectValue.h" #import "OFPointValue.h" #import "OFPointerValue.h" #import "OFRangeValue.h" -#import "OFRectangleValue.h" +#import "OFRectValue.h" +#import "OFSizeValue.h" #import "OFString.h" #import "OFOutOfMemoryException.h" @implementation OFValue @@ -51,30 +51,28 @@ { 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 ++ (instancetype)valueWithPoint: (OFPoint)point { return [[[OFPointValue alloc] initWithPoint: point] autorelease]; } -+ (instancetype)valueWithDimension: (of_dimension_t)dimension ++ (instancetype)valueWithSize: (OFSize)size { - return [[[OFDimensionValue alloc] - initWithDimension: dimension] autorelease]; + return [[[OFSizeValue alloc] initWithSize: size] autorelease]; } -+ (instancetype)valueWithRectangle: (of_rectangle_t)rectangle ++ (instancetype)valueWithRect: (OFRect)rect { - return [[[OFRectangleValue alloc] - initWithRectangle: rectangle] autorelease]; + return [[[OFRectValue alloc] initWithRect: rect] autorelease]; } - (instancetype)initWithBytes: (const void *)bytes objCType: (const char *)objCType { @@ -171,34 +169,34 @@ id ret; [self getValue: &ret size: sizeof(ret)]; return ret; } -- (of_range_t)rangeValue +- (OFRange)rangeValue +{ + OFRange ret; + [self getValue: &ret size: sizeof(ret)]; + return ret; +} + +- (OFPoint)pointValue { - of_range_t ret; + OFPoint ret; [self getValue: &ret size: sizeof(ret)]; return ret; } -- (of_point_t)pointValue +- (OFSize)sizeValue { - of_point_t ret; + OFSize ret; [self getValue: &ret size: sizeof(ret)]; return ret; } -- (of_dimension_t)dimensionValue -{ - of_dimension_t ret; - [self getValue: &ret size: sizeof(ret)]; - return ret; -} - -- (of_rectangle_t)rectangleValue -{ - of_rectangle_t ret; +- (OFRect)rectValue +{ + OFRect ret; [self getValue: &ret size: sizeof(ret)]; return ret; } - (OFString *)description Index: src/OFWin32ConsoleStdIOStream.h ================================================================== --- src/OFWin32ConsoleStdIOStream.h +++ src/OFWin32ConsoleStdIOStream.h @@ -21,12 +21,12 @@ @interface OFWin32ConsoleStdIOStream: OFStdIOStream { HANDLE _handle; WORD _attributes; - of_char16_t _incompleteUTF16Surrogate; + OFChar16 _incompleteUTF16Surrogate; char _incompleteUTF8Surrogate[4]; size_t _incompleteUTF8SurrogateLen; } @end OF_ASSUME_NONNULL_END Index: src/OFWin32ConsoleStdIOStream.m ================================================================== --- src/OFWin32ConsoleStdIOStream.m +++ src/OFWin32ConsoleStdIOStream.m @@ -58,24 +58,24 @@ #import "OFReadFailedException.h" #import "OFWriteFailedException.h" #include -static of_string_encoding_t +static OFStringEncoding codepageToEncoding(UINT codepage) { switch (codepage) { case 437: - return OF_STRING_ENCODING_CODEPAGE_437; + return OFStringEncodingCodepage437; case 850: - return OF_STRING_ENCODING_CODEPAGE_850; + return OFStringEncodingCodepage850; case 858: - return OF_STRING_ENCODING_CODEPAGE_858; + return OFStringEncodingCodepage858; case 1251: - return OF_STRING_ENCODING_WINDOWS_1251; + return OFStringEncodingWindows1251; case 1252: - return OF_STRING_ENCODING_WINDOWS_1252; + return OFStringEncodingWindows1252; default: @throw [OFInvalidEncodingException exception]; } } @@ -126,17 +126,17 @@ - (size_t)lowlevelReadIntoBuffer: (void *)buffer_ length: (size_t)length { void *pool = objc_autoreleasePoolPush(); char *buffer = buffer_; - of_char16_t *UTF16; + OFChar16 *UTF16; size_t j = 0; if (length > UINT32_MAX) @throw [OFOutOfRangeException exception]; - UTF16 = of_alloc(length, sizeof(of_char16_t)); + UTF16 = of_alloc(length, sizeof(OFChar16)); @try { DWORD UTF16Len; OFMutableData *rest = nil; size_t i = 0; @@ -146,11 +146,11 @@ @throw [OFReadFailedException exceptionWithObject: self requestedLength: length * 2 errNo: EIO]; } else { - of_string_encoding_t encoding; + OFStringEncoding encoding; OFString *string; size_t stringLen; if (!ReadConsoleA(_handle, (char *)UTF16, (DWORD)length, &UTF16Len, NULL)) @@ -171,11 +171,11 @@ UTF16Len = (DWORD)stringLen; memcpy(UTF16, string.UTF16String, stringLen); } if (UTF16Len > 0 && _incompleteUTF16Surrogate != 0) { - of_unichar_t c = + OFUnichar c = (((_incompleteUTF16Surrogate & 0x3FF) << 10) | (UTF16[0] & 0x3FF)) + 0x10000; char UTF8[4]; size_t UTF8Len; @@ -195,20 +195,20 @@ _incompleteUTF16Surrogate = 0; i++; } for (; i < UTF16Len; i++) { - of_unichar_t c = UTF16[i]; + OFUnichar c = UTF16[i]; char UTF8[4]; size_t UTF8Len; /* Missing high surrogate */ if ((c & 0xFC00) == 0xDC00) @throw [OFInvalidEncodingException exception]; if ((c & 0xFC00) == 0xD800) { - of_char16_t next; + OFChar16 next; if (UTF16Len <= i + 1) { _incompleteUTF16Surrogate = c; if (rest != nil) { @@ -262,19 +262,19 @@ } - (size_t)lowlevelWriteBuffer: (const void *)buffer_ length: (size_t)length { const char *buffer = buffer_; - of_char16_t *tmp; + OFChar16 *tmp; size_t i = 0, j = 0; if (length > SIZE_MAX / 2) @throw [OFOutOfRangeException exception]; if (_incompleteUTF8SurrogateLen > 0) { - of_unichar_t c; - of_char16_t UTF16[2]; + OFUnichar c; + OFChar16 UTF16[2]; ssize_t UTF8Len; size_t toCopy; DWORD UTF16Len, bytesWritten; UTF8Len = -of_string_utf8_decode( @@ -324,11 +324,11 @@ } else { void *pool = objc_autoreleasePoolPush(); OFString *string = [OFString stringWithUTF16String: UTF16 length: UTF16Len]; - of_string_encoding_t encoding = + OFStringEncoding encoding = codepageToEncoding(GetConsoleOutputCP()); size_t nativeLen = [string cStringLengthWithEncoding: encoding]; if (nativeLen > UINT32_MAX) @@ -355,16 +355,16 @@ _incompleteUTF8SurrogateLen = 0; i += toCopy; } - tmp = of_alloc(length * 2, sizeof(of_char16_t)); + tmp = of_alloc(length * 2, sizeof(OFChar16)); @try { DWORD bytesWritten; while (i < length) { - of_unichar_t c; + OFUnichar c; ssize_t UTF8Len; UTF8Len = of_string_utf8_decode(buffer + i, length - i, &c); @@ -407,11 +407,11 @@ errNo: EIO]; } else { void *pool = objc_autoreleasePoolPush(); OFString *string = [OFString stringWithUTF16String: tmp length: j]; - of_string_encoding_t encoding = + OFStringEncoding encoding = codepageToEncoding(GetConsoleOutputCP()); size_t nativeLen = [string cStringLengthWithEncoding: encoding]; if (nativeLen > UINT32_MAX) @@ -580,19 +580,19 @@ csbi.dwCursorPosition.X = column; SetConsoleCursorPosition(_handle, csbi.dwCursorPosition); } -- (void)setCursorPosition: (of_point_t)position +- (void)setCursorPosition: (OFPoint)position { if (position.x < 0 || position.y < 0) @throw [OFInvalidArgumentException exception]; SetConsoleCursorPosition(_handle, (COORD){ position.x, position.y }); } -- (void)setRelativeCursorPosition: (of_point_t)position +- (void)setRelativeCursorPosition: (OFPoint)position { CONSOLE_SCREEN_BUFFER_INFO csbi; if (!GetConsoleScreenBufferInfo(_handle, &csbi)) return; Index: src/OFWindowsRegistryKey.m ================================================================== --- src/OFWindowsRegistryKey.m +++ src/OFWindowsRegistryKey.m @@ -285,11 +285,11 @@ if (data.itemSize != 1) @throw [OFInvalidFormatException exception]; if ([OFSystemInfo isWindowsNT]) { - const of_char16_t *UTF16String = data.items; + const OFChar16 *UTF16String = data.items; size_t length = data.count; if (length % 2 == 1) @throw [OFInvalidFormatException exception]; @@ -349,13 +349,13 @@ OFData *data; if ([OFSystemInfo isWindowsNT]) data = [OFData dataWithItems: string.UTF16String count: string.UTF16StringLength + 1 - itemSize: sizeof(of_char16_t)]; + itemSize: sizeof(OFChar16)]; else { - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; const char *cString = [string cStringWithEncoding: encoding]; size_t length = [string cStringLengthWithEncoding: encoding]; data = [OFData dataWithItems: cString count: length + 1]; } Index: src/OFXMLElement+Serialization.m ================================================================== --- src/OFXMLElement+Serialization.m +++ src/OFXMLElement+Serialization.m @@ -30,11 +30,11 @@ void *pool = objc_autoreleasePoolPush(); Class class; id object; if ((class = objc_getClass([_name cStringWithEncoding: - OF_STRING_ENCODING_ASCII])) == Nil) + OFStringEncodingASCII])) == Nil) @throw [OFInvalidArgumentException exception]; if (![class conformsToProtocol: @protocol(OFSerialization)]) @throw [OFInvalidArgumentException exception]; Index: src/OFXMLParser.h ================================================================== --- src/OFXMLParser.h +++ src/OFXMLParser.h @@ -165,11 +165,11 @@ OFMutableArray OF_GENERIC(OFString *) *_previous; size_t _level; bool _acceptProlog; size_t _lineNumber; bool _lastCarriageReturn, _finishedParsing; - of_string_encoding_t _encoding; + OFStringEncoding _encoding; size_t _depthLimit; } /** * @brief The delegate that is used by the XML parser. Index: src/OFXMLParser.m ================================================================== --- src/OFXMLParser.m +++ src/OFXMLParser.m @@ -89,13 +89,13 @@ [OF_XMLPARSER_IN_DOCTYPE] = inDOCTYPEState }; static OF_INLINE void appendToBuffer(OFMutableData *buffer, const char *string, - of_string_encoding_t encoding, size_t length) + OFStringEncoding encoding, size_t length) { - if OF_LIKELY(encoding == OF_STRING_ENCODING_UTF_8) + if OF_LIKELY(encoding == OFStringEncodingUTF8) [buffer addItems: string count: length]; else { void *pool = objc_autoreleasePoolPush(); OFString *tmp = [OFString stringWithCString: string encoding: encoding @@ -209,11 +209,11 @@ @"xmlns", @"http://www.w3.org/2000/xmlns/", nil]; [_namespaces addObject: dict]; _acceptProlog = true; _lineNumber = 1; - _encoding = OF_STRING_ENCODING_UTF_8; + _encoding = OFStringEncodingUTF8; _depthLimit = 32; objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @@ -448,11 +448,11 @@ } if ([attribute isEqual: @"encoding"]) { @try { self->_encoding = - of_string_parse_encoding(value); + OFParseStringEncodingName(value); } @catch (OFInvalidArgumentException *e) { @throw [OFInvalidEncodingException exception]; } } @@ -487,21 +487,21 @@ PI = transformString(self, self->_buffer, 1, false); whitespaceCS = [OFCharacterSet characterSetWithCharactersInString: @" \r\n\r"]; pos = [PI indexOfCharacterFromSet: whitespaceCS]; - if (pos != OF_NOT_FOUND) { + if (pos != OFNotFound) { target = [PI substringToIndex: pos]; data = [[PI substringFromIndex: pos + 1] stringByDeletingEnclosingWhitespaces]; if (data.length == 0) data = nil; } else target = PI; - if ([target caseInsensitiveCompare: @"xml"] == OF_ORDERED_SAME) + if ([target caseInsensitiveCompare: @"xml"] == OFOrderedSame) if (!parseXMLProcessingInstruction(self, data)) @throw [OFMalformedXMLException exceptionWithParser: self]; if ([self->_delegate respondsToSelector: @selector( Index: src/OFZIPArchive.m ================================================================== --- src/OFZIPArchive.m +++ src/OFZIPArchive.m @@ -280,11 +280,11 @@ _centralDirectoryOffset = [_stream readLittleEndianInt32]; commentLength = [_stream readLittleEndianInt16]; _archiveComment = [[_stream readStringWithLength: commentLength - encoding: OF_STRING_ENCODING_CODEPAGE_437] copy]; + encoding: OFStringEncodingCodepage437] copy]; if (_diskNumber == 0xFFFF || _centralDirectoryDisk == 0xFFFF || _centralDirectoryEntriesInDisk == 0xFFFF || _centralDirectoryEntries == 0xFFFF || @@ -633,11 +633,11 @@ @try { void *pool = objc_autoreleasePoolPush(); OFMutableData *extraField = nil; uint16_t fileNameLength, extraFieldLength; - of_string_encoding_t encoding; + OFStringEncoding encoding; size_t ZIP64Index; uint16_t ZIP64Size; if ([stream readLittleEndianInt32] != 0x04034B50) @throw [OFInvalidFormatException exception]; @@ -651,12 +651,11 @@ _compressedSize = [stream readLittleEndianInt32]; _uncompressedSize = [stream readLittleEndianInt32]; fileNameLength = [stream readLittleEndianInt16]; extraFieldLength = [stream readLittleEndianInt16]; encoding = (_generalPurposeBitFlag & (1u << 11) - ? OF_STRING_ENCODING_UTF_8 - : OF_STRING_ENCODING_CODEPAGE_437); + ? OFStringEncodingUTF8 : OFStringEncodingCodepage437); _fileName = [[stream readStringWithLength: fileNameLength encoding: encoding] copy]; if (extraFieldLength > 0) extraField = [[[stream readDataWithCount: @@ -663,15 +662,15 @@ extraFieldLength] mutableCopy] autorelease]; ZIP64Index = of_zip_archive_entry_extra_field_find(extraField, OF_ZIP_ARCHIVE_ENTRY_EXTRA_FIELD_ZIP64, &ZIP64Size); - if (ZIP64Index != OF_NOT_FOUND) { + if (ZIP64Index != OFNotFound) { 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.h ================================================================== --- src/OFZIPArchiveEntry.h +++ src/OFZIPArchiveEntry.h @@ -248,11 +248,11 @@ * @param extraField The extra field to search for an extensible data field with * the specified tag * @param tag The tag to look for * @param size A pointer to an uint16_t that should be set to the size * @return The index at which the extra field content starts in the OFData, or - * OF_NOT_FOUND + * `OFNotFound` */ extern size_t of_zip_archive_entry_extra_field_find(OFData *extraField, uint16_t tag, uint16_t *size); #ifdef __cplusplus } Index: src/OFZIPArchiveEntry.m ================================================================== --- src/OFZIPArchiveEntry.m +++ src/OFZIPArchiveEntry.m @@ -168,11 +168,11 @@ i += 4 + currentSize; } *size = 0; - return OF_NOT_FOUND; + return OFNotFound; } @implementation OFZIPArchiveEntry + (instancetype)entryWithFileName: (OFString *)fileName { @@ -211,11 +211,11 @@ @try { void *pool = objc_autoreleasePoolPush(); OFMutableData *extraField = nil; uint16_t fileNameLength, extraFieldLength, fileCommentLength; - of_string_encoding_t encoding; + OFStringEncoding encoding; size_t ZIP64Index; uint16_t ZIP64Size; if ([stream readLittleEndianInt32] != 0x02014B50) @throw [OFInvalidFormatException exception]; @@ -236,12 +236,11 @@ _internalAttributes = [stream readLittleEndianInt16]; _versionSpecificAttributes = [stream readLittleEndianInt32]; _localFileHeaderOffset = [stream readLittleEndianInt32]; encoding = (_generalPurposeBitFlag & (1u << 11) - ? OF_STRING_ENCODING_UTF_8 - : OF_STRING_ENCODING_CODEPAGE_437); + ? OFStringEncodingUTF8 : OFStringEncodingCodepage437); _fileName = [[stream readStringWithLength: fileNameLength encoding: encoding] copy]; if (extraFieldLength > 0) extraField = [[[stream readDataWithCount: @@ -252,15 +251,15 @@ encoding: encoding] copy]; ZIP64Index = of_zip_archive_entry_extra_field_find(extraField, OF_ZIP_ARCHIVE_ENTRY_EXTRA_FIELD_ZIP64, &ZIP64Size); - if (ZIP64Index != OF_NOT_FOUND) { + if (ZIP64Index != OFNotFound) { 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/base64.m ================================================================== --- src/base64.m +++ src/base64.m @@ -57,11 +57,11 @@ tb[1] = of_base64_encode_table[(sb & 0x03F000) >> 12]; tb[2] = of_base64_encode_table[(sb & 0x000FC0) >> 6]; tb[3] = of_base64_encode_table[sb & 0x00003F]; [ret appendCString: tb - encoding: OF_STRING_ENCODING_ASCII + encoding: OFStringEncodingASCII length: 4]; } switch (rest) { case 1: @@ -68,11 +68,11 @@ tb[0] = of_base64_encode_table[buffer[i] >> 2]; tb[1] = of_base64_encode_table[(buffer[i] & 3) << 4]; tb[2] = tb[3] = '='; [ret appendCString: tb - encoding: OF_STRING_ENCODING_ASCII + encoding: OFStringEncodingASCII length: 4]; break; case 2: sb = (buffer[i] << 16) | (buffer[i + 1] << 8); @@ -81,11 +81,11 @@ tb[1] = of_base64_encode_table[(sb & 0x03F000) >> 12]; tb[2] = of_base64_encode_table[(sb & 0x000FC0) >> 6]; tb[3] = '='; [ret appendCString: tb - encoding: OF_STRING_ENCODING_ASCII + encoding: OFStringEncodingASCII length: 4]; break; } Index: src/condition.h ================================================================== --- src/condition.h +++ src/condition.h @@ -20,11 +20,11 @@ #if !defined(OF_HAVE_THREADS) || \ (!defined(OF_HAVE_PTHREADS) && !defined(OF_WINDOWS) && !defined(OF_AMIGAOS)) # error No conditions available! #endif -/* For of_time_interval_t */ +/* For OFTimeInterval */ #import "OFObject.h" #import "mutex.h" #if defined(OF_HAVE_PTHREADS) @@ -53,16 +53,16 @@ extern int of_condition_new(of_condition_t *condition); extern int of_condition_signal(of_condition_t *condition); extern int of_condition_broadcast(of_condition_t *condition); extern int of_condition_wait(of_condition_t *condition, of_mutex_t *mutex); extern int of_condition_timed_wait(of_condition_t *condition, - of_mutex_t *mutex, of_time_interval_t timeout); + of_mutex_t *mutex, OFTimeInterval timeout); #ifdef OF_AMIGAOS extern int of_condition_wait_or_signal(of_condition_t *condition, of_mutex_t *mutex, ULONG *signalMask); extern int of_condition_timed_wait_or_signal(of_condition_t *condition, - of_mutex_t *mutex, of_time_interval_t timeout, ULONG *signalMask); + of_mutex_t *mutex, OFTimeInterval timeout, ULONG *signalMask); #endif extern int of_condition_free(of_condition_t *condition); #ifdef __cplusplus } #endif Index: src/encodings/codepage-437.m ================================================================== --- src/encodings/codepage-437.m +++ src/encodings/codepage-437.m @@ -17,11 +17,11 @@ #import "OFString.h" #import "common.h" -const of_char16_t of_codepage_437_table[] = { +const OFChar16 of_codepage_437_table[] = { 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192, 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, @@ -127,15 +127,15 @@ 0xFE }; static const uint8_t page25Start = 0x00; bool -of_unicode_to_codepage_437(const of_unichar_t *input, unsigned char *output, +of_unicode_to_codepage_437(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { - of_unichar_t c = input[i]; + OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { Index: src/encodings/codepage-850.m ================================================================== --- src/encodings/codepage-850.m +++ src/encodings/codepage-850.m @@ -17,11 +17,11 @@ #import "OFString.h" #import "common.h" -const of_char16_t of_codepage_850_table[] = { +const OFChar16 of_codepage_850_table[] = { 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192, 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, @@ -103,15 +103,15 @@ 0xFE }; static const uint8_t page25Start = 0x00; bool -of_unicode_to_codepage_850(const of_unichar_t *input, unsigned char *output, +of_unicode_to_codepage_850(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { - of_unichar_t c = input[i]; + OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { Index: src/encodings/codepage-858.m ================================================================== --- src/encodings/codepage-858.m +++ src/encodings/codepage-858.m @@ -17,11 +17,11 @@ #import "OFString.h" #import "common.h" -const of_char16_t of_codepage_858_table[] = { +const OFChar16 of_codepage_858_table[] = { 0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5, 0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192, 0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, @@ -109,15 +109,15 @@ 0xFE }; static const uint8_t page25Start = 0x00; bool -of_unicode_to_codepage_858(const of_unichar_t *input, unsigned char *output, +of_unicode_to_codepage_858(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { - of_unichar_t c = input[i]; + OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { Index: src/encodings/iso-8859-15.m ================================================================== --- src/encodings/iso-8859-15.m +++ src/encodings/iso-8859-15.m @@ -17,11 +17,11 @@ #import "OFString.h" #import "common.h" -const of_char16_t of_iso_8859_15_table[] = { +const OFChar16 of_iso_8859_15_table[] = { 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AC, 0x00A5, 0x0160, 0x00A7, 0x0161, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x017D, 0x00B5, 0x00B6, 0x00B7, 0x017E, 0x00B9, 0x00BA, 0x00BB, 0x0152, 0x0153, 0x0178, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, @@ -58,15 +58,15 @@ 0xA4 }; static const uint8_t page20Start = 0xAC; bool -of_unicode_to_iso_8859_15(const of_unichar_t *input, unsigned char *output, +of_unicode_to_iso_8859_15(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { - of_unichar_t c = input[i]; + OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { Index: src/encodings/iso-8859-2.m ================================================================== --- src/encodings/iso-8859-2.m +++ src/encodings/iso-8859-2.m @@ -17,11 +17,11 @@ #import "OFString.h" #import "common.h" -const of_char16_t of_iso_8859_2_table[] = { +const OFChar16 of_iso_8859_2_table[] = { 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, @@ -78,15 +78,15 @@ 0x00, 0xA2, 0xFF, 0x00, 0xB2, 0x00, 0xBD }; static const uint8_t page2Start = 0xC7; bool -of_unicode_to_iso_8859_2(const of_unichar_t *input, unsigned char *output, +of_unicode_to_iso_8859_2(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { - of_unichar_t c = input[i]; + OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { Index: src/encodings/iso-8859-3.m ================================================================== --- src/encodings/iso-8859-3.m +++ src/encodings/iso-8859-3.m @@ -17,11 +17,11 @@ #import "OFString.h" #import "common.h" -const of_char16_t of_iso_8859_3_table[] = { +const OFChar16 of_iso_8859_3_table[] = { 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0xFFFF, 0x0124, 0x00A7, 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0xFFFF, 0x017B, 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0xFFFF, 0x017C, 0x00C0, 0x00C1, 0x00C2, 0xFFFF, 0x00C4, 0x010A, 0x0108, 0x00C7, @@ -75,15 +75,15 @@ 0xA2, 0xFF }; static const uint8_t page2Start = 0xD8; bool -of_unicode_to_iso_8859_3(const of_unichar_t *input, unsigned char *output, +of_unicode_to_iso_8859_3(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { - of_unichar_t c = input[i]; + OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { Index: src/encodings/koi8-r.m ================================================================== --- src/encodings/koi8-r.m +++ src/encodings/koi8-r.m @@ -17,11 +17,11 @@ #import "OFString.h" #import "common.h" -const of_char16_t of_koi8_r_table[] = { +const OFChar16 of_koi8_r_table[] = { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248, 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, @@ -113,15 +113,15 @@ 0x94 }; static const uint8_t page25Start = 0x00; bool -of_unicode_to_koi8_r(const of_unichar_t *input, unsigned char *output, +of_unicode_to_koi8_r(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { - of_unichar_t c = input[i]; + OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { Index: src/encodings/koi8-u.m ================================================================== --- src/encodings/koi8-u.m +++ src/encodings/koi8-u.m @@ -17,11 +17,11 @@ #import "OFString.h" #import "common.h" -const of_char16_t of_koi8_u_table[] = { +const OFChar16 of_koi8_u_table[] = { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2219, 0x221A, 0x2248, 0x2264, 0x2265, 0x00A0, 0x2321, 0x00B0, 0x00B2, 0x00B7, 0x00F7, 0x2550, 0x2551, 0x2552, 0x0451, 0x0454, 0x2554, 0x0456, 0x0457, @@ -121,15 +121,15 @@ 0x94 }; static const uint8_t page25Start = 0x00; bool -of_unicode_to_koi8_u(const of_unichar_t *input, unsigned char *output, +of_unicode_to_koi8_u(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { - of_unichar_t c = input[i]; + OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { Index: src/encodings/mac-roman.m ================================================================== --- src/encodings/mac-roman.m +++ src/encodings/mac-roman.m @@ -17,11 +17,11 @@ #import "OFString.h" #import "common.h" -const of_char16_t of_mac_roman_table[] = { +const OFChar16 of_mac_roman_table[] = { 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3, 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC, 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF, @@ -147,15 +147,15 @@ 0xDE, 0xDF }; static const uint8_t pageFBStart = 0x01; bool -of_unicode_to_mac_roman(const of_unichar_t *input, unsigned char *output, +of_unicode_to_mac_roman(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { - of_unichar_t c = input[i]; + OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { Index: src/encodings/windows-1251.m ================================================================== --- src/encodings/windows-1251.m +++ src/encodings/windows-1251.m @@ -17,11 +17,11 @@ #import "OFString.h" #import "common.h" -const of_char16_t of_windows_1251_table[] = { +const OFChar16 of_windows_1251_table[] = { 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFF, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, 0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, @@ -100,15 +100,15 @@ 0x00, 0x00, 0x00, 0x00, 0x99 }; static const uint8_t page21Start = 0x16; bool -of_unicode_to_windows_1251(const of_unichar_t *input, unsigned char *output, +of_unicode_to_windows_1251(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { - of_unichar_t c = input[i]; + OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { Index: src/encodings/windows-1252.m ================================================================== --- src/encodings/windows-1252.m +++ src/encodings/windows-1252.m @@ -17,11 +17,11 @@ #import "OFString.h" #import "common.h" -const of_char16_t of_windows_1252_table[] = { +const OFChar16 of_windows_1252_table[] = { 0x20AC, 0xFFFF, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFF, 0x017D, 0xFFFF, 0xFFFF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0xFFFF, 0x017E, 0x0178, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, @@ -96,15 +96,15 @@ 0x99 }; static const uint8_t page21Start = 0x22; bool -of_unicode_to_windows_1252(const of_unichar_t *input, unsigned char *output, +of_unicode_to_windows_1252(const OFUnichar *input, unsigned char *output, size_t length, bool lossy) { for (size_t i = 0; i < length; i++) { - of_unichar_t c = input[i]; + OFUnichar c = input[i]; if OF_UNLIKELY (c > 0x7F) { uint8_t idx; if OF_UNLIKELY (c > 0xFFFF) { Index: src/macros.h ================================================================== --- src/macros.h +++ src/macros.h @@ -100,16 +100,10 @@ # define OF_CONST_FUNC # define OF_NO_RETURN_FUNC # define OF_WEAK_REF(sym) #endif -#ifdef OF_BIG_ENDIAN -# define OF_BYTE_ORDER_NATIVE OF_BYTE_ORDER_BIG_ENDIAN -#else -# define OF_BYTE_ORDER_NATIVE OF_BYTE_ORDER_LITTLE_ENDIAN -#endif - #if __STDC_VERSION__ >= 201112L # define OF_ALIGNOF(type) _Alignof(type) # define OF_ALIGNAS(type) _Alignas(type) #else # define OF_ALIGNOF(type) __alignof__(type) @@ -354,11 +348,10 @@ # endif # endif #endif #define OF_RETAIN_COUNT_MAX UINT_MAX -#define OF_NOT_FOUND SIZE_MAX #ifdef OBJC_COMPILING_RUNTIME # define OF_ENSURE(cond) \ do { \ if OF_UNLIKELY (!(cond)) \ Index: src/of_asprintf.m ================================================================== --- src/of_asprintf.m +++ src/of_asprintf.m @@ -417,11 +417,11 @@ ctx->subformat[ctx->subformatLen - 1] = 's'; { char buffer[5]; size_t len = of_string_utf8_encode( - va_arg(ctx->arguments, of_unichar_t), buffer); + va_arg(ctx->arguments, OFUnichar), buffer); if (len == 0) return false; buffer[len] = 0; @@ -434,12 +434,12 @@ return false; ctx->subformat[ctx->subformatLen - 1] = 's'; { - const of_unichar_t *arg = - va_arg(ctx->arguments, const of_unichar_t *); + const OFUnichar *arg = + va_arg(ctx->arguments, const OFUnichar *); size_t j, len = of_string_utf32_length(arg); char *buffer; if (SIZE_MAX / 4 < len || (SIZE_MAX / 4) - len < 1) return false; Index: src/platform/amiga/OFString+PathAdditions.m ================================================================== --- src/platform/amiga/OFString+PathAdditions.m +++ src/platform/amiga/OFString+PathAdditions.m @@ -118,11 +118,11 @@ size_t pos; fileName = self.lastPathComponent; pos = [fileName rangeOfString: @"." options: OF_STRING_SEARCH_BACKWARDS].location; - if (pos == OF_NOT_FOUND || pos == 0) { + if (pos == OFNotFound || pos == 0) { objc_autoreleasePoolPop(pool); return @""; } ret = [fileName substringFromIndex: pos + 1]; @@ -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]; @@ -177,11 +177,11 @@ components = [[self.pathComponents mutableCopy] autorelease]; fileName = components.lastObject; pos = [fileName rangeOfString: @"." options: OF_STRING_SEARCH_BACKWARDS].location; - if (pos == OF_NOT_FOUND || pos == 0) { + if (pos == OFNotFound || pos == 0) { objc_autoreleasePoolPop(pool); return [[self copy] autorelease]; } fileName = [fileName substringToIndex: pos]; @@ -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/amiga/condition.m ================================================================== --- src/platform/amiga/condition.m +++ src/platform/amiga/condition.m @@ -122,21 +122,21 @@ return error; } int of_condition_timed_wait(of_condition_t *condition, of_mutex_t *mutex, - of_time_interval_t timeout) + OFTimeInterval timeout) { ULONG signalMask = 0; return of_condition_timed_wait_or_signal(condition, mutex, timeout, &signalMask); } int of_condition_timed_wait_or_signal(of_condition_t *condition, of_mutex_t *mutex, - of_time_interval_t timeout, ULONG *signalMask) + OFTimeInterval timeout, ULONG *signalMask) { struct of_condition_waiting_task waitingTask = { .task = FindTask(NULL), .sigBit = AllocSignal(-1) }; Index: src/platform/libfat/OFString+PathAdditions.m ================================================================== --- src/platform/libfat/OFString+PathAdditions.m +++ src/platform/libfat/OFString+PathAdditions.m @@ -152,11 +152,11 @@ size_t pos; fileName = self.lastPathComponent; pos = [fileName rangeOfString: @"." options: OF_STRING_SEARCH_BACKWARDS].location; - if (pos == OF_NOT_FOUND || pos == 0) { + if (pos == OFNotFound || pos == 0) { objc_autoreleasePoolPop(pool); return @""; } ret = [fileName substringFromIndex: pos + 1]; @@ -222,11 +222,11 @@ components = [[self.pathComponents mutableCopy] autorelease]; fileName = components.lastObject; pos = [fileName rangeOfString: @"." options: OF_STRING_SEARCH_BACKWARDS].location; - if (pos == OF_NOT_FOUND || pos == 0) { + if (pos == OFNotFound || pos == 0) { objc_autoreleasePoolPop(pool); return [[self copy] autorelease]; } fileName = [fileName substringToIndex: pos]; @@ -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 @@ -145,11 +145,11 @@ size_t pos; fileName = self.lastPathComponent; pos = [fileName rangeOfString: @"." options: OF_STRING_SEARCH_BACKWARDS].location; - if (pos == OF_NOT_FOUND || pos == 0) { + if (pos == OFNotFound || pos == 0) { objc_autoreleasePoolPop(pool); return @""; } ret = [fileName substringFromIndex: pos + 1]; @@ -214,11 +214,11 @@ components = [[self.pathComponents mutableCopy] autorelease]; fileName = components.lastObject; pos = [fileName rangeOfString: @"." options: OF_STRING_SEARCH_BACKWARDS].location; - if (pos == OF_NOT_FOUND || pos == 0) { + if (pos == OFNotFound || pos == 0) { objc_autoreleasePoolPop(pool); return [[self copy] autorelease]; } fileName = [fileName substringToIndex: pos]; @@ -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/posix/OFSubprocess.m ================================================================== --- src/platform/posix/OFSubprocess.m +++ src/platform/posix/OFSubprocess.m @@ -236,11 +236,11 @@ forProgramName: (OFString *)programName andArguments: (OFArray *)arguments { OFString *const *objects = arguments.objects; size_t i, count = arguments.count; - of_string_encoding_t encoding; + OFStringEncoding encoding; *argv = of_alloc(count + 2, sizeof(char *)); encoding = [OFLocale encoding]; @@ -255,11 +255,11 @@ - (char **)of_environmentForDictionary: (OFDictionary *)environment { char **envp; size_t count; - of_string_encoding_t encoding; + OFStringEncoding encoding; if (environment == nil) return NULL; encoding = [OFLocale encoding]; Index: src/platform/posix/condition.m ================================================================== --- src/platform/posix/condition.m +++ src/platform/posix/condition.m @@ -41,11 +41,11 @@ return pthread_cond_wait(condition, mutex); } int of_condition_timed_wait(of_condition_t *condition, of_mutex_t *mutex, - of_time_interval_t timeout) + OFTimeInterval timeout) { struct timespec ts; ts.tv_sec = (time_t)timeout; ts.tv_nsec = (long)((timeout - ts.tv_sec) * 1000000000); Index: src/platform/windows/OFString+PathAdditions.m ================================================================== --- src/platform/windows/OFString+PathAdditions.m +++ src/platform/windows/OFString+PathAdditions.m @@ -156,11 +156,11 @@ size_t pos; fileName = self.lastPathComponent; pos = [fileName rangeOfString: @"." options: OF_STRING_SEARCH_BACKWARDS].location; - if (pos == OF_NOT_FOUND || pos == 0) { + if (pos == OFNotFound || pos == 0) { objc_autoreleasePoolPop(pool); return @""; } ret = [fileName substringFromIndex: pos + 1]; @@ -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]; @@ -225,11 +225,11 @@ components = [[self.pathComponents mutableCopy] autorelease]; fileName = components.lastObject; pos = [fileName rangeOfString: @"." options: OF_STRING_SEARCH_BACKWARDS].location; - if (pos == OF_NOT_FOUND || pos == 0) { + if (pos == OFNotFound || pos == 0) { objc_autoreleasePoolPop(pool); return [[self copy] autorelease]; } fileName = [fileName substringToIndex: pos]; @@ -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: src/platform/windows/OFSubprocess.m ================================================================== --- src/platform/windows/OFSubprocess.m +++ src/platform/windows/OFSubprocess.m @@ -33,11 +33,11 @@ #import "OFWriteFailedException.h" #include @interface OFSubprocess () -- (of_char16_t *)of_wideEnvironmentForDictionary: (OFDictionary *)dictionary; +- (OFChar16 *)of_wideEnvironmentForDictionary: (OFDictionary *)dictionary; - (char *)of_environmentForDictionary: (OFDictionary *)environment; @end @implementation OFSubprocess + (instancetype)subprocessWithProgram: (OFString *)program @@ -180,11 +180,11 @@ [argumentsString appendString: @"\""]; } if ([OFSystemInfo isWindowsNT]) { size_t length; - of_char16_t *argumentsCopy; + OFChar16 *argumentsCopy; STARTUPINFOW si; memset(&si, 0, sizeof(si)); si.cb = sizeof(si); si.hStdInput = _writePipe[0]; @@ -192,11 +192,11 @@ si.hStdError = GetStdHandle(STD_ERROR_HANDLE); si.dwFlags |= STARTF_USESTDHANDLES; length = argumentsString.UTF16StringLength; argumentsCopy = of_alloc(length + 1, - sizeof(of_char16_t)); + sizeof(OFChar16)); memcpy(argumentsCopy, argumentsString.UTF16String, (length + 1) * 2); @try { if (!CreateProcessW(program.UTF16String, argumentsCopy, NULL, NULL, TRUE, @@ -207,11 +207,11 @@ exceptionWithClass: self.class]; } @finally { free(argumentsCopy); } } else { - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; STARTUPINFO si; memset(&si, 0, sizeof(si)); si.cb = sizeof(si); si.hStdInput = _writePipe[0]; @@ -249,22 +249,22 @@ [self close]; [super dealloc]; } -- (of_char16_t *)of_wideEnvironmentForDictionary: (OFDictionary *)environment +- (OFChar16 *)of_wideEnvironmentForDictionary: (OFDictionary *)environment { OFMutableData *env; OFEnumerator *keyEnumerator, *objectEnumerator; OFString *key, *object; - const of_char16_t equal = '='; - const of_char16_t zero[2] = { 0, 0 }; + const OFChar16 equal = '='; + const OFChar16 zero[2] = { 0, 0 }; if (environment == nil) return NULL; - env = [OFMutableData dataWithItemSize: sizeof(of_char16_t)]; + env = [OFMutableData dataWithItemSize: sizeof(OFChar16)]; keyEnumerator = [environment keyEnumerator]; objectEnumerator = [environment objectEnumerator]; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) { @@ -279,11 +279,11 @@ return env.mutableItems; } - (char *)of_environmentForDictionary: (OFDictionary *)environment { - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; OFMutableData *env; OFEnumerator *keyEnumerator, *objectEnumerator; OFString *key, *object; if (environment == nil) Index: src/platform/windows/condition.m ================================================================== --- src/platform/windows/condition.m +++ src/platform/windows/condition.m @@ -94,11 +94,11 @@ } } int of_condition_timed_wait(of_condition_t *condition, of_mutex_t *mutex, - of_time_interval_t timeout) + OFTimeInterval timeout) { int error; DWORD status; if ((error = of_mutex_unlock(mutex)) != 0) Index: src/socket.m ================================================================== --- src/socket.m +++ src/socket.m @@ -385,11 +385,11 @@ if (component.length == 0) @throw [OFInvalidFormatException exception]; if ([component indexOfCharacterFromSet: - whitespaceCharacterSet] != OF_NOT_FOUND) + whitespaceCharacterSet] != OFNotFound) @throw [OFInvalidFormatException exception]; number = component.unsignedLongLongValue; if (number > UINT8_MAX) @@ -409,11 +409,11 @@ parseIPv6Component(OFString *component) { unsigned long long number; if ([component indexOfCharacterFromSet: - [OFCharacterSet whitespaceCharacterSet]] != OF_NOT_FOUND) + [OFCharacterSet whitespaceCharacterSet]] != OFNotFound) @throw [OFInvalidFormatException exception]; number = [component unsignedLongLongValueWithBase: 16]; if (number > UINT16_MAX) @@ -441,11 +441,11 @@ #endif addrIn6->sin6_port = OF_BSWAP16_IF_LE(port); doubleColon = [IPv6 rangeOfString: @"::"].location; - if (doubleColon != OF_NOT_FOUND) { + if (doubleColon != OFNotFound) { OFString *left = [IPv6 substringToIndex: doubleColon]; OFString *right = [IPv6 substringFromIndex: doubleColon + 2]; OFArray OF_GENERIC(OFString *) *leftComponents; OFArray OF_GENERIC(OFString *) *rightComponents; size_t i; Index: src/unicode.h ================================================================== --- src/unicode.h +++ src/unicode.h @@ -23,20 +23,20 @@ #define OF_UNICODE_DECOMPOSITION_COMPAT_TABLE_SIZE 0x2FB #ifdef __cplusplus extern "C" { #endif -extern const of_unichar_t *const _Nonnull +extern const OFUnichar *const _Nonnull of_unicode_uppercase_table[OF_UNICODE_UPPERCASE_TABLE_SIZE]; -extern const of_unichar_t *const _Nonnull +extern const OFUnichar *const _Nonnull of_unicode_lowercase_table[OF_UNICODE_LOWERCASE_TABLE_SIZE]; -extern const of_unichar_t *const _Nonnull +extern const OFUnichar *const _Nonnull of_unicode_titlecase_table[OF_UNICODE_TITLECASE_TABLE_SIZE]; -extern const of_unichar_t *const _Nonnull +extern const OFUnichar *const _Nonnull of_unicode_casefolding_table[OF_UNICODE_CASEFOLDING_TABLE_SIZE]; extern const char *const _Nullable *const _Nonnull of_unicode_decomposition_table[OF_UNICODE_DECOMPOSITION_TABLE_SIZE]; extern const char *const _Nullable *const _Nonnull of_unicode_decomposition_compat_table[OF_UNICODE_DECOMPOSITION_COMPAT_TABLE_SIZE]; #ifdef __cplusplus } #endif Index: src/unicode.m ================================================================== --- src/unicode.m +++ src/unicode.m @@ -15,14 +15,14 @@ #include "config.h" #import "OFString.h" -static const of_unichar_t emptyPage[0x100] = { 0 }; +static const OFUnichar emptyPage[0x100] = { 0 }; static const char *emptyDecompositionPage[0x100] = { NULL }; -static const of_unichar_t uppercasePage0[0x100] = { +static const OFUnichar uppercasePage0[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -53,11 +53,11 @@ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 0, 216, 217, 218, 219, 220, 221, 222, 376, }; -static const of_unichar_t uppercasePage1[0x100] = { +static const OFUnichar uppercasePage1[0x100] = { 0, 256, 0, 258, 0, 260, 0, 262, 0, 264, 0, 266, 0, 268, 0, 270, 0, 272, 0, 274, 0, 276, 0, 278, 0, 280, 0, 282, 0, 284, 0, 286, 0, 288, 0, 290, 0, 292, 0, 294, @@ -88,11 +88,11 @@ 0, 488, 0, 490, 0, 492, 0, 494, 0, 0, 497, 497, 0, 500, 0, 0, 0, 504, 0, 506, 0, 508, 0, 510, }; -static const of_unichar_t uppercasePage2[0x100] = { +static const OFUnichar uppercasePage2[0x100] = { 0, 512, 0, 514, 0, 516, 0, 518, 0, 520, 0, 522, 0, 524, 0, 526, 0, 528, 0, 530, 0, 532, 0, 534, 0, 536, 0, 538, 0, 540, 0, 542, 0, 0, 0, 546, 0, 548, 0, 550, @@ -123,11 +123,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage3[0x100] = { +static const OFUnichar uppercasePage3[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -158,11 +158,11 @@ 0, 1000, 0, 1002, 0, 1004, 0, 1006, 922, 929, 1017, 895, 0, 917, 0, 0, 1015, 0, 0, 1018, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage4[0x100] = { +static const OFUnichar uppercasePage4[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -193,11 +193,11 @@ 0, 1256, 0, 1258, 0, 1260, 0, 1262, 0, 1264, 0, 1266, 0, 1268, 0, 1270, 0, 1272, 0, 1274, 0, 1276, 0, 1278, }; -static const of_unichar_t uppercasePage5[0x100] = { +static const OFUnichar uppercasePage5[0x100] = { 0, 1280, 0, 1282, 0, 1284, 0, 1286, 0, 1288, 0, 1290, 0, 1292, 0, 1294, 0, 1296, 0, 1298, 0, 1300, 0, 1302, 0, 1304, 0, 1306, 0, 1308, 0, 1310, 0, 1312, 0, 1314, 0, 1316, 0, 1318, @@ -228,11 +228,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage16[0x100] = { +static const OFUnichar uppercasePage16[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -263,11 +263,11 @@ 7336, 7337, 7338, 7339, 7340, 7341, 7342, 7343, 7344, 7345, 7346, 7347, 7348, 7349, 7350, 7351, 7352, 7353, 7354, 0, 0, 7357, 7358, 7359, }; -static const of_unichar_t uppercasePage19[0x100] = { +static const OFUnichar uppercasePage19[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -298,11 +298,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5104, 5105, 5106, 5107, 5108, 5109, 0, 0, }; -static const of_unichar_t uppercasePage28[0x100] = { +static const OFUnichar uppercasePage28[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -333,11 +333,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage29[0x100] = { +static const OFUnichar uppercasePage29[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -368,11 +368,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage30[0x100] = { +static const OFUnichar uppercasePage30[0x100] = { 0, 7680, 0, 7682, 0, 7684, 0, 7686, 0, 7688, 0, 7690, 0, 7692, 0, 7694, 0, 7696, 0, 7698, 0, 7700, 0, 7702, 0, 7704, 0, 7706, 0, 7708, 0, 7710, 0, 7712, 0, 7714, 0, 7716, 0, 7718, @@ -403,11 +403,11 @@ 0, 7912, 0, 7914, 0, 7916, 0, 7918, 0, 7920, 0, 7922, 0, 7924, 0, 7926, 0, 7928, 0, 7930, 0, 7932, 0, 7934, }; -static const of_unichar_t uppercasePage31[0x100] = { +static const OFUnichar uppercasePage31[0x100] = { 7944, 7945, 7946, 7947, 7948, 7949, 7950, 7951, 0, 0, 0, 0, 0, 0, 0, 0, 7960, 7961, 7962, 7963, 7964, 7965, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7976, 7977, 7978, 7979, 7980, 7981, 7982, 7983, @@ -438,11 +438,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8188, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage33[0x100] = { +static const OFUnichar uppercasePage33[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -473,11 +473,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage36[0x100] = { +static const OFUnichar uppercasePage36[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -508,11 +508,11 @@ 9422, 9423, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage44[0x100] = { +static const OFUnichar uppercasePage44[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -543,11 +543,11 @@ 0, 0, 0, 0, 11499, 0, 11501, 0, 0, 0, 0, 11506, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage45[0x100] = { +static const OFUnichar uppercasePage45[0x100] = { 4256, 4257, 4258, 4259, 4260, 4261, 4262, 4263, 4264, 4265, 4266, 4267, 4268, 4269, 4270, 4271, 4272, 4273, 4274, 4275, 4276, 4277, 4278, 4279, 4280, 4281, 4282, 4283, 4284, 4285, 4286, 4287, 4288, 4289, 4290, 4291, 4292, 4293, 0, 4295, @@ -578,11 +578,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage166[0x100] = { +static const OFUnichar uppercasePage166[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -613,11 +613,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage167[0x100] = { +static const OFUnichar uppercasePage167[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42786, 0, 42788, 0, 42790, @@ -648,11 +648,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42997, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage171[0x100] = { +static const OFUnichar uppercasePage171[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -683,11 +683,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage255[0x100] = { +static const OFUnichar uppercasePage255[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -718,11 +718,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage260[0x100] = { +static const OFUnichar uppercasePage260[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -753,11 +753,11 @@ 66752, 66753, 66754, 66755, 66756, 66757, 66758, 66759, 66760, 66761, 66762, 66763, 66764, 66765, 66766, 66767, 66768, 66769, 66770, 66771, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage268[0x100] = { +static const OFUnichar uppercasePage268[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -788,11 +788,11 @@ 68776, 68777, 68778, 68779, 68780, 68781, 68782, 68783, 68784, 68785, 68786, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage280[0x100] = { +static const OFUnichar uppercasePage280[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -823,11 +823,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage366[0x100] = { +static const OFUnichar uppercasePage366[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -858,11 +858,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t uppercasePage489[0x100] = { +static const OFUnichar uppercasePage489[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 125184, 125185, 125186, 125187, 125188, 125189, @@ -893,11 +893,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage0[0x100] = { +static const OFUnichar lowercasePage0[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -928,11 +928,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage1[0x100] = { +static const OFUnichar lowercasePage1[0x100] = { 257, 0, 259, 0, 261, 0, 263, 0, 265, 0, 267, 0, 269, 0, 271, 0, 273, 0, 275, 0, 277, 0, 279, 0, 281, 0, 283, 0, 285, 0, 287, 0, 289, 0, 291, 0, 293, 0, 295, 0, @@ -963,11 +963,11 @@ 489, 0, 491, 0, 493, 0, 495, 0, 0, 499, 499, 0, 501, 0, 405, 447, 505, 0, 507, 0, 509, 0, 511, 0, }; -static const of_unichar_t lowercasePage2[0x100] = { +static const OFUnichar lowercasePage2[0x100] = { 513, 0, 515, 0, 517, 0, 519, 0, 521, 0, 523, 0, 525, 0, 527, 0, 529, 0, 531, 0, 533, 0, 535, 0, 537, 0, 539, 0, 541, 0, 543, 0, 414, 0, 547, 0, 549, 0, 551, 0, @@ -998,11 +998,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage3[0x100] = { +static const OFUnichar lowercasePage3[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1033,11 +1033,11 @@ 1001, 0, 1003, 0, 1005, 0, 1007, 0, 0, 0, 0, 0, 952, 0, 0, 1016, 0, 1010, 1019, 0, 0, 891, 892, 893, }; -static const of_unichar_t lowercasePage4[0x100] = { +static const OFUnichar lowercasePage4[0x100] = { 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, @@ -1068,11 +1068,11 @@ 1257, 0, 1259, 0, 1261, 0, 1263, 0, 1265, 0, 1267, 0, 1269, 0, 1271, 0, 1273, 0, 1275, 0, 1277, 0, 1279, 0, }; -static const of_unichar_t lowercasePage5[0x100] = { +static const OFUnichar lowercasePage5[0x100] = { 1281, 0, 1283, 0, 1285, 0, 1287, 0, 1289, 0, 1291, 0, 1293, 0, 1295, 0, 1297, 0, 1299, 0, 1301, 0, 1303, 0, 1305, 0, 1307, 0, 1309, 0, 1311, 0, 1313, 0, 1315, 0, 1317, 0, 1319, 0, @@ -1103,11 +1103,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage16[0x100] = { +static const OFUnichar lowercasePage16[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1138,11 +1138,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage19[0x100] = { +static const OFUnichar lowercasePage19[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1173,11 +1173,11 @@ 43960, 43961, 43962, 43963, 43964, 43965, 43966, 43967, 5112, 5113, 5114, 5115, 5116, 5117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage28[0x100] = { +static const OFUnichar lowercasePage28[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1208,11 +1208,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage30[0x100] = { +static const OFUnichar lowercasePage30[0x100] = { 7681, 0, 7683, 0, 7685, 0, 7687, 0, 7689, 0, 7691, 0, 7693, 0, 7695, 0, 7697, 0, 7699, 0, 7701, 0, 7703, 0, 7705, 0, 7707, 0, 7709, 0, 7711, 0, 7713, 0, 7715, 0, 7717, 0, 7719, 0, @@ -1243,11 +1243,11 @@ 7913, 0, 7915, 0, 7917, 0, 7919, 0, 7921, 0, 7923, 0, 7925, 0, 7927, 0, 7929, 0, 7931, 0, 7933, 0, 7935, 0, }; -static const of_unichar_t lowercasePage31[0x100] = { +static const OFUnichar lowercasePage31[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 7936, 7937, 7938, 7939, 7940, 7941, 7942, 7943, 0, 0, 0, 0, 0, 0, 0, 0, 7952, 7953, 7954, 7955, 7956, 7957, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1278,11 +1278,11 @@ 8160, 8161, 8058, 8059, 8165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8056, 8057, 8060, 8061, 8179, 0, 0, 0, }; -static const of_unichar_t lowercasePage33[0x100] = { +static const OFUnichar lowercasePage33[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 969, 0, @@ -1313,11 +1313,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage36[0x100] = { +static const OFUnichar lowercasePage36[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1348,11 +1348,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage44[0x100] = { +static const OFUnichar lowercasePage44[0x100] = { 11312, 11313, 11314, 11315, 11316, 11317, 11318, 11319, 11320, 11321, 11322, 11323, 11324, 11325, 11326, 11327, 11328, 11329, 11330, 11331, 11332, 11333, 11334, 11335, 11336, 11337, 11338, 11339, 11340, 11341, 11342, 11343, 11344, 11345, 11346, 11347, 11348, 11349, 11350, 11351, @@ -1383,11 +1383,11 @@ 0, 0, 0, 11500, 0, 11502, 0, 0, 0, 0, 11507, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage166[0x100] = { +static const OFUnichar lowercasePage166[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1418,11 +1418,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage167[0x100] = { +static const OFUnichar lowercasePage167[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42787, 0, 42789, 0, 42791, 0, @@ -1453,11 +1453,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42998, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage255[0x100] = { +static const OFUnichar lowercasePage255[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65345, 65346, 65347, 65348, 65349, 65350, 65351, @@ -1488,11 +1488,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage260[0x100] = { +static const OFUnichar lowercasePage260[0x100] = { 66600, 66601, 66602, 66603, 66604, 66605, 66606, 66607, 66608, 66609, 66610, 66611, 66612, 66613, 66614, 66615, 66616, 66617, 66618, 66619, 66620, 66621, 66622, 66623, 66624, 66625, 66626, 66627, 66628, 66629, 66630, 66631, 66632, 66633, 66634, 66635, 66636, 66637, 66638, 66639, @@ -1523,11 +1523,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage268[0x100] = { +static const OFUnichar lowercasePage268[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1558,11 +1558,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage280[0x100] = { +static const OFUnichar lowercasePage280[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1593,11 +1593,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage366[0x100] = { +static const OFUnichar lowercasePage366[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1628,11 +1628,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t lowercasePage489[0x100] = { +static const OFUnichar lowercasePage489[0x100] = { 125218, 125219, 125220, 125221, 125222, 125223, 125224, 125225, 125226, 125227, 125228, 125229, 125230, 125231, 125232, 125233, 125234, 125235, 125236, 125237, 125238, 125239, 125240, 125241, 125242, 125243, 125244, 125245, 125246, 125247, 125248, 125249, 125250, 125251, 0, 0, 0, 0, 0, 0, @@ -1663,11 +1663,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t titlecasePage1[0x100] = { +static const OFUnichar titlecasePage1[0x100] = { 0, 256, 0, 258, 0, 260, 0, 262, 0, 264, 0, 266, 0, 268, 0, 270, 0, 272, 0, 274, 0, 276, 0, 278, 0, 280, 0, 282, 0, 284, 0, 286, 0, 288, 0, 290, 0, 292, 0, 294, @@ -1698,11 +1698,11 @@ 0, 488, 0, 490, 0, 492, 0, 494, 0, 498, 498, 498, 0, 500, 0, 0, 0, 504, 0, 506, 0, 508, 0, 510, }; -static const of_unichar_t titlecasePage16[0x100] = { +static const OFUnichar titlecasePage16[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1733,11 +1733,11 @@ 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4340, 4341, 4342, 4343, 4344, 4345, 4346, 0, 0, 4349, 4350, 4351, }; -static const of_unichar_t casefoldingPage0[0x100] = { +static const OFUnichar casefoldingPage0[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1768,11 +1768,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t casefoldingPage1[0x100] = { +static const OFUnichar casefoldingPage1[0x100] = { 257, 0, 259, 0, 261, 0, 263, 0, 265, 0, 267, 0, 269, 0, 271, 0, 273, 0, 275, 0, 277, 0, 279, 0, 281, 0, 283, 0, 285, 0, 287, 0, 289, 0, 291, 0, 293, 0, 295, 0, @@ -1803,11 +1803,11 @@ 489, 0, 491, 0, 493, 0, 495, 0, 0, 499, 499, 0, 501, 0, 405, 447, 505, 0, 507, 0, 509, 0, 511, 0, }; -static const of_unichar_t casefoldingPage3[0x100] = { +static const OFUnichar casefoldingPage3[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1838,11 +1838,11 @@ 1001, 0, 1003, 0, 1005, 0, 1007, 0, 954, 961, 0, 0, 952, 949, 0, 1016, 0, 1010, 1019, 0, 0, 891, 892, 893, }; -static const of_unichar_t casefoldingPage19[0x100] = { +static const OFUnichar casefoldingPage19[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1873,11 +1873,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5104, 5105, 5106, 5107, 5108, 5109, 0, 0, }; -static const of_unichar_t casefoldingPage28[0x100] = { +static const OFUnichar casefoldingPage28[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1908,11 +1908,11 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static const of_unichar_t casefoldingPage30[0x100] = { +static const OFUnichar casefoldingPage30[0x100] = { 7681, 0, 7683, 0, 7685, 0, 7687, 0, 7689, 0, 7691, 0, 7693, 0, 7695, 0, 7697, 0, 7699, 0, 7701, 0, 7703, 0, 7705, 0, 7707, 0, 7709, 0, 7711, 0, 7713, 0, 7715, 0, 7717, 0, 7719, 0, @@ -1943,11 +1943,11 @@ 7913, 0, 7915, 0, 7917, 0, 7919, 0, 7921, 0, 7923, 0, 7925, 0, 7927, 0, 7929, 0, 7931, 0, 7933, 0, 7935, 0, }; -static const of_unichar_t casefoldingPage31[0x100] = { +static const OFUnichar casefoldingPage31[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 7936, 7937, 7938, 7939, 7940, 7941, 7942, 7943, 0, 0, 0, 0, 0, 0, 0, 0, 7952, 7953, 7954, 7955, 7956, 7957, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1978,11 +1978,11 @@ 8160, 8161, 8058, 8059, 8165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8056, 8057, 8060, 8061, 8179, 0, 0, 0, }; -static const of_unichar_t casefoldingPage171[0x100] = { +static const OFUnichar casefoldingPage171[0x100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -12362,11 +12362,11 @@ NULL, NULL, NULL, NULL, NULL, NULL, }; -const of_unichar_t *const of_unicode_uppercase_table[0x1EA] = { +const OFUnichar *const of_unicode_uppercase_table[0x1EA] = { uppercasePage0, uppercasePage1, uppercasePage2, uppercasePage3, uppercasePage4, uppercasePage5, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, uppercasePage16, emptyPage, emptyPage, uppercasePage19, @@ -12488,11 +12488,11 @@ emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, uppercasePage489 }; -const of_unichar_t *const of_unicode_lowercase_table[0x1EA] = { +const OFUnichar *const of_unicode_lowercase_table[0x1EA] = { lowercasePage0, lowercasePage1, lowercasePage2, lowercasePage3, lowercasePage4, lowercasePage5, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, lowercasePage16, emptyPage, emptyPage, lowercasePage19, @@ -12614,11 +12614,11 @@ emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, lowercasePage489 }; -const of_unichar_t *const of_unicode_titlecase_table[0x1EA] = { +const OFUnichar *const of_unicode_titlecase_table[0x1EA] = { uppercasePage0, titlecasePage1, uppercasePage2, uppercasePage3, uppercasePage4, uppercasePage5, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, titlecasePage16, emptyPage, emptyPage, uppercasePage19, @@ -12740,11 +12740,11 @@ emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, uppercasePage489 }; -const of_unichar_t *const of_unicode_casefolding_table[0x1EA] = { +const OFUnichar *const of_unicode_casefolding_table[0x1EA] = { casefoldingPage0, casefoldingPage1, lowercasePage2, casefoldingPage3, lowercasePage4, lowercasePage5, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, emptyPage, 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 @@ -25,11 +25,11 @@ @interface SimpleCharacterSet: OFCharacterSet @end @implementation SimpleCharacterSet -- (bool)characterIsMember: (of_unichar_t)character +- (bool)characterIsMember: (OFUnichar)character { return (character % 2 == 0); } @end @@ -43,11 +43,11 @@ module = @"OFCharacterSet"; cs = [[[SimpleCharacterSet alloc] init] autorelease]; ok = true; - for (of_unichar_t c = 0; c < 65536; c++) { + for (OFUnichar c = 0; c < 65536; c++) { if (c % 2 == 0) { if (![cs characterIsMember: c]) ok = false; } else if ([cs characterIsMember: c]) ok = false; @@ -60,11 +60,11 @@ (cs = [OFCharacterSet characterSetWithCharactersInString: @"0123456789"]) && [cs isKindOfClass: [OFBitSetCharacterSet class]]) ok = true; - for (of_unichar_t c = 0; c < 65536; c++) { + for (OFUnichar c = 0; c < 65536; c++) { if (c >= '0' && c <= '9') { if (![cs characterIsMember: c]) ok = false; } else if ([cs characterIsMember: c]) ok = false; @@ -72,15 +72,16 @@ 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++) { + for (OFUnichar c = 0; c < 65536; c++) { if (c >= '0' && c <= '9') { if (![cs characterIsMember: c]) ok = false; } else if ([cs characterIsMember: c]) ok = false; @@ -87,11 +88,11 @@ } TEST(@"-[characterIsMember:]", ok); ok = true; ics = cs.invertedSet; - for (of_unichar_t c = 0; c < 65536; c++) { + for (OFUnichar c = 0; c < 65536; c++) { if (c >= '0' && c <= '9') { if ([ics characterIsMember: c]) ok = false; } else if (![ics characterIsMember: c]) ok = false; 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); @@ -61,24 +61,24 @@ (mutable = [[immutable mutableCopy] autorelease]) && [mutable isEqual: immutable]) TEST(@"-[compare]", [mutable compare: immutable] == 0 && R([mutable removeLastItem]) && - [immutable compare: mutable] == OF_ORDERED_DESCENDING && - [mutable compare: immutable] == OF_ORDERED_ASCENDING && + [immutable compare: mutable] == OFOrderedDescending && + [mutable compare: immutable] == OFOrderedAscending && [[OFData dataWithItems: "aa" count: 2] compare: - [OFData dataWithItems: "z" count: 1]] == OF_ORDERED_ASCENDING) + [OFData dataWithItems: "z" count: 1]] == OFOrderedAscending) TEST(@"-[hash]", immutable.hash == 0x634A529F) mutable = [OFMutableData dataWithItems: "abcdef" count: 6]; 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/OFDateTests.m ================================================================== --- tests/OFDateTests.m +++ tests/OFDateTests.m @@ -78,11 +78,11 @@ TEST(@"-[isEqual:]", [d1 isEqual: [OFDate dateWithTimeIntervalSince1970: 0]] && ![d1 isEqual: [OFDate dateWithTimeIntervalSince1970: 0.0000001]]) - TEST(@"-[compare:]", [d1 compare: d2] == OF_ORDERED_ASCENDING) + TEST(@"-[compare:]", [d1 compare: d2] == OFOrderedAscending) TEST(@"-[second]", d1.second == 0 && d2.second == 5) TEST(@"-[microsecond]", d1.microsecond == 0 && d2.microsecond == 2) Index: tests/OFINIFileTests.m ================================================================== --- tests/OFINIFileTests.m +++ tests/OFINIFileTests.m @@ -50,11 +50,11 @@ OFString *writePath; #endif TEST(@"+[fileWithPath:encoding:]", (file = [OFINIFile fileWithPath: @"testfile.ini" - encoding: OF_STRING_ENCODING_CODEPAGE_437])) + encoding: OFStringEncodingCodepage437])) tests = [file categoryForName: @"tests"]; foobar = [file categoryForName: @"foobar"]; types = [file categoryForName: @"types"]; TEST(@"-[categoryForName:]", @@ -119,18 +119,18 @@ [[OFApplication environment] objectForKey: @"HOME"], @"tmp", @"tmpfile.ini", nil]]; # endif TEST(@"-[writeToFile:encoding:]", R([file writeToFile: writePath - encoding: OF_STRING_ENCODING_CODEPAGE_437]) && + encoding: OFStringEncodingCodepage437]) && [[OFString stringWithContentsOfFile: writePath - encoding: OF_STRING_ENCODING_CODEPAGE_437] + encoding: OFStringEncodingCodepage437] isEqual: output]) [[OFFileManager defaultManager] removeItemAtPath: writePath]; #else (void)output; #endif objc_autoreleasePoolPop(pool); } @end Index: tests/OFLocaleTests.m ================================================================== --- tests/OFLocaleTests.m +++ tests/OFLocaleTests.m @@ -29,13 +29,13 @@ [of_stdout writeFormat: @"[OFLocale] Territory: %@\n", [OFLocale territory]]; [of_stdout writeFormat: @"[OFLocale] Encoding: %@\n", - of_string_name_of_encoding([OFLocale encoding])]; + OFStringEncodingName([OFLocale encoding])]; [of_stdout writeFormat: @"[OFLocale] Decimal point: %@\n", [OFLocale decimalPoint]]; objc_autoreleasePoolPop(pool); } @end Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -32,14 +32,14 @@ static OFString *module = nil; static OFString *whitespace[] = { @" \r \t\n\t \tasd \t \t\t\r\n", @" \t\t \t\t \t \t" }; -static of_unichar_t ucstr[] = { +static OFUnichar ucstr[] = { 0xFEFF, 'f', 0xF6, 0xF6, 'b', 0xE4, 'r', 0x1F03A, 0 }; -static of_unichar_t sucstr[] = { +static OFUnichar sucstr[] = { 0xFFFE0000, 0x66000000, 0xF6000000, 0xF6000000, 0x62000000, 0xE4000000, 0x72000000, 0x3AF00100, 0 }; static uint16_t utf16str[] = { 0xFEFF, 'f', 0xF6, 0xF6, 'b', 0xE4, 'r', 0xD83C, 0xDC3A, 0 @@ -89,11 +89,11 @@ return self; } - (instancetype)initWithCString: (const char *)cString - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding length: (size_t)length { self = [super init]; @try { @@ -106,13 +106,13 @@ } return self; } -- (instancetype)initWithUTF16String: (const of_char16_t *)UTF16String +- (instancetype)initWithUTF16String: (const OFChar16 *)UTF16String length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder + byteOrder: (OFByteOrder)byteOrder { self = [super init]; @try { _string = [[OFMutableString alloc] @@ -125,13 +125,13 @@ } return self; } -- (instancetype)initWithUTF32String: (const of_char32_t *)UTF32String +- (instancetype)initWithUTF32String: (const OFChar32 *)UTF32String length: (size_t)length - byteOrder: (of_byte_order_t)byteOrder + byteOrder: (OFByteOrder)byteOrder { self = [super init]; @try { _string = [[OFMutableString alloc] @@ -167,11 +167,11 @@ [_string release]; [super dealloc]; } -- (of_unichar_t)characterAtIndex: (size_t)idx +- (OFUnichar)characterAtIndex: (size_t)idx { return [_string characterAtIndex: idx]; } - (size_t)length @@ -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 @@ -215,11 +215,11 @@ void *pool = objc_autoreleasePoolPush(); OFMutableString *s[3]; OFString *is; OFArray *a; size_t i; - const of_unichar_t *ua; + const OFUnichar *ua; const uint16_t *u16a; OFCharacterSet *cs; EntityHandler *h; #ifdef OF_HAVE_BLOCKS __block int j; @@ -233,34 +233,34 @@ s[2] = [[s[0] copy] autorelease]; TEST(@"-[isEqual:]", [s[0] isEqual: s[2]] && ![s[0] isEqual: [[[OFObject alloc] init] autorelease]]) - TEST(@"-[compare:]", [s[0] compare: s[2]] == OF_ORDERED_SAME && - [s[0] compare: @""] != OF_ORDERED_SAME && - [C(@"") compare: @"a"] == OF_ORDERED_ASCENDING && - [C(@"a") compare: @"b"] == OF_ORDERED_ASCENDING && - [C(@"cd") compare: @"bc"] == OF_ORDERED_DESCENDING && - [C(@"ä") compare: @"ö"] == OF_ORDERED_ASCENDING && - [C(@"€") compare: @"ß"] == OF_ORDERED_DESCENDING && - [C(@"aa") compare: @"z"] == OF_ORDERED_ASCENDING) + TEST(@"-[compare:]", [s[0] compare: s[2]] == OFOrderedSame && + [s[0] compare: @""] != OFOrderedSame && + [C(@"") compare: @"a"] == OFOrderedAscending && + [C(@"a") compare: @"b"] == OFOrderedAscending && + [C(@"cd") compare: @"bc"] == OFOrderedDescending && + [C(@"ä") compare: @"ö"] == OFOrderedAscending && + [C(@"€") compare: @"ß"] == OFOrderedDescending && + [C(@"aa") compare: @"z"] == OFOrderedAscending) #ifdef OF_HAVE_UNICODE_TABLES TEST(@"-[caseInsensitiveCompare:]", - [C(@"a") caseInsensitiveCompare: @"A"] == OF_ORDERED_SAME && - [C(@"Ä") caseInsensitiveCompare: @"ä"] == OF_ORDERED_SAME && - [C(@"я") caseInsensitiveCompare: @"Я"] == OF_ORDERED_SAME && - [C(@"€") caseInsensitiveCompare: @"ß"] == OF_ORDERED_DESCENDING && - [C(@"ß") caseInsensitiveCompare: @"→"] == OF_ORDERED_ASCENDING && - [C(@"AA") caseInsensitiveCompare: @"z"] == OF_ORDERED_ASCENDING && + [C(@"a") caseInsensitiveCompare: @"A"] == OFOrderedSame && + [C(@"Ä") caseInsensitiveCompare: @"ä"] == OFOrderedSame && + [C(@"я") caseInsensitiveCompare: @"Я"] == OFOrderedSame && + [C(@"€") caseInsensitiveCompare: @"ß"] == OFOrderedDescending && + [C(@"ß") caseInsensitiveCompare: @"→"] == OFOrderedAscending && + [C(@"AA") caseInsensitiveCompare: @"z"] == OFOrderedAscending && [[stringClass stringWithUTF8String: "ABC"] caseInsensitiveCompare: [stringClass stringWithUTF8String: "AbD"]] == [C(@"abc") compare: @"abd"]) #else TEST(@"-[caseInsensitiveCompare:]", - [C(@"a") caseInsensitiveCompare: @"A"] == OF_ORDERED_SAME && - [C(@"AA") caseInsensitiveCompare: @"z"] == OF_ORDERED_ASCENDING && + [C(@"a") caseInsensitiveCompare: @"A"] == OFOrderedSame && + [C(@"AA") caseInsensitiveCompare: @"z"] == OFOrderedAscending && [[stringClass stringWithUTF8String: "ABC"] caseInsensitiveCompare: [stringClass stringWithUTF8String: "AbD"]] == [C(@"abc") compare: @"abd"]) #endif @@ -348,16 +348,16 @@ [is isEqual: @"fööbär🀺"]) #ifdef OF_HAVE_FILES TEST(@"+[stringWithContentsOfFile:encoding]", (is = [stringClass stringWithContentsOfFile: @"testfile.txt" - encoding: OF_STRING_ENCODING_ISO_8859_1]) && + encoding: OFStringEncodingISO8859_1]) && [is isEqual: @"testäöü"]) TEST(@"+[stringWithContentsOfURL:encoding]", (is = [stringClass stringWithContentsOfURL: [OFURL fileURLWithPath: @"testfile.txt"] - encoding: OF_STRING_ENCODING_ISO_8859_1]) && + encoding: OFStringEncodingISO8859_1]) && [is isEqual: @"testäöü"]) #endif TEST(@"-[appendUTFString:length:]", R([s[0] appendUTF8String: "\xEF\xBB\xBF" "barqux" length: 6]) && @@ -370,110 +370,110 @@ OFInvalidEncodingException, [stringClass stringWithUTF8String: "\xF0\x80\x80\xC0"]) TEST(@"Conversion of ISO 8859-1 to Unicode", [[stringClass stringWithCString: "\xE4\xF6\xFC" - encoding: OF_STRING_ENCODING_ISO_8859_1] + encoding: OFStringEncodingISO8859_1] isEqual: @"äöü"]) #ifdef HAVE_ISO_8859_15 TEST(@"Conversion of ISO 8859-15 to Unicode", [[stringClass stringWithCString: "\xA4\xA6\xA8\xB4\xB8\xBC\xBD\xBE" - encoding: OF_STRING_ENCODING_ISO_8859_15] + encoding: OFStringEncodingISO8859_15] isEqual: @"€ŠšŽžŒœŸ"]) #endif #ifdef HAVE_WINDOWS_1252 TEST(@"Conversion of Windows 1252 to Unicode", [[stringClass stringWithCString: "\x80\x82\x83\x84\x85\x86\x87\x88" "\x89\x8A\x8B\x8C\x8E\x91\x92\x93" "\x94\x95\x96\x97\x98\x99\x9A\x9B" "\x9C\x9E\x9F" - encoding: OF_STRING_ENCODING_WINDOWS_1252] + encoding: OFStringEncodingWindows1252] isEqual: @"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ"]) #endif #ifdef HAVE_CODEPAGE_437 TEST(@"Conversion of Codepage 437 to Unicode", [[stringClass stringWithCString: "\xB0\xB1\xB2\xDB" - encoding: OF_STRING_ENCODING_CODEPAGE_437] + encoding: OFStringEncodingCodepage437] isEqual: @"░▒▓█"]) #endif TEST(@"Conversion of Unicode to ASCII #1", !strcmp([C(@"This is a test") cStringWithEncoding: - OF_STRING_ENCODING_ASCII], "This is a test")) + OFStringEncodingASCII], "This is a test")) EXPECT_EXCEPTION(@"Conversion of Unicode to ASCII #2", OFInvalidEncodingException, [C(@"This is a tést") - cStringWithEncoding: OF_STRING_ENCODING_ASCII]) + cStringWithEncoding: OFStringEncodingASCII]) TEST(@"Conversion of Unicode to ISO-8859-1 #1", !strcmp([C(@"This is ä test") cStringWithEncoding: - OF_STRING_ENCODING_ISO_8859_1], "This is \xE4 test")) + OFStringEncodingISO8859_1], "This is \xE4 test")) EXPECT_EXCEPTION(@"Conversion of Unicode to ISO-8859-1 #2", OFInvalidEncodingException, [C(@"This is ä t€st") cStringWithEncoding: - OF_STRING_ENCODING_ISO_8859_1]) + OFStringEncodingISO8859_1]) #ifdef HAVE_ISO_8859_15 TEST(@"Conversion of Unicode to ISO-8859-15 #1", !strcmp([C(@"This is ä t€st") cStringWithEncoding: - OF_STRING_ENCODING_ISO_8859_15], "This is \xE4 t\xA4st")) + OFStringEncodingISO8859_15], "This is \xE4 t\xA4st")) EXPECT_EXCEPTION(@"Conversion of Unicode to ISO-8859-15 #2", OFInvalidEncodingException, [C(@"This is ä t€st…") cStringWithEncoding: - OF_STRING_ENCODING_ISO_8859_15]) + OFStringEncodingISO8859_15]) #endif #ifdef HAVE_WINDOWS_1252 TEST(@"Conversion of Unicode to Windows-1252 #1", !strcmp([C(@"This is ä t€st…") cStringWithEncoding: - OF_STRING_ENCODING_WINDOWS_1252], "This is \xE4 t\x80st\x85")) + OFStringEncodingWindows1252], "This is \xE4 t\x80st\x85")) EXPECT_EXCEPTION(@"Conversion of Unicode to Windows-1252 #2", OFInvalidEncodingException, [C(@"This is ä t€st…‼") - cStringWithEncoding: OF_STRING_ENCODING_WINDOWS_1252]) + cStringWithEncoding: OFStringEncodingWindows1252]) #endif #ifdef HAVE_CODEPAGE_437 TEST(@"Conversion of Unicode to Codepage 437 #1", !strcmp([C(@"Tést strîng ░▒▓") cStringWithEncoding: - OF_STRING_ENCODING_CODEPAGE_437], "T\x82st str\x8Cng \xB0\xB1\xB2")) + OFStringEncodingCodepage437], "T\x82st str\x8Cng \xB0\xB1\xB2")) EXPECT_EXCEPTION(@"Conversion of Unicode to Codepage 437 #2", OFInvalidEncodingException, [C(@"T€st strîng ░▒▓") - cStringWithEncoding: OF_STRING_ENCODING_CODEPAGE_437]) + cStringWithEncoding: OFStringEncodingCodepage437]) #endif TEST(@"Lossy conversion of Unicode to ASCII", !strcmp([C(@"This is a tést") lossyCStringWithEncoding: - OF_STRING_ENCODING_ASCII], "This is a t?st")) + OFStringEncodingASCII], "This is a t?st")) TEST(@"Lossy conversion of Unicode to ISO-8859-1", !strcmp([C(@"This is ä t€st") lossyCStringWithEncoding: - OF_STRING_ENCODING_ISO_8859_1], "This is \xE4 t?st")) + OFStringEncodingISO8859_1], "This is \xE4 t?st")) #ifdef HAVE_ISO_8859_15 TEST(@"Lossy conversion of Unicode to ISO-8859-15", !strcmp([C(@"This is ä t€st…") lossyCStringWithEncoding: - OF_STRING_ENCODING_ISO_8859_15], "This is \xE4 t\xA4st?")) + OFStringEncodingISO8859_15], "This is \xE4 t\xA4st?")) #endif #ifdef HAVE_WINDOWS_1252 TEST(@"Lossy conversion of Unicode to Windows-1252", !strcmp([C(@"This is ä t€st…‼") lossyCStringWithEncoding: - OF_STRING_ENCODING_WINDOWS_1252], "This is \xE4 t\x80st\x85?")) + OFStringEncodingWindows1252], "This is \xE4 t\x80st\x85?")) #endif #ifdef HAVE_CODEPAGE_437 TEST(@"Lossy conversion of Unicode to Codepage 437", !strcmp([C(@"T€st strîng ░▒▓") lossyCStringWithEncoding: - OF_STRING_ENCODING_CODEPAGE_437], "T?st str\x8Cng \xB0\xB1\xB2")) + OFStringEncodingCodepage437], "T?st str\x8Cng \xB0\xB1\xB2")) #endif TEST(@"+[stringWithFormat:]", [(s[0] = [mutableStringClass stringWithFormat: @"%@:%d", @"test", 123]) @@ -485,24 +485,24 @@ TEST(@"-[rangeOfString:]", [C(@"𝄞öö") rangeOfString: @"öö"].location == 1 && [C(@"𝄞öö") rangeOfString: @"ö"].location == 1 && [C(@"𝄞öö") rangeOfString: @"𝄞"].location == 0 && - [C(@"𝄞öö") rangeOfString: @"x"].location == OF_NOT_FOUND && + [C(@"𝄞öö") rangeOfString: @"x"].location == OFNotFound && [C(@"𝄞öö") rangeOfString: @"öö" options: OF_STRING_SEARCH_BACKWARDS].location == 1 && [C(@"𝄞öö") rangeOfString: @"ö" options: OF_STRING_SEARCH_BACKWARDS].location == 2 && [C(@"𝄞öö") rangeOfString: @"𝄞" options: OF_STRING_SEARCH_BACKWARDS].location == 0 && [C(@"𝄞öö") rangeOfString: @"x" - options: OF_STRING_SEARCH_BACKWARDS].location == OF_NOT_FOUND) + options: OF_STRING_SEARCH_BACKWARDS].location == OFNotFound) 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)] == OFNotFound) 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:]", @@ -1187,13 +1187,13 @@ TEST(@"-[characters]", (ua = C(@"fööbär🀺").characters) && !memcmp(ua, ucstr + 1, sizeof(ucstr) - 8)) #ifdef OF_BIG_ENDIAN -# define SWAPPED_BYTE_ORDER OF_BYTE_ORDER_LITTLE_ENDIAN +# define SWAPPED_BYTE_ORDER OFByteOrderLittleEndian #else -# define SWAPPED_BYTE_ORDER OF_BYTE_ORDER_BIG_ENDIAN +# define SWAPPED_BYTE_ORDER OFByteOrderBigEndian #endif TEST(@"-[UTF16String]", (u16a = C(@"fööbär🀺").UTF16String) && !memcmp(u16a, utf16str + 1, of_string_utf16_length(utf16str) * 2) && (u16a = [C(@"fööbär🀺") UTF16StringWithByteOrder: SWAPPED_BYTE_ORDER]) && @@ -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,30 @@ @implementation TestsAppDelegate (OFValueTests) - (void)valueTests { void *pool = objc_autoreleasePoolPush(); - of_range_t range = of_range(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; + 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 - 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 +74,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]) @@ -94,71 +93,70 @@ TEST(@"+[valueWithPoint:]", (value = [OFValue valueWithPoint: point])) TEST(@"-[pointValue]", - of_point_equal(value.pointValue, point) && + OFEqualPoints(value.pointValue, point) && (value = [OFValue valueWithBytes: &point - objCType: @encode(of_point_t)]) && - of_point_equal(value.pointValue, point)) + objCType: @encode(OFPoint)]) && + OFEqualPoints(value.pointValue, point)) TEST(@"-[getValue:size:] for OFPointValue", (value = [OFValue valueWithPoint: point]) && R([value getValue: &point2 size: sizeof(point2)]) && - of_point_equal(point2, point)) + OFEqualPoints(point2, point)) EXPECT_EXCEPTION(@"-[pointValue] with wrong size throws", OFOutOfRangeException, [[OFValue valueWithBytes: "a" objCType: @encode(char)] pointValue]) - TEST(@"+[valueWithDimension:]", - (value = [OFValue valueWithDimension: dimension])) - - TEST(@"-[dimensionValue]", - of_dimension_equal(value.dimensionValue, dimension) && - (value = [OFValue valueWithBytes: &dimension - objCType: @encode(of_dimension_t)]) && - of_dimension_equal(value.dimensionValue, dimension)) - - TEST(@"-[getValue:size:] for OFDimensionValue", - (value = [OFValue valueWithDimension: dimension]) && - R([value getValue: &dimension2 size: sizeof(dimension2)]) && - of_dimension_equal(dimension2, dimension)) - - EXPECT_EXCEPTION(@"-[dimensionValue] with wrong size throws", - OFOutOfRangeException, - [[OFValue valueWithBytes: "a" - objCType: @encode(char)] dimensionValue]) - - TEST(@"+[valueWithRectangle:]", - (value = [OFValue valueWithRectangle: rectangle])) - - TEST(@"-[rectangleValue]", - of_rectangle_equal(value.rectangleValue, rectangle) && - (value = [OFValue valueWithBytes: &rectangle - objCType: @encode(of_rectangle_t)]) && - of_rectangle_equal(value.rectangleValue, rectangle)) - - TEST(@"-[getValue:size:] for OFRectangleValue", - (value = [OFValue valueWithRectangle: rectangle]) && - R([value getValue: &rectangle2 size: sizeof(rectangle2)]) && - of_rectangle_equal(rectangle2, rectangle)) - - EXPECT_EXCEPTION(@"-[rectangleValue] with wrong size throws", - OFOutOfRangeException, - [[OFValue valueWithBytes: "a" - objCType: @encode(char)] rectangleValue]) - - TEST(@"-[isEqual:]", - [[OFValue valueWithRectangle: rectangle] - isEqual: [OFValue valueWithBytes: &rectangle - objCType: @encode(of_rectangle_t)]] && + TEST(@"+[valueWithSize:]", + (value = [OFValue valueWithSize: size])) + + TEST(@"-[sizeValue]", + OFEqualSizes(value.sizeValue, size) && + (value = [OFValue valueWithBytes: &size + objCType: @encode(OFSize)]) && + OFEqualSizes(value.sizeValue, size)) + + TEST(@"-[getValue:size:] for OFSizeValue", + (value = [OFValue valueWithSize: size]) && + R([value getValue: &size2 size: sizeof(size2)]) && + OFEqualSizes(size2, size)) + + EXPECT_EXCEPTION(@"-[sizeValue] with wrong size throws", + OFOutOfRangeException, + [[OFValue valueWithBytes: "a" + objCType: @encode(char)] sizeValue]) + + TEST(@"+[valueWithRect:]", + (value = [OFValue valueWithRect: rect])) + + TEST(@"-[rectValue]", + OFEqualRects(value.rectValue, rect) && + (value = [OFValue valueWithBytes: &rect + objCType: @encode(OFRect)]) && + OFEqualRects(value.rectValue, rect)) + + TEST(@"-[getValue:size:] for OFRectValue", + (value = [OFValue valueWithRect: rect]) && + R([value getValue: &rect2 size: sizeof(rect2)]) && + OFEqualRects(rect2, rect)) + + EXPECT_EXCEPTION(@"-[rectValue] with wrong size throws", + OFOutOfRangeException, + [[OFValue valueWithBytes: "a" objCType: @encode(char)] rectValue]) + + TEST(@"-[isEqual:]", + [[OFValue valueWithRect: rect] + isEqual: [OFValue valueWithBytes: &rect + objCType: @encode(OFRect)]] && ![[OFValue valueWithBytes: "a" objCType: @encode(signed char)] isEqual: [OFValue valueWithBytes: "a" objCType: @encode(unsigned char)]] && ![[OFValue valueWithBytes: "a" objCType: @encode(char)] isEqual: [OFValue valueWithBytes: "b" objCType: @encode(char)]]) objc_autoreleasePoolPop(pool); } @end Index: tests/terminal/TerminalTests.m ================================================================== --- tests/terminal/TerminalTests.m +++ tests/terminal/TerminalTests.m @@ -90,25 +90,25 @@ [OFThread sleepForTimeInterval: 2]; [of_stdout clear]; [OFThread sleepForTimeInterval: 2]; - [of_stdout setCursorPosition: of_point(5, 3)]; + [of_stdout setCursorPosition: OFMakePoint(5, 3)]; [of_stdout writeString: @"Text at (5, 3)"]; [OFThread sleepForTimeInterval: 2]; - [of_stdout setRelativeCursorPosition: of_point(-2, 0)]; - [OFThread sleepForTimeInterval: 2]; - [of_stdout setRelativeCursorPosition: of_point(2, 0)]; - [OFThread sleepForTimeInterval: 2]; - [of_stdout setRelativeCursorPosition: of_point(0, -2)]; - [OFThread sleepForTimeInterval: 2]; - [of_stdout setRelativeCursorPosition: of_point(0, 2)]; - [OFThread sleepForTimeInterval: 2]; - [of_stdout setRelativeCursorPosition: of_point(1, 1)]; - [OFThread sleepForTimeInterval: 2]; - [of_stdout setRelativeCursorPosition: of_point(-1, -1)]; + [of_stdout setRelativeCursorPosition: OFMakePoint(-2, 0)]; + [OFThread sleepForTimeInterval: 2]; + [of_stdout setRelativeCursorPosition: OFMakePoint(2, 0)]; + [OFThread sleepForTimeInterval: 2]; + [of_stdout setRelativeCursorPosition: OFMakePoint(0, -2)]; + [OFThread sleepForTimeInterval: 2]; + [of_stdout setRelativeCursorPosition: OFMakePoint(0, 2)]; + [OFThread sleepForTimeInterval: 2]; + [of_stdout setRelativeCursorPosition: OFMakePoint(1, 1)]; + [OFThread sleepForTimeInterval: 2]; + [of_stdout setRelativeCursorPosition: OFMakePoint(-1, -1)]; [OFThread sleepForTimeInterval: 2]; [of_stdout setCursorColumn: 2]; [OFThread sleepForTimeInterval: 2]; Index: utils/ofarc/Archive.h ================================================================== --- utils/ofarc/Archive.h +++ utils/ofarc/Archive.h @@ -18,15 +18,15 @@ #import "OFArray.h" @protocol Archive + (instancetype)archiveWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; - (instancetype)initWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; - (void)listFiles; - (void)extractFiles: (OFArray OF_GENERIC(OFString *) *)files; - (void)printFiles: (OFArray OF_GENERIC(OFString *) *)files; @optional - (void)addFiles: (OFArray OF_GENERIC(OFString *) *)files; @end Index: utils/ofarc/GZIPArchive.m ================================================================== --- utils/ofarc/GZIPArchive.m +++ utils/ofarc/GZIPArchive.m @@ -65,20 +65,20 @@ app = (OFArc *)[OFApplication sharedApplication].delegate; } + (instancetype)archiveWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return [[[self alloc] initWithStream: stream mode: mode encoding: encoding] autorelease]; } - (instancetype)initWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { self = [super init]; @try { _stream = [[OFGZIPStream alloc] initWithStream: stream Index: utils/ofarc/LHAArchive.m ================================================================== --- utils/ofarc/LHAArchive.m +++ utils/ofarc/LHAArchive.m @@ -88,28 +88,28 @@ app = (OFArc *)[OFApplication sharedApplication].delegate; } + (instancetype)archiveWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return [[[self alloc] initWithStream: stream mode: mode encoding: encoding] autorelease]; } - (instancetype)initWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { self = [super init]; @try { _archive = [[OFLHAArchive alloc] initWithStream: stream mode: mode]; - if (encoding != OF_STRING_ENCODING_AUTODETECT) + if (encoding != OFStringEncodingAutodetect) _archive.encoding = encoding; } @catch (id e) { [self release]; @throw e; } Index: utils/ofarc/OFArc.h ================================================================== --- utils/ofarc/OFArc.h +++ utils/ofarc/OFArc.h @@ -37,15 +37,15 @@ } - (id )openArchiveWithPath: (OFString *)path type: (OFString *)type mode: (char)mode - encoding: (of_string_encoding_t)encoding; + encoding: (OFStringEncoding)encoding; - (bool)shouldExtractFile: (OFString *)fileName outFileName: (OFString *)outFileName; - (ssize_t)copyBlockFromStream: (OFStream *)input toStream: (OFStream *)output fileName: (OFString *)fileName; - (nullable OFString *)safeLocalPathForPath: (OFString *)path; @end OF_ASSUME_NONNULL_END Index: utils/ofarc/OFArc.m ================================================================== --- utils/ofarc/OFArc.m +++ utils/ofarc/OFArc.m @@ -79,12 +79,12 @@ [OFApplication terminateWithStatus: status]; } static void -mutuallyExclusiveError(of_unichar_t shortOption1, OFString *longOption1, - of_unichar_t shortOption2, OFString *longOption2) +mutuallyExclusiveError(OFUnichar shortOption1, OFString *longOption1, + OFUnichar shortOption2, OFString *longOption2) { OFString *shortOption1Str = [OFString stringWithFormat: @"%C", shortOption1]; OFString *shortOption2Str = [OFString stringWithFormat: @"%C", shortOption2]; @@ -99,15 +99,15 @@ @"longopt2", longOption2)]; [OFApplication terminateWithStatus: 1]; } static void -mutuallyExclusiveError5(of_unichar_t shortOption1, OFString *longOption1, - of_unichar_t shortOption2, OFString *longOption2, - of_unichar_t shortOption3, OFString *longOption3, - of_unichar_t shortOption4, OFString *longOption4, - of_unichar_t shortOption5, OFString *longOption5) +mutuallyExclusiveError5(OFUnichar shortOption1, OFString *longOption1, + OFUnichar shortOption2, OFString *longOption2, + OFUnichar shortOption3, OFString *longOption3, + OFUnichar shortOption4, OFString *longOption4, + OFUnichar shortOption5, OFString *longOption5) { OFString *shortOption1Str = [OFString stringWithFormat: @"%C", shortOption1]; OFString *shortOption2Str = [OFString stringWithFormat: @"%C", shortOption2]; @@ -163,12 +163,12 @@ { 't', @"type", 1, NULL, &type }, { 'v', @"verbose", 0, NULL, NULL }, { 'x', @"extract", 0, NULL, NULL }, { '\0', nil, 0, NULL, NULL } }; - of_unichar_t option, mode = '\0'; - of_string_encoding_t encoding = OF_STRING_ENCODING_AUTODETECT; + OFUnichar option, mode = '\0'; + OFStringEncoding encoding = OFStringEncodingAutodetect; OFOptionsParser *optionsParser; OFArray OF_GENERIC(OFString *) *remainingArguments, *files; id archive; #ifdef OF_HAVE_SANDBOX @@ -294,11 +294,11 @@ } } @try { if (encodingString != nil) - encoding = of_string_parse_encoding(encodingString); + encoding = OFParseStringEncodingName(encodingString); } @catch (OFInvalidArgumentException *e) { [of_stderr writeLine: OF_LOCALIZED( @"invalid_encoding", @"%[prog]: Invalid encoding: %[encoding]", @"prog", [OFApplication programName], @@ -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"]; @@ -462,11 +462,11 @@ } - (id )openArchiveWithPath: (OFString *)path type: (OFString *)type mode: (char)mode - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { OFString *modeString, *fileModeString; OFStream *file = nil; id archive = nil; Index: utils/ofarc/TarArchive.m ================================================================== --- utils/ofarc/TarArchive.m +++ utils/ofarc/TarArchive.m @@ -66,28 +66,28 @@ app = (OFArc *)[OFApplication sharedApplication].delegate; } + (instancetype)archiveWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return [[[self alloc] initWithStream: stream mode: mode encoding: encoding] autorelease]; } - (instancetype)initWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { self = [super init]; @try { _archive = [[OFTarArchive alloc] initWithStream: stream mode: mode]; - if (encoding != OF_STRING_ENCODING_AUTODETECT) + if (encoding != OFStringEncodingAutodetect) _archive.encoding = encoding; } @catch (id e) { [self release]; @throw e; } Index: utils/ofarc/ZIPArchive.m ================================================================== --- utils/ofarc/ZIPArchive.m +++ utils/ofarc/ZIPArchive.m @@ -78,20 +78,20 @@ app = (OFArc *)[OFApplication sharedApplication].delegate; } + (instancetype)archiveWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { return [[[self alloc] initWithStream: stream mode: mode encoding: encoding] autorelease]; } - (instancetype)initWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode - encoding: (of_string_encoding_t)encoding + encoding: (OFStringEncoding)encoding { self = [super init]; @try { _archive = [[OFZIPArchive alloc] initWithStream: stream Index: utils/ofdns/OFDNS.m ================================================================== --- utils/ofdns/OFDNS.m +++ utils/ofdns/OFDNS.m @@ -90,11 +90,11 @@ { 't', @"type", 1, NULL, NULL }, { '\0', nil, 0, NULL, NULL } }; OFMutableArray OF_GENERIC(OFString *) *recordTypes; OFOptionsParser *optionsParser; - of_unichar_t option; + OFUnichar option; OFArray OF_GENERIC(OFString *) *remainingArguments; OFDNSResolver *resolver; of_dns_class_t DNSClass; #ifdef OF_HAVE_FILES Index: utils/ofhash/OFHash.m ================================================================== --- utils/ofhash/OFHash.m +++ utils/ofhash/OFHash.m @@ -80,11 +80,11 @@ { '\0', @"sha512", 0, &calculateSHA512, NULL }, { '\0', nil, 0, NULL, NULL } }; OFOptionsParser *optionsParser = [OFOptionsParser parserWithOptions: options]; - of_unichar_t option; + OFUnichar option; OFMD5Hash *MD5Hash = nil; OFRIPEMD160Hash *RIPEMD160Hash = nil; OFSHA1Hash *SHA1Hash = nil; OFSHA224Hash *SHA224Hash = nil; OFSHA256Hash *SHA256Hash = nil; Index: utils/ofhttp/OFHTTP.m ================================================================== --- utils/ofhttp/OFHTTP.m +++ utils/ofhttp/OFHTTP.m @@ -315,11 +315,11 @@ - (void)addHeader: (OFString *)header { size_t pos = [header rangeOfString: @":"].location; OFString *name, *value; - if (pos == OF_NOT_FOUND) { + if (pos == OFNotFound) { [of_stderr writeLine: OF_LOCALIZED(@"invalid_input_header", @"%[prog]: Headers must to be in format name:value!", @"prog", [OFApplication programName])]; [OFApplication terminateWithStatus: 1]; } @@ -389,11 +389,11 @@ rangeOfString: @":" options: OF_STRING_SEARCH_BACKWARDS].location; OFString *host; unsigned long long port; - if (pos == OF_NOT_FOUND) + if (pos == OFNotFound) @throw [OFInvalidFormatException exception]; host = [proxy substringToIndex: pos]; port = [proxy substringFromIndex: pos + 1] .unsignedLongLongValue; @@ -429,11 +429,11 @@ { '\0', @"insecure", 0, &_insecure, NULL }, { '\0', @"ignore-status", 0, &_ignoreStatus, NULL }, { '\0', nil, 0, NULL, NULL } }; OFOptionsParser *optionsParser; - of_unichar_t option; + OFUnichar option; #ifdef OF_HAVE_SANDBOX OFSandbox *sandbox = [OFSandbox sandbox]; sandbox.allowsStdIO = true; sandbox.allowsReadingFiles = true; @@ -571,11 +571,11 @@ } if (_insecure) _HTTPClient.allowsInsecureRedirects = true; - _useUnicode = ([OFLocale encoding] == OF_STRING_ENCODING_UTF_8); + _useUnicode = ([OFLocale encoding] == OFStringEncodingUTF8); [self performSelector: @selector(downloadNextURL) afterDelay: 0]; } - (void)client: (OFHTTPClient *)client