fCalendar = NULL;
}
if(other.fNumberFormat) {
- fNumberFormat = (NumberFormat*)other.fNumberFormat->clone();
+ fNumberFormat = other.fNumberFormat->clone();
} else {
fNumberFormat = NULL;
}
status = U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
- DateFormat *result = createInstanceForSkeleton(skeleton, locale, status);
+ Locale localeWithCalendar = locale;
+ localeWithCalendar.setKeywordValue("calendar", calendar->getType(), status);
+ if (U_FAILURE(status)) {
+ return NULL;
+ }
+ DateFormat *result = createInstanceForSkeleton(skeleton, localeWithCalendar, status);
if (U_FAILURE(status)) {
return NULL;
}
void
DateFormat::setNumberFormat(const NumberFormat& newNumberFormat)
{
- NumberFormat* newNumFmtClone = (NumberFormat*)newNumberFormat.clone();
+ NumberFormat* newNumFmtClone = newNumberFormat.clone();
if (newNumFmtClone != NULL) {
adoptNumberFormat(newNumFmtClone);
}