From d4260bd778ce6d814cbbcb30a53066e9607d433b Mon Sep 17 00:00:00 2001 From: Alan Liu Date: Fri, 13 Feb 2004 01:56:22 +0000 Subject: [PATCH] ICU-3399 fix copy ct, op=, op== X-SVN-Rev: 14510 --- icu4c/source/i18n/dcfmtsym.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/icu4c/source/i18n/dcfmtsym.cpp b/icu4c/source/i18n/dcfmtsym.cpp index f470334f0b5..3490f13f02b 100644 --- a/icu4c/source/i18n/dcfmtsym.cpp +++ b/icu4c/source/i18n/dcfmtsym.cpp @@ -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; } // -------------------------------------