]> granicus.if.org Git - icu/commitdiff
ICU-20783 use C++ covariant return types
authorMarkus Scherer <markus.icu@gmail.com>
Fri, 23 Aug 2019 03:00:25 +0000 (20:00 -0700)
committerMarkus Scherer <markus.icu@gmail.com>
Fri, 23 Aug 2019 18:45:36 +0000 (11:45 -0700)
55 files changed:
icu4c/source/common/unicode/unifilt.h
icu4c/source/common/unisetspan.cpp
icu4c/source/i18n/alphaindex.cpp
icu4c/source/i18n/calendar.cpp
icu4c/source/i18n/datefmt.cpp
icu4c/source/i18n/dtitvfmt.cpp
icu4c/source/i18n/measure.cpp
icu4c/source/i18n/numfmt.cpp
icu4c/source/i18n/olsontz.cpp
icu4c/source/i18n/plurfmt.cpp
icu4c/source/i18n/rbt_pars.cpp
icu4c/source/i18n/rbt_rule.cpp
icu4c/source/i18n/reldtfmt.cpp
icu4c/source/i18n/remtrans.cpp
icu4c/source/i18n/smpdtfmt.cpp
icu4c/source/i18n/tmutfmt.cpp
icu4c/source/i18n/translit.cpp
icu4c/source/i18n/transreg.cpp
icu4c/source/i18n/unicode/basictz.h
icu4c/source/i18n/unicode/datefmt.h
icu4c/source/i18n/unicode/numfmt.h
icu4c/source/i18n/uspoof.cpp
icu4c/source/i18n/uspoof_impl.cpp
icu4c/source/i18n/vtzone.cpp
icu4c/source/samples/citer/citer.cpp
icu4c/source/test/intltest/apicoll.cpp
icu4c/source/test/intltest/calregts.cpp
icu4c/source/test/intltest/caltest.cpp
icu4c/source/test/intltest/citrtest.cpp
icu4c/source/test/intltest/cpdtrtst.cpp
icu4c/source/test/intltest/dtfmapts.cpp
icu4c/source/test/intltest/dtifmtts.cpp
icu4c/source/test/intltest/itrbnf.cpp
icu4c/source/test/intltest/measfmttest.cpp
icu4c/source/test/intltest/nmfmapts.cpp
icu4c/source/test/intltest/numfmtst.cpp
icu4c/source/test/intltest/numrgts.cpp
icu4c/source/test/intltest/plurfmts.cpp
icu4c/source/test/intltest/rbbiapts.cpp
icu4c/source/test/intltest/rbbitst.cpp
icu4c/source/test/intltest/regcoll.cpp
icu4c/source/test/intltest/reldatefmttest.cpp
icu4c/source/test/intltest/reptest.cpp
icu4c/source/test/intltest/selfmts.cpp
icu4c/source/test/intltest/srchtest.cpp
icu4c/source/test/intltest/tchcfmt.cpp
icu4c/source/test/intltest/tmsgfmt.cpp
icu4c/source/test/intltest/transapi.cpp
icu4c/source/test/intltest/transtst.cpp
icu4c/source/test/intltest/tstnorm.cpp
icu4c/source/test/intltest/tufmtts.cpp
icu4c/source/test/intltest/tzregts.cpp
icu4c/source/test/intltest/tzrulets.cpp
icu4c/source/test/intltest/usettest.cpp
icu4c/source/test/intltest/ustrtest.cpp

index cb7b078c185f08d1054d53f866cebab9d16aed30..420e1a190564f03f6d28523dde7877502aab0e8d 100644 (file)
@@ -71,6 +71,14 @@ public:
      */
     virtual ~UnicodeFilter();
 
+    /**
+     * Clones this object polymorphically.
+     * The caller owns the result and should delete it when done.
+     * @return clone, or nullptr if an error occurred
+     * @stable ICU 2.4
+     */
+    virtual UnicodeFilter* clone() const = 0;
+
     /**
      * Returns <tt>true</tt> for characters that are in the selected
      * subset.  In other words, if a character is <b>to be
index 0a8893472f958b3fbed6f969e735508e097c829b..68e44d91ee70661ad96c941e03f2edf71d148f97 100644 (file)
@@ -400,7 +400,7 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSetStringSpan &otherStri
     if(otherStringSpan.pSpanNotSet==&otherStringSpan.spanSet) {
         pSpanNotSet=&spanSet;
     } else {
-        pSpanNotSet=(UnicodeSet *)otherStringSpan.pSpanNotSet->clone();
+        pSpanNotSet=otherStringSpan.pSpanNotSet->clone();
     }
 
     // Allocate a block of meta data.
@@ -436,7 +436,7 @@ void UnicodeSetStringSpan::addToSpanNotSet(UChar32 c) {
         if(spanSet.contains(c)) {
             return;  // Nothing to do.
         }
-        UnicodeSet *newSet=(UnicodeSet *)spanSet.cloneAsThawed();
+        UnicodeSet *newSet=spanSet.cloneAsThawed();
         if(newSet==NULL) {
             return;  // Out of memory.
         } else {
index 246c375120391e1ae8ac20bfcef2f91d7c706203..9c312bd8e674e54cf6e3e6b8893ab5594fab30fe 100644 (file)
@@ -260,8 +260,7 @@ AlphabeticIndex::ImmutableIndex *AlphabeticIndex::buildImmutableIndex(UErrorCode
     // but that would be worth it only if this method is called multiple times,
     // or called after using the old-style bucket iterator API.
     LocalPointer<BucketList> immutableBucketList(createBucketList(errorCode));
-    LocalPointer<RuleBasedCollator> coll(
-        static_cast<RuleBasedCollator *>(collatorPrimaryOnly_->clone()));
+    LocalPointer<RuleBasedCollator> coll(collatorPrimaryOnly_->clone());
     if (immutableBucketList.isNull() || coll.isNull()) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         return NULL;
@@ -907,7 +906,7 @@ void AlphabeticIndex::init(const Locale *locale, UErrorCode &status) {
             return;
         }
     }
-    collatorPrimaryOnly_ = static_cast<RuleBasedCollator *>(collator_->clone());
+    collatorPrimaryOnly_ = collator_->clone();
     if (collatorPrimaryOnly_ == NULL) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
index c7302457d3edb14365a03189678e98d625cac5e0..c043bb31861ad86ebb82d54904e16a2c8b2e7ece 100644 (file)
@@ -2595,7 +2595,7 @@ Calendar::isWeekend(UDate date, UErrorCode &status) const
         return FALSE;
     }
     // clone the calendar so we don't mess with the real one.
-    Calendar *work = (Calendar*)this->clone();
+    Calendar *work = this->clone();
     if (work == NULL) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return FALSE;
@@ -2755,7 +2755,7 @@ Calendar::getActualMinimum(UCalendarDateFields field, UErrorCode& status) const
 
     // clone the calendar so we don't mess with the real one, and set it to
     // accept anything for the field values
-    Calendar *work = (Calendar*)this->clone();
+    Calendar *work = this->clone();
     if (work == NULL) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return 0;
index 76ec3f48827a767879385972fa4cadd4d83cf7b8..a0e039cd5074e549299d1f2b51e9a794b6e49650 100644 (file)
@@ -154,7 +154,7 @@ DateFormat& DateFormat::operator=(const DateFormat& other)
           fCalendar = NULL;
         }
         if(other.fNumberFormat) {
-          fNumberFormat = (NumberFormat*)other.fNumberFormat->clone();
+          fNumberFormat = other.fNumberFormat->clone();
         } else {
           fNumberFormat = NULL;
         }
@@ -598,7 +598,7 @@ DateFormat::adoptNumberFormat(NumberFormat* newNumberFormat)
 void
 DateFormat::setNumberFormat(const NumberFormat& newNumberFormat)
 {
-    NumberFormat* newNumFmtClone = (NumberFormat*)newNumberFormat.clone();
+    NumberFormat* newNumFmtClone = newNumberFormat.clone();
     if (newNumFmtClone != NULL) {
         adoptNumberFormat(newNumFmtClone);
     }
index 8f4fcc50bc3ed3b3346ec0937f53612a63ae400a..f47e7708ccc128555177f82cbbbef91cd54358b1 100644 (file)
@@ -170,7 +170,7 @@ DateIntervalFormat::operator=(const DateIntervalFormat& itvfmt) {
         {
             Mutex lock(&gFormatterMutex);
             if ( itvfmt.fDateFormat ) {
-                fDateFormat = (SimpleDateFormat*)itvfmt.fDateFormat->clone();
+                fDateFormat = itvfmt.fDateFormat->clone();
             } else {
                 fDateFormat = NULL;
             }
@@ -196,9 +196,9 @@ DateIntervalFormat::operator=(const DateIntervalFormat& itvfmt) {
             fIntervalPatterns[i] = itvfmt.fIntervalPatterns[i];
         }
         fLocale = itvfmt.fLocale;
-        fDatePattern    = (itvfmt.fDatePattern)?    (UnicodeString*)itvfmt.fDatePattern->clone(): NULL;
-        fTimePattern    = (itvfmt.fTimePattern)?    (UnicodeString*)itvfmt.fTimePattern->clone(): NULL;
-        fDateTimeFormat = (itvfmt.fDateTimeFormat)? (UnicodeString*)itvfmt.fDateTimeFormat->clone(): NULL;
+        fDatePattern    = (itvfmt.fDatePattern)?    itvfmt.fDatePattern->clone(): NULL;
+        fTimePattern    = (itvfmt.fTimePattern)?    itvfmt.fTimePattern->clone(): NULL;
+        fDateTimeFormat = (itvfmt.fDateTimeFormat)? itvfmt.fDateTimeFormat->clone(): NULL;
     }
     return *this;
 }
index a10b37f5fba94ac87d7835f2ff70038067a923ea..bffa44215e3cde31f7d01faba6230bd942eac266 100644 (file)
@@ -43,7 +43,7 @@ Measure& Measure::operator=(const Measure& other) {
     if (this != &other) {
         delete unit;
         number = other.number;
-        unit = (MeasureUnit*) other.unit->clone();
+        unit = other.unit->clone();
     }
     return *this;
 }
index 672d4669e2707c8d452e74710e11e7bf07fc3018..7c3a0551c32992d4f068320f69d57c990dc15624 100644 (file)
@@ -569,7 +569,7 @@ NumberFormat::format(const Formattable& obj,
     if(arg.wasCurrency() && u_strcmp(iso, getCurrency())) {
       // trying to format a different currency.
       // Right now, we clone.
-      LocalPointer<NumberFormat> cloneFmt((NumberFormat*)this->clone());
+      LocalPointer<NumberFormat> cloneFmt(this->clone());
       cloneFmt->setCurrency(iso, status);
       // next line should NOT recurse, because n is numeric whereas obj was a wrapper around currency amount.
       return cloneFmt->format(*n, appendTo, pos, status);
@@ -624,7 +624,7 @@ NumberFormat::format(const Formattable& obj,
     if(arg.wasCurrency() && u_strcmp(iso, getCurrency())) {
       // trying to format a different currency.
       // Right now, we clone.
-      LocalPointer<NumberFormat> cloneFmt((NumberFormat*)this->clone());
+      LocalPointer<NumberFormat> cloneFmt(this->clone());
       cloneFmt->setCurrency(iso, status);
       // next line should NOT recurse, because n is numeric whereas obj was a wrapper around currency amount.
       return cloneFmt->format(*n, appendTo, posIter, status);
@@ -1059,7 +1059,7 @@ NumberFormat::createInstance(const Locale& loc, UNumberFormatStyle kind, UErrorC
     if (U_FAILURE(status)) {
         return NULL;
     }
-    NumberFormat *result = static_cast<NumberFormat *>((*shared)->clone());
+    NumberFormat *result = (*shared)->clone();
     shared->removeRef();
     if (result == NULL) {
         status = U_MEMORY_ALLOCATION_ERROR;
index 732140baf3ab5ab5e96beef7fcae95478645e57c..d21e6e99297b0612444d06f106682b2fc046227e 100644 (file)
@@ -287,8 +287,7 @@ OlsonTimeZone& OlsonTimeZone::operator=(const OlsonTimeZone& other) {
     typeMapData = other.typeMapData;
 
     delete finalZone;
-    finalZone = (other.finalZone != 0) ?
-        (SimpleTimeZone*) other.finalZone->clone() : 0;
+    finalZone = (other.finalZone != 0) ? other.finalZone->clone() : 0;
 
     finalStartYear = other.finalStartYear;
     finalStartMillis = other.finalStartMillis;
@@ -816,7 +815,7 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) {
              * For now, we do not set the valid start year when the construction time
              * and create a clone and set the start year when extracting rules.
              */
-            finalZoneWithStartYear = (SimpleTimeZone*)finalZone->clone();
+            finalZoneWithStartYear = finalZone->clone();
             // Check to make sure finalZone was actually cloned.
             if (finalZoneWithStartYear == NULL) {
                 status = U_MEMORY_ALLOCATION_ERROR;
@@ -837,7 +836,7 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) {
             startTime = tzt.getTime();
         } else {
             // final rule with no transitions
-            finalZoneWithStartYear = (SimpleTimeZone*)finalZone->clone();
+            finalZoneWithStartYear = finalZone->clone();
             // Check to make sure finalZone was actually cloned.
             if (finalZoneWithStartYear == NULL) {
                 status = U_MEMORY_ALLOCATION_ERROR;
index 044f4b3f3e752b6fb2e69e86a72ff8d496c50d89..b99437630e67b5d2dc6d99ae1a1a9c8cb40c7100 100644 (file)
@@ -159,7 +159,7 @@ PluralFormat::copyObjects(const PluralFormat& other) {
     if (other.numberFormat == NULL) {
         numberFormat = NumberFormat::createInstance(locale, status);
     } else {
-        numberFormat = (NumberFormat*)other.numberFormat->clone();
+        numberFormat = other.numberFormat->clone();
     }
     if (other.pluralRulesWrapper.pluralRules == NULL) {
         pluralRulesWrapper.pluralRules = PluralRules::forLocale(locale, status);
@@ -353,7 +353,7 @@ PluralFormat::setNumberFormat(const NumberFormat* format, UErrorCode& status) {
     if (U_FAILURE(status)) {
         return;
     }
-    NumberFormat* nf = (NumberFormat*)format->clone();
+    NumberFormat* nf = format->clone();
     if (nf != NULL) {
         delete numberFormat;
         numberFormat = nf;
index 9932dbdc95e3cc06bf35d035797ddc5e6060634a..1ae5b81f034d8f444d600d7685e47e91be36104c 100644 (file)
@@ -1111,7 +1111,7 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
             int32_t p = UHASH_FIRST;
             const UHashElement* he = variableNames.nextElement(p);
             while (he != NULL) {
-                UnicodeString* tempus = (UnicodeString*)(((UnicodeString*)(he->value.pointer))->clone());
+                UnicodeString* tempus = ((UnicodeString*)(he->value.pointer))->clone();
                 if (tempus == NULL) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                     return;
index 3569e42fa4f137f903264dc11428b17ba5a52a70..6cc5325c467eab08253055eaec713130f4881fed 100644 (file)
@@ -180,13 +180,13 @@ TransliterationRule::TransliterationRule(TransliterationRule& other) :
     }
 
     if (other.anteContext != NULL) {
-        anteContext = (StringMatcher*) other.anteContext->clone();
+        anteContext = other.anteContext->clone();
     }
     if (other.key != NULL) {
-        key = (StringMatcher*) other.key->clone();
+        key = other.key->clone();
     }
     if (other.postContext != NULL) {
-        postContext = (StringMatcher*) other.postContext->clone();
+        postContext = other.postContext->clone();
     }
     output = other.output->clone();
 }
index 271bda076dbe4075b8435f459c2169416de4fc54..c8ffd0464607044d2e576e58b8343f8b973f281a 100644 (file)
@@ -51,7 +51,7 @@ RelativeDateFormat::RelativeDateFormat(const RelativeDateFormat& other) :
  fCapitalizationBrkIter(NULL)
 {
     if(other.fDateTimeFormatter != NULL) {
-        fDateTimeFormatter = (SimpleDateFormat*)other.fDateTimeFormatter->clone();
+        fDateTimeFormatter = other.fDateTimeFormatter->clone();
     }
     if(other.fCombinedFormat != NULL) {
         fCombinedFormat = new SimpleFormatter(*other.fCombinedFormat);
index c198e65484c5acac27040ba6fc93892eda134370..03b878575ca86c90c5da3ec40db52dffef6e3b45 100644 (file)
@@ -51,7 +51,7 @@ RemoveTransliterator::~RemoveTransliterator() {}
 RemoveTransliterator* RemoveTransliterator::clone() const {
     RemoveTransliterator* result = new RemoveTransliterator();
     if (result != NULL && getFilter() != 0) {
-        result->adoptFilter((UnicodeFilter*)(getFilter()->clone()));
+        result->adoptFilter(getFilter()->clone());
     }
     return result;
 }
index c17e54f640c69e94f0462f2a9779f1be59cdeb91..0b4939f8e85144fedea42c7f514ce893b05cde51 100644 (file)
@@ -2108,7 +2108,7 @@ SimpleDateFormat::zeroPaddingNumber(
     // Fall back to slow path (clone and mutate the NumberFormat)
     if (currentNumberFormat != nullptr) {
         FieldPosition pos(FieldPosition::DONT_CARE);
-        LocalPointer<NumberFormat> nf(dynamic_cast<NumberFormat*>(currentNumberFormat->clone()));
+        LocalPointer<NumberFormat> nf(currentNumberFormat->clone());
         nf->setMinimumIntegerDigits(minDigits);
         nf->setMaximumIntegerDigits(maxDigits);
         nf->format(value, appendTo, pos);  // 3rd arg is there to speed up processing
@@ -3771,7 +3771,7 @@ void SimpleDateFormat::parseInt(const UnicodeString& text,
     auto* fmtAsDF = dynamic_cast<const DecimalFormat*>(fmt);
     LocalPointer<DecimalFormat> df;
     if (!allowNegative && fmtAsDF != nullptr) {
-        df.adoptInstead(dynamic_cast<DecimalFormat*>(fmtAsDF->clone()));
+        df.adoptInstead(fmtAsDF->clone());
         if (df.isNull()) {
             // Memory allocation error
             return;
index 2a4273e44b10fb22c311d4ba3f13542fa57ebe2a..231ea5799c3764285bf075bb140ba3ab63a85cc7 100644 (file)
@@ -685,7 +685,7 @@ TimeUnitFormat::setNumberFormat(const NumberFormat& format, UErrorCode& status){
     if (U_FAILURE(status)) {
         return;
     }
-    adoptNumberFormat((NumberFormat *)format.clone(), status);
+    adoptNumberFormat(format.clone(), status);
 }
 
 
@@ -721,8 +721,8 @@ TimeUnitFormat::copyHash(const Hashtable* source, Hashtable* target, UErrorCode&
             const UHashTok valueTok = element->value;
             const MessageFormat** value = (const MessageFormat**)valueTok.pointer;
             MessageFormat** newVal = (MessageFormat**)uprv_malloc(UTMUTFMT_FORMAT_STYLE_COUNT*sizeof(MessageFormat*));
-            newVal[0] = (MessageFormat*)value[0]->clone();
-            newVal[1] = (MessageFormat*)value[1]->clone();
+            newVal[0] = value[0]->clone();
+            newVal[1] = value[1]->clone();
             target->put(UnicodeString(*key), newVal, status);
             if ( U_FAILURE(status) ) {
                 delete newVal[0];
index a3ad1fc998ff81642eb38bc2463a90a0441a2372..dae87d06d79111c557ef686ffc07586313d5323f 100644 (file)
@@ -158,7 +158,7 @@ Transliterator::Transliterator(const Transliterator& other) :
 
     if (other.filter != 0) {
         // We own the filter, so we must have our own copy
-        filter = (UnicodeFilter*) other.filter->clone();
+        filter = other.filter->clone();
     }
 }
 
@@ -175,7 +175,7 @@ Transliterator& Transliterator::operator=(const Transliterator& other) {
     ID.getTerminatedBuffer();
 
     maximumContextLength = other.maximumContextLength;
-    adoptFilter((other.filter == 0) ? 0 : (UnicodeFilter*) other.filter->clone());
+    adoptFilter((other.filter == 0) ? 0 : other.filter->clone());
     return *this;
 }
 
index f80df1ea0eb5eae8da64d058dbc96e330b85c1e3..c412a20079e72ec9d34d06f82994dbdec2f441d4 100644 (file)
@@ -131,7 +131,7 @@ Transliterator* TransliteratorAlias::create(UParseError& pe,
             return 0;
         }
         if (compoundFilter != 0)
-            t->adoptFilter((UnicodeSet*)compoundFilter->clone());
+            t->adoptFilter(compoundFilter->clone());
         break;
     case COMPOUND:
         {
@@ -173,8 +173,8 @@ Transliterator* TransliteratorAlias::create(UParseError& pe,
 
             if (U_SUCCESS(ec)) {
                 t = new CompoundTransliterator(ID, transliterators,
-                    (compoundFilter ? (UnicodeSet*)(compoundFilter->clone()) : 0),
-                    anonymousRBTs, pe, ec);
+                        (compoundFilter ? compoundFilter->clone() : nullptr),
+                        anonymousRBTs, pe, ec);
                 if (t == 0) {
                     ec = U_MEMORY_ALLOCATION_ERROR;
                     return 0;
@@ -946,7 +946,7 @@ void TransliteratorRegistry::registerEntry(const UnicodeString& ID,
     if (visible) {
         registerSTV(source, target, variant);
         if (!availableIDs.contains((void*) &ID)) {
-            UnicodeString *newID = (UnicodeString *)ID.clone();
+            UnicodeString *newID = ID.clone();
             // Check to make sure newID was created.
             if (newID != NULL) {
                 // NUL-terminate the ID string
index 08b66ebc88fcaf774f275fd7282778df75f8448b..c4d08768987d69c38c0ae4874b71cf9173932406 100644 (file)
@@ -43,6 +43,14 @@ public:
      */
     virtual ~BasicTimeZone();
 
+    /**
+     * Clones this object polymorphically.
+     * The caller owns the result and should delete it when done.
+     * @return clone, or nullptr if an error occurred
+     * @stable ICU 3.8
+     */
+    virtual BasicTimeZone* clone() const = 0;
+
     /**
      * Gets the first time zone transition after the base time.
      * @param base      The base time.
index 59a0e0e28e3906c851086061e66c6b8259a92579..f106e821a762ae021a0d296238e5c887dcfb4f5f 100644 (file)
@@ -223,6 +223,14 @@ public:
      */
     virtual ~DateFormat();
 
+    /**
+     * Clones this object polymorphically.
+     * The caller owns the result and should delete it when done.
+     * @return clone, or nullptr if an error occurred
+     * @stable ICU 2.0
+     */
+    virtual DateFormat* clone() const = 0;
+
     /**
      * Equality operator.  Returns true if the two formats have the same behavior.
      * @stable ICU 2.0
index 468a822c558cf4f39654a26ee64e5e96192d3d1b..722e6b7e74cdeccdf69e79d1cecf400b4d1e04d2 100644 (file)
@@ -262,6 +262,14 @@ public:
      */
     virtual ~NumberFormat();
 
+    /**
+     * Clones this object polymorphically.
+     * The caller owns the result and should delete it when done.
+     * @return clone, or nullptr if an error occurred
+     * @stable ICU 2.0
+     */
+    virtual NumberFormat* clone() const = 0;
+
     /**
      * Return true if the given Format objects are semantically equal.
      * Objects of different subclasses are considered unequal.
index a6be2e06b249c66381e7e545ea4df77aa669582c..5b7b326f1fd6cfebce9c69ffed8f9feb0a9b8e7e 100644 (file)
@@ -349,7 +349,7 @@ uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const UnicodeSet *chars, UErrorCo
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
-    UnicodeSet *clonedSet = static_cast<UnicodeSet *>(chars->clone());
+    UnicodeSet *clonedSet = chars->clone();
     if (clonedSet == NULL || clonedSet->isBogus()) {
         *status = U_MEMORY_ALLOCATION_ERROR;
         return;
index 5087637d2f50900e8d1b239fa05737db35943f85..88245b7f8f9c2218fc77c87cbb3b86f9b0a9a4a1 100644 (file)
@@ -82,7 +82,7 @@ SpoofImpl::SpoofImpl(const SpoofImpl &src, UErrorCode &status)  :
     if (src.fSpoofData != NULL) {
         fSpoofData = src.fSpoofData->addReference();
     }
-    fAllowedCharsSet = static_cast<const UnicodeSet *>(src.fAllowedCharsSet->clone());
+    fAllowedCharsSet = src.fAllowedCharsSet->clone();
     fAllowedLocales = uprv_strdup(src.fAllowedLocales);
     if (fAllowedCharsSet == NULL || fAllowedLocales == NULL) {
         status = U_MEMORY_ALLOCATION_ERROR;
@@ -193,7 +193,7 @@ void SpoofImpl::setAllowedLocales(const char *localesList, UErrorCode &status) {
     }
 
     // Store the updated spoof checker state.
-    tmpSet = static_cast<UnicodeSet *>(allowedChars.clone());
+    tmpSet = allowedChars.clone();
     const char *tmpLocalesList = uprv_strdup(localesList);
     if (tmpSet == NULL || tmpLocalesList == NULL) {
         status = U_MEMORY_ALLOCATION_ERROR;
index 7308693927e9310d2e94bcaed40a46d91a7b2b9a..fa8c3390b815a949577e94db419301f8eeff45ca 100644 (file)
@@ -965,7 +965,7 @@ VTimeZone::VTimeZone(const VTimeZone& source)
     tzurl(source.tzurl), lastmod(source.lastmod),
     olsonzid(source.olsonzid), icutzver(source.icutzver) {
     if (source.tz != NULL) {
-        tz = (BasicTimeZone*)source.tz->clone();
+        tz = source.tz->clone();
     }
     if (source.vtzlines != NULL) {
         UErrorCode status = U_ZERO_ERROR;
@@ -1007,7 +1007,7 @@ VTimeZone::operator=(const VTimeZone& right) {
             tz = NULL;
         }
         if (right.tz != NULL) {
-            tz = (BasicTimeZone*)right.tz->clone();
+            tz = right.tz->clone();
         }
         if (vtzlines != NULL) {
             delete vtzlines;
@@ -1092,7 +1092,7 @@ VTimeZone::createVTimeZoneFromBasicTimeZone(const BasicTimeZone& basic_time_zone
         status = U_MEMORY_ALLOCATION_ERROR;
         return NULL;
     }
-    vtz->tz = (BasicTimeZone *)basic_time_zone.clone();
+    vtz->tz = basic_time_zone.clone();
     if (vtz->tz == NULL) {
         status = U_MEMORY_ALLOCATION_ERROR;
         delete vtz;
@@ -1957,7 +1957,7 @@ VTimeZone::writeZone(VTZWriter& w, BasicTimeZone& basictz,
                 && (atzrule = dynamic_cast<const AnnualTimeZoneRule *>(tzt.getTo())) != NULL
                 && atzrule->getEndYear() == AnnualTimeZoneRule::MAX_YEAR
             ) {
-                finalDstRule = (AnnualTimeZoneRule*)tzt.getTo()->clone();
+                finalDstRule = atzrule->clone();
             }
             if (dstCount > 0) {
                 if (year == dstStartYear + dstCount
@@ -2008,7 +2008,7 @@ VTimeZone::writeZone(VTZWriter& w, BasicTimeZone& basictz,
                 && (atzrule = dynamic_cast<const AnnualTimeZoneRule *>(tzt.getTo())) != NULL
                 && atzrule->getEndYear() == AnnualTimeZoneRule::MAX_YEAR
             ) {
-                finalStdRule = (AnnualTimeZoneRule*)tzt.getTo()->clone();
+                finalStdRule = atzrule->clone();
             }
             if (stdCount > 0) {
                 if (year == stdStartYear + stdCount
index 43e5a00a054e22c321b1eae99c13d6cb911bc554..4d5a3bbe837dbc80a7497526228638a33e40e091 100644 (file)
@@ -59,7 +59,7 @@ void Test::TestUChariter() {
     const UChar *testText = testString.getTerminatedBuffer();
 
     UCharCharacterIterator iter(testText, u_strlen(testText));
-    UCharCharacterIterator* test2 = (UCharCharacterIterator*)iter.clone();
+    UCharCharacterIterator* test2 = iter.clone();
 
     u_fprintf(out, "testText = %s", testChars);
 
@@ -126,7 +126,7 @@ void Test::TestStringiter() {
     const UChar *testText    = testString.getTerminatedBuffer();
 
     StringCharacterIterator iter(testText, u_strlen(testText));
-    StringCharacterIterator* test2 = (StringCharacterIterator*)iter.clone();
+    StringCharacterIterator* test2 = iter.clone();
 
     if (iter != *test2 ) {
         u_fprintf(out, "clone() or equals() failed: Two clones tested unequal\n");
index a8ee961ddfd2cb34be81ca5e466f288a87f5bc7c..88eefa92b98ee35051dc44011ee1e4d932123f19 100644 (file)
@@ -2345,7 +2345,7 @@ void CollationAPITest::TestClone() {
     dump("c1", c1, status);
     
     logln("\ninit c2");
-    RuleBasedCollator* c2 = (RuleBasedCollator*)c1->clone();
+    RuleBasedCollator* c2 = c1->clone();
     val = c2->getAttribute(UCOL_CASE_FIRST, status);
     if(val == UCOL_LOWER_FIRST){
         c2->setAttribute(UCOL_CASE_FIRST, UCOL_UPPER_FIRST, status);
index 33bcd2fc52bc13f6f7c73feadcf583f2de2846f8..8806d04be18f23fb2873d1d2e91127dc1e60bd94 100644 (file)
@@ -193,7 +193,7 @@ CalendarRegressionTest::test4028518()
       return;
     }
     failure(status, "new GregorianCalendar");
-    GregorianCalendar *cal2 = (GregorianCalendar*) cal1->clone() ;
+    GregorianCalendar *cal2 = cal1->clone() ;
 
     printdate(cal1, "cal1: ") ;
     printdate(cal2, "cal2 - cloned(): ") ;
@@ -1521,7 +1521,7 @@ void CalendarRegressionTest::test4141665()
       delete cal;
       return;
     }
-    GregorianCalendar *cal2 = (GregorianCalendar*)cal->clone();
+    GregorianCalendar *cal2 = cal->clone();
     UDate cut = cal->getGregorianChange();
     UDate cut2 = cut + 100*24*60*60*1000.0; // 100 days later
     if (*cal != *cal2) {
@@ -1937,7 +1937,7 @@ CalendarRegressionTest::Test4167060()
 
             if(U_FAILURE(status))
                 errln("setGregorianChange() failed");
-            format->adoptCalendar((Calendar*)calendar->clone());
+            format->adoptCalendar(calendar->clone());
 
             UDate dateBefore = calendar->getTime(status);
             if(U_FAILURE(status))
index ac8b067d872b24036c242bb2daf8f79e56521e4f..677c98a12196ad1548824e03c759cab644c25227 100644 (file)
@@ -750,7 +750,7 @@ CalendarTest::TestClonesUnique908()
     UErrorCode status = U_ZERO_ERROR;
     Calendar *c = Calendar::createInstance(status);
     if (failure(status, "Calendar::createInstance", TRUE)) return;
-    Calendar *d = (Calendar*) c->clone();
+    Calendar *d = c->clone();
     c->set(UCAL_MILLISECOND, 123);
     d->set(UCAL_MILLISECOND, 456);
     if (c->get(UCAL_MILLISECOND, status) != 123 ||
@@ -1732,7 +1732,7 @@ void
 CalendarTest::marchByDelta(Calendar* cal, int32_t delta)
 {
     UErrorCode status = U_ZERO_ERROR;
-    Calendar *cur = (Calendar*) cal->clone();
+    Calendar *cur = cal->clone();
     int32_t initialDOW = cur->get(UCAL_DAY_OF_WEEK, status);
     if (U_FAILURE(status)) { errln("Calendar::get failed"); return; }
     int32_t DOW, newDOW = initialDOW;
index e1fed1cc6fabbe11aaeea9e2fb493e7d8c1c5dbc..dfd45aaba1f6ed39dc2766bc8320405c79dbe36d 100644 (file)
@@ -198,7 +198,7 @@ void CharIterTest::TestConstructionAndEquality() {
     UnicodeString  testText2("Don't bother using this string.");
     UnicodeString result1, result2, result3;
 
-    CharacterIterator* test1 = new StringCharacterIterator(testText);
+    StringCharacterIterator* test1 = new StringCharacterIterator(testText);
     CharacterIterator* test1b= new StringCharacterIterator(testText, -1);
     CharacterIterator* test1c= new StringCharacterIterator(testText, 100);
     CharacterIterator* test1d= new StringCharacterIterator(testText, -2, 100, 5);
@@ -257,7 +257,7 @@ void CharIterTest::TestConstructionAndEquality() {
    
     StringCharacterIterator* testChar1=new StringCharacterIterator(testText);
     StringCharacterIterator* testChar2=new StringCharacterIterator(testText2);
-    StringCharacterIterator* testChar3=(StringCharacterIterator*)test1->clone();
+    StringCharacterIterator* testChar3=test1->clone();
 
     testChar1->getText(result1);
     testChar2->getText(result2);
@@ -292,7 +292,7 @@ void CharIterTest::TestConstructionAndEqualityUChariter() {
     UCharCharacterIterator* test2 = new UCharCharacterIterator(testText, u_strlen(testText), 5);
     UCharCharacterIterator* test3 = new UCharCharacterIterator(testText, u_strlen(testText), 2, 20, 5);
     UCharCharacterIterator* test4 = new UCharCharacterIterator(testText2, u_strlen(testText2));
-    UCharCharacterIterator* test5 = (UCharCharacterIterator*)test1->clone();
+    UCharCharacterIterator* test5 = test1->clone();
     UCharCharacterIterator* test6 = new UCharCharacterIterator(*test1);
 
     // j785: length=-1 will use u_strlen()
index b5691947542c2a3c06fe24257dc55051ab1ce2cb..fbc4457f16d66f3be07c3e14050eb11baa998f70 100644 (file)
@@ -159,10 +159,10 @@ void CompoundTransliteratorTest::TestCloneEqual(){
         errln("Error: =operator or copy constructor failed");
     }
 
-    CompoundTransliterator *clonect1a=(CompoundTransliterator*)ct1->clone();
-    CompoundTransliterator *clonect1b=(CompoundTransliterator*)equalct1.clone();
-    CompoundTransliterator *clonect2a=(CompoundTransliterator*)ct2->clone();
-    CompoundTransliterator *clonect2b=(CompoundTransliterator*)copyct2->clone();
+    CompoundTransliterator *clonect1a=ct1->clone();
+    CompoundTransliterator *clonect1b=equalct1.clone();
+    CompoundTransliterator *clonect2a=ct2->clone();
+    CompoundTransliterator *clonect2b=copyct2->clone();
 
 
     if(clonect1a->getID()  != ct1->getID()       || clonect1a->getCount() != ct1->getCount()        ||
index 928a722a2f590178ac317db9f611d3b615d5bc41..361c35c5baedf2c370f02a43ab9aa477fba42ca0 100644 (file)
@@ -235,7 +235,7 @@ if (fr != NULL && it != NULL && de != NULL)
     }
 
     const NumberFormat *nf = def->getNumberFormat();
-    NumberFormat *newNf = (NumberFormat*) nf->clone();
+    NumberFormat *newNf = nf->clone();
     de->adoptNumberFormat(newNf);   
     it->setNumberFormat(*newNf);
     if( *(de->getNumberFormat()) != *(it->getNumberFormat())) {
index fa0847619878888855c86c149a4eaeb0c9299585..e2a9faa25a066ac6a430129d13ed3d89ea128882 100644 (file)
@@ -132,7 +132,7 @@ void DateIntervalFormatTest::testAPI() {
     status = U_ZERO_ERROR;
     logln("Testing DateIntervalFormat clone");
 
-    DateIntervalFormat* another = (DateIntervalFormat*)dtitvfmt->clone();
+    DateIntervalFormat* another = dtitvfmt->clone();
     if ( (*another) != (*dtitvfmt) ) {
         dataerrln("%s:%d ERROR: clone failed", __FILE__, __LINE__);
     }
@@ -224,7 +224,7 @@ void DateIntervalFormatTest::testAPI() {
     }
 
     status = U_ZERO_ERROR;
-    DateFormat* nonConstFmt = (DateFormat*)fmt->clone();
+    DateFormat* nonConstFmt = fmt->clone();
     dtitvfmt->adoptDateFormat(nonConstFmt, status);
     anotherFmt = dtitvfmt->getDateFormat();
     if ( (*fmt) != (*anotherFmt) || U_FAILURE(status) ) {
@@ -250,7 +250,7 @@ void DateIntervalFormatTest::testAPI() {
     logln("Testing DateIntervalFormat constructor and assigment operator");
     status = U_ZERO_ERROR;
 
-    DateFormat* constFmt = (constFmt*)dtitvfmt->getDateFormat()->clone();
+    DateFormat* constFmt = dtitvfmt->getDateFormat()->clone();
     inf = dtitvfmt->getDateIntervalInfo()->clone();
 
 
@@ -1483,7 +1483,7 @@ void DateIntervalFormatTest::stress(const char** data, int32_t data_length,
                 GregorianCalendar* gregCal = new GregorianCalendar(loc, ec);
                 if (!assertSuccess("GregorianCalendar()", ec)) return;
                 const DateFormat* dformat = dtitvfmt->getDateFormat();
-                DateFormat* newOne = (DateFormat*)dformat->clone();
+                DateFormat* newOne = dformat->clone();
                 newOne->adoptCalendar(gregCal);
                 //dtitvfmt->adoptDateFormat(newOne, ec);
                 dtitvfmt->setDateFormat(*newOne, ec);
@@ -1640,7 +1640,7 @@ void DateIntervalFormatTest::testTicket12065() {
         dataerrln("FAIL: DateIntervalFormat::createInstance failed for Locale::getEnglish()");
         return;
     }
-    LocalPointer<DateIntervalFormat> clone(dynamic_cast<DateIntervalFormat *>(formatter->clone()));
+    LocalPointer<DateIntervalFormat> clone(formatter->clone());
     if (*formatter != *clone) {
         errln("%s:%d DateIntervalFormat and clone are not equal.", __FILE__, __LINE__);
         return;
index 549f24ca059da1ad4cd85a01b7048633d9957af0..ed4e865aaa3eb6b921dea42bace09cebc8eb2a7b 100644 (file)
@@ -166,7 +166,7 @@ IntlTestRBNF::TestAPI() {
   // test clone
   {
     logln("Testing Clone");
-    RuleBasedNumberFormat* rbnfClone = (RuleBasedNumberFormat *)formatter->clone();
+    RuleBasedNumberFormat* rbnfClone = formatter->clone();
     if(rbnfClone != NULL) {
       if(!(*rbnfClone == *formatter)) {
         errln("Clone should be semantically equivalent to the original!");
index f3079bf391b6a61cb11e471a892fb955d0c87fce..c4d0064e89b54df377b7c0b73136777e68057b6e 100644 (file)
@@ -1543,7 +1543,7 @@ void MeasureFormatTest::TestBasic() {
     if (!(*ptr1 != *ptr3)) {
         errln("Expect != to work.");
     }
-    MeasureUnit *ptr4 = (MeasureUnit *) ptr1->clone();
+    MeasureUnit *ptr4 = ptr1->clone();
     if (*ptr1 != *ptr4) {
         errln("Expect clone to work.");
     }
@@ -1874,7 +1874,7 @@ void MeasureFormatTest::TestFormatPeriodEn() {
         return;
     }
     nf->setMaximumFractionDigits(4);
-    MeasureFormat mf(en, UMEASFMT_WIDTH_WIDE, (NumberFormat *) nf->clone(), status);
+    MeasureFormat mf(en, UMEASFMT_WIDTH_WIDE, nf->clone(), status);
     if (!assertSuccess("Error creating measure format en WIDE", status)) {
         return;
     }
@@ -1887,21 +1887,21 @@ void MeasureFormatTest::TestFormatPeriodEn() {
     }
     // exercise clone
     {
-        MeasureFormat *mf3 = (MeasureFormat *) mf.clone();
+        MeasureFormat *mf3 = mf.clone();
         verifyFormat("en WIDE copy", *mf3, fullData, UPRV_LENGTHOF(fullData));
         delete mf3;
     }
-    mf = MeasureFormat(en, UMEASFMT_WIDTH_SHORT, (NumberFormat *) nf->clone(), status);
+    mf = MeasureFormat(en, UMEASFMT_WIDTH_SHORT, nf->clone(), status);
     if (!assertSuccess("Error creating measure format en SHORT", status)) {
         return;
     }
     verifyFormat("en SHORT", mf, abbrevData, UPRV_LENGTHOF(abbrevData));
-    mf = MeasureFormat(en, UMEASFMT_WIDTH_NARROW, (NumberFormat *) nf->clone(), status);
+    mf = MeasureFormat(en, UMEASFMT_WIDTH_NARROW, nf->clone(), status);
     if (!assertSuccess("Error creating measure format en NARROW", status)) {
         return;
     }
     verifyFormat("en NARROW", mf, narrowData, UPRV_LENGTHOF(narrowData));
-    mf = MeasureFormat(en, UMEASFMT_WIDTH_NUMERIC, (NumberFormat *) nf->clone(), status);
+    mf = MeasureFormat(en, UMEASFMT_WIDTH_NUMERIC, nf->clone(), status);
     if (!assertSuccess("Error creating measure format en NUMERIC", status)) {
         return;
     }
@@ -1913,12 +1913,12 @@ void MeasureFormatTest::TestFormatPeriodEn() {
         return;
     }
     nf->setMaximumFractionDigits(4);
-    mf = MeasureFormat(de, UMEASFMT_WIDTH_WIDE, (NumberFormat *) nf->clone(), status);
+    mf = MeasureFormat(de, UMEASFMT_WIDTH_WIDE, nf->clone(), status);
     if (!assertSuccess("Error creating measure format de WIDE", status)) {
         return;
     }
     verifyFormat("de WIDE", mf, fullDataDe, UPRV_LENGTHOF(fullDataDe));
-    mf = MeasureFormat(de, UMEASFMT_WIDTH_NUMERIC, (NumberFormat *) nf->clone(), status);
+    mf = MeasureFormat(de, UMEASFMT_WIDTH_NUMERIC, nf->clone(), status);
     if (!assertSuccess("Error creating measure format de NUMERIC", status)) {
         return;
     }
@@ -1930,7 +1930,7 @@ void MeasureFormatTest::TestFormatPeriodEn() {
         return;
     }
     nf->setMaximumFractionDigits(4);
-    mf = MeasureFormat(bengali, UMEASFMT_WIDTH_NUMERIC, (NumberFormat *) nf->clone(), status);
+    mf = MeasureFormat(bengali, UMEASFMT_WIDTH_NUMERIC, nf->clone(), status);
     if (!assertSuccess("Error creating measure format bn NUMERIC", status)) {
         return;
     }
@@ -1942,7 +1942,7 @@ void MeasureFormatTest::TestFormatPeriodEn() {
         return;
     }
     nf->setMaximumFractionDigits(4);
-    mf = MeasureFormat(bengaliLatin, UMEASFMT_WIDTH_NUMERIC, (NumberFormat *) nf->clone(), status);
+    mf = MeasureFormat(bengaliLatin, UMEASFMT_WIDTH_NUMERIC, nf->clone(), status);
     if (!assertSuccess("Error creating measure format bn-u-nu-latn NUMERIC", status)) {
         return;
     }
@@ -2248,7 +2248,7 @@ void MeasureFormatTest::helperTestSimplePer(
     if (!assertSuccess("Error creating format object", status)) {
         return;
     }
-    Measure measure(value, (MeasureUnit *) unit.clone(), status);
+    Measure measure(value, unit.clone(), status);
     if (!assertSuccess("Error creating measure object", status)) {
         return;
     }
index 4729d009fe7f208c21d792da8a9fe90ddb75e245..e5b69e44a09da6cbbe266ba63759bffea2ee6ae0 100644 (file)
@@ -274,7 +274,7 @@ public:
     virtual NumberFormat* createFormat(const Locale& /* loc */, UNumberFormatStyle formatType)
     {
         if (formatType == UNUM_CURRENCY) {
-            return (NumberFormat*)currencyStyle->clone();
+            return currencyStyle->clone();
         }
         return NULL;
     }
index 9bb4efaabe067a4203445a2a95f63b3ec21b3275..3d0f64c9fc3b63273851c8fe72d44e96349cfc69 100644 (file)
@@ -321,7 +321,7 @@ public:
         static char classID = 0;
         return (UClassID)&classID;
     }
-    virtual Format* clone() const {return NULL;}
+    virtual StubNumberFormat* clone() const {return NULL;}
 };
 
 void
@@ -2224,7 +2224,7 @@ void NumberFormatTest::TestCurrencyUnit(void){
         errln("CurrencyUnit copy constructed object should be same");
     }
 
-    CurrencyUnit * cu3 = (CurrencyUnit *)cu.clone();
+    CurrencyUnit * cu3 = cu.clone();
     if (!(*cu3 == cu)){
         errln("CurrencyUnit cloned object should be same");
     }
@@ -2292,7 +2292,7 @@ void NumberFormatTest::TestCurrencyAmount(void){
         errln("CurrencyAmount assigned object should be same");
     }
 
-    CurrencyAmount *ca3 = (CurrencyAmount *)ca.clone();
+    CurrencyAmount *ca3 = ca.clone();
     if (!(*ca3 == ca)){
         errln("CurrencyAmount cloned object should be same");
     }
@@ -3183,7 +3183,7 @@ void NumberFormatTest::TestCurrencyFormat()
         dataerrln("FAIL: Status %s", u_errorName(status));
         return;
     }
-    cloneObj = (MeasureFormat *)measureObj->clone();
+    cloneObj = measureObj->clone();
     if (cloneObj == NULL) {
         errln("Clone doesn't work");
         return;
@@ -3493,7 +3493,7 @@ void NumberFormatTest::TestNumberingSystems() {
             continue;
         }
         // Clone to test ticket #10682
-        NumberFormat *fmt = (NumberFormat *) origFmt->clone();
+        NumberFormat *fmt = origFmt->clone();
         delete origFmt;
 
 
@@ -8088,7 +8088,7 @@ void NumberFormatTest::TestEquality() {
        return;
     }
 
-    DecimalFormat* fmtClone = (DecimalFormat*)fmtBase.clone();
+    DecimalFormat* fmtClone = fmtBase.clone();
     fmtClone->setFormatWidth(fmtBase.getFormatWidth() + 32);
     if (*fmtClone == fmtBase) {
         errln("Error: DecimalFormat == does not distinguish objects that differ only in FormatWidth");
index 893a639f738f774502f050164aa8f7d86a11300f..7bdb5f86ea87e10f416fcef19620aba3f4c0f6c7 100644 (file)
@@ -78,7 +78,7 @@ public:
     {
         NumberFormat::parse(text, result, status);
     }
-    virtual Format* clone() const 
+    virtual MyNumberFormatTest* clone() const 
     { return NULL; }
 
     virtual UnicodeString& format(int32_t, 
index f431a9353a387f4ccf63f607b6f7fdcfd599052c..30ecb408f03756768149bf31be3bab0a00e3db0a 100644 (file)
@@ -124,7 +124,7 @@ void PluralFormatTest::pluralFormatBasicTest(/*char *par*/)
     }
 
     if ( U_SUCCESS(status[1]) ) {
-        plFmt[2] = (PluralFormat*) plFmt[1]->clone();
+        plFmt[2] = plFmt[1]->clone();
 
         if (plFmt[1]!=NULL) {
             if ( *plFmt[1] != *plFmt[2] ) {
index fd1fe3df6382eff0029520b08838b50009d36e69..ecc10e8ea65b1138c18884d7218fdf24553449eb 100644 (file)
@@ -132,8 +132,8 @@ void RBBIAPITest::TestCloneEquals()
 
 
     logln((UnicodeString)"Testing clone()");
-    RuleBasedBreakIterator* bi1clone = dynamic_cast<RuleBasedBreakIterator *>(bi1->clone());
-    RuleBasedBreakIterator* bi2clone = dynamic_cast<RuleBasedBreakIterator *>(bi2->clone());
+    RuleBasedBreakIterator* bi1clone = bi1->clone();
+    RuleBasedBreakIterator* bi2clone = bi2->clone();
 
     if(*bi1clone != *bi1 || *bi1clone  != *biequal  ||
       *bi1clone == *bi3 || *bi1clone == *bi2)
@@ -203,7 +203,7 @@ void RBBIAPITest::TestgetRules()
     UnicodeString text(u"Hello there");
     bi1->setText(text);
 
-    LocalPointer <RuleBasedBreakIterator> bi3((RuleBasedBreakIterator*)bi1->clone());
+    LocalPointer <RuleBasedBreakIterator> bi3(bi1->clone());
 
     UnicodeString temp=bi1->getRules();
     UnicodeString temp2=bi2->getRules();
@@ -238,8 +238,8 @@ void RBBIAPITest::TestHashCode()
     bi2->setText((UnicodeString)"Hash code");
     bi3->setText((UnicodeString)"Hash code");
 
-    RuleBasedBreakIterator* bi1clone= (RuleBasedBreakIterator*)bi1->clone();
-    RuleBasedBreakIterator* bi2clone= (RuleBasedBreakIterator*)bi2->clone();
+    RuleBasedBreakIterator* bi1clone= bi1->clone();
+    RuleBasedBreakIterator* bi2clone= bi2->clone();
 
     if(bi1->hashCode() != bi1clone->hashCode() ||  bi1->hashCode() != bi3->hashCode() ||
         bi1clone->hashCode() != bi3->hashCode() || bi2->hashCode() != bi2clone->hashCode())
@@ -300,7 +300,7 @@ void RBBIAPITest::TestGetSetAdoptText()
     TEST_ASSERT(tstr == str1);
 
 
-    LocalPointer<RuleBasedBreakIterator> rb((RuleBasedBreakIterator*)wordIter1->clone());
+    LocalPointer<RuleBasedBreakIterator> rb(wordIter1->clone());
     rb->adoptText(text1);
     if(rb->getText() != *text1)
         errln((UnicodeString)"ERROR:1 error in adoptText ");
index 61e4aa8af90ba2b51b43addaa6a7f4df9e704256..8f063d0e416a3c49a68793da55d7e34e7ceb6129 100644 (file)
@@ -4432,11 +4432,11 @@ void RBBITest::TestBug12519() {
     assertTrue(WHERE, Locale::getFrench() == biFr->getLocale(ULOC_VALID_LOCALE, status));
     assertTrue(WHERE "Locales do not participate in BreakIterator equality.", *biEn == *biFr);
 
-    LocalPointer<RuleBasedBreakIterator>cloneEn((RuleBasedBreakIterator *)biEn->clone());
+    LocalPointer<RuleBasedBreakIterator>cloneEn(biEn->clone());
     assertTrue(WHERE, *biEn == *cloneEn);
     assertTrue(WHERE, Locale::getEnglish() == cloneEn->getLocale(ULOC_VALID_LOCALE, status));
 
-    LocalPointer<RuleBasedBreakIterator>cloneFr((RuleBasedBreakIterator *)biFr->clone());
+    LocalPointer<RuleBasedBreakIterator>cloneFr(biFr->clone());
     assertTrue(WHERE, *biFr == *cloneFr);
     assertTrue(WHERE, Locale::getFrench() == cloneFr->getLocale(ULOC_VALID_LOCALE, status));
 
index 766a72ec30054a23bfc1140e7861a2bd10644809..67c95a6a8c2342a1d0db5ca5ceecce3fdbeb9568 100644 (file)
@@ -142,7 +142,7 @@ void CollationRegressionTest::Test4054238(/* char* par */)
 {
     const UChar chars3[] = {0x61, 0x00FC, 0x62, 0x65, 0x63, 0x6b, 0x20, 0x47, 0x72, 0x00F6, 0x00DF, 0x65, 0x20, 0x4c, 0x00FC, 0x62, 0x63, 0x6b, 0};
     const UnicodeString test3(chars3);
-    RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone();
+    RuleBasedCollator *c = en_us->clone();
 
     // NOTE: The Java code uses en_us to create the CollationElementIterators
     // but I'm pretty sure that's wrong, so I've changed this to use c.
@@ -184,7 +184,7 @@ void CollationRegressionTest::Test4054734(/* char* par */)
 
 
     UErrorCode status = U_ZERO_ERROR;
-    RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone();
+    RuleBasedCollator *c = en_us->clone();
 
     c->setStrength(Collator::IDENTICAL);
 
@@ -201,7 +201,7 @@ void CollationRegressionTest::Test4054734(/* char* par */)
 void CollationRegressionTest::Test4054736(/* char* par */)
 {
     UErrorCode status = U_ZERO_ERROR;
-    RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone();
+    RuleBasedCollator *c = en_us->clone();
 
     c->setStrength(Collator::SECONDARY);
     c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
@@ -425,11 +425,11 @@ void CollationRegressionTest::Test4066189(/* char* par */)
     // NOTE: The java code used en_us to create the
     // CollationElementIterator's. I'm pretty sure that
     // was wrong, so I've change the code to use c1 and c2
-    RuleBasedCollator *c1 = (RuleBasedCollator *) en_us->clone();
+    RuleBasedCollator *c1 = en_us->clone();
     c1->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
     CollationElementIterator *i1 = c1->createCollationElementIterator(test1);
 
-    RuleBasedCollator *c2 = (RuleBasedCollator *) en_us->clone();
+    RuleBasedCollator *c2 = en_us->clone();
     c2->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_OFF, status);
     CollationElementIterator *i2 = c2->createCollationElementIterator(test2);
 
@@ -495,7 +495,7 @@ void CollationRegressionTest::Test4076676(/* char* par */)
     static const UChar s1[] = {0x41, 0x0301, 0x0302, 0x0300, 0};
     static const UChar s2[] = {0x41, 0x0302, 0x0300, 0x0301, 0};
 
-    RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone();
+    RuleBasedCollator *c = en_us->clone();
     c->setStrength(Collator::TERTIARY);
 
     if (c->compare(s1,s2) == 0)
@@ -573,7 +573,7 @@ void CollationRegressionTest::Test4081866(/* char* par */)
     static const UChar s2[] = {0x41, 0x0327, 0x0316, 0x0315, 0x0300, 0};
 
     UErrorCode status = U_ZERO_ERROR;
-    RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone();
+    RuleBasedCollator *c = en_us->clone();
     c->setStrength(Collator::TERTIARY);
 
     // Now that the default collators are set to NO_DECOMPOSITION
@@ -628,7 +628,7 @@ void CollationRegressionTest::Test4087241(/* char* par */)
 //
 void CollationRegressionTest::Test4087243(/* char* par */)
 {
-    RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone();
+    RuleBasedCollator *c = en_us->clone();
     c->setStrength(Collator::TERTIARY);
 
     static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] =
@@ -738,7 +738,7 @@ void CollationRegressionTest::Test4101940(/* char* par */)
 //
 void CollationRegressionTest::Test4103436(/* char* par */)
 {
-    RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone();
+    RuleBasedCollator *c = en_us->clone();
     c->setStrength(Collator::TERTIARY);
 
     static const UChar tests[][CollationRegressionTest::MAX_TOKEN_LEN] =
@@ -759,7 +759,7 @@ void CollationRegressionTest::Test4103436(/* char* par */)
 void CollationRegressionTest::Test4114076(/* char* par */)
 {
     UErrorCode status = U_ZERO_ERROR;
-    RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone();
+    RuleBasedCollator *c = en_us->clone();
     c->setStrength(Collator::TERTIARY);
 
     //
@@ -884,7 +884,7 @@ void CollationRegressionTest::Test4114077(/* char* par */)
     // as we do with it on....
 
     UErrorCode status = U_ZERO_ERROR;
-    RuleBasedCollator *c = (RuleBasedCollator *) en_us->clone();
+    RuleBasedCollator *c = en_us->clone();
     c->setStrength(Collator::TERTIARY);
 
     static const UChar test1[][CollationRegressionTest::MAX_TOKEN_LEN] =
@@ -1253,7 +1253,7 @@ void CollationRegressionTest::TestT7189() {
 }
 
 void CollationRegressionTest::TestCaseFirstCompression() {
-    RuleBasedCollator *col = (RuleBasedCollator *) en_us->clone();
+    RuleBasedCollator *col = en_us->clone();
     UErrorCode status = U_ZERO_ERROR;
 
     // default
index b52f0acd7d4991e2f7a245bb6ed5a8e2d41eb85e..79430a38e7c3eca51302226f573eb2c4a603a993 100644 (file)
@@ -988,7 +988,7 @@ void RelativeDateTimeFormatterTest::TestCustomNumberFormat() {
                     "Failure creating format object - %s", u_errorName(status));
             return;
         }
-        nf = (NumberFormat *) fmt.getNumberFormat().clone();
+        nf = fmt.getNumberFormat().clone();
     }
     nf->setMinimumFractionDigits(1);
     nf->setMaximumFractionDigits(1);
index 35a3f5dcf5e40b6a32a425a55ebbd70153f316a1..bf4a72243183bd473605ed9cbcc36fd6b1159d4f 100644 (file)
@@ -71,7 +71,7 @@ public:
         this->styles = s;
     }
 
-    virtual Replaceable *clone() const {
+    virtual TestReplaceable *clone() const {
         return new TestReplaceable(chars, styles);
     }
 
@@ -289,7 +289,7 @@ void ReplaceableTest::check(const UnicodeString& transliteratorName,
                                             pe, status);
 
         // test clone()
-        TestReplaceable *tr2 = (TestReplaceable *)tr->clone();
+        TestReplaceable *tr2 = tr->clone();
         if(tr2 != NULL) {
             delete tr;
             tr = tr2;
index 8f2ca4eabfadb0dc91c8ec002960347afadb71b0..3bf1be60bd1637c807469b59d1af5daa50f85138 100644 (file)
@@ -235,7 +235,7 @@ void SelectFormatTest::selectFormatAPITest(/*char *par*/)
     // ======= Test clone && == operator.
     logln("SelectFormat API test: Testing clone and == operator ...");
     if ( U_SUCCESS(status[0])  ) {
-        selFmt[1] = (SelectFormat*)selFmt[0]->clone();
+        selFmt[1] = selFmt[0]->clone();
         if (selFmt[1]!=NULL) {
             if ( *selFmt[1] != *selFmt[0] ) {
                 errln("ERROR: SelectFormat API test clone test failed!");
index 1eb728e4d22c868f8e09e5622825ba026bfe9513..573158a3cd875896bf426fb64782aca72bbf6a2c 100644 (file)
@@ -769,7 +769,7 @@ void StringSearchTest::TestInitialization()
     }
     delete copy;
 
-    copy = (StringSearch *)result->safeClone();
+    copy = result->safeClone();
     if (*(copy->getCollator()) != *(result->getCollator()) ||
         copy->getBreakIterator() != result->getBreakIterator() ||
         copy->getMatchedLength() != result->getMatchedLength() ||
index 942119e70622dbad01c2f723a1a23ad760d5669d..89526b92461fdbada2e85975a4f3d1a24454e570 100644 (file)
@@ -311,7 +311,7 @@ TestChoiceFormat::TestComplexExample( void )
             it_errln("***  operator!=");
         }
 
-        ChoiceFormat* form_A3 = (ChoiceFormat*) form_A->clone();
+        ChoiceFormat* form_A3 = form_A->clone();
         if (!form_A3) {
             it_errln("***  ChoiceFormat->clone is nil.");
         }else{
index 731bf7675024097c7d8a18ab30c6174c22f8d161..335bcf07cad127096219be7f99bebb0289102f0b 100644 (file)
@@ -921,7 +921,7 @@ void TestMessageFormat::testClone()
     MessageFormat *x = new MessageFormat("There are {0} files on {1}", success);
     MessageFormat *z = new MessageFormat("There are {0} files on {1} created", success);
     MessageFormat *y = 0;
-    y = (MessageFormat*)x->clone();
+    y = x->clone();
     if ( (*x == *y) && 
          (*x != *z) && 
          (*y != *z) )
@@ -1433,8 +1433,8 @@ static void _testCopyConstructor2()
         goto cleanup;
     }
 
-    fmt3 = (MessageFormat*) fmt1->clone();
-    fmt4 = (MessageFormat*) fmt2->clone();
+    fmt3 = fmt1->clone();
+    fmt4 = fmt2->clone();
 
     if (fmt3 == NULL) {
         it_err("testCopyConstructor2: (fmt3 != NULL)");
index f80293849516558ffc7b0d4db071a96f9b469b68..4b59ecfde49231ec281599ee5e60a82e5a6e43e7 100644 (file)
@@ -712,7 +712,7 @@ int gTestFilter3ClassID = 0;
  */
 class TestFilter1 : public UnicodeFilter {
     UClassID getDynamicClassID()const { return &gTestFilter1ClassID; }
-    virtual UnicodeFunctor* clone() const {
+    virtual TestFilter1* clone() const {
         return new TestFilter1(*this);
     }
     virtual UBool contains(UChar32 c) const {
@@ -733,7 +733,7 @@ class TestFilter1 : public UnicodeFilter {
 };
 class TestFilter2 : public UnicodeFilter {
     UClassID getDynamicClassID()const { return &gTestFilter2ClassID; }
-    virtual UnicodeFunctor* clone() const {
+    virtual TestFilter2* clone() const {
         return new TestFilter2(*this);
     }
     virtual UBool contains(UChar32 c) const {
@@ -754,7 +754,7 @@ class TestFilter2 : public UnicodeFilter {
 };
 class TestFilter3 : public UnicodeFilter {
     UClassID getDynamicClassID()const { return &gTestFilter3ClassID; }
-    virtual UnicodeFunctor* clone() const {
+    virtual TestFilter3* clone() const {
         return new TestFilter3(*this);
     }
     virtual UBool contains(UChar32 c) const {
index 303f8116f592a96f1f46ccb5fa10bc1cd283872d..965fca88ebbfd3ba6776bc47bc9fe7249275e411 100644 (file)
@@ -657,7 +657,7 @@ int gTestFilterClassID = 0;
  * Used by TestFiltering().
  */
 class TestFilter : public UnicodeFilter {
-    virtual UnicodeFunctor* clone() const {
+    virtual TestFilter* clone() const {
         return new TestFilter(*this);
     }
     virtual UBool contains(UChar32 c) const {
index 56df7cac445c22a04b20f27798939828a912632c..b3f4185ab50f9bd13632a30b5c34851eb6acc0c5 100644 (file)
@@ -1369,7 +1369,7 @@ initExpectedSkippables(UnicodeSet skipSets[UNORM_MODE_COUNT], UErrorCode &errorC
     // We need not look at control codes, Han characters nor Hangul LVT syllables because they
     // do not combine forward. LV syllables are already removed.
     UnicodeSet notInteresting("[[:C:][:Unified_Ideograph:][:HST=LVT:]]", errorCode);
-    LocalPointer<UnicodeSet> unsure(&((UnicodeSet *)(skipSets[UNORM_NFC].clone()))->removeAll(notInteresting));
+    LocalPointer<UnicodeSet> unsure(&(skipSets[UNORM_NFC].clone())->removeAll(notInteresting));
     // System.out.format("unsure.size()=%d\n", unsure.size());
 
     // For each character about which we are unsure, see if it changes when we add
index ed7ac760b9f6d17a664d580f8d4d07001bbd6fea..3a0d7b65f878ce723866937d4daed60480bd287c 100644 (file)
@@ -171,7 +171,7 @@ void TimeUnitTest::testAPI() {
     TimeUnit* tmunit = TimeUnit::createInstance(TimeUnit::UTIMEUNIT_YEAR, status);
     if (!assertSuccess("TimeUnit::createInstance", status)) return;
 
-    TimeUnit* another = (TimeUnit*)tmunit->clone();
+    TimeUnit* another = tmunit->clone();
     TimeUnit third(*tmunit);
     TimeUnit fourth = third;
 
@@ -239,7 +239,7 @@ void TimeUnitTest::testAPI() {
 
     TimeUnitAmount second(tma);
     TimeUnitAmount third_tma = tma;
-    TimeUnitAmount* fourth_tma = (TimeUnitAmount*)tma.clone();
+    TimeUnitAmount* fourth_tma = tma.clone();
 
     assertTrue("orig and copy are equal", (second == tma));
     assertTrue("clone and assigned are equal", (third_tma == *fourth_tma));
@@ -266,7 +266,7 @@ void TimeUnitTest::testAPI() {
     TimeUnitFormat tmf_copy(tmf_fr);
     assertTrue("TimeUnitFormat: orig and copy are equal", (tmf_fr == tmf_copy));
 
-    TimeUnitFormat* tmf_clone = (TimeUnitFormat*)tmf_en->clone();
+    TimeUnitFormat* tmf_clone = tmf_en->clone();
     assertTrue("TimeUnitFormat: orig and clone are equal", (*tmf_en == *tmf_clone));
     delete tmf_clone;
 
index e13edaba460f794fd2e940ae7a241b109ed6ae40..5268254ba931dc945d135cfc170f2a918fbbe9cb 100644 (file)
@@ -352,7 +352,7 @@ UBool
 TimeZoneRegressionTest::checkCalendar314(GregorianCalendar *testCal, TimeZone *testTZ) 
 {
     UErrorCode status = U_ZERO_ERROR;
-    // GregorianCalendar testCal = (GregorianCalendar)aCal.clone(); 
+    // GregorianCalendar testCal = aCal.clone(); 
 
     int32_t tzOffset, tzRawOffset; 
     float tzOffsetFloat,tzRawOffsetFloat; 
index cc699bb45c47086880eda18d9b5954393ee0b082..dc644329e9424aeb075cafe36f7c1cd9cd079383 100644 (file)
@@ -266,7 +266,7 @@ TimeZoneRuleTest::TestSimpleRuleBasedTimeZone(void) {
     if (rbtz1->hasSameRules(*rbtz3)) {
         errln("FAIL: rbtz1 and rbtz3 have different rules, but returned true.");
     }
-    RuleBasedTimeZone *rbtz1c = (RuleBasedTimeZone*)rbtz1->clone();
+    RuleBasedTimeZone *rbtz1c = rbtz1->clone();
     if (!rbtz1->hasSameRules(*rbtz1c)) {
         errln("FAIL: Cloned RuleBasedTimeZone must have the same rules with the original.");
     }
@@ -548,7 +548,7 @@ TimeZoneRuleTest::TestHistoricalRuleBasedTimeZone(void) {
     if (ny->hasSameRules(*rbtz) || rbtz->hasSameRules(*ny)) {
         errln("FAIL: hasSameRules must return false");
     }
-    RuleBasedTimeZone *rbtzc = (RuleBasedTimeZone*)rbtz->clone();
+    RuleBasedTimeZone *rbtzc = rbtz->clone();
     if (!rbtz->hasSameRules(*rbtzc) || !rbtz->hasEquivalentTransitions(*rbtzc, jan1_1950, jan1_2010, TRUE, status)) {
         errln("FAIL: hasSameRules/hasEquivalentTransitions must return true for cloned RBTZs");
     }
@@ -742,7 +742,7 @@ TimeZoneRuleTest::TestHasEquivalentTransitions(void) {
     }
 
     // Cloned TimeZone
-    BasicTimeZone *newyork2 = (BasicTimeZone*)newyork->clone();
+    BasicTimeZone *newyork2 = newyork->clone();
     if (!newyork->hasEquivalentTransitions(*newyork2, jan1_1971, jan1_2011, FALSE, status)) {
         errln("FAIL: Cloned TimeZone must have the same transitions");
     }
@@ -1695,7 +1695,7 @@ TimeZoneRuleTest::TestVTimeZoneCoverage(void) {
 
     // setRawOffset
     const int32_t RAW = -10*HOUR;
-    VTimeZone *tmpvtz = (VTimeZone*)vtz->clone();
+    VTimeZone *tmpvtz = vtz->clone();
     tmpvtz->setRawOffset(RAW);
     if (tmpvtz->getRawOffset() != RAW) {
         logln("setRawOffset is implemented in VTimeZone");
index 91806095ad829271dc4357e4e4939561768f2deb..b8dbae76d4d10f50773477cf6fc4733ac329b98b 100644 (file)
@@ -364,8 +364,8 @@ UnicodeSetTest::TestCloneEqualHash(void) {
     }
 
     logln("Testing clone()");
-    UnicodeSet *set1clone=(UnicodeSet*)set1->clone();
-    UnicodeSet *set2clone=(UnicodeSet*)set2->clone();
+    UnicodeSet *set1clone=set1->clone();
+    UnicodeSet *set2clone=set2->clone();
     if(*set1clone != *set1 || *set1clone != *set1copy || *set1clone != set1equal || 
         *set2clone != *set2 || *set2clone == *set1copy || *set2clone != set2equal || 
         *set2clone == *set1 || *set2clone == set1equal || *set2clone == *set1clone){
@@ -2255,7 +2255,7 @@ void UnicodeSetTest::TestFreezable() {
         errln("FAIL: copying a frozen set results in a thawed one");
     }
 
-    UnicodeSet *cloned=(UnicodeSet *)frozen.clone();
+    UnicodeSet *cloned=frozen.clone();
     if(!cloned->isFrozen() || *cloned!=frozen || cloned->containsSome(0xd802, 0xd805)) {
         errln("FAIL: clone() failed");
     }
@@ -2265,7 +2265,7 @@ void UnicodeSetTest::TestFreezable() {
     }
     delete cloned;
 
-    UnicodeSet *thawed=(UnicodeSet *)frozen.cloneAsThawed();
+    UnicodeSet *thawed=frozen.cloneAsThawed();
     if(thawed->isFrozen() || *thawed!=frozen || thawed->containsSome(0xd802, 0xd805)) {
         errln("FAIL: cloneAsThawed() failed");
     }
@@ -3692,11 +3692,11 @@ void UnicodeSetTest::TestSpan() {
             // Intermediate set: Test cloning of a frozen set.
             UnicodeSet *fast=new UnicodeSet(*sets[SLOW]);
             fast->freeze();
-            sets[FAST]=(UnicodeSet *)fast->clone();
+            sets[FAST]=fast->clone();
             delete fast;
             UnicodeSet *fastNot=new UnicodeSet(*sets[SLOW_NOT]);
             fastNot->freeze();
-            sets[FAST_NOT]=(UnicodeSet *)fastNot->clone();
+            sets[FAST_NOT]=fastNot->clone();
             delete fastNot;
 
             for(j=0; j<SET_COUNT; ++j) {
index c31a4650a3e74fa45218c9be80d6c1b54f3a143a..b6515ea813cf8f480f09005f7ec26d75792e3ced 100644 (file)
@@ -77,7 +77,7 @@ UnicodeStringTest::TestBasicManipulation()
     UnicodeString   expectedValue;
     UnicodeString   *c;
 
-    c=(UnicodeString *)test1.clone();
+    c=test1.clone();
     test1.insert(24, "good ");
     expectedValue = "Now is the time for all good men to come swiftly to the aid of the party.\n";
     if (test1 != expectedValue)
@@ -1254,7 +1254,7 @@ UnicodeStringTest::TestStackAllocation()
         errln("UnicodeString.setTo(readonly alias) does not alias correctly");
     }
 
-    UnicodeString *c=(UnicodeString *)test->clone();
+    UnicodeString *c=test->clone();
 
     workingBuffer[1] = 0x109;
     if(test->charAt(1) != 0x109) {