ICU-6799 swat compiler warnings

X-SVN-Rev: 25661
This commit is contained in:
Andy Heninger 2009-03-27 00:37:55 +00:00
parent c567c8c1b1
commit c89045b0d6
9 changed files with 29 additions and 26 deletions

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2007-2008, International Business Machines Corporation and *
* Copyright (C) 2007-2009, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -508,8 +508,8 @@ error:
}
void
BasicTimeZone::getOffsetFromLocal(UDate date, int32_t nonExistingTimeOpt, int32_t duplicatedTimeOpt,
int32_t& rawOffset, int32_t& dstOffset, UErrorCode& status) /*const*/ {
BasicTimeZone::getOffsetFromLocal(UDate /*date*/, int32_t /*nonExistingTimeOpt*/, int32_t /*duplicatedTimeOpt*/,
int32_t& /*rawOffset*/, int32_t& /*dstOffset*/, UErrorCode& status) /*const*/ {
if (U_FAILURE(status)) {
return;
}

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1996-2008, International Business Machines Corporation and *
* Copyright (C) 1996-2009, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -200,7 +200,7 @@ void CollationElementIterator::setText(const UnicodeString& source,
*string = 0;
}
/* Free offsetBuffer before initializing it. */
freeOffsetBuffer(&(m_data_->iteratordata_));
ucol_freeOffsetBuffer(&(m_data_->iteratordata_));
uprv_init_collIterate(m_data_->iteratordata_.coll, string, length,
&m_data_->iteratordata_);
@ -247,7 +247,7 @@ void CollationElementIterator::setText(CharacterIterator& source,
}
m_data_->isWritable = TRUE;
/* Free offsetBuffer before initializing it. */
freeOffsetBuffer(&(m_data_->iteratordata_));
ucol_freeOffsetBuffer(&(m_data_->iteratordata_));
uprv_init_collIterate(m_data_->iteratordata_.coll, buffer, length,
&m_data_->iteratordata_);
m_data_->reset_ = TRUE;

View file

@ -430,8 +430,8 @@ Collator::EComparisonResult Collator::compare(const UChar* source, int32_t sourc
return (Collator::EComparisonResult)compare(source, sourceLength, target, targetLength, ec);
}
UCollationResult Collator::compare(UCharIterator &sIter,
UCharIterator &tIter,
UCollationResult Collator::compare(UCharIterator &/*sIter*/,
UCharIterator &/*tIter*/,
UErrorCode &status) const {
if(U_SUCCESS(status)) {
// Not implemented in the base class.

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2005-2008, International Business Machines
* Copyright (C) 2005-2009, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
@ -370,7 +370,7 @@ static const UEnumeration gCSDetEnumeration = {
};
U_CAPI UEnumeration * U_EXPORT2
ucsdet_getAllDetectableCharsets(const UCharsetDetector *ucsd, UErrorCode *status)
ucsdet_getAllDetectableCharsets(const UCharsetDetector * /*ucsd*/, UErrorCode *status)
{
U_NAMESPACE_USE

View file

@ -5407,7 +5407,7 @@ cleanup:
}
/* To avoid memory leak, free the offset buffer if necessary. */
freeOffsetBuffer(&s);
ucol_freeOffsetBuffer(&s);
if(normSource != normBuffer) {
uprv_free(normSource);
@ -5791,7 +5791,7 @@ cleanup:
}
/* To avoid memory leak, free the offset buffer if necessary. */
freeOffsetBuffer(&s);
ucol_freeOffsetBuffer(&s);
if(normSource != normBuffer) {
uprv_free(normSource);
@ -6654,7 +6654,7 @@ saveState:
}
/* To avoid memory leak, free the offset buffer if necessary. */
freeOffsetBuffer(&s);
ucol_freeOffsetBuffer(&s);
// Return number of meaningful sortkey bytes.
UTRACE_DATA4(UTRACE_VERBOSE, "dest = %vb, state=%d %d",
@ -7060,7 +7060,7 @@ ucol_setVariableTop(UCollator *coll, const UChar *varTop, int32_t len, UErrorCod
}
/* To avoid memory leak, free the offset buffer if necessary. */
freeOffsetBuffer(&s);
ucol_freeOffsetBuffer(&s);
return CE & UCOL_PRIMARYMASK;
}

View file

@ -1064,13 +1064,7 @@ static inline UBool ucol_unsafeCP(UChar c, const UCollator *coll) {
#endif /* XP_CPLUSPLUS */
/* The offsetBuffer in collIterate might need to be freed to avoid memory leaks. */
static void freeOffsetBuffer(collIterate *s) {
if (s != NULL && s->offsetBuffer != NULL) {
uprv_free(s->offsetBuffer);
s->offsetBuffer = NULL;
s->offsetBufferSize = 0;
}
}
void ucol_freeOffsetBuffer(collIterate *s);
#endif /* #if !UCONFIG_NO_COLLATION */

View file

@ -758,8 +758,8 @@ static const UEnumeration defaultKeywordValues = {
#define MAX_LOCALE_SIZE 20
U_CAPI UEnumeration* U_EXPORT2
ucol_getKeywordValuesForLocale(const char* key, const char* locale,
UBool commonlyUsed, UErrorCode* status) {
ucol_getKeywordValuesForLocale(const char* /*key*/, const char* locale,
UBool /*commonlyUsed*/, UErrorCode* status) {
/* Get the locale base name. */
char localeBuffer[MAX_LOCALE_SIZE] = "";
uloc_getBaseName(locale, localeBuffer, MAX_LOCALE_SIZE, status);

View file

@ -696,7 +696,7 @@ ucol_setText( UCollationElements *elems,
elems->isWritable = FALSE;
/* free offset buffer to avoid memory leak before initializing. */
freeOffsetBuffer(&(elems->iteratordata_));
ucol_freeOffsetBuffer(&(elems->iteratordata_));
uprv_init_collIterate(elems->iteratordata_.coll, text, textLength,
&elems->iteratordata_);
@ -781,4 +781,13 @@ ucol_tertiaryOrder (int32_t order)
return (order & UCOL_TERTIARYMASK);
}
void ucol_freeOffsetBuffer(collIterate *s) {
if (s != NULL && s->offsetBuffer != NULL) {
uprv_free(s->offsetBuffer);
s->offsetBuffer = NULL;
s->offsetBufferSize = 0;
}
}
#endif /* #if !UCONFIG_NO_COLLATION */

View file

@ -3037,7 +3037,7 @@ U_CAPI void U_EXPORT2 usearch_setCollator( UStringSearch *strsrch,
initialize(strsrch, status);
if (U_SUCCESS(*status)) {
/* free offset buffer to avoid memory leak before initializing. */
freeOffsetBuffer(&(strsrch->textIter->iteratordata_));
ucol_freeOffsetBuffer(&(strsrch->textIter->iteratordata_));
uprv_init_collIterate(collator, strsrch->search->text,
strsrch->search->textLength,
&(strsrch->textIter->iteratordata_));
@ -3429,7 +3429,7 @@ U_CAPI void U_EXPORT2 usearch_reset(UStringSearch *strsrch)
initialize(strsrch, &status);
}
/* free offset buffer to avoid memory leak before initializing. */
freeOffsetBuffer(&(strsrch->textIter->iteratordata_));
ucol_freeOffsetBuffer(&(strsrch->textIter->iteratordata_));
uprv_init_collIterate(strsrch->collator, strsrch->search->text,
strsrch->search->textLength,
&(strsrch->textIter->iteratordata_));