ICU-6799 Fixed warnings for collation.

X-SVN-Rev: 25871
This commit is contained in:
Claire Ho 2009-04-22 23:10:07 +00:00
parent 131e1b25ab
commit 9efbecd983
7 changed files with 677 additions and 677 deletions

View file

@ -121,7 +121,7 @@ Target::Target(UCollator *theCollator, const UnicodeString *target, int32_t patt
setTargetString(target);
}
switch (strength)
switch (strength)
{
default:
strengthMask |= UCOL_TERTIARYORDERMASK;
@ -162,7 +162,7 @@ void Target::setTargetString(const UnicodeString *target)
elements = ucol_openElements(coll, target->getBuffer(), target->length(), &status);
ucol_forceHanImplicit(elements, &status);
charBreakIterator = ubrk_open(UBRK_CHARACTER, ucol_getLocale(coll, ULOC_VALID_LOCALE, &status),
charBreakIterator = ubrk_open(UBRK_CHARACTER, ucol_getLocaleByType(coll, ULOC_VALID_LOCALE, &status),
targetBuffer, targetLength, &status);
} else {
targetBuffer = NULL;
@ -190,7 +190,7 @@ const CEI *Target::nextCE(int32_t offset)
order = ucol_next(elements, &status);
high = ucol_getOffset(elements);
if (order == UCOL_NULLORDER) {
if (order == (uint32_t)UCOL_NULLORDER) {
//high = low = -1;
break;
}
@ -240,7 +240,7 @@ const CEI *Target::prevCE(int32_t offset)
order = ucol_previous(elements, &status);
low = ucol_getOffset(elements);
if (order == UCOL_NULLORDER) {
if (order == (uint32_t)UCOL_NULLORDER) {
break;
}
@ -355,8 +355,8 @@ UBool Target::isIdentical(UnicodeString &pattern, int32_t start, int32_t end)
UErrorCode status = U_ZERO_ERROR, status2 = U_ZERO_ERROR;
int32_t decomplength = unorm_decompose(t2, ARRAY_SIZE(t2),
targetBuffer + start, length,
int32_t decomplength = unorm_decompose(t2, ARRAY_SIZE(t2),
targetBuffer + start, length,
FALSE, 0, &status);
// use separate status2 in case of buffer overflow
@ -385,10 +385,10 @@ UBool Target::isIdentical(UnicodeString &pattern, int32_t start, int32_t end)
pat = text + decomplength;
unorm_decompose(text, decomplength, targetBuffer + start,
unorm_decompose(text, decomplength, targetBuffer + start,
length, FALSE, 0, &status);
unorm_decompose(pat, decomplength, pBuffer,
unorm_decompose(pat, decomplength, pBuffer,
pLength, FALSE, 0, &status);
} else {
// NFD failed, make sure that u_memcmp() does not overrun t2 & p2
@ -764,7 +764,7 @@ UBool BoyerMooreSearch::search(int32_t offset, int32_t &start, int32_t &end)
if (tcei->order != pce) {
// There is a mismatch at this position. Decide how far
// over to shift the pattern, then try again.
int32_t gsOffset = tOffset + (*goodSuffixTable)[pIndex];
#ifdef EXTRA_CAUTIOUS
int32_t old = tOffset;
@ -797,7 +797,7 @@ UBool BoyerMooreSearch::search(int32_t offset, int32_t &start, int32_t &end)
int32_t mStart = firstCEI.lowOffset;
int32_t minLimit = lastCEI.lowOffset;
int32_t maxLimit = lastCEI.highOffset;
int32_t mLimit;
int32_t mLimit;
UBool found = TRUE;
target->setOffset(/*tOffset*/maxLimit);
@ -808,7 +808,7 @@ UBool BoyerMooreSearch::search(int32_t offset, int32_t &start, int32_t &end)
maxLimit = nextCEI.lowOffset;
}
if (nextCEI.lowOffset == nextCEI.highOffset && nextCEI.order != UCOL_NULLORDER) {
if (nextCEI.lowOffset == nextCEI.highOffset && nextCEI.order != (uint32_t)UCOL_NULLORDER) {
found = FALSE;
}
@ -852,7 +852,7 @@ UBool BoyerMooreSearch::search(int32_t offset, int32_t &start, int32_t &end)
}
// Otherwise, we're here because of a mismatch, so keep going....
}
// no match
start = -1;
end = -1;

View file

@ -63,7 +63,7 @@ CEList::CEList(UCollator *coll, const UnicodeString &string, UErrorCode &status)
// **** only set flag if string has Han(gul) ****
ucol_forceHanImplicit(elems, &status);
switch (strength)
switch (strength)
{
default:
strengthMask |= UCOL_TERTIARYORDERMASK;
@ -89,7 +89,7 @@ CEList::CEList(UCollator *coll, const UnicodeString &string, UErrorCode &status)
order &= strengthMask;
if (toShift && variableTop > order && (order & UCOL_PRIMARYORDERMASK) != 0) {
if (toShift && variableTop > (uint32_t)order && (order & UCOL_PRIMARYORDERMASK) != 0) {
if (strength >= UCOL_QUATERNARY) {
order &= UCOL_PRIMARYORDERMASK;
} else {
@ -295,7 +295,7 @@ public:
StringList *getStringList(uint32_t ce) const;
private:
void putStringList(uint32_t ce, StringList *stringList, UErrorCode &status);
UHashtable *map;
};
@ -470,7 +470,7 @@ private:
U_CFUNC void deleteChars(void */*obj*/)
{
// char *chars = (char *) obj;
// All the key strings are owned by the
// All the key strings are owned by the
// CollData objects and don't need to
// be freed here.
//DELETE_ARRAY(chars);
@ -571,7 +571,7 @@ CollData *CollDataCache::get(UCollator *collator, UErrorCode &status)
void CollDataCache::unref(CollData *collData)
{
CollDataCacheEntry *entry = NULL;
umtx_lock(&lock);
entry = (CollDataCacheEntry *) uhash_get(cache, collData->key);
@ -675,7 +675,7 @@ CollData::CollData(UCollator *collator, char *cacheKey, int32_t cacheKeyLength,
if (U_FAILURE(status)) {
goto bail;
}
if (cacheKeyLength > KEY_BUFFER_SIZE) {
key = NEW_ARRAY(char, cacheKeyLength);
@ -794,7 +794,7 @@ bail:
minHan = 0xFFFFFFFF;
maxHan = 0;
for(int32_t h = 0; h < hanList.size(); h += 2) {
uint32_t han = (uint32_t) hanList[h];
@ -844,7 +844,7 @@ const CEList *CollData::getCEList(const UnicodeString *string) const
#else
UErrorCode status = U_ZERO_ERROR;
const CEList *list = new CEList(coll, *string, status);
if (U_FAILURE(status)) {
delete list;
list = NULL;
@ -877,7 +877,7 @@ int32_t CollData::minLengthInChars(const CEList *ceList, int32_t offset, int32_t
if (strings != NULL) {
int32_t stringCount = strings->size();
for (int32_t s = 0; s < stringCount; s += 1) {
const UnicodeString *string = strings->get(s);
#ifdef CACHE_CELISTS
@ -897,7 +897,7 @@ int32_t CollData::minLengthInChars(const CEList *ceList, int32_t offset, int32_t
int32_t slength = string->length();
int32_t roffset = offset + clength;
int32_t rlength = 0;
if (roffset < maxOffset) {
rlength = minLengthInChars(ceList, roffset, history);
@ -923,7 +923,7 @@ int32_t CollData::minLengthInChars(const CEList *ceList, int32_t offset, int32_t
}
if (shortestLength == INT32_MAX) {
// No matching strings at this offset. See if
// No matching strings at this offset. See if
// the CE is in a range we can handle manually.
if (ce >= minHan && ce < maxHan) {
// all han have implicit orders which
@ -1021,7 +1021,7 @@ CollData *CollData::open(UCollator *collator, UErrorCode &status)
}
CollDataCache *cache = getCollDataCache();
return cache->get(collator, status);
}

View file

@ -40,7 +40,7 @@
#if U_CHARSET_FAMILY==U_EBCDIC_FAMILY
/**
* If we are on EBCDIC, use an iterator which will
* If we are on EBCDIC, use an iterator which will
* traverse the bundles in ASCII order.
*/
#define U_USE_ASCII_BUNDLE_ITERATOR
@ -189,7 +189,7 @@ static const dtTypeElem dtTypes[] = {
{CAP_Z, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 4, 0},
{CAP_V, UDATPG_ZONE_FIELD, DT_SHORT - DT_DELTA, 1, 3},
{CAP_V, UDATPG_ZONE_FIELD, DT_LONG - DT_DELTA, 4, 0},
{0, UDATPG_FIELD_COUNT, 0, 0, 0} , // last row of dtTypes[]
{0, UDATPG_FIELD_COUNT, 0, 0, 0} , // last row of dtTypes[]
};
static const char* const CLDR_FIELD_APPEND[] = {
@ -200,7 +200,7 @@ static const char* const CLDR_FIELD_APPEND[] = {
static const char* const CLDR_FIELD_NAME[] = {
"era", "year", "quarter", "month", "week", "*", "weekday", "day", "*", "*", "dayperiod",
"hour", "minute", "second", "*", "zone"
};
};
static const char* const Resource_Fields[] = {
"day", "dayperiod", "era", "hour", "minute", "month", "second", "week",
@ -255,7 +255,7 @@ DateTimePatternGenerator::createEmptyInstance(UErrorCode& status) {
return result;
}
DateTimePatternGenerator::DateTimePatternGenerator(UErrorCode &status) :
DateTimePatternGenerator::DateTimePatternGenerator(UErrorCode &status) :
skipMatcher(NULL),
fAvailableFormatKeyHash(NULL)
{
@ -284,13 +284,13 @@ DateTimePatternGenerator::DateTimePatternGenerator(const Locale& locale, UErrorC
}
}
DateTimePatternGenerator::DateTimePatternGenerator(const DateTimePatternGenerator& other) :
DateTimePatternGenerator::DateTimePatternGenerator(const DateTimePatternGenerator& other) :
UObject(),
skipMatcher(NULL),
fAvailableFormatKeyHash(NULL)
{
fp = new FormatParser();
dtMatcher = new DateTimeMatcher();
dtMatcher = new DateTimeMatcher();
distanceInfo = new DistanceInfo();
patternMap = new PatternMap();
*this=other;
@ -358,8 +358,8 @@ DateTimePatternGenerator::~DateTimePatternGenerator() {
if (fAvailableFormatKeyHash!=NULL) {
delete fAvailableFormatKeyHash;
}
if (fp != NULL) delete fp;
if (fp != NULL) delete fp;
if (dtMatcher != NULL) delete dtMatcher;
if (distanceInfo != NULL) delete distanceInfo;
if (patternMap != NULL) delete patternMap;
@ -369,7 +369,7 @@ DateTimePatternGenerator::~DateTimePatternGenerator() {
void
DateTimePatternGenerator::initData(const Locale& locale, UErrorCode &status) {
//const char *baseLangName = locale.getBaseName(); // unused
skipMatcher = NULL;
fAvailableFormatKeyHash=NULL;
addCanonicalItems();
@ -441,7 +441,7 @@ void
DateTimePatternGenerator::hackTimes(const UnicodeString& hackPattern, UErrorCode& status) {
UDateTimePatternConflict conflictingStatus;
UnicodeString conflictingString;
fp->set(hackPattern);
UnicodeString mmss;
UBool gotMm=FALSE;
@ -516,7 +516,7 @@ DateTimePatternGenerator::addCLDRData(const Locale& locale) {
}
rb = ures_open(NULL, locale.getName(), &err);
const char *curLocaleName=ures_getLocale(rb, &err);
const char *curLocaleName=ures_getLocaleByType(rb, ULOC_ACTUAL_LOCALE, &err);
const char * calendarTypeToUse = DT_DateTimeGregorianTag; // initial default
char calendarType[ULOC_KEYWORDS_CAPACITY]; // to be filled in with the type to use, if all goes well
if ( U_SUCCESS(err) ) {
@ -561,7 +561,7 @@ DateTimePatternGenerator::addCLDRData(const Locale& locale) {
}
};
ures_close(patBundle);
err = U_ZERO_ERROR;
patBundle = ures_getByKeyWithFallback(calTypeBundle, DT_DateTimeAppendItemsTag, NULL, &err);
key=NULL;
@ -576,7 +576,7 @@ DateTimePatternGenerator::addCLDRData(const Locale& locale) {
}
}
ures_close(patBundle);
key=NULL;
err = U_ZERO_ERROR;
fBundle = ures_getByKeyWithFallback(calTypeBundle, DT_DateTimeFieldsTag, NULL, &err);
@ -588,7 +588,7 @@ DateTimePatternGenerator::addCLDRData(const Locale& locale) {
ures_close(fieldBundle);
ures_close(patBundle);
if (rbPattern.length()==0 ) {
continue;
continue;
}
else {
setAppendItemName(getAppendNameNumber(Resource_Fields[i]), rbPattern);
@ -630,14 +630,14 @@ DateTimePatternGenerator::addCLDRData(const Locale& locale) {
ures_close(calTypeBundle);
ures_close(calBundle);
ures_close(rb);
err = U_ZERO_ERROR;
char parentLocale[50];
int32_t localeNameLen=0;
uprv_strcpy(parentLocale, curLocaleName);
while((localeNameLen=uloc_getParent(parentLocale, parentLocale, 50, &err))>=0 ) {
rb = ures_open(NULL, parentLocale, &err);
curLocaleName=ures_getLocale(rb, &err);
curLocaleName=ures_getLocaleByType(rb, ULOC_ACTUAL_LOCALE, &err);
uprv_strcpy(parentLocale, curLocaleName);
calBundle = ures_getByKey(rb, DT_DateTimeCalendarTag, NULL, &err);
calTypeBundle = ures_getByKey(calBundle, calendarTypeToUse, NULL, &err);
@ -656,7 +656,7 @@ DateTimePatternGenerator::addCLDRData(const Locale& locale) {
retPattern=ures_a_getNextString(&aiter, &len, &key, &err);
#else
retPattern=ures_getNextString(patBundle, &len, &key, &err);
#endif
#endif
UnicodeString format=UnicodeString(retPattern);
UnicodeString retKey=UnicodeString(key, -1, US_INV);
if ( !isAvailableFormatSet(retKey) ) {
@ -736,10 +736,10 @@ DateTimePatternGenerator::getBestPattern(const UnicodeString& patternForm, UErro
int32_t dateMask=(1<<UDATPG_DAYPERIOD_FIELD) - 1;
int32_t timeMask=(1<<UDATPG_FIELD_COUNT) - 1 - dateMask;
UnicodeString patternFormCopy = UnicodeString(patternForm);
patternFormCopy.findAndReplace(UnicodeString(LOW_J), UnicodeString(fDefaultHourFormatChar));
resultPattern.remove();
dtMatcher->set(patternFormCopy, fp);
const PtnSkeleton* specifiedSkeleton=NULL;
@ -772,8 +772,8 @@ DateTimePatternGenerator::getBestPattern(const UnicodeString& patternForm, UErro
}
UnicodeString
DateTimePatternGenerator::replaceFieldTypes(const UnicodeString& pattern,
const UnicodeString& skeleton,
DateTimePatternGenerator::replaceFieldTypes(const UnicodeString& pattern,
const UnicodeString& skeleton,
UErrorCode& /*status*/) {
dtMatcher->set(skeleton, fp);
UnicodeString result = adjustFieldTypes(pattern, NULL, FALSE);
@ -819,7 +819,7 @@ void
DateTimePatternGenerator::setDateTimeFromCalendar(const Locale& locale, UErrorCode& status) {
const UChar *resStr;
int32_t resStrLen = 0;
Calendar* fCalendar = Calendar::createInstance(locale, status);
CalendarData calData(locale, fCalendar?fCalendar->getType():NULL, status);
UResourceBundle *dateTimePatterns = calData.getByKey(DT_DateTimePatternsTag, status);
@ -832,7 +832,7 @@ DateTimePatternGenerator::setDateTimeFromCalendar(const Locale& locale, UErrorCo
}
resStr = ures_getStringByIndex(dateTimePatterns, (int32_t)DateFormat::kDateTime, &resStrLen, &status);
setDateTimeFormat(UnicodeString(TRUE, resStr, resStrLen));
delete fCalendar;
}
@ -909,7 +909,7 @@ DateTimePatternGenerator::addPatternWithSkeleton(
if(U_FAILURE(status)) {
return conflictingStatus;
}
return UDATPG_NO_CONFLICT;
}
@ -1101,7 +1101,7 @@ DateTimePatternGenerator::getTopBitNumber(int32_t foundMask) {
if (i-1 >UDATPG_ZONE_FIELD) {
return UDATPG_ZONE_FIELD;
}
else
else
return i-1;
}
@ -1152,10 +1152,10 @@ DateTimePatternGenerator::getSkeletons(UErrorCode& status) const {
const UnicodeString&
DateTimePatternGenerator::getPatternForSkeleton(const UnicodeString& skeleton) const {
PtnElem *curElem;
if (skeleton.length() ==0) {
return emptyString;
}
}
curElem = patternMap->getHeader(skeleton.charAt(0));
while ( curElem != NULL ) {
if ( curElem->skeleton->getSkeleton()==skeleton ) {
@ -1190,7 +1190,7 @@ DateTimePatternGenerator::getRedundants(UErrorCode& status) {
*skipMatcher = current;
}
UnicodeString trial = getBestPattern(current.getPattern(), status);
if (trial == *pattern) {
if (trial == *pattern) {
((DTRedundantEnumeration *)output)->add(*pattern, status);
}
if (current.equals(skipMatcher)) {
@ -1258,10 +1258,10 @@ PatternMap::copyFrom(const PatternMap& other, UErrorCode& status) {
}
}
PtnElem*
PtnElem*
PatternMap::getHeader(UChar baseChar) {
PtnElem* curElem;
if ( (baseChar >= CAP_A) && (baseChar <= CAP_Z) ) {
curElem = boot[baseChar-CAP_A];
}
@ -1275,7 +1275,7 @@ PatternMap::getHeader(UChar baseChar) {
}
return curElem;
}
PatternMap::~PatternMap() {
for (int32_t i=0; i < MAX_PATTERN_ENTRIES; ++i ) {
if (boot[i]!=NULL ) {
@ -1397,7 +1397,7 @@ PatternMap::getPatternFromSkeleton(PtnSkeleton& skeleton, const PtnSkeleton** sp
break;
}
}
if ((curElem=getHeader(baseChar))==NULL) {
return NULL; // no match
}
@ -1429,7 +1429,7 @@ PatternMap::getPatternFromSkeleton(PtnSkeleton& skeleton, const PtnSkeleton** sp
}while (curElem != NULL);
return NULL;
}
}
UBool
PatternMap::equals(const PatternMap& other) {
@ -1569,7 +1569,7 @@ DateTimeMatcher::getBasePattern(UnicodeString &result ) {
UnicodeString
DateTimeMatcher::getPattern() {
UnicodeString result;
for (int32_t i=0; i<UDATPG_FIELD_COUNT; ++i ) {
if (skeleton.original[i].length()!=0) {
result += skeleton.original[i];
@ -1757,7 +1757,7 @@ FormatParser::isQuoteLiteral(const UnicodeString& s) const {
void
FormatParser::getQuoteLiteral(UnicodeString& quote, int32_t *itemIndex) {
int32_t i=*itemIndex;
quote.remove();
if (items[i].charAt(0)==SINGLE_QUOTE) {
quote += items[i];
@ -1822,7 +1822,7 @@ PatternMapIterator::set(PatternMap& newPatternMap) {
this->patternMap=&newPatternMap;
}
PtnSkeleton*
PtnSkeleton*
PatternMapIterator::getSkeleton() {
if ( nodePtr == NULL ) {
return NULL;
@ -1950,7 +1950,7 @@ PtnSkeleton::getBaseSkeleton() {
PtnSkeleton::~PtnSkeleton() {
}
PtnElem::PtnElem(const UnicodeString &basePat, const UnicodeString &pat) :
PtnElem::PtnElem(const UnicodeString &basePat, const UnicodeString &pat) :
basePattern(basePat),
skeleton(NULL),
pattern(pat),

View file

@ -126,8 +126,8 @@ RuleBasedCollator::RuleBasedCollator(const UnicodeString& rules,
decompositionMode,
status);
}
RuleBasedCollator::RuleBasedCollator(const uint8_t *bin, int32_t length,
const RuleBasedCollator *base,
RuleBasedCollator::RuleBasedCollator(const uint8_t *bin, int32_t length,
const RuleBasedCollator *base,
UErrorCode &status) :
dataIsOwned(TRUE),
isWriteThroughAlias(FALSE)
@ -303,7 +303,7 @@ void RuleBasedCollator::getRules(UColRuleOption delta, UnicodeString &buffer)
ucol_getRulesEx(ucollator, delta, rules, rulesize);
buffer.setTo(rules, rulesize);
uprv_free(rules);
} else { // couldn't allocate
} else { // couldn't allocate
buffer.remove();
}
}
@ -600,7 +600,7 @@ int32_t RuleBasedCollator::hashCode() const
* return the locale of this collator
*/
const Locale RuleBasedCollator::getLocale(ULocDataLocaleType type, UErrorCode &status) const {
const char *result = ucol_getLocale(ucollator, type, &status);
const char *result = ucol_getLocaleByType(ucollator, type, &status);
if(result == NULL) {
Locale res("");
res.setToBogus();
@ -683,7 +683,7 @@ RuleBasedCollator::RuleBasedCollator(const Locale& desiredLocale,
}
}
void
void
RuleBasedCollator::setUCollator(const char *locale,
UErrorCode &status)
{

View file

@ -117,7 +117,7 @@ ucol_initUCA(UErrorCode *status) {
if(U_SUCCESS(*status)){
// Initalize variables for implicit generation
uprv_uca_initImplicitConstants(status);
umtx_lock(NULL);
if(_staticUCA == NULL) {
UCA_DATA_MEM = result;
@ -283,7 +283,7 @@ ucol_open_internal(const char *loc,
result->ucaRules = ures_getStringByKey(b,"UCARules",NULL,&intStatus);
if(loc == NULL) {
loc = ures_getLocale(b, status);
loc = ures_getLocaleByType(b, ULOC_ACTUAL_LOCALE, status);
}
result->requestedLocale = uprv_strdup(loc);
/* test for NULL */
@ -291,14 +291,14 @@ ucol_open_internal(const char *loc,
*status = U_MEMORY_ALLOCATION_ERROR;
goto clean;
}
loc = ures_getLocale(collElem, status);
loc = ures_getLocaleByType(collElem, ULOC_ACTUAL_LOCALE, status);
result->actualLocale = uprv_strdup(loc);
/* test for NULL */
if (result->actualLocale == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
goto clean;
}
loc = ures_getLocale(b, status);
loc = ures_getLocaleByType(b, ULOC_ACTUAL_LOCALE, status);
result->validLocale = uprv_strdup(loc);
/* test for NULL */
if (result->validLocale == NULL) {
@ -750,7 +750,7 @@ static const UEnumeration defaultKeywordValues = {
ulist_close_keyword_values_iterator,
ulist_count_keyword_values,
uenum_unextDefault,
ulist_next_keyword_value,
ulist_next_keyword_value,
ulist_reset_keyword_values_iterator
};
@ -760,7 +760,7 @@ ucol_getKeywordValuesForLocale(const char* /*key*/, const char* locale,
/* Get the locale base name. */
char localeBuffer[ULOC_FULLNAME_CAPACITY] = "";
uloc_getBaseName(locale, localeBuffer, sizeof(localeBuffer), status);
/* Create the 2 lists
* -values is the temp location for the keyword values
* -results hold the actual list used by the UEnumeration object
@ -778,19 +778,19 @@ ucol_getKeywordValuesForLocale(const char* /*key*/, const char* locale,
ulist_deleteList(results);
return NULL;
}
memcpy(en, &defaultKeywordValues, sizeof(UEnumeration));
en->context = results;
/* Open the resource bundle for collation with the given locale. */
UResourceBundle bundle, collations, collres, defres;
ures_initStackObject(&bundle);
ures_initStackObject(&collations);
ures_initStackObject(&collres);
ures_initStackObject(&defres);
ures_openFillIn(&bundle, U_ICUDATA_COLL, localeBuffer, status);
while (U_SUCCESS(*status)) {
ures_getByKey(&bundle, RESOURCE_NAME, &collations, status);
ures_resetIterator(&collations);
@ -804,17 +804,17 @@ ucol_getKeywordValuesForLocale(const char* /*key*/, const char* locale,
if (ulist_getListSize(results) == 0) {
char *defcoll = (char *)uprv_malloc(sizeof(char) * ULOC_KEYWORDS_CAPACITY);
int32_t defcollLength = ULOC_KEYWORDS_CAPACITY;
ures_getNextResource(&collres, &defres, status);
ures_getUTF8String(&defres, defcoll, &defcollLength, TRUE, status);
ulist_addItemBeginList(results, defcoll, TRUE, status);
}
} else {
ulist_addItemEndList(values, key, FALSE, status);
}
}
/* If the locale is "" this is root so exit. */
if (uprv_strlen(localeBuffer) == 0) {
break;
@ -823,12 +823,12 @@ ucol_getKeywordValuesForLocale(const char* /*key*/, const char* locale,
uloc_getParent(localeBuffer, localeBuffer, sizeof(localeBuffer), status);
ures_openFillIn(&bundle, U_ICUDATA_COLL, localeBuffer, status);
}
ures_close(&defres);
ures_close(&collres);
ures_close(&collations);
ures_close(&bundle);
if (U_SUCCESS(*status)) {
char *value = NULL;
ulist_resetList(values);
@ -841,16 +841,16 @@ ucol_getKeywordValuesForLocale(const char* /*key*/, const char* locale,
}
}
}
ulist_deleteList(values);
if (U_FAILURE(*status)){
uenum_close(en);
en = NULL;
} else {
ulist_resetList(results);
}
return en;
}

View file

@ -114,7 +114,7 @@ static const AttributeConversion conversions[12] = {
};
static char
static char
ucol_sit_attributeValueToLetter(UColAttributeValue value, UErrorCode *status) {
uint32_t i = 0;
for(i = 0; i < sizeof(conversions)/sizeof(conversions[0]); i++) {
@ -126,7 +126,7 @@ ucol_sit_attributeValueToLetter(UColAttributeValue value, UErrorCode *status) {
return 0;
}
static UColAttributeValue
static UColAttributeValue
ucol_sit_letterToAttributeValue(char letter, UErrorCode *status) {
uint32_t i = 0;
for(i = 0; i < sizeof(conversions)/sizeof(conversions[0]); i++) {
@ -147,8 +147,8 @@ U_CDECL_END
U_CDECL_BEGIN
static const char* U_CALLCONV
_processLocaleElement(CollatorSpec *spec, uint32_t value, const char* string,
UErrorCode *status)
_processLocaleElement(CollatorSpec *spec, uint32_t value, const char* string,
UErrorCode *status)
{
int32_t len = 0;
do {
@ -169,8 +169,8 @@ U_CDECL_END
U_CDECL_BEGIN
static const char* U_CALLCONV
_processRFC3066Locale(CollatorSpec *spec, uint32_t, const char* string,
UErrorCode *status)
_processRFC3066Locale(CollatorSpec *spec, uint32_t, const char* string,
UErrorCode *status)
{
char terminator = *string;
string++;
@ -188,8 +188,8 @@ U_CDECL_END
U_CDECL_BEGIN
static const char* U_CALLCONV
_processCollatorOption(CollatorSpec *spec, uint32_t option, const char* string,
UErrorCode *status)
_processCollatorOption(CollatorSpec *spec, uint32_t option, const char* string,
UErrorCode *status)
{
spec->options[option] = ucol_sit_letterToAttributeValue(*string, status);
if((*(++string) != '_' && *string) || U_FAILURE(*status)) {
@ -200,8 +200,8 @@ _processCollatorOption(CollatorSpec *spec, uint32_t option, const char* string,
U_CDECL_END
static UChar
readHexCodeUnit(const char **string, UErrorCode *status)
static UChar
readHexCodeUnit(const char **string, UErrorCode *status)
{
UChar result = 0;
int32_t value = 0;
@ -231,7 +231,7 @@ readHexCodeUnit(const char **string, UErrorCode *status)
U_CDECL_BEGIN
static const char* U_CALLCONV
_processVariableTop(CollatorSpec *spec, uint32_t value1, const char* string, UErrorCode *status)
_processVariableTop(CollatorSpec *spec, uint32_t value1, const char* string, UErrorCode *status)
{
// get four digits
int32_t i = 0;
@ -248,7 +248,7 @@ _processVariableTop(CollatorSpec *spec, uint32_t value1, const char* string, UEr
}
if(U_SUCCESS(*status)) {
spec->variableTopSet = TRUE;
}
}
return string;
}
U_CDECL_END
@ -263,7 +263,7 @@ struct ShortStringOptions {
static const ShortStringOptions options[UCOL_SIT_ITEMS_COUNT] =
{
/* 10 ALTERNATE_HANDLING */ {alternateHArg, _processCollatorOption, UCOL_ALTERNATE_HANDLING }, // alternate N, S, D
/* 10 ALTERNATE_HANDLING */ {alternateHArg, _processCollatorOption, UCOL_ALTERNATE_HANDLING }, // alternate N, S, D
/* 15 VARIABLE_TOP_VALUE */ {variableTopValArg, _processVariableTop, 1 },
/* 08 CASE_FIRST */ {caseFirstArg, _processCollatorOption, UCOL_CASE_FIRST }, // case first L, U, X, D
/* 09 NUMERIC_COLLATION */ {numericCollArg, _processCollatorOption, UCOL_NUMERIC_COLLATION }, // codan O, X, D
@ -283,8 +283,8 @@ static const ShortStringOptions options[UCOL_SIT_ITEMS_COUNT] =
static
const char* ucol_sit_readOption(const char *start, CollatorSpec *spec,
UErrorCode *status)
const char* ucol_sit_readOption(const char *start, CollatorSpec *spec,
UErrorCode *status)
{
int32_t i = 0;
@ -301,7 +301,7 @@ const char* ucol_sit_readOption(const char *start, CollatorSpec *spec,
}
static
void ucol_sit_initCollatorSpecs(CollatorSpec *spec)
void ucol_sit_initCollatorSpecs(CollatorSpec *spec)
{
// reset everything
uprv_memset(spec, 0, sizeof(CollatorSpec));
@ -312,12 +312,12 @@ void ucol_sit_initCollatorSpecs(CollatorSpec *spec)
}
}
static const char*
ucol_sit_readSpecs(CollatorSpec *s, const char *string,
static const char*
ucol_sit_readSpecs(CollatorSpec *s, const char *string,
UParseError *parseError, UErrorCode *status)
{
const char *definition = string;
while(U_SUCCESS(*status) && *string) {
while(U_SUCCESS(*status) && *string) {
string = ucol_sit_readOption(string, s, status);
// advance over '_'
while(*string && *string == '_') {
@ -335,7 +335,7 @@ int32_t ucol_sit_dumpSpecs(CollatorSpec *s, char *destination, int32_t capacity,
{
int32_t i = 0, j = 0;
int32_t len = 0;
char optName;
char optName;
if(U_SUCCESS(*status)) {
for(i = 0; i < UCOL_SIT_ITEMS_COUNT; i++) {
if(s->entries[i].start) {
@ -344,7 +344,7 @@ int32_t ucol_sit_dumpSpecs(CollatorSpec *s, char *destination, int32_t capacity,
uprv_strcat(destination, "_");
}
len++;
}
}
optName = *(s->entries[i].start);
if(optName == languageArg || optName == regionArg || optName == variantArg || optName == keywordArg) {
for(j = 0; j < s->entries[i].len; j++) {
@ -429,7 +429,7 @@ ucol_prepareShortStringOpen( const char *definition,
ucol_sit_initCollatorSpecs(&s);
ucol_sit_readSpecs(&s, definition, parseError, status);
ucol_sit_calculateWholeLocale(&s);
char buffer[internalBufferSize];
uprv_memset(buffer, 0, internalBufferSize);
uloc_canonicalize(s.locale, buffer, internalBufferSize, status);
@ -493,7 +493,7 @@ ucol_openFromShortString( const char *definition,
ucol_sit_initCollatorSpecs(&s);
string = ucol_sit_readSpecs(&s, definition, parseError, status);
ucol_sit_calculateWholeLocale(&s);
char buffer[internalBufferSize];
uprv_memset(buffer, 0, internalBufferSize);
uloc_canonicalize(s.locale, buffer, internalBufferSize, status);
@ -571,7 +571,7 @@ ucol_getShortDefinitionString(const UCollator *coll,
ucol_sit_initCollatorSpecs(&s);
if(!locale) {
locale = ucol_getLocale(coll, ULOC_VALID_LOCALE, status);
locale = ucol_getLocaleByType(coll, ULOC_VALID_LOCALE, status);
}
elementSize = ucol_getFunctionalEquivalent(locBuff, internalBufferSize, "collation", locale, &isAvailable, status);
@ -587,7 +587,7 @@ ucol_getShortDefinitionString(const UCollator *coll,
appendShortStringElement(tempbuff, elementSize, buffer, &resultSize, /*capacity*/internalBufferSize, variantArg);
elementSize = uloc_getKeywordValue(locBuff, "collation", tempbuff, internalBufferSize, status);
appendShortStringElement(tempbuff, elementSize, buffer, &resultSize, /*capacity*/internalBufferSize, keywordArg);
}
}
int32_t i = 0;
UColAttributeValue attribute = UCOL_DEFAULT;
@ -596,7 +596,7 @@ ucol_getShortDefinitionString(const UCollator *coll,
attribute = ucol_getAttributeOrDefault(coll, (UColAttribute)options[i].attr, status);
if(attribute != UCOL_DEFAULT) {
char letter = ucol_sit_attributeValueToLetter(attribute, status);
appendShortStringElement(&letter, 1,
appendShortStringElement(&letter, 1,
buffer, &resultSize, /*capacity*/internalBufferSize, options[i].optionStart);
}
}
@ -640,7 +640,7 @@ ucol_normalizeShortDefinitionString(const char *definition,
}
U_CAPI UColAttributeValue U_EXPORT2
ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status)
ucol_getAttributeOrDefault(const UCollator *coll, UColAttribute attr, UErrorCode *status)
{
if(U_FAILURE(*status) || coll == NULL) {
return UCOL_DEFAULT;
@ -683,8 +683,8 @@ struct contContext {
static void
addSpecial(contContext *context, UChar *buffer, int32_t bufLen,
uint32_t CE, int32_t leftIndex, int32_t rightIndex, UErrorCode *status)
addSpecial(contContext *context, UChar *buffer, int32_t bufLen,
uint32_t CE, int32_t leftIndex, int32_t rightIndex, UErrorCode *status)
{
const UCollator *coll = context->coll;
USet *contractions = context->conts;
@ -704,7 +704,7 @@ addSpecial(contContext *context, UChar *buffer, int32_t bufLen,
uset_addString(expansions, buffer+leftIndex, rightIndex-leftIndex);
}
}
}
}
UCharOffset++;
// check whether we're doing contraction or prefix
@ -755,7 +755,7 @@ addSpecial(contContext *context, UChar *buffer, int32_t bufLen,
U_CDECL_BEGIN
static UBool U_CALLCONV
_processSpecials(const void *context, UChar32 start, UChar32 limit, uint32_t CE)
_processSpecials(const void *context, UChar32 start, UChar32 limit, uint32_t CE)
{
UErrorCode *status = ((contContext *)context)->status;
USet *expansions = ((contContext *)context)->expansions;
@ -765,7 +765,7 @@ _processSpecials(const void *context, UChar32 start, UChar32 limit, uint32_t CE)
if(isSpecial(CE)) {
if(((getCETag(CE) == SPEC_PROC_TAG && addPrefixes) || getCETag(CE) == CONTRACTION_TAG)) {
while(start < limit && U_SUCCESS(*status)) {
// if there are suppressed contractions, we don't
// if there are suppressed contractions, we don't
// want to add them.
if(removed && uset_contains(removed, start)) {
start++;
@ -852,7 +852,7 @@ ucol_getContractionsAndExpansions( const UCollator *coll,
// Add the UCA contractions
c.coll = coll->UCA;
utrie_enum(&coll->UCA->mapping, NULL, _processSpecials, &c);
// This is collator specific. Add contractions from a collator
c.coll = coll;
c.removedContractions = NULL;
@ -889,7 +889,7 @@ ucol_getUnsafeSet( const UCollator *coll,
int32_t contsSize = ucol_getContractions(coll, contractions, status);
UChar32 c = 0;
// Contraction set consists only of strings
// to get unsafe code points, we need to
// to get unsafe code points, we need to
// break the strings apart and add them to the unsafe set
for(i = 0; i < contsSize; i++) {
len = uset_getItem(contractions, i, NULL, NULL, buffer, internalBufferSize, status);

File diff suppressed because it is too large Load diff