mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 17:01:16 +00:00
ICU-2487 fix warnings, clean up long lines
X-SVN-Rev: 14956
This commit is contained in:
parent
4f3e9c90d2
commit
2435461145
1 changed files with 42 additions and 23 deletions
|
@ -1964,7 +1964,9 @@ ures_openAvailableLocales(const char *path, UErrorCode *status)
|
|||
UEnumeration *en = NULL;
|
||||
ULocalesContext *myContext = NULL;
|
||||
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
if(U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
myContext = uprv_malloc(sizeof(ULocalesContext));
|
||||
en = (UEnumeration *)uprv_malloc(sizeof(UEnumeration));
|
||||
if(!en || !myContext) {
|
||||
|
@ -1981,7 +1983,8 @@ ures_openAvailableLocales(const char *path, UErrorCode *status)
|
|||
ures_getByKey(index, INDEX_TAG, &myContext->installed, status);
|
||||
if(U_SUCCESS(*status)) {
|
||||
#if defined(URES_TREE_DEBUG)
|
||||
fprintf(stderr, "Got %s::%s::[%s] : %s\n", path, INDEX_LOCALE_NAME, INDEX_TAG, ures_getKey(&myContext->installed));
|
||||
fprintf(stderr, "Got %s::%s::[%s] : %s\n",
|
||||
path, INDEX_LOCALE_NAME, INDEX_TAG, ures_getKey(&myContext->installed));
|
||||
#endif
|
||||
en->context = myContext;
|
||||
} else {
|
||||
|
@ -2001,8 +2004,8 @@ ures_openAvailableLocales(const char *path, UErrorCode *status)
|
|||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
|
||||
const char *path, const char *resName, const char *keyword, const char *locid,
|
||||
UBool *isAvailable, UErrorCode *status)
|
||||
const char *path, const char *resName, const char *keyword, const char *locid,
|
||||
UBool *isAvailable, UErrorCode *status)
|
||||
{
|
||||
char kwVal[1024] = ""; /* value of keyword 'keyword' */
|
||||
char defVal[1024] = ""; /* default value for given locale */
|
||||
|
@ -2015,7 +2018,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
|
|||
UResourceBundle *res = NULL;
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
int32_t length = 0;
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
if(U_FAILURE(*status)) return 0;
|
||||
if(isAvailable) {
|
||||
*isAvailable = TRUE;
|
||||
}
|
||||
|
@ -2025,7 +2028,8 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
|
|||
}
|
||||
uloc_getBaseName(locid, base, 1024-1,&subStatus);
|
||||
#if defined(URES_TREE_DEBUG)
|
||||
fprintf(stderr, "gFE: %s: [%s @ %s = %s] - %s\n", locid, keyword, base, kwVal, u_errorName(subStatus));
|
||||
fprintf(stderr, "gFE: %s: [%s @ %s = %s] - %s\n",
|
||||
locid, keyword, base, kwVal, u_errorName(subStatus));
|
||||
#endif
|
||||
ures_initStackObject(&bund1);
|
||||
ures_initStackObject(&bund2);
|
||||
|
@ -2036,7 +2040,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
|
|||
|
||||
if(U_FAILURE(subStatus)) {
|
||||
*status = subStatus;
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
do {
|
||||
|
@ -2060,19 +2064,22 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
|
|||
int32_t defLen;
|
||||
/* look for default item */
|
||||
#if defined(URES_TREE_DEBUG)
|
||||
fprintf(stderr, "%s;%s : loaded default -> %s\n", path?path:"ICUDATA", parent, u_errorName(subStatus));
|
||||
fprintf(stderr, "%s;%s : loaded default -> %s\n",
|
||||
path?path:"ICUDATA", parent, u_errorName(subStatus));
|
||||
#endif
|
||||
defUstr = ures_getStringByKey(&bund1, DEFAULT_TAG, &defLen, &subStatus);
|
||||
if(U_SUCCESS(subStatus) && defLen) {
|
||||
u_UCharsToChars(defUstr, defVal, 1023);
|
||||
#if defined(URES_TREE_DEBUG)
|
||||
fprintf(stderr, "%s;%s -> default %s=%s, %s\n", path?path:"ICUDATA", parent, keyword, defVal, u_errorName(subStatus));
|
||||
fprintf(stderr, "%s;%s -> default %s=%s, %s\n",
|
||||
path?path:"ICUDATA", parent, keyword, defVal, u_errorName(subStatus));
|
||||
#endif
|
||||
uprv_strcpy(defLoc, parent);
|
||||
if(kwVal[0]==0) {
|
||||
uprv_strcpy(kwVal, defVal);
|
||||
#if defined(URES_TREE_DEBUG)
|
||||
fprintf(stderr, "%s;%s -> kwVal = %s\n", path?path:"ICUDATA", parent, keyword, kwVal);
|
||||
fprintf(stderr, "%s;%s -> kwVal = %s\n",
|
||||
path?path:"ICUDATA", parent, keyword, kwVal);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -2099,7 +2106,8 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
|
|||
isAvailable = NULL; /* only want to set this the first time around */
|
||||
|
||||
#if defined(URES_TREE_DEBUG)
|
||||
fprintf(stderr, "%s;%s -> %s (looking for %s)\n", path?path:"ICUDATA", parent, u_errorName(subStatus), kwVal);
|
||||
fprintf(stderr, "%s;%s -> %s (looking for %s)\n",
|
||||
path?path:"ICUDATA", parent, u_errorName(subStatus), kwVal);
|
||||
#endif
|
||||
if(U_FAILURE(subStatus)) {
|
||||
*status = subStatus;
|
||||
|
@ -2111,7 +2119,8 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
|
|||
ures_getByKey(&bund1, kwVal, &bund2, &subStatus);
|
||||
if(subStatus == U_ZERO_ERROR) {
|
||||
#if defined(URES_TREE_DEBUG)
|
||||
fprintf(stderr, "%s;%s -> full %s=%s, %s\n", path?path:"ICUDATA", parent, keyword, kwVal, u_errorName(subStatus));
|
||||
fprintf(stderr, "%s;%s -> full %s=%s, %s\n",
|
||||
path?path:"ICUDATA", parent, keyword, kwVal, u_errorName(subStatus));
|
||||
#endif
|
||||
uprv_strcpy(full, parent);
|
||||
if(*full == 0) {
|
||||
|
@ -2119,7 +2128,8 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
|
|||
}
|
||||
} else {
|
||||
#if defined(URES_TREE_DEBUG)
|
||||
fprintf(stderr, "err=%s in %s looking for %s\n", u_errorName(subStatus), parent, kwVal);
|
||||
fprintf(stderr, "err=%s in %s looking for %s\n",
|
||||
u_errorName(subStatus), parent, kwVal);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -2149,7 +2159,8 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
|
|||
isAvailable = NULL; /* only want to set this the first time around */
|
||||
|
||||
#if defined(URES_TREE_DEBUG)
|
||||
fprintf(stderr, "%s;%s -> %s (looking for default %s)\n", path?path:"ICUDATA", parent, u_errorName(subStatus), kwVal);
|
||||
fprintf(stderr, "%s;%s -> %s (looking for default %s)\n",
|
||||
path?path:"ICUDATA", parent, u_errorName(subStatus), kwVal);
|
||||
#endif
|
||||
if(U_FAILURE(subStatus)) {
|
||||
*status = subStatus;
|
||||
|
@ -2161,7 +2172,8 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
|
|||
ures_getByKey(&bund1, kwVal, &bund2, &subStatus);
|
||||
if(subStatus == U_ZERO_ERROR) {
|
||||
#if defined(URES_TREE_DEBUG)
|
||||
fprintf(stderr, "%s;%s -> full %s=%s, %s\n", path?path:"ICUDATA", parent, keyword, kwVal, u_errorName(subStatus));
|
||||
fprintf(stderr, "%s;%s -> full %s=%s, %s\n", path?path:"ICUDATA",
|
||||
parent, keyword, kwVal, u_errorName(subStatus));
|
||||
#endif
|
||||
uprv_strcpy(full, parent);
|
||||
if(*full == 0) {
|
||||
|
@ -2184,8 +2196,9 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
|
|||
fprintf(stderr, "Still could not load keyword %s=%s\n", keyword, kwVal);
|
||||
*status = U_MISSING_RESOURCE_ERROR;
|
||||
#endif
|
||||
} else if( (!uprv_strcmp(kwVal, defVal)) &&
|
||||
uprv_strlen(defLoc) <= uprv_strlen(full)) {
|
||||
} else if( (!uprv_strcmp(kwVal, defVal)) && /* if the requested kw is default, */
|
||||
uprv_strlen(defLoc) <= uprv_strlen(full)) { /* and the default is in or in an
|
||||
ancestor of the current locale */
|
||||
#if defined(URES_TREE_DEBUG)
|
||||
fprintf(stderr, "Removing unneeded var %s=%s\n", keyword, kwVal);
|
||||
#endif
|
||||
|
@ -2235,12 +2248,14 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
|
|||
|
||||
UResourceBundle item;
|
||||
UResourceBundle subItem;
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
|
||||
ures_initStackObject(&item);
|
||||
ures_initStackObject(&subItem);
|
||||
locs = ures_openAvailableLocales(path, status);
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
|
||||
if(U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
valuesBuf[0]=0;
|
||||
valuesBuf[1]=0;
|
||||
|
@ -2253,7 +2268,8 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
|
|||
|
||||
#if defined(URES_TREE_DEBUG)
|
||||
if(!bund || U_FAILURE(subStatus)) {
|
||||
fprintf(stderr, "%s-%s values: Can't open %s locale - skipping. (%s)\n", path?path:"<ICUDATA>", keyword, locale, u_errorName(subStatus));
|
||||
fprintf(stderr, "%s-%s values: Can't open %s locale - skipping. (%s)\n",
|
||||
path?path:"<ICUDATA>", keyword, locale, u_errorName(subStatus));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2261,7 +2277,8 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
|
|||
|
||||
if(!bund || U_FAILURE(subStatus)) {
|
||||
#if defined(URES_TREE_DEBUG)
|
||||
fprintf(stderr, "%s-%s values: Can't find in %s - skipping. (%s)\n", path?path:"<ICUDATA>", keyword, locale, u_errorName(subStatus));
|
||||
fprintf(stderr, "%s-%s values: Can't find in %s - skipping. (%s)\n",
|
||||
path?path:"<ICUDATA>", keyword, locale, u_errorName(subStatus));
|
||||
continue;
|
||||
#endif
|
||||
}
|
||||
|
@ -2293,7 +2310,8 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
|
|||
valuesList[valuesCount++] = valuesBuf+valuesIndex;
|
||||
valuesIndex += kLen;
|
||||
#if defined(URES_TREE_DEBUG)
|
||||
fprintf(stderr, "%s | %s | %s | [%s] (UNIQUE)\n", path?path:"<ICUDATA>", keyword, locale, k);
|
||||
fprintf(stderr, "%s | %s | %s | [%s] (UNIQUE)\n",
|
||||
path?path:"<ICUDATA>", keyword, locale, k);
|
||||
#endif
|
||||
valuesBuf[valuesIndex++] = 0; /* terminate */
|
||||
}
|
||||
|
@ -2305,7 +2323,8 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
|
|||
ures_close(&item);
|
||||
ures_close(&subItem);
|
||||
#if defined(URES_TREE_DEBUG)
|
||||
fprintf(stderr, "%s: size %d, #%d\n", u_errorName(*status), valuesIndex, valuesCount);
|
||||
fprintf(stderr, "%s: size %d, #%d\n", u_errorName(*status),
|
||||
valuesIndex, valuesCount);
|
||||
#endif
|
||||
return uloc_openKeywordList(valuesBuf, valuesIndex, status);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue