diff --git a/icu4c/source/i18n/ucol.cpp b/icu4c/source/i18n/ucol.cpp index 09d9ac2aed5..eb8ffd9ee01 100644 --- a/icu4c/source/i18n/ucol.cpp +++ b/icu4c/source/i18n/ucol.cpp @@ -1160,7 +1160,7 @@ inline UBool collIterFCD(collIterate *collationSource) { /* some more sofisticated and slower functions are invoked */ static inline uint32_t ucol_IGetNextCE(const UCollator *coll, collIterate *collationSource, UErrorCode *status) { - uint32_t order; + uint32_t order = 0; if (collationSource->CEpos > collationSource->toReturn) { /* Are there any CEs from previous expansions? */ order = *(collationSource->toReturn++); /* if so, return them */ if(collationSource->CEpos == collationSource->toReturn) { @@ -1169,7 +1169,7 @@ inline uint32_t ucol_IGetNextCE(const UCollator *coll, collIterate *collationSou return order; } - UChar ch; + UChar ch = 0; for (;;) /* Loop handles case when incremental normalize switches */ { /* to or from the side buffer / original string, and we */ @@ -1497,7 +1497,7 @@ inline uint32_t ucol_IGetPrevCE(const UCollator *coll, collIterate *data, } } else { - UChar ch; + UChar ch = 0; /* Loop handles case when incremental normalize switches to or from the side buffer / original string, and we need to start again to get the @@ -6653,7 +6653,7 @@ ucol_strcoll( const UCollator *coll, } if(coll->latinOneUse) { - if (*source&0xff00 || *target&0xff00) { // source or target start with non-latin-1 + if ((sourceLength > 0 && *source&0xff00) || (targetLength > 0 && *target&0xff00)) { // source or target start with non-latin-1 return ucol_strcollRegular(coll, source, sourceLength, target, targetLength, &status); } else { return ucol_strcollUseLatin1(coll, source, sourceLength, target, targetLength, &status); diff --git a/icu4c/source/i18n/ucol_tok.cpp b/icu4c/source/i18n/ucol_tok.cpp index 2590d59a0f7..b643f09b1fb 100644 --- a/icu4c/source/i18n/ucol_tok.cpp +++ b/icu4c/source/i18n/ucol_tok.cpp @@ -424,7 +424,7 @@ ucol_tok_getNextArgument(const UChar *start, const UChar *end, ucol_uprv_tok_initData(); - while(u_isWhitespace(*start) && start < end) { /* eat whitespace */ + while(start < end && u_isWhitespace(*start)) { /* eat whitespace */ start++; } if(start >= end) { diff --git a/icu4c/source/test/intltest/dtfmtrtts.cpp b/icu4c/source/test/intltest/dtfmtrtts.cpp index 1befe8a3a6a..e5547d3d3e6 100644 --- a/icu4c/source/test/intltest/dtfmtrtts.cpp +++ b/icu4c/source/test/intltest/dtfmtrtts.cpp @@ -308,7 +308,7 @@ void DateFormatRoundTripTest::test(DateFormat *fmt, const Locale &origLocale, UB (j > 0 && s[j] == s[j-1]?" s==":"")); } } - delete d; + delete[] d; delete[] s; } /*} diff --git a/icu4c/source/test/intltest/intltest.cpp b/icu4c/source/test/intltest/intltest.cpp index 9e9e37c67fb..3cbf46a4aaa 100644 --- a/icu4c/source/test/intltest/intltest.cpp +++ b/icu4c/source/test/intltest/intltest.cpp @@ -1146,7 +1146,7 @@ main(int argc, char* argv[]) CalendarTimeZoneTest::cleanup(); #endif - delete _testDataPath; + delete[] _testDataPath; _testDataPath = 0; fprintf(stdout, "\n--------------------------------------\n");