mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-7983 Resolve valgrind error when calling Calendar::createInstance().
X-SVN-Rev: 28739
This commit is contained in:
parent
770725ba5f
commit
742f501232
1 changed files with 3 additions and 2 deletions
|
@ -3250,14 +3250,15 @@ Calendar::setWeekData(const Locale& desiredLocale, const char *type, UErrorCode&
|
|||
// 2). If the locale has a script designation then we ignore it,
|
||||
// then remove it ( i.e. "en_Latn_US" becomes "en_US" )
|
||||
|
||||
char minLocaleID[ULOC_FULLNAME_CAPACITY];
|
||||
char minLocaleID[ULOC_FULLNAME_CAPACITY] = { 0 };
|
||||
UErrorCode myStatus = U_ZERO_ERROR;
|
||||
|
||||
uloc_minimizeSubtags(desiredLocale.getName(),minLocaleID,ULOC_FULLNAME_CAPACITY,&myStatus);
|
||||
Locale min = Locale::createFromName(minLocaleID);
|
||||
Locale useLocale;
|
||||
if ( uprv_strlen(desiredLocale.getCountry()) == 0 ||
|
||||
uprv_strlen(desiredLocale.getScript()) > 0 && uprv_strlen(min.getScript()) == 0 ) {
|
||||
char maxLocaleID[ULOC_FULLNAME_CAPACITY];
|
||||
char maxLocaleID[ULOC_FULLNAME_CAPACITY] = { 0 };
|
||||
myStatus = U_ZERO_ERROR;
|
||||
uloc_addLikelySubtags(desiredLocale.getName(),maxLocaleID,ULOC_FULLNAME_CAPACITY,&myStatus);
|
||||
Locale max = Locale::createFromName(maxLocaleID);
|
||||
|
|
Loading…
Add table
Reference in a new issue