diff --git a/icu4c/source/common/locid.cpp b/icu4c/source/common/locid.cpp index f7899cc4dc..9bf3a1eb98 100644 --- a/icu4c/source/common/locid.cpp +++ b/icu4c/source/common/locid.cpp @@ -1226,7 +1226,7 @@ public: return new KeywordEnumeration(keywords, length, (int32_t)(current - keywords), status); } - int32_t count(UErrorCode &/*status*/) const { + virtual int32_t count(UErrorCode &/*status*/) const { char *kw = keywords; int32_t result = 0; while(*kw) { @@ -1236,7 +1236,7 @@ public: return result; } - const char* next(int32_t* resultLength, UErrorCode& status) { + virtual const char* next(int32_t* resultLength, UErrorCode& status) { const char* result; int32_t len; if(U_SUCCESS(status) && *current != 0) { @@ -1255,13 +1255,13 @@ public: return result; } - const UnicodeString* snext(UErrorCode& status) { + virtual const UnicodeString* snext(UErrorCode& status) { int32_t resultLength = 0; const char *s = next(&resultLength, status); return setChars(s, resultLength, status); } - void reset(UErrorCode& /*status*/) { + virtual void reset(UErrorCode& /*status*/) { current = keywords; } }; diff --git a/icu4c/source/common/ucnv_u16.c b/icu4c/source/common/ucnv_u16.c index 9341cc1050..86fd19991c 100644 --- a/icu4c/source/common/ucnv_u16.c +++ b/icu4c/source/common/ucnv_u16.c @@ -19,7 +19,6 @@ #if !UCONFIG_NO_CONVERSION #include "unicode/ucnv.h" -#include "unicode/ucnv_err.h" #include "ucnv_bld.h" #include "ucnv_cnv.h" #include "cmemory.h" diff --git a/icu4c/source/common/ucnv_u32.c b/icu4c/source/common/ucnv_u32.c index 96fe68ee2f..1a37e96f59 100644 --- a/icu4c/source/common/ucnv_u32.c +++ b/icu4c/source/common/ucnv_u32.c @@ -19,7 +19,6 @@ #if !UCONFIG_NO_CONVERSION #include "unicode/ucnv.h" -#include "unicode/ucnv_err.h" #include "ucnv_bld.h" #include "ucnv_cnv.h" #include "cmemory.h" diff --git a/icu4c/source/common/ucnv_u7.c b/icu4c/source/common/ucnv_u7.c index ac46536760..f15da50331 100644 --- a/icu4c/source/common/ucnv_u7.c +++ b/icu4c/source/common/ucnv_u7.c @@ -19,7 +19,6 @@ #if !UCONFIG_NO_CONVERSION #include "unicode/ucnv.h" -#include "unicode/ucnv_err.h" #include "ucnv_bld.h" #include "ucnv_cnv.h" diff --git a/icu4c/source/common/ucnv_u8.c b/icu4c/source/common/ucnv_u8.c index 7123d574d8..d9114dfdc2 100644 --- a/icu4c/source/common/ucnv_u8.c +++ b/icu4c/source/common/ucnv_u8.c @@ -23,7 +23,6 @@ #if !UCONFIG_NO_CONVERSION #include "unicode/ucnv.h" -#include "unicode/ucnv_err.h" #include "ucnv_bld.h" #include "ucnv_cnv.h" #include "cmemory.h" diff --git a/icu4c/source/common/ucnvhz.c b/icu4c/source/common/ucnvhz.c index 9bec70a403..c030f1825c 100644 --- a/icu4c/source/common/ucnvhz.c +++ b/icu4c/source/common/ucnvhz.c @@ -19,7 +19,6 @@ #if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION #include "cmemory.h" -#include "unicode/ucnv_err.h" #include "unicode/ucnv.h" #include "unicode/ucnv_cb.h" #include "unicode/uset.h" diff --git a/icu4c/source/common/ucnvisci.c b/icu4c/source/common/ucnvisci.c index 57e9f015f7..7eb3994ea0 100644 --- a/icu4c/source/common/ucnvisci.c +++ b/icu4c/source/common/ucnvisci.c @@ -20,7 +20,6 @@ #if !UCONFIG_NO_CONVERSION && !UCONFIG_NO_LEGACY_CONVERSION #include "cmemory.h" -#include "unicode/ucnv_err.h" #include "ucnv_bld.h" #include "unicode/ucnv.h" #include "ucnv_cnv.h" diff --git a/icu4c/source/common/ucnvlat1.c b/icu4c/source/common/ucnvlat1.c index 109a1dc0a0..7ddf376aa4 100644 --- a/icu4c/source/common/ucnvlat1.c +++ b/icu4c/source/common/ucnvlat1.c @@ -17,7 +17,6 @@ #if !UCONFIG_NO_CONVERSION #include "unicode/ucnv.h" -#include "unicode/ucnv_err.h" #include "unicode/uset.h" #include "ucnv_bld.h" #include "ucnv_cnv.h" diff --git a/icu4c/source/common/unicode/uniset.h b/icu4c/source/common/unicode/uniset.h index b15235815c..7cb4410120 100644 --- a/icu4c/source/common/unicode/uniset.h +++ b/icu4c/source/common/unicode/uniset.h @@ -715,12 +715,12 @@ public: * Implement UnicodeMatcher::matches() * @stable ICU 2.4 */ - UMatchDegree matches(const Replaceable& text, + virtual UMatchDegree matches(const Replaceable& text, int32_t& offset, int32_t limit, UBool incremental); - private: +private: /** * Returns the longest match for s in text at the given position. * If limit > start then match forward from start+1 to limit @@ -757,7 +757,7 @@ public: */ int32_t findCodePoint(UChar32 c) const; - public: +public: /** * Implementation of UnicodeMatcher API. Union the set of all @@ -766,7 +766,7 @@ public: * @param toUnionTo the set into which to union the source characters * @stable ICU 2.4 */ - void addMatchSetTo(UnicodeSet& toUnionTo) const; + virtual void addMatchSetTo(UnicodeSet& toUnionTo) const; /** * Returns the index of the given character within this set, where diff --git a/icu4c/source/common/unicode/utf16.h b/icu4c/source/common/unicode/utf16.h index aad6c81e5e..d5e4ca4643 100644 --- a/icu4c/source/common/unicode/utf16.h +++ b/icu4c/source/common/unicode/utf16.h @@ -100,7 +100,7 @@ * @stable ICU 2.4 */ #define U16_GET_SUPPLEMENTARY(lead, trail) \ - (((lead)<<10UL)+(trail)-U16_SURROGATE_OFFSET) + (((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET) /** diff --git a/icu4c/source/i18n/nfsubs.h b/icu4c/source/i18n/nfsubs.h index fce41403f5..ec03fee9c4 100644 --- a/icu4c/source/i18n/nfsubs.h +++ b/icu4c/source/i18n/nfsubs.h @@ -267,11 +267,11 @@ public: const UnicodeString& description, UErrorCode& status); - int64_t transformNumber(int64_t number) const { return number; } - double transformNumber(double number) const { return number; } - double composeRuleValue(double newRuleValue, double /*oldRuleValue*/) const { return newRuleValue; } - double calcUpperBound(double oldUpperBound) const { return oldUpperBound; } - UChar tokenChar() const { return (UChar)0x003d; } // '=' + virtual int64_t transformNumber(int64_t number) const { return number; } + virtual double transformNumber(double number) const { return number; } + virtual double composeRuleValue(double newRuleValue, double /*oldRuleValue*/) const { return newRuleValue; } + virtual double calcUpperBound(double oldUpperBound) const { return oldUpperBound; } + virtual UChar tokenChar() const { return (UChar)0x003d; } // '=' private: static const char fgClassID; @@ -299,7 +299,7 @@ public: } } - void setDivisor(int32_t radix, int32_t exponent, UErrorCode& status) { + virtual void setDivisor(int32_t radix, int32_t exponent, UErrorCode& status) { divisor = uprv_pow(radix, exponent); ldivisor = util64_fromDouble(divisor); @@ -308,23 +308,23 @@ public: } } - UBool operator==(const NFSubstitution& rhs) const; + virtual UBool operator==(const NFSubstitution& rhs) const; - int64_t transformNumber(int64_t number) const { + virtual int64_t transformNumber(int64_t number) const { return number / ldivisor; } - double transformNumber(double number) const { + virtual double transformNumber(double number) const { return uprv_floor(number / divisor); } - double composeRuleValue(double newRuleValue, double /*oldRuleValue*/) const { + virtual double composeRuleValue(double newRuleValue, double /*oldRuleValue*/) const { return newRuleValue * divisor; } - double calcUpperBound(double /*oldUpperBound*/) const { return divisor; } + virtual double calcUpperBound(double /*oldUpperBound*/) const { return divisor; } - UChar tokenChar() const { return (UChar)0x003c; } // '<' + virtual UChar tokenChar() const { return (UChar)0x003c; } // '<' private: static const char fgClassID; @@ -346,7 +346,7 @@ public: const UnicodeString& description, UErrorCode& status); - void setDivisor(int32_t radix, int32_t exponent, UErrorCode& status) { + virtual void setDivisor(int32_t radix, int32_t exponent, UErrorCode& status) { divisor = uprv_pow(radix, exponent); ldivisor = util64_fromDouble(divisor); @@ -355,30 +355,30 @@ public: } } - UBool operator==(const NFSubstitution& rhs) const; + virtual UBool operator==(const NFSubstitution& rhs) const; - void doSubstitution(int64_t number, UnicodeString& toInsertInto, int32_t pos) const; - void doSubstitution(double number, UnicodeString& toInsertInto, int32_t pos) const; + virtual void doSubstitution(int64_t number, UnicodeString& toInsertInto, int32_t pos) const; + virtual void doSubstitution(double number, UnicodeString& toInsertInto, int32_t pos) const; - int64_t transformNumber(int64_t number) const { return number % ldivisor; } - double transformNumber(double number) const { return uprv_fmod(number, divisor); } + virtual int64_t transformNumber(int64_t number) const { return number % ldivisor; } + virtual double transformNumber(double number) const { return uprv_fmod(number, divisor); } - UBool doParse(const UnicodeString& text, + virtual UBool doParse(const UnicodeString& text, ParsePosition& parsePosition, double baseValue, double upperBound, UBool lenientParse, Formattable& result) const; - double composeRuleValue(double newRuleValue, double oldRuleValue) const { + virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const { return oldRuleValue - uprv_fmod(oldRuleValue, divisor) + newRuleValue; } - double calcUpperBound(double /*oldUpperBound*/) const { return divisor; } + virtual double calcUpperBound(double /*oldUpperBound*/) const { return divisor; } - UBool isModulusSubstitution() const { return TRUE; } + virtual UBool isModulusSubstitution() const { return TRUE; } - UChar tokenChar() const { return (UChar)0x003e; } // '>' + virtual UChar tokenChar() const { return (UChar)0x003e; } // '>' private: static const char fgClassID; @@ -396,11 +396,11 @@ public: UErrorCode& status) : NFSubstitution(_pos, _ruleSet, formatter, description, status) {} - int64_t transformNumber(int64_t number) const { return number; } - double transformNumber(double number) const { return uprv_floor(number); } - double composeRuleValue(double newRuleValue, double oldRuleValue) const { return newRuleValue + oldRuleValue; } - double calcUpperBound(double /*oldUpperBound*/) const { return DBL_MAX; } - UChar tokenChar() const { return (UChar)0x003c; } // '<' + virtual int64_t transformNumber(int64_t number) const { return number; } + virtual double transformNumber(double number) const { return uprv_floor(number); } + virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const { return newRuleValue + oldRuleValue; } + virtual double calcUpperBound(double /*oldUpperBound*/) const { return DBL_MAX; } + virtual UChar tokenChar() const { return (UChar)0x003c; } // '<' private: static const char fgClassID; @@ -420,23 +420,23 @@ public: const UnicodeString& description, UErrorCode& status); - UBool operator==(const NFSubstitution& rhs) const; + virtual UBool operator==(const NFSubstitution& rhs) const; - void doSubstitution(double number, UnicodeString& toInsertInto, int32_t pos) const; - void doSubstitution(int64_t /*number*/, UnicodeString& /*toInsertInto*/, int32_t /*_pos*/) const {} - int64_t transformNumber(int64_t /*number*/) const { return 0; } - double transformNumber(double number) const { return number - uprv_floor(number); } + virtual void doSubstitution(double number, UnicodeString& toInsertInto, int32_t pos) const; + virtual void doSubstitution(int64_t /*number*/, UnicodeString& /*toInsertInto*/, int32_t /*_pos*/) const {} + virtual int64_t transformNumber(int64_t /*number*/) const { return 0; } + virtual double transformNumber(double number) const { return number - uprv_floor(number); } - UBool doParse(const UnicodeString& text, + virtual UBool doParse(const UnicodeString& text, ParsePosition& parsePosition, double baseValue, double upperBound, UBool lenientParse, Formattable& result) const; - double composeRuleValue(double newRuleValue, double oldRuleValue) const { return newRuleValue + oldRuleValue; } - double calcUpperBound(double /*oldUpperBound*/) const { return 0.0; } - UChar tokenChar() const { return (UChar)0x003e; } // '>' + virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const { return newRuleValue + oldRuleValue; } + virtual double calcUpperBound(double /*oldUpperBound*/) const { return 0.0; } + virtual UChar tokenChar() const { return (UChar)0x003e; } // '>' private: static const char fgClassID; @@ -454,11 +454,11 @@ public: UErrorCode& status) : NFSubstitution(_pos, _ruleSet, formatter, description, status) {} - int64_t transformNumber(int64_t number) const { return number >= 0 ? number : -number; } - double transformNumber(double number) const { return uprv_fabs(number); } - double composeRuleValue(double newRuleValue, double /*oldRuleValue*/) const { return -newRuleValue; } - double calcUpperBound(double /*oldUpperBound*/) const { return DBL_MAX; } - UChar tokenChar() const { return (UChar)0x003e; } // '>' + virtual int64_t transformNumber(int64_t number) const { return number >= 0 ? number : -number; } + virtual double transformNumber(double number) const { return uprv_fabs(number); } + virtual double composeRuleValue(double newRuleValue, double /*oldRuleValue*/) const { return -newRuleValue; } + virtual double calcUpperBound(double /*oldUpperBound*/) const { return DBL_MAX; } + virtual UChar tokenChar() const { return (UChar)0x003e; } // '>' private: static const char fgClassID; @@ -482,12 +482,12 @@ public: ldenominator = util64_fromDouble(denominator); } - UBool operator==(const NFSubstitution& rhs) const; + virtual UBool operator==(const NFSubstitution& rhs) const; - int64_t transformNumber(int64_t number) const { return number * ldenominator; } - double transformNumber(double number) const { return uprv_round(number * denominator); } + virtual int64_t transformNumber(int64_t number) const { return number * ldenominator; } + virtual double transformNumber(double number) const { return uprv_round(number * denominator); } - UBool doParse(const UnicodeString& text, + virtual UBool doParse(const UnicodeString& text, ParsePosition& parsePosition, double baseValue, double upperBound, @@ -499,9 +499,9 @@ public: // it SERIOUSLY messes up the algorithm return NFSubstitution::doParse(text, parsePosition, baseValue, upperBound, FALSE, result); } - double composeRuleValue(double newRuleValue, double oldRuleValue) const { return newRuleValue / oldRuleValue; } - double calcUpperBound(double /*oldUpperBound*/) const { return denominator; } - UChar tokenChar() const { return (UChar)0x003c; } // '<' + virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const { return newRuleValue / oldRuleValue; } + virtual double calcUpperBound(double /*oldUpperBound*/) const { return denominator; } + virtual UChar tokenChar() const { return (UChar)0x003c; } // '<' private: static const char fgClassID; @@ -519,22 +519,22 @@ public: UErrorCode& status) : NFSubstitution(_pos, _ruleSet, formatter, description, status) {} - void toString(UnicodeString& /*result*/) const {} - void doSubstitution(double /*number*/, UnicodeString& /*toInsertInto*/, int32_t /*_pos*/) const {} - void doSubstitution(int64_t /*number*/, UnicodeString& /*toInsertInto*/, int32_t /*_pos*/) const {} - int64_t transformNumber(int64_t /*number*/) const { return 0; } - double transformNumber(double /*number*/) const { return 0; } - UBool doParse(const UnicodeString& /*text*/, + virtual void toString(UnicodeString& /*result*/) const {} + virtual void doSubstitution(double /*number*/, UnicodeString& /*toInsertInto*/, int32_t /*_pos*/) const {} + virtual void doSubstitution(int64_t /*number*/, UnicodeString& /*toInsertInto*/, int32_t /*_pos*/) const {} + virtual int64_t transformNumber(int64_t /*number*/) const { return 0; } + virtual double transformNumber(double /*number*/) const { return 0; } + virtual UBool doParse(const UnicodeString& /*text*/, ParsePosition& /*parsePosition*/, double baseValue, double /*upperBound*/, UBool /*lenientParse*/, Formattable& result) const { result.setDouble(baseValue); return TRUE; } - double composeRuleValue(double /*newRuleValue*/, double /*oldRuleValue*/) const { return 0.0; } // never called - double calcUpperBound(double /*oldUpperBound*/) const { return 0; } // never called - UBool isNullSubstitution() const { return TRUE; } - UChar tokenChar() const { return (UChar)0x0020; } // ' ' never called + virtual double composeRuleValue(double /*newRuleValue*/, double /*oldRuleValue*/) const { return 0.0; } // never called + virtual double calcUpperBound(double /*oldUpperBound*/) const { return 0; } // never called + virtual UBool isNullSubstitution() const { return TRUE; } + virtual UChar tokenChar() const { return (UChar)0x0020; } // ' ' never called private: static const char fgClassID; diff --git a/icu4c/source/i18n/timezone.cpp b/icu4c/source/i18n/timezone.cpp index 12d86ec79c..54f051e502 100644 --- a/icu4c/source/i18n/timezone.cpp +++ b/icu4c/source/i18n/timezone.cpp @@ -788,11 +788,11 @@ public: return new TZEnumeration(*this); } - int32_t count(UErrorCode& status) const { + virtual int32_t count(UErrorCode& status) const { return U_FAILURE(status) ? 0 : len; } - const UnicodeString* snext(UErrorCode& status) { + virtual const UnicodeString* snext(UErrorCode& status) { if (U_SUCCESS(status) && pos < len) { getID((map == 0) ? pos : map[pos]); ++pos; @@ -801,7 +801,7 @@ public: return 0; } - void reset(UErrorCode& /*status*/) { + virtual void reset(UErrorCode& /*status*/) { pos = 0; } diff --git a/icu4c/source/i18n/unicode/coleitr.h b/icu4c/source/i18n/unicode/coleitr.h index ffdb7a64e4..e2add4a24a 100644 --- a/icu4c/source/i18n/unicode/coleitr.h +++ b/icu4c/source/i18n/unicode/coleitr.h @@ -143,7 +143,7 @@ public: * Destructor * @stable ICU 2.0 */ - ~CollationElementIterator(); + virtual ~CollationElementIterator(); // CollationElementIterator public methods ---------------------------------- diff --git a/icu4c/source/i18n/unicode/dtfmtsym.h b/icu4c/source/i18n/unicode/dtfmtsym.h index 4ec91a5e05..3546ab093d 100644 --- a/icu4c/source/i18n/unicode/dtfmtsym.h +++ b/icu4c/source/i18n/unicode/dtfmtsym.h @@ -150,7 +150,7 @@ public: * subclassed. * @stable ICU 2.0 */ - ~DateFormatSymbols(); + virtual ~DateFormatSymbols(); /** * Return true if another object is semantically equal to this one.