diff --git a/icu4c/source/common/iculserv.cpp b/icu4c/source/common/iculserv.cpp index d20d582605b..303df79ac9d 100644 --- a/icu4c/source/common/iculserv.cpp +++ b/icu4c/source/common/iculserv.cpp @@ -86,7 +86,7 @@ LocaleUtility::initNameFromLocale(const Locale& locale, UnicodeString& result) } const Hashtable* -LocaleUtility::getAvailableLocaleNames(const UnicodeString& bundleID) +LocaleUtility::getAvailableLocaleNames(const UnicodeString& /* bundleID */) { // have to ignore bundleID for the moment, since we don't have easy C++ api. // assume it's the default bundle @@ -346,7 +346,7 @@ LocaleKeyFactory::updateVisibleIDs(Hashtable& result, UErrorCode& status) const const UHashElement* elem = NULL; int32_t pos = 0; - while (elem = supported->nextElement(pos)) { + while ((elem = supported->nextElement(pos)) != NULL) { const UnicodeString& id = *((const UnicodeString*)elem->key.pointer); if (!visible) { result.remove(id); @@ -375,7 +375,10 @@ LocaleKeyFactory::getDisplayName(const UnicodeString& id, const Locale& locale, } UObject* -LocaleKeyFactory::handleCreate(const Locale& loc, int32_t kind, const ICUService* service, UErrorCode& status) const { +LocaleKeyFactory::handleCreate(const Locale& /* loc */, + int32_t /* kind */, + const ICUService* /* service */, + UErrorCode& /* status */) const { return NULL; } @@ -386,7 +389,7 @@ LocaleKeyFactory::isSupportedID(const UnicodeString& id, UErrorCode& status) con } const Hashtable* -LocaleKeyFactory::getSupportedIDs(UErrorCode& status) const { +LocaleKeyFactory::getSupportedIDs(UErrorCode& /* status */) const { return NULL; } @@ -461,7 +464,7 @@ SimpleLocaleKeyFactory::create(const ICUServiceKey& key, const ICUService* servi } UBool -SimpleLocaleKeyFactory::isSupportedID(const UnicodeString& id, UErrorCode& status) const +SimpleLocaleKeyFactory::isSupportedID(const UnicodeString& id, UErrorCode& /* status */) const { return id == _id; } @@ -525,7 +528,7 @@ ICUResourceBundleFactory::getSupportedIDs(UErrorCode& status) const } UObject* -ICUResourceBundleFactory::handleCreate(const Locale& loc, int32_t kind, const ICUService* service, UErrorCode& status) const +ICUResourceBundleFactory::handleCreate(const Locale& loc, int32_t /* kind */, const ICUService* /* service */, UErrorCode& status) const { if (U_SUCCESS(status)) { return new ResourceBundle(_bundleName, loc, status); diff --git a/icu4c/source/common/icuserv.cpp b/icu4c/source/common/icuserv.cpp index d73fc189a36..624b6be69e8 100644 --- a/icu4c/source/common/icuserv.cpp +++ b/icu4c/source/common/icuserv.cpp @@ -493,7 +493,6 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer // going to update the cache at all. putInCache = TRUE; - int32_t n = 0; int32_t index = startIndex; while (index < limit) { ICUServiceFactory* f = (ICUServiceFactory*)factories->elementAt(index++); @@ -591,7 +590,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer } UObject* -ICUService::handleDefault(const ICUServiceKey& key, UnicodeString* actualIDReturn, UErrorCode& status) const +ICUService::handleDefault(const ICUServiceKey& /* key */, UnicodeString* /* actualIDReturn */, UErrorCode& /* status */) const { return NULL; } @@ -744,7 +743,7 @@ ICUService::getDisplayNames(UVector& result, int32_t pos = 0; const UHashElement* entry = NULL; - while (entry = m->nextElement(pos)) { + while ((entry = m->nextElement(pos)) != NULL) { const UnicodeString* id = (const UnicodeString*)entry->key.pointer; ICUServiceFactory* f = (ICUServiceFactory*)entry->value.pointer; UnicodeString dname; @@ -768,7 +767,7 @@ ICUService::getDisplayNames(UVector& result, ICUServiceKey* matchKey = createKey(matchID, status); int32_t pos = 0; const UHashElement *entry = NULL; - while (entry = dnCache->cache.nextElement(pos)) { + while ((entry = dnCache->cache.nextElement(pos)) != NULL) { const UnicodeString* id = (const UnicodeString*)entry->value.pointer; if (matchKey != NULL && !matchKey->isFallbackOf(*id)) { continue; diff --git a/icu4c/source/i18n/decimfmt.cpp b/icu4c/source/i18n/decimfmt.cpp index 91bd6b97572..a6d6948c75e 100644 --- a/icu4c/source/i18n/decimfmt.cpp +++ b/icu4c/source/i18n/decimfmt.cpp @@ -1329,7 +1329,6 @@ UBool DecimalFormat::subparse(const UnicodeString& text, ParsePosition& parsePos decimal = &getConstSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol); } const UnicodeString *grouping = &getConstSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol); - const UnicodeString *exponentChar = &getConstSymbol(DecimalFormatSymbols::kExponentialSymbol); UBool sawDecimal = FALSE; UBool sawDigit = FALSE; int32_t backup = -1; @@ -2939,7 +2938,7 @@ DecimalFormat::applyPattern(const UnicodeString& pattern, int8_t groupingCount = -1; int8_t groupingCount2 = -1; int32_t padPos = -1; - UChar32 padChar; + UChar32 padChar = 0; int32_t roundingPos = -1; DigitList roundingInc; int8_t expDigits = -1; diff --git a/icu4c/source/i18n/numfmt.cpp b/icu4c/source/i18n/numfmt.cpp index 12f5678c056..83294584c93 100644 --- a/icu4c/source/i18n/numfmt.cpp +++ b/icu4c/source/i18n/numfmt.cpp @@ -339,7 +339,7 @@ static ICULocaleService* gService = NULL; class ICUNumberFormatFactory : public ICUResourceBundleFactory { protected: - virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* service, UErrorCode& status) const { + virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* /* service */, UErrorCode& status) const { // !!! kind is not an EStyles, need to determine how to handle this return NumberFormat::makeInstance(loc, (NumberFormat::EStyles)kind, status); } @@ -421,7 +421,7 @@ public: return ((NumberFormat*)instance)->clone(); } - virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* actualID, UErrorCode& status) const { + virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* /* actualID */, UErrorCode& status) const { LocaleKey& lkey = (LocaleKey&)key; int32_t kind = lkey.kind(); Locale loc; diff --git a/icu4c/source/i18n/rbnf.cpp b/icu4c/source/i18n/rbnf.cpp index 5e7e8903550..e683184d40a 100644 --- a/icu4c/source/i18n/rbnf.cpp +++ b/icu4c/source/i18n/rbnf.cpp @@ -245,7 +245,7 @@ RuleBasedNumberFormat::findRuleSet(const UnicodeString& name, UErrorCode& status UnicodeString& RuleBasedNumberFormat::format(int32_t number, UnicodeString& toAppendTo, - FieldPosition& pos) const + FieldPosition& /* pos */) const { if (defaultRuleSet) defaultRuleSet->format((int64_t)number, toAppendTo, toAppendTo.length()); return toAppendTo; @@ -255,7 +255,7 @@ RuleBasedNumberFormat::format(int32_t number, UnicodeString& RuleBasedNumberFormat::format(int64_t number, UnicodeString& toAppendTo, - FieldPosition& pos) const + FieldPosition& /* pos */) const { if (defaultRuleSet) defaultRuleSet->format(number, toAppendTo, toAppendTo.length()); return toAppendTo; @@ -265,7 +265,7 @@ RuleBasedNumberFormat::format(int64_t number, UnicodeString& RuleBasedNumberFormat::format(double number, UnicodeString& toAppendTo, - FieldPosition& pos) const + FieldPosition& /* pos */) const { if (defaultRuleSet) defaultRuleSet->format(number, toAppendTo, toAppendTo.length()); return toAppendTo; @@ -276,7 +276,7 @@ UnicodeString& RuleBasedNumberFormat::format(int32_t number, const UnicodeString& ruleSetName, UnicodeString& toAppendTo, - FieldPosition& pos, + FieldPosition& /* pos */, UErrorCode& status) const { // return format((int64_t)number, ruleSetName, toAppendTo, pos, status); @@ -299,7 +299,7 @@ UnicodeString& RuleBasedNumberFormat::format(int64_t number, const UnicodeString& ruleSetName, UnicodeString& toAppendTo, - FieldPosition& pos, + FieldPosition& /* pos */, UErrorCode& status) const { if (U_SUCCESS(status)) { @@ -331,7 +331,7 @@ UnicodeString& RuleBasedNumberFormat::format(double number, const UnicodeString& ruleSetName, UnicodeString& toAppendTo, - FieldPosition& pos, + FieldPosition& /* pos */, UErrorCode& status) const { if (U_SUCCESS(status)) { @@ -446,7 +446,7 @@ RuleBasedNumberFormat::initDefaultRuleSet() void -RuleBasedNumberFormat::init(const UnicodeString& rules, UParseError& pErr, UErrorCode& status) +RuleBasedNumberFormat::init(const UnicodeString& rules, UParseError& /* pErr */, UErrorCode& status) { // TODO: implement UParseError // Note: this can leave ruleSets == NULL, so remaining code should check diff --git a/icu4c/source/test/intltest/icusvtst.cpp b/icu4c/source/test/intltest/icusvtst.cpp index b570ef259f8..19ab339ec6f 100644 --- a/icu4c/source/test/intltest/icusvtst.cpp +++ b/icu4c/source/test/intltest/icusvtst.cpp @@ -467,7 +467,7 @@ class TestStringService : public ICUService { return LocaleKey::createWithCanonicalFallback(id, NULL, status); // no fallback locale } - virtual ICUServiceFactory* createSimpleFactory(UObject* obj, const UnicodeString& id, UBool visible, UErrorCode& status) + virtual ICUServiceFactory* createSimpleFactory(UObject* obj, const UnicodeString& id, UBool visible, UErrorCode& /* status */) { if (obj && obj->getDynamicClassID() == UnicodeString::getStaticClassID()) { return new SimpleFactory((UnicodeString*)obj, id, visible); @@ -484,7 +484,7 @@ class TestStringService : public ICUService { class AnonymousStringFactory : public ICUServiceFactory { public: - virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const { + virtual UObject* create(const ICUServiceKey& key, const ICUService* /* service */, UErrorCode& /* status */) const { return new UnicodeString(key.getID()); } @@ -530,12 +530,19 @@ class TestMultipleKeyStringFactory : public ICUServiceFactory { ~TestMultipleKeyStringFactory() { } - UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const { + UObject* create(const ICUServiceKey& key, const ICUService* /* service */, UErrorCode& status) const { + if (U_FAILURE(status)) { + return NULL; + } UnicodeString temp; key.currentID(temp); - if (U_SUCCESS(_status) && _ids.contains(&temp)) { - return new UnicodeString(_factoryID + temp); - } + if (U_SUCCESS(_status)) { + if (_ids.contains(&temp)) { + return new UnicodeString(_factoryID + temp); + } + } else { + status = _status; + } return NULL; } @@ -1208,7 +1215,7 @@ class WrapFactory : public ICUServiceFactory { } } - UnicodeString& getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const { + UnicodeString& getDisplayName(const UnicodeString& id, const Locale& /* locale */, UnicodeString& result) const { result.append("wrap '"); result.append(id); result.append("'"); diff --git a/icu4c/source/test/intltest/nmfmapts.cpp b/icu4c/source/test/intltest/nmfmapts.cpp index 4f143c698a2..76ea94e9cde 100644 --- a/icu4c/source/test/intltest/nmfmapts.cpp +++ b/icu4c/source/test/intltest/nmfmapts.cpp @@ -257,7 +257,7 @@ public: delete currencyStyle; } - virtual NumberFormat* createFormat(const Locale& loc, UNumberFormatStyle formatType) + virtual NumberFormat* createFormat(const Locale& /* loc */, UNumberFormatStyle formatType) { if (formatType == UNUM_CURRENCY) { return (NumberFormat*)currencyStyle->clone();