diff options
author | Steven R. Loomis <srloomis@us.ibm.com> | 2018-03-26 15:29:02 -0700 |
---|---|---|
committer | Steven R. Loomis <srloomis@us.ibm.com> | 2018-04-02 18:18:28 -0700 |
commit | 64211405dab824a570e52d000891c49415cc42b8 (patch) | |
tree | 4c196d0e2c19e083db1e124139dd4ba6272fd049 /deps/icu-small/source/common/rbbi_cache.cpp | |
parent | 88773af540a36b23a47af0d6c4ce03b8cc3ef9aa (diff) | |
download | android-node-v8-64211405dab824a570e52d000891c49415cc42b8.tar.gz android-node-v8-64211405dab824a570e52d000891c49415cc42b8.tar.bz2 android-node-v8-64211405dab824a570e52d000891c49415cc42b8.zip |
deps: ICU 61.1 bump
- Update to released ICU 61.1, including:
- CLDR 33 (many new languages and data improvements)
- Many small API additions, improvements, and bug fixes
- note: 'icu::' namespace is no longer used by default
(Necessated https://github.com/nodejs/node/pull/18667 )
PR-URL: https://github.com/nodejs/node/pull/19621
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps/icu-small/source/common/rbbi_cache.cpp')
-rw-r--r-- | deps/icu-small/source/common/rbbi_cache.cpp | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/deps/icu-small/source/common/rbbi_cache.cpp b/deps/icu-small/source/common/rbbi_cache.cpp index 9d716bb342..ba9329d477 100644 --- a/deps/icu-small/source/common/rbbi_cache.cpp +++ b/deps/icu-small/source/common/rbbi_cache.cpp @@ -26,14 +26,11 @@ U_NAMESPACE_BEGIN */ RuleBasedBreakIterator::DictionaryCache::DictionaryCache(RuleBasedBreakIterator *bi, UErrorCode &status) : - fBI(bi), fBreaks(NULL), fPositionInCache(-1), + fBI(bi), fBreaks(status), fPositionInCache(-1), fStart(0), fLimit(0), fFirstRuleStatusIndex(0), fOtherRuleStatusIndex(0) { - fBreaks = new UVector32(status); } RuleBasedBreakIterator::DictionaryCache::~DictionaryCache() { - delete fBreaks; - fBreaks = NULL; } void RuleBasedBreakIterator::DictionaryCache::reset() { @@ -42,7 +39,7 @@ void RuleBasedBreakIterator::DictionaryCache::reset() { fLimit = 0; fFirstRuleStatusIndex = 0; fOtherRuleStatusIndex = 0; - fBreaks->removeAllElements(); + fBreaks.removeAllElements(); } UBool RuleBasedBreakIterator::DictionaryCache::following(int32_t fromPos, int32_t *result, int32_t *statusIndex) { @@ -54,13 +51,13 @@ UBool RuleBasedBreakIterator::DictionaryCache::following(int32_t fromPos, int32_ // Sequential iteration, move from previous boundary to the following int32_t r = 0; - if (fPositionInCache >= 0 && fPositionInCache < fBreaks->size() && fBreaks->elementAti(fPositionInCache) == fromPos) { + if (fPositionInCache >= 0 && fPositionInCache < fBreaks.size() && fBreaks.elementAti(fPositionInCache) == fromPos) { ++fPositionInCache; - if (fPositionInCache >= fBreaks->size()) { + if (fPositionInCache >= fBreaks.size()) { fPositionInCache = -1; return FALSE; } - r = fBreaks->elementAti(fPositionInCache); + r = fBreaks.elementAti(fPositionInCache); U_ASSERT(r > fromPos); *result = r; *statusIndex = fOtherRuleStatusIndex; @@ -69,8 +66,8 @@ UBool RuleBasedBreakIterator::DictionaryCache::following(int32_t fromPos, int32_ // Random indexing. Linear search for the boundary following the given position. - for (fPositionInCache = 0; fPositionInCache < fBreaks->size(); ++fPositionInCache) { - r= fBreaks->elementAti(fPositionInCache); + for (fPositionInCache = 0; fPositionInCache < fBreaks.size(); ++fPositionInCache) { + r= fBreaks.elementAti(fPositionInCache); if (r > fromPos) { *result = r; *statusIndex = fOtherRuleStatusIndex; @@ -90,16 +87,16 @@ UBool RuleBasedBreakIterator::DictionaryCache::preceding(int32_t fromPos, int32_ } if (fromPos == fLimit) { - fPositionInCache = fBreaks->size() - 1; + fPositionInCache = fBreaks.size() - 1; if (fPositionInCache >= 0) { - U_ASSERT(fBreaks->elementAti(fPositionInCache) == fromPos); + U_ASSERT(fBreaks.elementAti(fPositionInCache) == fromPos); } } int32_t r; - if (fPositionInCache > 0 && fPositionInCache < fBreaks->size() && fBreaks->elementAti(fPositionInCache) == fromPos) { + if (fPositionInCache > 0 && fPositionInCache < fBreaks.size() && fBreaks.elementAti(fPositionInCache) == fromPos) { --fPositionInCache; - r = fBreaks->elementAti(fPositionInCache); + r = fBreaks.elementAti(fPositionInCache); U_ASSERT(r < fromPos); *result = r; *statusIndex = ( r== fStart) ? fFirstRuleStatusIndex : fOtherRuleStatusIndex; @@ -111,8 +108,8 @@ UBool RuleBasedBreakIterator::DictionaryCache::preceding(int32_t fromPos, int32_ return FALSE; } - for (fPositionInCache = fBreaks->size()-1; fPositionInCache >= 0; --fPositionInCache) { - r = fBreaks->elementAti(fPositionInCache); + for (fPositionInCache = fBreaks.size()-1; fPositionInCache >= 0; --fPositionInCache) { + r = fBreaks.elementAti(fPositionInCache); if (r < fromPos) { *result = r; *statusIndex = ( r == fStart) ? fFirstRuleStatusIndex : fOtherRuleStatusIndex; @@ -141,7 +138,7 @@ void RuleBasedBreakIterator::DictionaryCache::populateDictionary(int32_t startPo int32_t current; UErrorCode status = U_ZERO_ERROR; int32_t foundBreakCount = 0; - UText *text = fBI->fText; + UText *text = &fBI->fText; // Loop through the text, looking for ranges of dictionary characters. // For each span, find the appropriate break engine, and ask it to find @@ -168,7 +165,7 @@ void RuleBasedBreakIterator::DictionaryCache::populateDictionary(int32_t startPo // Ask the language object if there are any breaks. It will add them to the cache and // leave the text pointer on the other side of its range, ready to search for the next one. if (lbe != NULL) { - foundBreakCount += lbe->findBreaks(text, rangeStart, rangeEnd, fBI->fBreakType, *fBreaks); + foundBreakCount += lbe->findBreaks(text, rangeStart, rangeEnd, fBreaks); } // Reload the loop variables for the next go-round @@ -182,21 +179,21 @@ void RuleBasedBreakIterator::DictionaryCache::populateDictionary(int32_t startPo // printf("foundBreakCount = %d\n", foundBreakCount); if (foundBreakCount > 0) { - U_ASSERT(foundBreakCount == fBreaks->size()); - if (startPos < fBreaks->elementAti(0)) { + U_ASSERT(foundBreakCount == fBreaks.size()); + if (startPos < fBreaks.elementAti(0)) { // The dictionary did not place a boundary at the start of the segment of text. // Add one now. This should not commonly happen, but it would be easy for interactions // of the rules for dictionary segments and the break engine implementations to // inadvertently cause it. Cover it here, just in case. - fBreaks->insertElementAt(startPos, 0, status); + fBreaks.insertElementAt(startPos, 0, status); } - if (endPos > fBreaks->peeki()) { - fBreaks->push(endPos, status); + if (endPos > fBreaks.peeki()) { + fBreaks.push(endPos, status); } fPositionInCache = 0; // Note: Dictionary matching may extend beyond the original limit. - fStart = fBreaks->elementAti(0); - fLimit = fBreaks->peeki(); + fStart = fBreaks.elementAti(0); + fLimit = fBreaks.peeki(); } else { // there were no language-based breaks, even though the segment contained // dictionary characters. Subsequent attempts to fetch boundaries from the dictionary cache |