From ac893ce00e5b9848a34766ede89383839493fa40 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Tue, 7 Dec 2004 23:43:48 +0000 Subject: [PATCH] ICU-4288 Fix some compiler warnings. X-SVN-Rev: 16926 --- icu4c/source/common/iculserv.h | 10 +++++----- icu4c/source/common/icunotif.cpp | 6 +++--- icu4c/source/common/icuserv.h | 10 +++++----- icu4c/source/common/ucnv2022.c | 6 +++--- icu4c/source/common/uloc.c | 2 +- icu4c/source/common/umutex.h | 2 +- icu4c/source/i18n/esctrn.h | 2 +- icu4c/source/i18n/funcrepl.h | 4 ++++ icu4c/source/i18n/nortrans.h | 2 +- icu4c/source/i18n/unesctrn.h | 2 +- 10 files changed, 25 insertions(+), 21 deletions(-) diff --git a/icu4c/source/common/iculserv.h b/icu4c/source/common/iculserv.h index 1798e20073..cbf8cc0658 100644 --- a/icu4c/source/common/iculserv.h +++ b/icu4c/source/common/iculserv.h @@ -243,12 +243,12 @@ public: * Override of superclass method. This adjusts the result based * on the coverage rule for this factory. */ - void updateVisibleIDs(Hashtable& result, UErrorCode& status) const; + virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const; /** * Return a localized name for the locale represented by id. */ - UnicodeString& getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const; + virtual UnicodeString& getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const; protected: /** @@ -261,7 +261,7 @@ protected: * Return true if this id is one the factory supports (visible or * otherwise). */ - virtual UBool isSupportedID(const UnicodeString& id, UErrorCode& status) const; + virtual UBool isSupportedID(const UnicodeString& id, UErrorCode& status) const; /** * Return the set of ids that this factory supports (visible or @@ -319,13 +319,13 @@ class U_COMMON_API SimpleLocaleKeyFactory : public LocaleKeyFactory { /** * Override of superclass method. Returns the service object if kind/locale match. Service is not used. */ - UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const; + virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const; /** * Override of superclass method. This adjusts the result based * on the coverage rule for this factory. */ - void updateVisibleIDs(Hashtable& result, UErrorCode& status) const; + virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const; protected: /** diff --git a/icu4c/source/common/icunotif.cpp b/icu4c/source/common/icunotif.cpp index f8b64862ee..d33daed286 100644 --- a/icu4c/source/common/icunotif.cpp +++ b/icu4c/source/common/icunotif.cpp @@ -1,6 +1,6 @@ /** ******************************************************************************* - * Copyright (C) 2001-2003, International Business Machines Corporation and * + * Copyright (C) 2001-2004, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ @@ -10,7 +10,7 @@ #if !UCONFIG_NO_SERVICE #include "icunotif.h" -#if DEBUG +#ifdef NOTIFIER_DEBUG #include #endif @@ -58,7 +58,7 @@ ICUNotifier::addListener(const EventListener* l, UErrorCode& status) listeners->addElement((void*)l, status); // cast away const } else { -#if DEBUG +#ifdef NOTIFIER_DEBUG fprintf(stderr, "Listener invalid for this notifier."); exit(1); #endif diff --git a/icu4c/source/common/icuserv.h b/icu4c/source/common/icuserv.h index eeb4cbcca8..39d39a2aed 100644 --- a/icu4c/source/common/icuserv.h +++ b/icu4c/source/common/icuserv.h @@ -203,7 +203,7 @@ public: */ /** - *

ICUServiceFactories generate the service objects maintained by the + *

An implementing ICUServiceFactory generates the service objects maintained by the * service. A factory generates a service object from a key, * updates id->factory mappings, and returns the display name for * a supported id.

@@ -310,7 +310,7 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory { * @param status the error code status. * @return the service object, or NULL if the factory does not support the key. */ - UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const; + virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const; /** *

This implementation adds a mapping from ID -> this to result if visible is TRUE, @@ -319,7 +319,7 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory { * @param result the mapping table to update. * @param status the error code status. */ - void updateVisibleIDs(Hashtable& result, UErrorCode& status) const; + virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const; /** *

This implementation returns the factory ID if it equals id and visible is TRUE, @@ -331,9 +331,9 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory { * @param result output parameter to hold the display name. * @return result. */ - UnicodeString& getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const; + virtual UnicodeString& getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeString& result) const; - public: +public: /** * UObject RTTI boilerplate. */ diff --git a/icu4c/source/common/ucnv2022.c b/icu4c/source/common/ucnv2022.c index 07c6908fd7..8081a33365 100644 --- a/icu4c/source/common/ucnv2022.c +++ b/icu4c/source/common/ucnv2022.c @@ -712,7 +712,7 @@ changeState_2022(UConverter* _this, UCNV_TableStates_2022 value; UConverterDataISO2022* myData2022 = ((UConverterDataISO2022*)_this->extraInfo); uint32_t key = myData2022->key; - int32_t offset; + int32_t offset = 0; char c; value = VALID_NON_TERMINAL_2022; @@ -1297,7 +1297,7 @@ UConverter_fromUnicode_ISO_2022_JP_OFFSETS_LOGIC(UConverterFromUnicodeArgs* args int32_t len, outLen; int8_t choices[10]; int32_t choiceCount; - uint32_t targetValue; + uint32_t targetValue = 0; UBool useFallback; int32_t i; @@ -2382,7 +2382,7 @@ UConverter_fromUnicode_ISO_2022_CN_OFFSETS_LOGIC(UConverterFromUnicodeArgs* args int32_t len; int8_t choices[3]; int32_t choiceCount; - uint32_t targetValue; + uint32_t targetValue = 0; UBool useFallback; /* set up the state */ diff --git a/icu4c/source/common/uloc.c b/icu4c/source/common/uloc.c index 02d0eb749e..69e4f3b45e 100644 --- a/icu4c/source/common/uloc.c +++ b/icu4c/source/common/uloc.c @@ -2146,7 +2146,7 @@ _getStringOrCopyKey(const char *path, const char *locale, UChar *dest, int32_t destCapacity, UErrorCode *pErrorCode) { const UChar *s = NULL; - int32_t length; + int32_t length = 0; if(itemKey==NULL) { /* top-level item: normal resource bundle access */ diff --git a/icu4c/source/common/umutex.h b/icu4c/source/common/umutex.h index 6a4fcb8fff..fdd0aceb90 100644 --- a/icu4c/source/common/umutex.h +++ b/icu4c/source/common/umutex.h @@ -46,7 +46,7 @@ * or mutexes. * @internal */ -#if UMTX_STRONG_MEMORY_MODEL +#if defined(UMTX_STRONG_MEMORY_MODEL) && UMTX_STRONG_MEMORY_MODEL #define UMTX_CHECK(pMutex, expression, result) \ (result)=(expression); diff --git a/icu4c/source/i18n/esctrn.h b/icu4c/source/i18n/esctrn.h index 7a571ed38a..b71bec2dab 100644 --- a/icu4c/source/i18n/esctrn.h +++ b/icu4c/source/i18n/esctrn.h @@ -134,7 +134,7 @@ class U_I18N_API EscapeTransliterator : public Transliterator { /** * Implements {@link Transliterator#handleTransliterate}. */ - void handleTransliterate(Replaceable& text, UTransPosition& offset, + virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, UBool isIncremental) const; private: diff --git a/icu4c/source/i18n/funcrepl.h b/icu4c/source/i18n/funcrepl.h index c9cfe605f8..af6a3fc405 100644 --- a/icu4c/source/i18n/funcrepl.h +++ b/icu4c/source/i18n/funcrepl.h @@ -8,6 +8,9 @@ ********************************************************************** */ +#ifndef FUNCREPL_H +#define FUNCREPL_H + #include "unicode/utypes.h" #if !UCONFIG_NO_TRANSLITERATION @@ -118,5 +121,6 @@ class U_I18N_API FunctionReplacer : public UnicodeFunctor, public UnicodeReplace U_NAMESPACE_END #endif /* #if !UCONFIG_NO_TRANSLITERATION */ +#endif //eof diff --git a/icu4c/source/i18n/nortrans.h b/icu4c/source/i18n/nortrans.h index 786ffc7397..e157a58d28 100644 --- a/icu4c/source/i18n/nortrans.h +++ b/icu4c/source/i18n/nortrans.h @@ -83,7 +83,7 @@ class U_I18N_API NormalizationTransliterator : public Transliterator { * @param incremental if true, assume more text may be coming after * pos.contextLimit. Otherwise, assume the text is complete. */ - void handleTransliterate(Replaceable& text, UTransPosition& offset, + virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, UBool isIncremental) const; public: diff --git a/icu4c/source/i18n/unesctrn.h b/icu4c/source/i18n/unesctrn.h index 69184899aa..aa8b4f92ce 100644 --- a/icu4c/source/i18n/unesctrn.h +++ b/icu4c/source/i18n/unesctrn.h @@ -102,7 +102,7 @@ class U_I18N_API UnescapeTransliterator : public Transliterator { * @param incremental if true, assume more text may be coming after * pos.contextLimit. Otherwise, assume the text is complete. */ - void handleTransliterate(Replaceable& text, UTransPosition& offset, + virtual void handleTransliterate(Replaceable& text, UTransPosition& offset, UBool isIncremental) const; private: