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

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

Issue 796153002: Fix for a check failure in ftp listing (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: desc. change Created 6 years 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 | « no previous file | no next file » | 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-2012, International Business Machines 3 * Copyright (C) 1997-2012, 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 UErrorCode err; 477 UErrorCode err;
478 478
479 if(localeID == NULL) { 479 if(localeID == NULL) {
480 // not an error, just set the default locale 480 // not an error, just set the default locale
481 return *this = getDefault(); 481 return *this = getDefault();
482 } 482 }
483 483
484 /* preset all fields to empty */ 484 /* preset all fields to empty */
485 language[0] = script[0] = country[0] = 0; 485 language[0] = script[0] = country[0] = 0;
486 486
487 // Need to reset baseName. Otherwise, when a Locale object created with
488 // the default constructor is changed with setFromPOSIXID() later
489 // (e.g. locales obtained with getAvailableLocales()),
490 // baseName will be still that of the default locale instead of one
491 // corresponding to localeID.
492 baseName = NULL;
493
487 // "canonicalize" the locale ID to ICU/Java format 494 // "canonicalize" the locale ID to ICU/Java format
488 err = U_ZERO_ERROR; 495 err = U_ZERO_ERROR;
489 length = canonicalize ? 496 length = canonicalize ?
490 uloc_canonicalize(localeID, fullName, sizeof(fullNameBuffer), &err) : 497 uloc_canonicalize(localeID, fullName, sizeof(fullNameBuffer), &err) :
491 uloc_getName(localeID, fullName, sizeof(fullNameBuffer), &err); 498 uloc_getName(localeID, fullName, sizeof(fullNameBuffer), &err);
492 499
493 if(err == U_BUFFER_OVERFLOW_ERROR || length >= (int32_t)sizeof(fullNameB uffer)) { 500 if(err == U_BUFFER_OVERFLOW_ERROR || length >= (int32_t)sizeof(fullNameB uffer)) {
494 /*Go to heap for the fullName if necessary*/ 501 /*Go to heap for the fullName if necessary*/
495 fullName = (char *)uprv_malloc(sizeof(char)*(length + 1)); 502 fullName = (char *)uprv_malloc(sizeof(char)*(length + 1));
496 if(fullName == 0) { 503 if(fullName == 0) {
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 // the length of the baseName. Patch around this for now. 1035 // the length of the baseName. Patch around this for now.
1029 if (variantBegin == (int32_t)uprv_strlen(fullName)) { 1036 if (variantBegin == (int32_t)uprv_strlen(fullName)) {
1030 ((Locale*)this)->variantBegin = baseNameSize; 1037 ((Locale*)this)->variantBegin = baseNameSize;
1031 } 1038 }
1032 } 1039 }
1033 return baseName; 1040 return baseName;
1034 } 1041 }
1035 1042
1036 //eof 1043 //eof
1037 U_NAMESPACE_END 1044 U_NAMESPACE_END
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698