From cbd785db50126d756f323a2fe78ab4b63a02f40e Mon Sep 17 00:00:00 2001 From: Kedar Rajwade Date: Thu, 17 Apr 2008 20:52:04 +0000 Subject: [PATCH] ICU-5966 Fixed some compiler warnings X-SVN-Rev: 23806 --- icu4c/source/common/rbbitblb.cpp | 3 ++- icu4c/source/i18n/japancal.cpp | 1 + icu4c/source/i18n/smpdtfmt.cpp | 2 +- icu4c/source/i18n/zstrfmt.cpp | 9 +++++++++ icu4c/source/i18n/zstrfmt.h | 1 + icu4c/source/io/uprntf_p.c | 2 +- icu4c/source/tools/genrb/wrtjava.c | 1 - icu4c/source/tools/makeconv/genmbcs.c | 2 +- 8 files changed, 16 insertions(+), 5 deletions(-) diff --git a/icu4c/source/common/rbbitblb.cpp b/icu4c/source/common/rbbitblb.cpp index a65f38b6fe..44c8e9fdd9 100644 --- a/icu4c/source/common/rbbitblb.cpp +++ b/icu4c/source/common/rbbitblb.cpp @@ -546,7 +546,8 @@ void RBBITableBuilder::buildStateTable() { return; } RBBIStateDescriptor *failState; - RBBIStateDescriptor *initialState; + // Set it to NULL to avoid uninitialized warning + RBBIStateDescriptor *initialState = NULL; // // Add a dummy state 0 - the stop state. Not from Aho. int lastInputSymbol = fRB->fSetBuilder->getNumCharCategories() - 1; diff --git a/icu4c/source/i18n/japancal.cpp b/icu4c/source/i18n/japancal.cpp index e57300f9c4..26ddcc3338 100644 --- a/icu4c/source/i18n/japancal.cpp +++ b/icu4c/source/i18n/japancal.cpp @@ -492,6 +492,7 @@ int32_t JapaneseCalendar::handleGetLimit(UCalendarDateFields field, ELimitType l return 1; case UCAL_LIMIT_LEAST_MAXIMUM: return 1; + case UCAL_LIMIT_COUNT: //added to avoid warning case UCAL_LIMIT_MAXIMUM: return GregorianCalendar::handleGetLimit(UCAL_YEAR, UCAL_LIMIT_MAXIMUM) - kEraInfo[kCurrentEra].year; } diff --git a/icu4c/source/i18n/smpdtfmt.cpp b/icu4c/source/i18n/smpdtfmt.cpp index b92a6f93e9..4e4e0249cb 100644 --- a/icu4c/source/i18n/smpdtfmt.cpp +++ b/icu4c/source/i18n/smpdtfmt.cpp @@ -938,7 +938,7 @@ SimpleDateFormat::initGMTFormatters(UErrorCode &status) { fGMTFormatters = (MessageFormat**)uprv_malloc(kNumGMTFormatters * sizeof(MessageFormat*)); if (fGMTFormatters) { for (int32_t i = 0; i < kNumGMTFormatters; i++) { - const UnicodeString *hourPattern; + const UnicodeString *hourPattern = NULL; //initialized it to avoid warning switch (i) { case kGMTNegativeHMS: hourPattern = &(fSymbols->fGmtHourFormats[DateFormatSymbols::GMT_NEGATIVE_HMS]); diff --git a/icu4c/source/i18n/zstrfmt.cpp b/icu4c/source/i18n/zstrfmt.cpp index 45d811b9d0..4465719739 100644 --- a/icu4c/source/i18n/zstrfmt.cpp +++ b/icu4c/source/i18n/zstrfmt.cpp @@ -145,9 +145,11 @@ getTimeZoneTranslationType(TimeZoneTranslationTypeIndex typeIdx) { case ZSIDX_LONG_DAYLIGHT: type = DAYLIGHT_LONG; break; + case ZSIDX_COUNT: case ZSIDX_SHORT_DAYLIGHT: type = DAYLIGHT_SHORT; break; + } return type; } @@ -213,6 +215,11 @@ CharacterNode::getChildNode(UChar32 c) const { return result; } +//---------------------------------------------------------------------------- +// Virtual destructor to avoid warning +TextTrieMapSearchResultHandler::~TextTrieMapSearchResultHandler(){ +} + // ---------------------------------------------------------------------------- TextTrieMap::TextTrieMap(UBool ignoreCase) : fIgnoreCase(ignoreCase), fRoot(NULL) { @@ -1012,6 +1019,7 @@ ZoneStringFormat::getString(const UnicodeString &tzid, TimeZoneTranslationTypeIn break; case ZSIDX_SHORT_STANDARD: case ZSIDX_SHORT_DAYLIGHT: + case ZSIDX_COUNT: //added to avoid warning case ZSIDX_SHORT_GENERIC: if (!commonlyUsedOnly || zstrings->isShortFormatCommonlyUsed()) { zstrings->getString(typeIdx, result); @@ -1036,6 +1044,7 @@ ZoneStringFormat::getString(const UnicodeString &tzid, TimeZoneTranslationTypeIn break; case ZSIDX_SHORT_STANDARD: case ZSIDX_SHORT_DAYLIGHT: + case ZSIDX_COUNT: //added to avoid warning case ZSIDX_SHORT_GENERIC: if (!commonlyUsedOnly || mzstrings->isShortFormatCommonlyUsed()) { mzstrings->getString(typeIdx, result); diff --git a/icu4c/source/i18n/zstrfmt.h b/icu4c/source/i18n/zstrfmt.h index ad3b3765c0..b60ee867d5 100644 --- a/icu4c/source/i18n/zstrfmt.h +++ b/icu4c/source/i18n/zstrfmt.h @@ -59,6 +59,7 @@ class TextTrieMapSearchResultHandler : public UMemory { public: virtual UBool handleMatch(int32_t matchLength, const UVector *values, UErrorCode& status) = 0; + virtual ~TextTrieMapSearchResultHandler(); //added to avoid warning }; /** diff --git a/icu4c/source/io/uprntf_p.c b/icu4c/source/io/uprntf_p.c index ddbd1b1807..fd45a43cc4 100644 --- a/icu4c/source/io/uprntf_p.c +++ b/icu4c/source/io/uprntf_p.c @@ -1224,7 +1224,7 @@ u_printf_parse(const u_printf_stream_handler *streamHandler, const UChar *lastAlias; const UChar *orgAlias = fmt; /* parsed argument list */ - ufmt_args *arglist; + ufmt_args *arglist = NULL; //initialized it to avoid warning UErrorCode status = U_ZERO_ERROR; if (!locStringContext || locStringContext->available >= 0) { /* get the parsed list of argument types */ diff --git a/icu4c/source/tools/genrb/wrtjava.c b/icu4c/source/tools/genrb/wrtjava.c index 2a5f40b417..5b29cde7dd 100644 --- a/icu4c/source/tools/genrb/wrtjava.c +++ b/icu4c/source/tools/genrb/wrtjava.c @@ -99,7 +99,6 @@ static void write_tabs(FileStream* os){ static const char* enc =""; static UConverter* conv = NULL; -static char NUMBER = ZERO; static int32_t uCharsToChars( char* target,int32_t targetLen, UChar* source, int32_t sourceLen,UErrorCode* status){ diff --git a/icu4c/source/tools/makeconv/genmbcs.c b/icu4c/source/tools/makeconv/genmbcs.c index 960a45a870..3578603e1c 100644 --- a/icu4c/source/tools/makeconv/genmbcs.c +++ b/icu4c/source/tools/makeconv/genmbcs.c @@ -1414,7 +1414,7 @@ MBCSWrite(NewConverter *cnvData, const UConverterStaticData *staticData, if(mbcsData->omitFromU) { /* find how much of stage2 can be omitted */ int32_t utf8Limit=(int32_t)mbcsData->utf8Max+1; - uint32_t st2; + uint32_t st2=0; //initialized it to avoid warning i=utf8Limit>>MBCS_STAGE_1_SHIFT; if((utf8Limit&((1<stage1[i])!=0) {