ICU-13788 Minor coverity fixes for number code.

X-SVN-Rev: 41459
This commit is contained in:
Shane Carr 2018-05-25 03:01:38 +00:00
parent f7309c34cf
commit bf977d1acc
2 changed files with 6 additions and 4 deletions

View File

@ -98,7 +98,7 @@ static const char *gNumberElementKeys[DecimalFormatSymbols::kFormatSymbolCount]
// Initializes this with the decimal format symbols in the default locale.
DecimalFormatSymbols::DecimalFormatSymbols(UErrorCode& status)
: UObject(), locale() {
: UObject(), locale(), currPattern(NULL) {
initialize(locale, status, TRUE);
}
@ -106,12 +106,12 @@ DecimalFormatSymbols::DecimalFormatSymbols(UErrorCode& status)
// Initializes this with the decimal format symbols in the desired locale.
DecimalFormatSymbols::DecimalFormatSymbols(const Locale& loc, UErrorCode& status)
: UObject(), locale(loc) {
: UObject(), locale(loc), currPattern(NULL) {
initialize(locale, status);
}
DecimalFormatSymbols::DecimalFormatSymbols(const Locale& loc, const NumberingSystem& ns, UErrorCode& status)
: UObject(), locale(loc) {
: UObject(), locale(loc), currPattern(NULL) {
initialize(locale, status, FALSE, &ns);
}
@ -349,7 +349,6 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status,
{
if (U_FAILURE(status)) { return; }
*validLocale = *actualLocale = 0;
currPattern = NULL;
// First initialize all the symbols to the fallbacks for anything we can't find
initialize();
@ -477,6 +476,7 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status,
UErrorCode localStatus = U_ZERO_ERROR;
uccLen = ucurr_forLocale(locName, ucc, uccLen, &localStatus);
// TODO: Currency pattern data loading is duplicated in number_formatimpl.cpp
if(U_SUCCESS(localStatus) && uccLen > 0) {
char cc[4]={0};
u_UCharsToChars(ucc, cc, uccLen);

View File

@ -20,6 +20,8 @@ namespace impl {
// Exported as U_I18N_API for tests
class U_I18N_API MultiplierFormatHandler : public MicroPropsGenerator, public UMemory {
public:
MultiplierFormatHandler() = default; // WARNING: Leaves object in an unusable state; call setAndChain()
void setAndChain(const Scale& multiplier, const MicroPropsGenerator* parent);
void processQuantity(DecimalQuantity& quantity, MicroProps& micros,