ICU-4707 Fix some compiler warnings

X-SVN-Rev: 18987
This commit is contained in:
George Rhoten 2006-01-14 09:24:33 +00:00
parent 6a10781c1a
commit 177c4eec63
2 changed files with 19 additions and 23 deletions

View File

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1997-2005, International Business Machines Corporation and *
* Copyright (C) 1997-2006, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@ -43,30 +43,43 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Formattable)
// of the Measure class, which is true as of 3.0. [alan]
// Return TRUE if *a == *b.
inline UBool objectEquals(const UObject* a, const UObject* b) {
static inline UBool objectEquals(const UObject* a, const UObject* b) {
// LATER: return *a == *b;
return *((const Measure*) a) == *((const Measure*) b);
}
// Return a clone of *a.
inline UObject* objectClone(const UObject* a) {
static inline UObject* objectClone(const UObject* a) {
// LATER: return a->clone();
return ((const Measure*) a)->clone();
}
// Return TRUE if *a is an instance of Measure.
inline UBool instanceOfMeasure(const UObject* a) {
static inline UBool instanceOfMeasure(const UObject* a) {
// LATER: return a->instanceof(Measure::getStaticClassID());
return a->getDynamicClassID() ==
CurrencyAmount::getStaticClassID();
}
/**
* Creates a new Formattable array and copies the values from the specified
* original.
* @param array the original array
* @param count the original array count
* @return the new Formattable array.
*/
static inline Formattable* createArrayCopy(const Formattable* array, int32_t count) {
Formattable *result = new Formattable[count];
for (int32_t i=0; i<count; ++i) result[i] = array[i]; // Don't memcpy!
return result;
}
//-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
/**
* Set 'ec' to 'err' only if 'ec' is not already set to a failing UErrorCode.
*/
inline void setError(UErrorCode& ec, UErrorCode err) {
static inline void setError(UErrorCode& ec, UErrorCode err) {
if (U_SUCCESS(ec)) {
ec = err;
}

View File

@ -1,6 +1,6 @@
/*
********************************************************************************
* Copyright (C) 1997-2005, International Business Machines
* Copyright (C) 1997-2006, International Business Machines
* Corporation and others. All Rights Reserved.
********************************************************************************
*
@ -542,15 +542,6 @@ private:
*/
void dispose(void);
/**
* Creates a new Formattable array and copies the values from the specified
* original.
* @param array the original array
* @param count the original array count
* @return the new Formattable array.
*/
static Formattable* createArrayCopy(const Formattable* array, int32_t count);
UnicodeString* getBogus() const;
union {
@ -569,14 +560,6 @@ private:
UnicodeString fBogus; // Bogus string when it's needed.
};
inline Formattable*
Formattable::createArrayCopy(const Formattable* array, int32_t count)
{
Formattable *result = new Formattable[count];
for (int32_t i=0; i<count; ++i) result[i] = array[i]; // Don't memcpy!
return result;
}
inline UDate Formattable::getDate(UErrorCode& status) const {
if (fType != kDate) {
if (U_SUCCESS(status)) {