diff options
author | Steven R. Loomis <srloomis@us.ibm.com> | 2017-09-21 15:31:38 -0700 |
---|---|---|
committer | Steven R. Loomis <srloomis@us.ibm.com> | 2017-11-09 18:25:58 -0800 |
commit | 44d3e17985befbd45457d5ad7f0a0387849e1b2f (patch) | |
tree | f75f2eddb868f13254b7f514875534dee616c0d6 /deps/icu-small/source/i18n/tznames_impl.cpp | |
parent | 3b3ceafaf922e1d79950595eaa501aa412913820 (diff) | |
download | android-node-v8-44d3e17985befbd45457d5ad7f0a0387849e1b2f.tar.gz android-node-v8-44d3e17985befbd45457d5ad7f0a0387849e1b2f.tar.bz2 android-node-v8-44d3e17985befbd45457d5ad7f0a0387849e1b2f.zip |
deps: ICU 60 bump
- Update to released ICU 60.1, including:
- CLDR 32 (many new languages and data improvements)
- Unicode 10 (8,518 new characters, including four new scripts,
7,494 new Han characters, and 56 new emoji characters)
- UTF-8 malformed bytes now handled according to W3C/WHATWG spec
Fixes: https://github.com/nodejs/node/issues/15540
PR-URL: https://github.com/nodejs/node/pull/16876
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'deps/icu-small/source/i18n/tznames_impl.cpp')
-rw-r--r-- | deps/icu-small/source/i18n/tznames_impl.cpp | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/deps/icu-small/source/i18n/tznames_impl.cpp b/deps/icu-small/source/i18n/tznames_impl.cpp index d00d7e1145..ef04b31c13 100644 --- a/deps/icu-small/source/i18n/tznames_impl.cpp +++ b/deps/icu-small/source/i18n/tznames_impl.cpp @@ -18,6 +18,7 @@ #include "unicode/strenum.h" #include "unicode/ustring.h" #include "unicode/timezone.h" +#include "unicode/utf16.h" #include "tznames_impl.h" #include "cmemory.h" @@ -69,7 +70,7 @@ enum UTimeZoneNameTypeIndex { UTZNM_INDEX_SHORT_DAYLIGHT, UTZNM_INDEX_COUNT }; -static const UChar* EMPTY_NAMES[UTZNM_INDEX_COUNT] = {0,0,0,0,0,0,0}; +static const UChar* const EMPTY_NAMES[UTZNM_INDEX_COUNT] = {0,0,0,0,0,0,0}; U_CDECL_BEGIN static UBool U_CALLCONV tzdbTimeZoneNames_cleanup(void) { @@ -411,25 +412,29 @@ TextTrieMap::search(CharacterNode *node, const UnicodeString &text, int32_t star return; } } - UChar32 c = text.char32At(index); if (fIgnoreCase) { - // size of character may grow after fold operation - UnicodeString tmp(c); + // for folding we need to get a complete code point. + // size of character may grow after fold operation; + // then we need to get result as UTF16 code units. + UChar32 c32 = text.char32At(index); + index += U16_LENGTH(c32); + UnicodeString tmp(c32); tmp.foldCase(); int32_t tmpidx = 0; while (tmpidx < tmp.length()) { - c = tmp.char32At(tmpidx); + UChar c = tmp.charAt(tmpidx++); node = getChildNode(node, c); if (node == NULL) { break; } - tmpidx = tmp.moveIndex32(tmpidx, 1); } } else { + // here we just get the next UTF16 code unit + UChar c = text.charAt(index++); node = getChildNode(node, c); } if (node != NULL) { - search(node, text, start, index+1, handler, status); + search(node, text, start, index, handler, status); } } @@ -1070,7 +1075,7 @@ TimeZoneNamesImpl::loadStrings(const UnicodeString& tzCanonicalID, UErrorCode& s U_ASSERT(!mzIDs.isNull()); const UnicodeString *mzID; - while ((mzID = mzIDs->snext(status)) && U_SUCCESS(status)) { + while (((mzID = mzIDs->snext(status)) != NULL) && U_SUCCESS(status)) { loadMetaZoneNames(*mzID, status); } } @@ -1651,7 +1656,7 @@ void TimeZoneNamesImpl::internalLoadAllDisplayNames(UErrorCode& status) { StringEnumeration *tzIDs = TimeZone::createTimeZoneIDEnumeration( UCAL_ZONE_TYPE_CANONICAL, NULL, NULL, status); if (U_SUCCESS(status)) { - while ((id = tzIDs->snext(status))) { + while ((id = tzIDs->snext(status)) != NULL) { if (U_FAILURE(status)) { break; } @@ -2056,6 +2061,9 @@ static void U_CALLCONV prepareFind(UErrorCode &status) { if (U_SUCCESS(status)) { while ((mzID = mzIDs->snext(status)) && U_SUCCESS(status)) { const TZDBNames *names = TZDBTimeZoneNames::getMetaZoneNames(*mzID, status); + if (U_FAILURE(status)) { + break; + } if (names == NULL) { continue; } @@ -2187,9 +2195,11 @@ TZDBTimeZoneNames::getMetaZoneDisplayName(const UnicodeString& mzID, UErrorCode status = U_ZERO_ERROR; const TZDBNames *tzdbNames = TZDBTimeZoneNames::getMetaZoneNames(mzID, status); if (U_SUCCESS(status)) { - const UChar *s = tzdbNames->getName(type); - if (s != NULL) { - name.setTo(TRUE, s, -1); + if (tzdbNames != NULL) { + const UChar *s = tzdbNames->getName(type); + if (s != NULL) { + name.setTo(TRUE, s, -1); + } } } |