Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: source/i18n/tzgnames.cpp

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/i18n/tzfmt.cpp ('k') | source/i18n/tznames.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/i18n/tzgnames.cpp
diff --git a/source/i18n/tzgnames.cpp b/source/i18n/tzgnames.cpp
index e6bd109b749bee9bfd6c9ea683f391c2000240ab..6389c862d6b301a12ad8982e5f86fc77ed663b51 100644
--- a/source/i18n/tzgnames.cpp
+++ b/source/i18n/tzgnames.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 2011-2013, International Business Machines Corporation and
+* Copyright (C) 2011-2015, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
@@ -434,7 +434,7 @@ TZGNCore::initialize(const Locale& locale, UErrorCode& status) {
TimeZone *tz = TimeZone::createDefault();
const UChar *tzID = ZoneMeta::getCanonicalCLDRID(*tz);
if (tzID != NULL) {
- loadStrings(UnicodeString(tzID));
+ loadStrings(UnicodeString(TRUE, tzID, -1));
}
delete tz;
}
@@ -467,7 +467,7 @@ TZGNCore::getDisplayName(const TimeZone& tz, UTimeZoneGenericNameType type, UDat
{
const UChar* tzCanonicalID = ZoneMeta::getCanonicalCLDRID(tz);
if (tzCanonicalID != NULL) {
- getGenericLocationName(UnicodeString(tzCanonicalID), name);
+ getGenericLocationName(UnicodeString(TRUE, tzCanonicalID, -1), name);
}
}
break;
@@ -477,7 +477,7 @@ TZGNCore::getDisplayName(const TimeZone& tz, UTimeZoneGenericNameType type, UDat
if (name.isEmpty()) {
const UChar* tzCanonicalID = ZoneMeta::getCanonicalCLDRID(tz);
if (tzCanonicalID != NULL) {
- getGenericLocationName(UnicodeString(tzCanonicalID), name);
+ getGenericLocationName(UnicodeString(TRUE, tzCanonicalID, -1), name);
}
}
break;
@@ -620,7 +620,7 @@ TZGNCore::formatGenericNonLocationName(const TimeZone& tz, UTimeZoneGenericNameT
return name;
}
- UnicodeString tzID(uID);
+ UnicodeString tzID(TRUE, uID, -1);
// Try to get a name from time zone first
UTimeZoneNameType nameType = (type == UTZGNM_LONG) ? UTZNM_LONG_GENERIC : UTZNM_SHORT_GENERIC;
@@ -631,12 +631,14 @@ TZGNCore::formatGenericNonLocationName(const TimeZone& tz, UTimeZoneGenericNameT
}
// Try meta zone
- UnicodeString mzID;
+ UChar mzIDBuf[32];
+ UnicodeString mzID(mzIDBuf, 0, UPRV_LENGTHOF(mzIDBuf));
fTimeZoneNames->getMetaZoneID(tzID, date, mzID);
if (!mzID.isEmpty()) {
UErrorCode status = U_ZERO_ERROR;
UBool useStandard = FALSE;
int32_t raw, sav;
+ UChar tmpNameBuf[64];
tz.getOffset(date, FALSE, raw, sav, status);
if (U_FAILURE(status)) {
@@ -694,7 +696,7 @@ TZGNCore::formatGenericNonLocationName(const TimeZone& tz, UTimeZoneGenericNameT
if (useStandard) {
UTimeZoneNameType stdNameType = (nameType == UTZNM_LONG_GENERIC)
? UTZNM_LONG_STANDARD : UTZNM_SHORT_STANDARD;
- UnicodeString stdName;
+ UnicodeString stdName(tmpNameBuf, 0, UPRV_LENGTHOF(tmpNameBuf));
fTimeZoneNames->getDisplayName(tzID, stdNameType, date, stdName);
if (!stdName.isEmpty()) {
name.setTo(stdName);
@@ -704,7 +706,8 @@ TZGNCore::formatGenericNonLocationName(const TimeZone& tz, UTimeZoneGenericNameT
// for some meta zones in some locales. This looks like a data bugs.
// For now, we check if the standard name is different from its generic
// name below.
- UnicodeString mzGenericName;
+ UChar genNameBuf[64];
+ UnicodeString mzGenericName(genNameBuf, 0, UPRV_LENGTHOF(genNameBuf));
fTimeZoneNames->getMetaZoneDisplayName(mzID, nameType, mzGenericName);
if (stdName.caseCompare(mzGenericName, 0) == 0) {
name.setToBogus();
@@ -713,13 +716,14 @@ TZGNCore::formatGenericNonLocationName(const TimeZone& tz, UTimeZoneGenericNameT
}
if (name.isEmpty()) {
// Get a name from meta zone
- UnicodeString mzName;
+ UnicodeString mzName(tmpNameBuf, 0, UPRV_LENGTHOF(tmpNameBuf));
fTimeZoneNames->getMetaZoneDisplayName(mzID, nameType, mzName);
if (!mzName.isEmpty()) {
// Check if we need to use a partial location format.
// This check is done by comparing offset with the meta zone's
// golden zone at the given date.
- UnicodeString goldenID;
+ UChar idBuf[32];
+ UnicodeString goldenID(idBuf, 0, UPRV_LENGTHOF(idBuf));
fTimeZoneNames->getReferenceZoneID(mzID, fTargetRegion, goldenID);
if (!goldenID.isEmpty() && goldenID != tzID) {
TimeZone *goldenZone = TimeZone::createTimeZone(goldenID);
@@ -1185,7 +1189,7 @@ U_CDECL_END
* block.
*/
static void sweepCache() {
- int32_t pos = -1;
+ int32_t pos = UHASH_FIRST;
const UHashElement* elem;
double now = (double)uprv_getUTCtime();
« no previous file with comments | « source/i18n/tzfmt.cpp ('k') | source/i18n/tznames.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698