ICU-3399 fix copy ct, op=, op==

X-SVN-Rev: 14510
This commit is contained in:
Alan Liu 2004-02-13 01:56:22 +00:00
parent f5a3aee7f2
commit d4260bd778

View File

@ -74,13 +74,7 @@ DecimalFormatSymbols::~DecimalFormatSymbols()
DecimalFormatSymbols::DecimalFormatSymbols(const DecimalFormatSymbols &source)
: UObject(source)
{
int i;
for(i = 0; i < (int)kFormatSymbolCount; ++i) {
// fastCopyFrom is safe, see docs on fSymbols
fSymbols[(ENumberFormatSymbol)i].fastCopyFrom(source.fSymbols[(ENumberFormatSymbol)i]);
}
uprv_strcpy(validLocale, source.validLocale);
uprv_strcpy(actualLocale, source.actualLocale);
*this = source;
}
// -------------------------------------
@ -89,13 +83,14 @@ DecimalFormatSymbols::DecimalFormatSymbols(const DecimalFormatSymbols &source)
DecimalFormatSymbols&
DecimalFormatSymbols::operator=(const DecimalFormatSymbols& rhs)
{
if (this != &rhs)
{
int i;
for(i = 0; i < (int)kFormatSymbolCount; ++i) {
if (this != &rhs) {
for(int32_t i = 0; i < (int32_t)kFormatSymbolCount; ++i) {
// fastCopyFrom is safe, see docs on fSymbols
fSymbols[(ENumberFormatSymbol)i].fastCopyFrom(rhs.fSymbols[(ENumberFormatSymbol)i]);
}
locale = rhs.locale;
uprv_strcpy(validLocale, rhs.validLocale);
uprv_strcpy(actualLocale, rhs.actualLocale);
}
return *this;
}
@ -108,14 +103,14 @@ DecimalFormatSymbols::operator==(const DecimalFormatSymbols& that) const
if (this == &that) {
return TRUE;
}
int i;
for(i = 0; i < (int)kFormatSymbolCount; ++i) {
for(int32_t i = 0; i < (int32_t)kFormatSymbolCount; ++i) {
if(fSymbols[(ENumberFormatSymbol)i] != that.fSymbols[(ENumberFormatSymbol)i]) {
return FALSE;
}
}
return TRUE;
return locale == that.locale &&
uprv_strcmp(validLocale, that.validLocale) == 0 &&
uprv_strcmp(actualLocale, that.actualLocale) == 0;
}
// -------------------------------------