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

Unified Diff: source/i18n/zonemeta.cpp

Issue 845603002: Update ICU to 54.1 step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: remove unusued directories Created 5 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/wintzimpl.cpp ('k') | source/icudefs.mk.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/i18n/zonemeta.cpp
diff --git a/source/i18n/zonemeta.cpp b/source/i18n/zonemeta.cpp
index 1d34af5a9b7edb3b086b31f77c730466cebcbed6..e2c75e5577b503499895a78c50e0e2c079f01970 100644
--- a/source/i18n/zonemeta.cpp
+++ b/source/i18n/zonemeta.cpp
@@ -1,6 +1,6 @@
/*
*******************************************************************************
-* Copyright (C) 2007-2013, International Business Machines Corporation and
+* Copyright (C) 2007-2014, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
@@ -235,8 +235,7 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
return NULL;
}
- int32_t len = tzid.length();
- if (len > ZID_KEY_MAX) {
+ if (tzid.isBogus() || tzid.length() > ZID_KEY_MAX) {
status = U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
@@ -268,10 +267,7 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
// If not, resolve CLDR canonical ID with resource data
UBool isInputCanonical = FALSE;
char id[ZID_KEY_MAX + 1];
- const UChar* idChars = tzid.getBuffer();
-
- u_UCharsToChars(idChars,id,len);
- id[len] = (char) 0; // Make sure it is null terminated.
+ tzid.extract(0, 0x7fffffff, id, UPRV_LENGTHOF(id), US_INV);
// replace '/' with ':'
char *p = id;
@@ -309,7 +305,7 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
if (derefer == NULL) {
status = U_ILLEGAL_ARGUMENT_ERROR;
} else {
- len = u_strlen(derefer);
+ int32_t len = u_strlen(derefer);
u_UCharsToChars(derefer,id,len);
id[len] = (char) 0; // Make sure it is null terminated.
@@ -717,7 +713,7 @@ ZoneMeta::getZoneIdByMetazone(const UnicodeString &mzid, const UnicodeString &re
char keyBuf[ZID_KEY_MAX + 1];
int32_t keyLen = 0;
- if (mzid.length() > ZID_KEY_MAX) {
+ if (mzid.isBogus() || mzid.length() > ZID_KEY_MAX) {
result.setToBogus();
return result;
}
« no previous file with comments | « source/i18n/wintzimpl.cpp ('k') | source/icudefs.mk.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698