From 7ec7853f1e32fe02e3e18b9bea14a5882f6d7d60 Mon Sep 17 00:00:00 2001 From: Vladimir Weinstein Date: Thu, 15 May 2003 23:20:11 +0000 Subject: [PATCH] ICU-2699 more gcc warnings fixes X-SVN-Rev: 11958 --- icu4c/source/i18n/sortkey.cpp | 4 ++++ icu4c/source/i18n/tblcoll.cpp | 14 +++++++++++--- icu4c/source/i18n/ucol.cpp | 3 +-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/icu4c/source/i18n/sortkey.cpp b/icu4c/source/i18n/sortkey.cpp index f9fca6dc7aa..44fa1fa38af 100644 --- a/icu4c/source/i18n/sortkey.cpp +++ b/icu4c/source/i18n/sortkey.cpp @@ -256,6 +256,7 @@ CollationKey::compareTo(const CollationKey& target) const UCollationResult CollationKey::compareTo(const CollationKey& target, UErrorCode &status) const { + if(U_SUCCESS(status)) { uint8_t *src = this->fBytes; uint8_t *tgt = target.fBytes; @@ -294,6 +295,9 @@ CollationKey::compareTo(const CollationKey& target, UErrorCode &status) const } return result; + } else { + return UCOL_EQUAL; + } } CollationKey& diff --git a/icu4c/source/i18n/tblcoll.cpp b/icu4c/source/i18n/tblcoll.cpp index e096322aef6..b02109e1a7f 100644 --- a/icu4c/source/i18n/tblcoll.cpp +++ b/icu4c/source/i18n/tblcoll.cpp @@ -348,7 +348,11 @@ UCollationResult RuleBasedCollator::compare(const UChar* source, int32_t targetLength, UErrorCode &status) const { - return ucol_strcoll(ucollator, source, sourceLength, target, targetLength); + if(U_SUCCESS(status)) { + return ucol_strcoll(ucollator, source, sourceLength, target, targetLength); + } else { + return UCOL_EQUAL; + } } /** @@ -367,8 +371,12 @@ UCollationResult RuleBasedCollator::compare( const UnicodeString& target, UErrorCode &status) const { - return ucol_strcoll(ucollator, source.getBuffer(), source.length(), - target.getBuffer(), target.length()); + if(U_SUCCESS(status)) { + return ucol_strcoll(ucollator, source.getBuffer(), source.length(), + target.getBuffer(), target.length()); + } else { + return UCOL_EQUAL; + } } /** diff --git a/icu4c/source/i18n/ucol.cpp b/icu4c/source/i18n/ucol.cpp index 719ea1ea867..39b97dcf8f7 100644 --- a/icu4c/source/i18n/ucol.cpp +++ b/icu4c/source/i18n/ucol.cpp @@ -1636,7 +1636,7 @@ UChar peekCharacter(collIterate *source, int32_t offset) { return (UChar)source->iterator->current(source->iterator); } } else { - return U_SENTINEL; + return (UChar)U_SENTINEL; } } @@ -6914,7 +6914,6 @@ static UCollationResult ucol_compareUsingSortKeys(collIterate *sColl, UChar *source = NULL; UChar *target = NULL; UChar sStackBuf[256], tStackBuf[256]; - int32_t sBufSize = 256, tBufSize = 256; int32_t sourceLength = (sColl->flags&UCOL_ITER_HASLEN)?(sColl->endp-sColl->string):-1; int32_t targetLength = (tColl->flags&UCOL_ITER_HASLEN)?(tColl->endp-tColl->string):-1;