ICU-8495 Merging the fix for ticket#8519 (r30033, r30034) from trunk to maint-4-4

X-SVN-Rev: 30123
This commit is contained in:
Yoshito Umaoka 2011-05-16 21:47:24 +00:00
parent 253c834cf9
commit 06c2575a6a
2 changed files with 15 additions and 4 deletions

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2009-2010, International Business Machines
* Copyright (C) 2009-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
@ -1471,12 +1471,19 @@ _appendKeywords(ULanguageTag* langtag, char* appendAt, int32_t capacity, UErrorC
ExtensionListEntry *kwdFirst = NULL;
ExtensionListEntry *kwd;
const char *key, *type;
char kwdBuf[ULOC_KEYWORDS_CAPACITY];
char *kwdBuf = NULL;
int32_t kwdBufLength = capacity;
if (U_FAILURE(*status)) {
return 0;
}
kwdBuf = (char *)uprv_malloc(kwdBufLength);
if (kwdBuf == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
return 0;
}
n = ultag_getExtensionsSize(langtag);
/* resolve locale keywords and reordering keys */
@ -1484,7 +1491,7 @@ _appendKeywords(ULanguageTag* langtag, char* appendAt, int32_t capacity, UErrorC
key = ultag_getExtensionKey(langtag, i);
type = ultag_getExtensionValue(langtag, i);
if (*key == LDMLEXT) {
_appendLDMLExtensionAsKeywords(type, &kwdFirst, kwdBuf, sizeof(kwdBuf), status);
_appendLDMLExtensionAsKeywords(type, &kwdFirst, kwdBuf, kwdBufLength, status);
if (U_FAILURE(*status)) {
break;
}
@ -1569,6 +1576,8 @@ _appendKeywords(ULanguageTag* langtag, char* appendAt, int32_t capacity, UErrorC
kwd = tmpKwd;
}
uprv_free(kwdBuf);
if (U_FAILURE(*status)) {
return 0;
}

View file

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2010, International Business Machines Corporation and
* Copyright (c) 1997-2011, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*****************************************************************************
@ -5516,6 +5516,8 @@ static const struct {
{"en-us-u-tz-usnyc", "en_US@timezone=America/New_York", 16},
{"und-a-abc-def", "und@a=abc-def", 13},
{"zh-u-ca-chinese-x-u-ca-chinese", "zh@calendar=chinese;x=u-ca-chinese", 30},
{"de-u-xc-xphonebk-co-phonebk-ca-buddhist-mo-very-lo-extensi-xd-that-de-should-vc-probably-xz-killthebuffer",
"de@calendar=buddhist;collation=phonebook;de=should;lo=extensi;mo=very;vc=probably;xc=xphonebk;xd=that", 88},
{NULL, NULL, 0}
};