X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/f3c0d7a59d99c2a94c6b8822291f0e42be3773c9..c5116b9f5a666b9d59f443b3770acd6ef64dc6c3:/icuSources/i18n/transreg.cpp diff --git a/icuSources/i18n/transreg.cpp b/icuSources/i18n/transreg.cpp index d47e6d5e..5cc29625 100644 --- a/icuSources/i18n/transreg.cpp +++ b/icuSources/i18n/transreg.cpp @@ -2,7 +2,7 @@ // License & terms of use: http://www.unicode.org/copyright.html /* ********************************************************************** -* Copyright (c) 2001-2016 International Business Machines +* Copyright (c) 2001-2014, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Date Name Description @@ -53,6 +53,9 @@ static const UChar LAT[] = { 0x4C, 0x61, 0x74, 0 }; // Lat #define NO_VARIANT UnicodeString() // initial estimate for specDAG size +// ICU 60 Transliterator::countAvailableSources() +//#define SPECDAG_INIT_SIZE 149 +// Apple adjustment #define SPECDAG_INIT_SIZE 134 // initial estimate for number of variant names @@ -60,9 +63,15 @@ static const UChar LAT[] = { 0x4C, 0x61, 0x74, 0 }; // Lat #define VARIANT_LIST_MAX_SIZE 31 // initial estimate for availableIDs count (default estimate is 8 => multiple reallocs) +// ICU 60 Transliterator::countAvailableIDs() +//#define AVAILABLE_IDS_INIT_SIZE 641 +// Apple adjustment #define AVAILABLE_IDS_INIT_SIZE 493 // initial estimate for number of targets for source "Any", "Lat" +// ICU 60 Transliterator::countAvailableTargets("Any")/("Latn") +//#define ANY_TARGETS_INIT_SIZE 125 +// Apple adjustmennt #define ANY_TARGETS_INIT_SIZE 102 #define LAT_TARGETS_INIT_SIZE 23 @@ -183,8 +192,7 @@ Transliterator* TransliteratorAlias::create(UParseError& pe, } break; case RULES: - U_ASSERT(FALSE); // don't call create() if isRuleBased() returns TRUE! - break; + UPRV_UNREACHABLE; // don't call create() if isRuleBased() returns TRUE! } return t; } @@ -803,7 +811,7 @@ int32_t TransliteratorRegistry::countAvailableVariants(const UnicodeString& sour if (targets == 0) { return 0; } - int32_t varMask = targets->geti(target); + uint32_t varMask = targets->geti(target); int32_t varCount = 0; while (varMask > 0) { if (varMask & 1) { @@ -823,7 +831,7 @@ UnicodeString& TransliteratorRegistry::getAvailableVariant(int32_t index, result.truncate(0); // invalid source return result; } - int32_t varMask = targets->geti(target); + uint32_t varMask = targets->geti(target); int32_t varCount = 0; int32_t varListIndex = 0; while (varMask > 0) { @@ -999,8 +1007,8 @@ void TransliteratorRegistry::registerSTV(const UnicodeString& source, return; } } - int32_t addMask = 1 << variantListIndex; - int32_t varMask = targets->geti(target); + uint32_t addMask = 1 << variantListIndex; + uint32_t varMask = targets->geti(target); targets->puti(target, varMask | addMask, status); } @@ -1017,7 +1025,7 @@ void TransliteratorRegistry::removeSTV(const UnicodeString& source, if (targets == NULL) { return; // should never happen for valid s-t/v } - int32_t varMask = targets->geti(target); + uint32_t varMask = targets->geti(target); if (varMask == 0) { return; // should never happen for valid s-t/v } @@ -1032,7 +1040,7 @@ void TransliteratorRegistry::removeSTV(const UnicodeString& source, } else { targets->remove(target); // should delete variants if (targets->count() == 0) { - specDAG.remove(source); // should delete targetss + specDAG.remove(source); // should delete targets } } } @@ -1327,12 +1335,12 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID int32_t passNumber = 1; for (int32_t i = 0; U_SUCCESS(status) && i < entry->u.dataVector->size(); i++) { // TODO: Should passNumber be turned into a decimal-string representation (1 -> "1")? - Transliterator* t = new RuleBasedTransliterator(UnicodeString(CompoundTransliterator::PASS_STRING) + UnicodeString(passNumber++), + Transliterator* tl = new RuleBasedTransliterator(UnicodeString(CompoundTransliterator::PASS_STRING) + UnicodeString(passNumber++), (TransliterationRuleData*)(entry->u.dataVector->elementAt(i)), FALSE); - if (t == 0) + if (tl == 0) status = U_MEMORY_ALLOCATION_ERROR; else - rbts->addElement(t, status); + rbts->addElement(tl, status); } if (U_FAILURE(status)) { delete rbts; @@ -1393,8 +1401,7 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID } return 0; default: - U_ASSERT(FALSE); // can't get here - return 0; + UPRV_UNREACHABLE; // can't get here } } U_NAMESPACE_END