]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/datefmt.cpp
ICU-66108.tar.gz
[apple/icu.git] / icuSources / i18n / datefmt.cpp
index 7c4e1630f37868ea8367fd5c5eecab83eb91ba9b..09f90ef6c76ab24f2fa9546afd6515699f1ad07c 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;
         }
@@ -460,7 +460,12 @@ DateFormat::createInstanceForSkeleton(
         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;
     }
@@ -595,7 +600,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);
     }