diff options
author | Steven R. Loomis <srloomis@us.ibm.com> | 2018-10-17 09:43:52 -0700 |
---|---|---|
committer | Steven R. Loomis <srloomis@us.ibm.com> | 2018-10-24 08:27:36 -0700 |
commit | 6786ff4d3688512d8b717ec24188818ac5493d0b (patch) | |
tree | ab18b7a66afee52420fe0bedf7b38eb93f671373 /deps/icu-small/source/common/rbbitblb.cpp | |
parent | d8f2d2726143ecfbf99b90b7bbbc6f41b3cd95fc (diff) | |
download | android-node-v8-6786ff4d3688512d8b717ec24188818ac5493d0b.tar.gz android-node-v8-6786ff4d3688512d8b717ec24188818ac5493d0b.tar.bz2 android-node-v8-6786ff4d3688512d8b717ec24188818ac5493d0b.zip |
deps: icu 63.1 bump (CLDR 34)
- Full release notes: http://site.icu-project.org/download/63
Fixes: https://github.com/nodejs/node/issues/22344
PR-URL: https://github.com/nodejs/node/pull/23715
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'deps/icu-small/source/common/rbbitblb.cpp')
-rw-r--r-- | deps/icu-small/source/common/rbbitblb.cpp | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/deps/icu-small/source/common/rbbitblb.cpp b/deps/icu-small/source/common/rbbitblb.cpp index 42116b0f95..e6ae2dc654 100644 --- a/deps/icu-small/source/common/rbbitblb.cpp +++ b/deps/icu-small/source/common/rbbitblb.cpp @@ -428,8 +428,8 @@ void RBBITableBuilder::calcChainedFollowPos(RBBINode *tree) { addRuleRootNodes(&ruleRootNodes, tree); UVector matchStartNodes(*fStatus); - for (int i=0; i<ruleRootNodes.size(); ++i) { - RBBINode *node = static_cast<RBBINode *>(ruleRootNodes.elementAt(i)); + for (int j=0; j<ruleRootNodes.size(); ++j) { + RBBINode *node = static_cast<RBBINode *>(ruleRootNodes.elementAt(j)); if (node->fChainIn) { setAdd(&matchStartNodes, node->fFirstPosSet); } @@ -1082,21 +1082,22 @@ bool RBBITableBuilder::findDuplCharClassFrom(IntPair *categories) { int32_t numStates = fDStates->size(); int32_t numCols = fRB->fSetBuilder->getNumCharCategories(); - uint16_t table_base; - uint16_t table_dupl; for (; categories->first < numCols-1; categories->first++) { for (categories->second=categories->first+1; categories->second < numCols; categories->second++) { - for (int32_t state=0; state<numStates; state++) { - RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(state); - table_base = (uint16_t)sd->fDtran->elementAti(categories->first); - table_dupl = (uint16_t)sd->fDtran->elementAti(categories->second); - if (table_base != table_dupl) { - break; - } - } - if (table_base == table_dupl) { - return true; - } + // Initialized to different values to prevent returning true if numStates = 0 (implies no duplicates). + uint16_t table_base = 0; + uint16_t table_dupl = 1; + for (int32_t state=0; state<numStates; state++) { + RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(state); + table_base = (uint16_t)sd->fDtran->elementAti(categories->first); + table_dupl = (uint16_t)sd->fDtran->elementAti(categories->second); + if (table_base != table_dupl) { + break; + } + } + if (table_base == table_dupl) { + return true; + } } } return false; @@ -1236,7 +1237,7 @@ void RBBITableBuilder::removeSafeState(IntPair duplStates) { } else if (existingVal > duplState) { newVal = existingVal - 1; } - sd->setCharAt(col, newVal); + sd->setCharAt(col, static_cast<char16_t>(newVal)); } } } @@ -1245,12 +1246,16 @@ void RBBITableBuilder::removeSafeState(IntPair duplStates) { /* * RemoveDuplicateStates */ -void RBBITableBuilder::removeDuplicateStates() { +int32_t RBBITableBuilder::removeDuplicateStates() { IntPair dupls = {3, 0}; + int32_t numStatesRemoved = 0; + while (findDuplicateState(&dupls)) { // printf("Removing duplicate states (%d, %d)\n", dupls.first, dupls.second); removeState(dupls); + ++numStatesRemoved; } + return numStatesRemoved; } @@ -1411,7 +1416,7 @@ void RBBITableBuilder::buildSafeReverseTable(UErrorCode &status) { UnicodeString &startState = *static_cast<UnicodeString *>(fSafeTable->elementAt(1)); for (int32_t charClass=0; charClass < numCharClasses; ++charClass) { // Note: +2 for the start & stop state. - startState.setCharAt(charClass, charClass+2); + startState.setCharAt(charClass, static_cast<char16_t>(charClass+2)); } // Initially make every other state table row look like the start state row, |