X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/374ca955a76ecab1204ca8bfa63ff9238d998416..efa1e6592fb03ce23b15276b2b91d885a3ee7da5:/icuSources/samples/numfmt/main.cpp?ds=inline diff --git a/icuSources/samples/numfmt/main.cpp b/icuSources/samples/numfmt/main.cpp index 1ebd4948..5adffe36 100644 --- a/icuSources/samples/numfmt/main.cpp +++ b/icuSources/samples/numfmt/main.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1999-2004, International Business Machines Corporation and + * Copyright (c) 1999-2010, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ @@ -113,7 +113,8 @@ setNumberFormatCurrency_2_4(NumberFormat &nf, const char *currency, UErrorCode & // check that the formatter is a DecimalFormat instance // necessary because we will cast to the DecimalFormat subclass to set // the currency symbol - if(nf.getDynamicClassID()!=DecimalFormat::getStaticClassID()) { + DecimalFormat *dnf=dynamic_cast(&nf); + if(dnf==NULL) { errorCode=U_ILLEGAL_ARGUMENT_ERROR; return; } @@ -168,12 +169,11 @@ setNumberFormatCurrency_2_4(NumberFormat &nf, const char *currency, UErrorCode & nf.setMinimumFractionDigits(currencyMap[i].fractionDigits); nf.setMaximumFractionDigits(currencyMap[i].fractionDigits); - DecimalFormat &dnf=(DecimalFormat &)nf; - dnf.setRoundingIncrement(currencyMap[i].roundingIncrement); + dnf->setRoundingIncrement(currencyMap[i].roundingIncrement); - DecimalFormatSymbols symbols(*dnf.getDecimalFormatSymbols()); + DecimalFormatSymbols symbols(*dnf->getDecimalFormatSymbols()); symbols.setSymbol(DecimalFormatSymbols::kCurrencySymbol, currencyMap[i].symbol); - dnf.setDecimalFormatSymbols(symbols); // do not adopt symbols: Jitterbug 2889 + dnf->setDecimalFormatSymbols(symbols); // do not adopt symbols: Jitterbug 2889 } /*