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

Side by Side Diff: source/common/locid.cpp

Issue 822213003: ICU upgrade to 54.1 step 2 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: readme: better wrapping, declspec patch dropped 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 unified diff | Download patch
« no previous file with comments | « patches/wpo.patch ('k') | source/common/locmap.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ********************************************************************** 2 **********************************************************************
3 * Copyright (C) 1997-2014, International Business Machines 3 * Copyright (C) 1997-2014, International Business Machines
4 * Corporation and others. All Rights Reserved. 4 * Corporation and others. All Rights Reserved.
5 ********************************************************************** 5 **********************************************************************
6 * 6 *
7 * File locid.cpp 7 * File locid.cpp
8 * 8 *
9 * Created by: Richard Gillam 9 * Created by: Richard Gillam
10 * 10 *
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 UErrorCode err; 502 UErrorCode err;
503 503
504 if(localeID == NULL) { 504 if(localeID == NULL) {
505 // not an error, just set the default locale 505 // not an error, just set the default locale
506 return *this = getDefault(); 506 return *this = getDefault();
507 } 507 }
508 508
509 /* preset all fields to empty */ 509 /* preset all fields to empty */
510 language[0] = script[0] = country[0] = 0; 510 language[0] = script[0] = country[0] = 0;
511 511
512 // Need to reset baseName. Otherwise, when a Locale object created with
513 // the default constructor is changed with setFromPOSIXID() later
514 // (e.g. locales obtained with getAvailableLocales()),
515 // baseName will be still that of the default locale instead of one
516 // corresponding to localeID.
517 baseName = NULL;
518
512 // "canonicalize" the locale ID to ICU/Java format 519 // "canonicalize" the locale ID to ICU/Java format
513 err = U_ZERO_ERROR; 520 err = U_ZERO_ERROR;
514 length = canonicalize ? 521 length = canonicalize ?
515 uloc_canonicalize(localeID, fullName, sizeof(fullNameBuffer), &err) : 522 uloc_canonicalize(localeID, fullName, sizeof(fullNameBuffer), &err) :
516 uloc_getName(localeID, fullName, sizeof(fullNameBuffer), &err); 523 uloc_getName(localeID, fullName, sizeof(fullNameBuffer), &err);
517 524
518 if(err == U_BUFFER_OVERFLOW_ERROR || length >= (int32_t)sizeof(fullNameB uffer)) { 525 if(err == U_BUFFER_OVERFLOW_ERROR || length >= (int32_t)sizeof(fullNameB uffer)) {
519 /*Go to heap for the fullName if necessary*/ 526 /*Go to heap for the fullName if necessary*/
520 fullName = (char *)uprv_malloc(sizeof(char)*(length + 1)); 527 fullName = (char *)uprv_malloc(sizeof(char)*(length + 1));
521 if(fullName == 0) { 528 if(fullName == 0) {
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 // the length of the baseName. Patch around this for now. 1022 // the length of the baseName. Patch around this for now.
1016 if (variantBegin == (int32_t)uprv_strlen(fullName)) { 1023 if (variantBegin == (int32_t)uprv_strlen(fullName)) {
1017 ((Locale*)this)->variantBegin = baseNameSize; 1024 ((Locale*)this)->variantBegin = baseNameSize;
1018 } 1025 }
1019 } 1026 }
1020 return baseName; 1027 return baseName;
1021 } 1028 }
1022 1029
1023 //eof 1030 //eof
1024 U_NAMESPACE_END 1031 U_NAMESPACE_END
OLDNEW
« no previous file with comments | « patches/wpo.patch ('k') | source/common/locmap.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698