diff options
author | Hoa V. Dinh <dinh.viet.hoa@gmail.com> | 2014-10-27 14:27:43 -0700 |
---|---|---|
committer | Hoa V. Dinh <dinh.viet.hoa@gmail.com> | 2014-10-27 14:27:43 -0700 |
commit | 96e1109ebc850761bd08459f06706d73543c1d38 (patch) | |
tree | c43e55c69f55cbe3e5721e8e38772ed4a8b89d25 | |
parent | 585e244057a5274413a71c27ecfb5e4d5d39228a (diff) |
Cleanup multiple codepaths
-rw-r--r-- | src/core/basetypes/MCString.cc | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/core/basetypes/MCString.cc b/src/core/basetypes/MCString.cc index faee0005..e4225347 100644 --- a/src/core/basetypes/MCString.cc +++ b/src/core/basetypes/MCString.cc @@ -960,7 +960,6 @@ void String::appendUTF8CharactersLength(const char * UTF8Characters, unsigned in return; } -#if DISABLE_ICU const UTF8 * source = (const UTF8 *) UTF8Characters; UTF16 * target = (UTF16 *) malloc(length * sizeof(* target)); UTF16 * targetStart = target; @@ -968,30 +967,6 @@ void String::appendUTF8CharactersLength(const char * UTF8Characters, unsigned in &targetStart, targetStart + length, lenientConversion); appendCharactersLength((UChar *) target, (unsigned int ) (targetStart - target)); free(target); -#else - UChar * dest; - int32_t destLength; - int32_t destCapacity; - UErrorCode err; - - err = U_ZERO_ERROR; - u_strFromUTF8WithSub(NULL, 0, &destLength, UTF8Characters, length, 0xFFFD, NULL, &err); - destCapacity = destLength + 1; - dest = (UChar *) malloc(destCapacity * sizeof(* dest)); - err = U_ZERO_ERROR; - u_strFromUTF8WithSub(dest, destCapacity, &destLength, UTF8Characters, length, 0xFFFD, NULL, &err); - dest[destLength] = 0; - // Fix in case of bad conversion. - for(int32_t i = 0 ; i < destLength ; i ++) { - if (dest[i] == 0) { - dest[i] = ' '; - } - } - - appendCharactersLength(dest, destLength); - - free(dest); -#endif } void String::appendUTF8Characters(const char * UTF8Characters) @@ -1014,7 +989,6 @@ const UChar * String::unicodeCharacters() const char * String::UTF8Characters() { -#if DISABLE_ICU const UTF16 * source = (const UTF16 *) mUnicodeChars; UTF8 * target = (UTF8 *) malloc(mLength * 6 + 1); UTF8 * targetStart = target; @@ -1026,25 +1000,6 @@ const char * String::UTF8Characters() free(target); return data->bytes(); -#else - char * dest; - int32_t destLength; - int32_t destCapacity; - UErrorCode err; - - err = U_ZERO_ERROR; - u_strToUTF8(NULL, 0, &destLength, mUnicodeChars, mLength, &err); - destCapacity = destLength + 1; - dest = (char *) malloc(destCapacity * sizeof(* dest)); - err = U_ZERO_ERROR; - u_strToUTF8(dest, destCapacity, &destLength, mUnicodeChars, mLength, &err); - dest[destLength] = 0; - - Data * data = Data::dataWithBytes(dest, destLength + 1); - free(dest); - - return data->bytes(); -#endif } unsigned int String::length() |