@@ -99,31 +99,31 @@ @end @interface OFStringPlaceholder: OFString @end -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 *, +extern bool OFUnicodeToISO8859_2(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool OFUnicodeToISO8859_3(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool OFUnicodeToISO8859_15(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool OFUnicodeToWindows1251(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool OFUnicodeToWindows1252(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool OFUnicodeToCodepage437(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool OFUnicodeToCodepage850(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool OFUnicodeToCodepage858(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool OFUnicodeToMacRoman(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool OFUnicodeToKOI8R(const OFUnichar *, unsigned char *, + size_t, bool); +extern bool OFUnicodeToKOI8U(const OFUnichar *, unsigned char *, size_t, bool); /* References for static linking */ void _references_to_categories_of_OFString(void) @@ -239,11 +239,11 @@ return nil; } size_t -of_string_utf8_encode(OFUnichar character, char *buffer) +OFUTF8StringEncode(OFUnichar character, char *buffer) { if (character < 0x80) { buffer[0] = character; return 1; } else if (character < 0x800) { @@ -265,11 +265,11 @@ return 0; } ssize_t -of_string_utf8_decode(const char *buffer_, size_t length, OFUnichar *ret) +OFUTF8StringDecode(const char *buffer_, size_t length, OFUnichar *ret) { const unsigned char *buffer = (const unsigned char *)buffer_; if (!(*buffer & 0x80)) { *ret = buffer[0]; @@ -315,11 +315,11 @@ return 0; } size_t -of_string_utf16_length(const OFChar16 *string) +OFUTF16StringLength(const OFChar16 *string) { size_t length = 0; while (*string++ != 0) length++; @@ -326,11 +326,11 @@ return length; } size_t -of_string_utf32_length(const OFChar32 *string) +OFUTF32StringLength(const OFChar32 *string) { size_t length = 0; while (*string++ != 0) length++; @@ -897,11 +897,11 @@ } - (instancetype)initWithUTF16String: (const OFChar16 *)string { return [self initWithUTF16String: string - length: of_string_utf16_length(string) + length: OFUTF16StringLength(string) byteOrder: OFByteOrderNative]; } - (instancetype)initWithUTF16String: (const OFChar16 *)string length: (size_t)length @@ -913,11 +913,11 @@ - (instancetype)initWithUTF16String: (const OFChar16 *)string byteOrder: (OFByteOrder)byteOrder { return [self initWithUTF16String: string - length: of_string_utf16_length(string) + length: OFUTF16StringLength(string) byteOrder: byteOrder]; } - (instancetype)initWithUTF16String: (const OFChar16 *)string length: (size_t)length @@ -927,11 +927,11 @@ } - (instancetype)initWithUTF32String: (const OFChar32 *)string { return [self initWithUTF32String: string - length: of_string_utf32_length(string) + length: OFUTF32StringLength(string) byteOrder: OFByteOrderNative]; } - (instancetype)initWithUTF32String: (const OFChar32 *)string length: (size_t)length @@ -943,11 +943,11 @@ - (instancetype)initWithUTF32String: (const OFChar32 *)string byteOrder: (OFByteOrder)byteOrder { return [self initWithUTF32String: string - length: of_string_utf32_length(string) + length: OFUTF32StringLength(string) byteOrder: byteOrder]; } - (instancetype)initWithUTF32String: (const OFChar32 *)string length: (size_t)length @@ -1126,12 +1126,11 @@ case OFStringEncodingUTF8:; size_t j = 0; for (i = 0; i < length; i++) { char buffer[4]; - size_t len = of_string_utf8_encode(characters[i], - buffer); + size_t len = OFUTF8StringEncode(characters[i], buffer); /* * Check for one more than the current index, as we * need one for the terminating zero. */ @@ -1199,12 +1198,12 @@ #ifdef HAVE_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)) + if (!OFUnicodeToISO8859_2(characters, (unsigned char *)cString, + length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; @@ -1212,12 +1211,12 @@ #ifdef HAVE_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)) + if (!OFUnicodeToISO8859_3(characters, (unsigned char *)cString, + length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; @@ -1225,12 +1224,12 @@ #ifdef HAVE_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)) + if (!OFUnicodeToISO8859_15(characters, (unsigned char *)cString, + length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; @@ -1238,11 +1237,11 @@ #ifdef HAVE_WINDOWS_1251 case OFStringEncodingWindows1251: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; - if (!of_unicode_to_windows_1251(characters, + if (!OFUnicodeToWindows1251(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; @@ -1251,11 +1250,11 @@ #ifdef HAVE_WINDOWS_1252 case OFStringEncodingWindows1252: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; - if (!of_unicode_to_windows_1252(characters, + if (!OFUnicodeToWindows1252(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; @@ -1264,11 +1263,11 @@ #ifdef HAVE_CODEPAGE_437 case OFStringEncodingCodepage437: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; - if (!of_unicode_to_codepage_437(characters, + if (!OFUnicodeToCodepage437(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; @@ -1277,11 +1276,11 @@ #ifdef HAVE_CODEPAGE_850 case OFStringEncodingCodepage850: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; - if (!of_unicode_to_codepage_850(characters, + if (!OFUnicodeToCodepage850(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; @@ -1290,11 +1289,11 @@ #ifdef HAVE_CODEPAGE_858 case OFStringEncodingCodepage858: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; - if (!of_unicode_to_codepage_858(characters, + if (!OFUnicodeToCodepage858(characters, (unsigned char *)cString, length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; @@ -1303,12 +1302,12 @@ #ifdef HAVE_MAC_ROMAN case OFStringEncodingMacRoman: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; - if (!of_unicode_to_mac_roman(characters, - (unsigned char *)cString, length, lossy)) + if (!OFUnicodeToMacRoman(characters, (unsigned char *)cString, + length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; @@ -1316,12 +1315,12 @@ #ifdef HAVE_KOI8_R case OFStringEncodingKOI8R: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; - if (!of_unicode_to_koi8_r(characters, - (unsigned char *)cString, length, lossy)) + if (!OFUnicodeToKOI8R(characters, (unsigned char *)cString, + length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; @@ -1329,12 +1328,12 @@ #ifdef HAVE_KOI8_U case OFStringEncodingKOI8U: if (length + 1 > maxLength) @throw [OFOutOfRangeException exception]; - if (!of_unicode_to_koi8_u(characters, - (unsigned char *)cString, length, lossy)) + if (!OFUnicodeToKOI8U(characters, (unsigned char *)cString, + length, lossy)) @throw [OFInvalidEncodingException exception]; cString[length] = '\0'; return length; @@ -1464,12 +1463,11 @@ characters = self.characters; length = self.length; for (size_t i = 0; i < length; i++) { char buffer[4]; - size_t len = of_string_utf8_encode(characters[i], - buffer); + size_t len = OFUTF8StringEncode(characters[i], buffer); if (len == 0) @throw [OFInvalidEncodingException exception]; UTF8StringLength += len; @@ -1618,20 +1616,20 @@ for (size_t i = 0; i < minimumLength; i++) { OFUnichar c = characters[i]; OFUnichar oc = otherCharacters[i]; #ifdef OF_HAVE_UNICODE_TABLES - if (c >> 8 < OF_UNICODE_CASEFOLDING_TABLE_SIZE) { + if (c >> 8 < OFUnicodeCaseFoldingTableSize) { OFUnichar tc = - of_unicode_casefolding_table[c >> 8][c & 0xFF]; + OFUnicodeCaseFoldingTable[c >> 8][c & 0xFF]; if (tc) c = tc; } - if (oc >> 8 < OF_UNICODE_CASEFOLDING_TABLE_SIZE) { + if (oc >> 8 < OFUnicodeCaseFoldingTableSize) { OFUnichar tc = - of_unicode_casefolding_table[oc >> 8][oc & 0xFF]; + OFUnicodeCaseFoldingTable[oc >> 8][oc & 0xFF]; if (tc) oc = tc; } #else @@ -2668,18 +2666,18 @@ } #ifdef OF_HAVE_UNICODE_TABLES - (OFString *)decomposedStringWithCanonicalMapping { - return decomposedString(self, of_unicode_decomposition_table, - OF_UNICODE_DECOMPOSITION_TABLE_SIZE); + return decomposedString(self, OFUnicodeDecompositionTable, + OFUnicodeDecompositionTableSize); } - (OFString *)decomposedStringWithCompatibilityMapping { - return decomposedString(self, of_unicode_decomposition_compat_table, - OF_UNICODE_DECOMPOSITION_COMPAT_TABLE_SIZE); + return decomposedString(self, OFUnicodeDecompositionCompatTable, + OFUnicodeDecompositionCompatTableSize); } #endif #ifdef OF_WINDOWS - (OFString *)stringByExpandingWindowsEnvironmentStrings