summaryrefslogtreecommitdiffstats
path: root/intl/icu-patches/bug-1636984-alias-append-items-sink.diff
blob: 61d6a36cb95b8625b127e3d5874827f7e002fa91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Handle "alias" entries in DateTimePatternGenerator::AppendItemNamesSink.
#
# ICU bug: https://unicode-org.atlassian.net/browse/ICU-20992

diff --git a/intl/icu/source/i18n/dtptngen.cpp b/intl/icu/source/i18n/dtptngen.cpp
--- a/intl/icu/source/i18n/dtptngen.cpp
+++ b/intl/icu/source/i18n/dtptngen.cpp
@@ -956,16 +956,25 @@ struct DateTimePatternGenerator::AppendI
     virtual void put(const char *key, ResourceValue &value, UBool /*noFallback*/,
             UErrorCode &errorCode) {
         ResourceTable itemsTable = value.getTable(errorCode);
         if (U_FAILURE(errorCode)) { return; }
         for (int32_t i = 0; itemsTable.getKeyAndValue(i, key, value); ++i) {
             UDateTimePGDisplayWidth width;
             UDateTimePatternField field = dtpg.getFieldAndWidthIndices(key, &width);
             if (field == UDATPG_FIELD_COUNT) { continue; }
+
+            UResType type = value.getType();
+            U_ASSERT(type == URES_TABLE || type == URES_ALIAS);
+
+            // TODO: Implement support for alias types.
+            if (type == URES_ALIAS) {
+                continue;
+            }
+
             ResourceTable detailsTable = value.getTable(errorCode);
             if (U_FAILURE(errorCode)) { return; }
             for (int32_t j = 0; detailsTable.getKeyAndValue(j, key, value); ++j) {
                 if (uprv_strcmp(key, "dn") != 0) { continue; }
                 const UnicodeString& valueStr = value.getUnicodeString(errorCode);
                 if (dtpg.getFieldDisplayName(field,width).isEmpty() && !valueStr.isEmpty()) {
                     dtpg.setFieldDisplayName(field,width,valueStr);
                 }