@@ -46,11 +46,11 @@ { self = [super init]; @try { _HTTPClient = [[OFHTTPClient alloc] init]; - [_HTTPClient setDelegate: self]; + _HTTPClient.delegate = self; _uppercaseTableSize = SIZE_MAX; _lowercaseTableSize = SIZE_MAX; _titlecaseTableSize = SIZE_MAX; _casefoldingTableSize = SIZE_MAX; @@ -108,17 +108,17 @@ while ((line = [response readLine]) != nil) { void *pool2; OFArray OF_GENERIC(OFString *) *components; of_unichar_t codePoint; - if ([line length] == 0) + if (line.length == 0) continue; pool2 = objc_autoreleasePoolPush(); components = [line componentsSeparatedByString: @";"]; - if ([components count] != 15) { + if (components.count != 15) { of_log(@"Invalid line: %@\n", line); [OFApplication terminateWithStatus: 1]; } codePoint = (of_unichar_t) @@ -138,21 +138,21 @@ OFArray *decomposed = [[components objectAtIndex: 5] componentsSeparatedByString: @" "]; bool compat = false; OFMutableString *string; - if ([[decomposed firstObject] hasPrefix: @"<"]) { + if ([decomposed.firstObject hasPrefix: @"<"]) { decomposed = [decomposed objectsInRange: - of_range(1, [decomposed count] - 1)]; + of_range(1, decomposed.count - 1)]; compat = true; } string = [OFMutableString string]; for (OFString *character in decomposed) { of_unichar_t unichar = - (of_unichar_t)[character hexadecimalValue]; + (of_unichar_t)character.hexadecimalValue; [string appendCharacters: &unichar length: 1]; } @@ -187,17 +187,17 @@ while ((line = [response readLine]) != nil) { void *pool2; OFArray OF_GENERIC(OFString *) *components; of_unichar_t codePoint; - if ([line length] == 0 || [line hasPrefix: @"#"]) + if (line.length == 0 || [line hasPrefix: @"#"]) continue; pool2 = objc_autoreleasePoolPush(); components = [line componentsSeparatedByString: @"; "]; - if ([components count] != 4) { + if (components.count != 4) { of_log(@"Invalid line: %s\n", line); [OFApplication terminateWithStatus: 1]; } if (![[components objectAtIndex: 1] isEqual: @"S"] && @@ -237,12 +237,12 @@ if (table[i] == nil) continue; pool = objc_autoreleasePoolPush(); - characters = [table[i] characters]; - length = [table[i] length]; + characters = table[i].characters; + length = table[i].length; replacement = [OFMutableString string]; for (size_t j = 0; j < length; j++) { if (characters[j] > 0x10FFFF) @throw [OFOutOfRangeException @@ -276,14 +276,14 @@ OFURL *URL; [of_stdout writeString: @"Writing files…"]; URL = [OFURL fileURLWithPath: @"../src/unicode.m"]; - [self writeTablesToFile: [URL fileSystemRepresentation]]; + [self writeTablesToFile: URL.fileSystemRepresentation]; URL = [OFURL fileURLWithPath: @"../src/unicode.h"]; - [self writeHeaderToFile: [URL fileSystemRepresentation]]; + [self writeHeaderToFile: URL.fileSystemRepresentation]; [of_stdout writeLine: @" done"]; [OFApplication terminate]; } @@ -316,25 +316,25 @@ } if (!isEmpty) { void *pool2 = objc_autoreleasePoolPush(); - [file writeString: [OFString stringWithFormat: - @"static const of_unichar_t " - @"uppercasePage%u[0x100] = {\n", i >> 8]]; + [file writeFormat: @"static const of_unichar_t " + @"uppercasePage%u[0x100] = {\n", + i >> 8]; for (of_unichar_t j = i; j < i + 0x100; j += 8) - [file writeString: [OFString stringWithFormat: + [file writeFormat: @"\t%u, %u, %u, %u, %u, %u, %u, %u,\n", _uppercaseTable[j], _uppercaseTable[j + 1], _uppercaseTable[j + 2], _uppercaseTable[j + 3], _uppercaseTable[j + 4], _uppercaseTable[j + 5], _uppercaseTable[j + 6], - _uppercaseTable[j + 7]]]; + _uppercaseTable[j + 7]]; [file writeString: @"};\n\n"]; objc_autoreleasePoolPop(pool2); } @@ -354,25 +354,25 @@ } if (!isEmpty) { void *pool2 = objc_autoreleasePoolPush(); - [file writeString: [OFString stringWithFormat: - @"static const of_unichar_t " - @"lowercasePage%u[0x100] = {\n", i >> 8]]; + [file writeFormat: @"static const of_unichar_t " + @"lowercasePage%u[0x100] = {\n", + i >> 8]; for (of_unichar_t j = i; j < i + 0x100; j += 8) - [file writeString: [OFString stringWithFormat: + [file writeFormat: @"\t%u, %u, %u, %u, %u, %u, %u, %u,\n", _lowercaseTable[j], _lowercaseTable[j + 1], _lowercaseTable[j + 2], _lowercaseTable[j + 3], _lowercaseTable[j + 4], _lowercaseTable[j + 5], _lowercaseTable[j + 6], - _lowercaseTable[j + 7]]]; + _lowercaseTable[j + 7]]; [file writeString: @"};\n\n"]; objc_autoreleasePoolPop(pool2); } @@ -395,25 +395,25 @@ } if (!isEmpty) { void *pool2 = objc_autoreleasePoolPush(); - [file writeString: [OFString stringWithFormat: - @"static const of_unichar_t " - @"titlecasePage%u[0x100] = {\n", i >> 8]]; + [file writeFormat: @"static const of_unichar_t " + @"titlecasePage%u[0x100] = {\n", + i >> 8]; for (of_unichar_t j = i; j < i + 0x100; j += 8) - [file writeString: [OFString stringWithFormat: + [file writeFormat: @"\t%u, %u, %u, %u, %u, %u, %u, %u,\n", _titlecaseTable[j], _titlecaseTable[j + 1], _titlecaseTable[j + 2], _titlecaseTable[j + 3], _titlecaseTable[j + 4], _titlecaseTable[j + 5], _titlecaseTable[j + 6], - _titlecaseTable[j + 7]]]; + _titlecaseTable[j + 7]]; [file writeString: @"};\n\n"]; objc_autoreleasePoolPop(pool2); } @@ -436,25 +436,25 @@ } if (!isEmpty) { void *pool2 = objc_autoreleasePoolPush(); - [file writeString: [OFString stringWithFormat: - @"static const of_unichar_t " - @"casefoldingPage%u[0x100] = {\n", i >> 8]]; + [file writeFormat: @"static const of_unichar_t " + @"casefoldingPage%u[0x100] = {\n", + i >> 8]; for (of_unichar_t j = i; j < i + 0x100; j += 8) - [file writeString: [OFString stringWithFormat: + [file writeFormat: @"\t%u, %u, %u, %u, %u, %u, %u, %u,\n", _casefoldingTable[j], _casefoldingTable[j + 1], _casefoldingTable[j + 2], _casefoldingTable[j + 3], _casefoldingTable[j + 4], _casefoldingTable[j + 5], _casefoldingTable[j + 6], - _casefoldingTable[j + 7]]]; + _casefoldingTable[j + 7]]; [file writeString: @"};\n\n"]; objc_autoreleasePoolPop(pool2); } @@ -475,25 +475,25 @@ } if (!isEmpty) { void *pool2 = objc_autoreleasePoolPush(); - [file writeString: [OFString stringWithFormat: - @"static const char *const " - @"decompositionPage%u[0x100] = {\n", i >> 8]]; + [file writeFormat: @"static const char *const " + @"decompositionPage%u[0x100] = {\n", + i >> 8]; for (of_unichar_t j = i; j < i + 0x100; j++) { if ((j - i) % 2 == 0) [file writeString: @"\t"]; else [file writeString: @" "]; if (_decompositionTable[j] != nil) { const char *UTF8String = - [_decompositionTable[j] UTF8String]; - size_t length = [_decompositionTable[j] - UTF8StringLength]; + _decompositionTable[j].UTF8String; + size_t length = _decompositionTable[j] + .UTF8StringLength; [file writeString: @"\""]; for (size_t k = 0; k < length; k++) [file writeFormat: @@ -538,27 +538,27 @@ } if (!isEmpty) { void *pool2 = objc_autoreleasePoolPush(); - [file writeString: [OFString stringWithFormat: - @"static const char *const " - @"decompCompatPage%u[0x100] = {\n", i >> 8]]; + [file writeFormat: @"static const char *const " + @"decompCompatPage%u[0x100] = {\n", + i >> 8]; for (of_unichar_t j = i; j < i + 0x100; j++) { if ((j - i) % 2 == 0) [file writeString: @"\t"]; else [file writeString: @" "]; if (_decompositionCompatTable[j] != nil) { const char *UTF8String = - [_decompositionCompatTable[j] - UTF8String]; + _decompositionCompatTable[j] + .UTF8String; size_t length = - [_decompositionCompatTable[j] - UTF8StringLength]; + _decompositionCompatTable[j] + .UTF8StringLength; [file writeString: @"\""]; for (size_t k = 0; k < length; k++) [file writeFormat: @@ -589,18 +589,17 @@ _casefoldingTableSize++; _decompositionTableSize++; _decompositionCompatTableSize++; /* Write of_unicode_uppercase_table */ - [file writeString: [OFString stringWithFormat: - @"const of_unichar_t *const of_unicode_uppercase_table[0x%X] = " - @"{\n\t", _uppercaseTableSize]]; + [file writeFormat: @"const of_unichar_t *const " + @"of_unicode_uppercase_table[0x%X] = {\n\t", + _uppercaseTableSize]; for (of_unichar_t i = 0; i < _uppercaseTableSize; i++) { if (_uppercaseTableUsed[i]) - [file writeString: [OFString stringWithFormat: - @"uppercasePage%u", i]]; + [file writeFormat: @"uppercasePage%u", i]; else [file writeString: @"emptyPage"]; if (i + 1 < _uppercaseTableSize) { if ((i + 1) % 4 == 0) @@ -611,18 +610,17 @@ } [file writeString: @"\n};\n\n"]; /* Write of_unicode_lowercase_table */ - [file writeString: [OFString stringWithFormat: - @"const of_unichar_t *const of_unicode_lowercase_table[0x%X] = " - @"{\n\t", _lowercaseTableSize]]; + [file writeFormat: @"const of_unichar_t *const " + @"of_unicode_lowercase_table[0x%X] = {\n\t", + _lowercaseTableSize]; for (of_unichar_t i = 0; i < _lowercaseTableSize; i++) { if (_lowercaseTableUsed[i]) - [file writeString: [OFString stringWithFormat: - @"lowercasePage%u", i]]; + [file writeFormat: @"lowercasePage%u", i]; else [file writeString: @"emptyPage"]; if (i + 1 < _lowercaseTableSize) { if ((i + 1) % 4 == 0) @@ -633,21 +631,19 @@ } [file writeString: @"\n};\n\n"]; /* Write of_unicode_titlecase_table */ - [file writeString: [OFString stringWithFormat: - @"const of_unichar_t *const of_unicode_titlecase_table[0x%X] = {" - @"\n\t", _titlecaseTableSize]]; + [file writeFormat: @"const of_unichar_t *const " + @"of_unicode_titlecase_table[0x%X] = {\n\t", + _titlecaseTableSize]; for (of_unichar_t i = 0; i < _titlecaseTableSize; i++) { if (_titlecaseTableUsed[i] == 1) - [file writeString: [OFString stringWithFormat: - @"titlecasePage%u", i]]; + [file writeFormat: @"titlecasePage%u", i]; else if (_titlecaseTableUsed[i] == 2) - [file writeString: [OFString stringWithFormat: - @"uppercasePage%u", i]]; + [file writeFormat: @"uppercasePage%u", i]; else [file writeString: @"emptyPage"]; if (i + 1 < _titlecaseTableSize) { if ((i + 1) % 4 == 0) @@ -658,21 +654,19 @@ } [file writeString: @"\n};\n\n"]; /* Write of_unicode_casefolding_table */ - [file writeString: [OFString stringWithFormat: - @"const of_unichar_t *const of_unicode_casefolding_table[0x%X] = " - @"{\n\t", _casefoldingTableSize]]; + [file writeFormat: @"const of_unichar_t *const " + @"of_unicode_casefolding_table[0x%X] = {\n\t", + _casefoldingTableSize]; for (of_unichar_t i = 0; i < _casefoldingTableSize; i++) { if (_casefoldingTableUsed[i] == 1) - [file writeString: [OFString stringWithFormat: - @"casefoldingPage%u", i]]; + [file writeFormat: @"casefoldingPage%u", i]; else if (_casefoldingTableUsed[i] == 2) - [file writeString: [OFString stringWithFormat: - @"lowercasePage%u", i]]; + [file writeFormat: @"lowercasePage%u", i]; else [file writeString: @"emptyPage"]; if (i + 1 < _casefoldingTableSize) { if ((i + 1) % 3 == 0) @@ -683,18 +677,17 @@ } [file writeString: @"\n};\n\n"]; /* Write of_unicode_decomposition_table */ - [file writeString: [OFString stringWithFormat: - @"const char *const *of_unicode_decomposition_table[0x%X] = " - @"{\n\t", _decompositionTableSize]]; + [file writeFormat: @"const char *const " + @"*of_unicode_decomposition_table[0x%X] = {\n\t", + _decompositionTableSize]; for (of_unichar_t i = 0; i < _decompositionTableSize; i++) { if (_decompositionTableUsed[i]) - [file writeString: [OFString stringWithFormat: - @"decompositionPage%u", i]]; + [file writeFormat: @"decompositionPage%u", i]; else [file writeString: @"emptyDecompositionPage"]; if (i + 1 < _decompositionTableSize) { if ((i + 1) % 3 == 0) @@ -705,21 +698,20 @@ } [file writeString: @"\n};\n\n"]; /* Write of_unicode_decomposition_compat_table */ - [file writeString: [OFString stringWithFormat: - @"const char *const *of_unicode_decomposition_compat_table[0x%X] = " - @"{\n\t", _decompositionCompatTableSize]]; + [file writeFormat: @"const char *const " + @"*of_unicode_decomposition_compat_table[0x%X] = {" + @"\n\t", + _decompositionCompatTableSize]; for (of_unichar_t i = 0; i < _decompositionCompatTableSize; i++) { if (_decompositionCompatTableUsed[i] == 1) - [file writeString: [OFString stringWithFormat: - @"decompCompatPage%u", i]]; + [file writeFormat: @"decompCompatPage%u", i]; else if (_decompositionCompatTableUsed[i] == 2) - [file writeString: [OFString stringWithFormat: - @"decompositionPage%u", i]]; + [file writeFormat: @"decompositionPage%u", i]; else [file writeString: @"emptyDecompositionPage"]; if (i + 1 < _decompositionCompatTableSize) { if ((i + 1) % 3 == 0) @@ -741,20 +733,20 @@ mode: @"w"]; [file writeString: COPYRIGHT @"#import \"OFString.h\"\n\n"]; - [file writeString: [OFString stringWithFormat: + [file writeFormat: @"#define OF_UNICODE_UPPERCASE_TABLE_SIZE 0x%X\n" @"#define OF_UNICODE_LOWERCASE_TABLE_SIZE 0x%X\n" @"#define OF_UNICODE_TITLECASE_TABLE_SIZE 0x%X\n" @"#define OF_UNICODE_CASEFOLDING_TABLE_SIZE 0x%X\n" @"#define OF_UNICODE_DECOMPOSITION_TABLE_SIZE 0x%X\n" @"#define OF_UNICODE_DECOMPOSITION_COMPAT_TABLE_SIZE 0x%X\n\n", _uppercaseTableSize, _lowercaseTableSize, _titlecaseTableSize, _casefoldingTableSize, _decompositionTableSize, - _decompositionCompatTableSize]]; + _decompositionCompatTableSize]; [file writeString: @"#ifdef __cplusplus\n" @"extern \"C\" {\n" @"#endif\n"