]> granicus.if.org Git - icu/commitdiff
ICU-12614 DateFormatSymbols resource bundle data loading updated to use the ResourceS...
authorFelipe Balbontín <fabalbon@google.com>
Fri, 8 Jul 2016 22:19:26 +0000 (22:19 +0000)
committerFelipe Balbontín <fabalbon@google.com>
Fri, 8 Jul 2016 22:19:26 +0000 (22:19 +0000)
X-SVN-Rev: 38962

icu4c/source/i18n/dtfmtsym.cpp

index d774a130b37c86da4762257d7e5d8bfb96088d0a..2e5ea99797bf93cfeb8a69938d49e4f2e6f196a1 100644 (file)
@@ -2107,10 +2107,10 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
     // Iterate over the resource bundle data following the fallbacks through different calendar types
     UnicodeString calendarType((type != NULL && *type != '\0')? type : gGregorianTag, -1, US_INV);
     while (!calendarType.isBogus()) {
-        int32_t calendarTypeSize = calendarType.length();
-        char calendarTypeCArray[calendarTypeSize + 1];
-        calendarType.extract(0, calendarTypeSize, calendarTypeCArray, calendarTypeSize, US_INV);
-        calendarTypeCArray[calendarTypeSize] = '\0';
+        CharString calendarTypeBuffer;
+        calendarTypeBuffer.appendInvariantChars(calendarType, status);
+        if (U_FAILURE(status)) { return; }
+        const char *calendarTypeCArray = calendarTypeBuffer.data();
 
         // Enumerate this calendar type. If the calendar is not found fallback to gregorian
         UErrorCode oldStatus = status;