bug-2000225-ICU-23264-increase-measure-unit-capacity.diff (1150B)
1 # Increase measure unit capacity for ICU 78. 2 # 3 # ICU bug: https://unicode-org.atlassian.net/browse/ICU-23264 4 5 diff --git a/intl/icu/source/i18n/number_skeletons.cpp b/intl/icu/source/i18n/number_skeletons.cpp 6 --- a/intl/icu/source/i18n/number_skeletons.cpp 7 +++ b/intl/icu/source/i18n/number_skeletons.cpp 8 @@ -1067,18 +1067,17 @@ void blueprint_helpers::parseMeasureUnit 9 } 10 11 // Need to do char <-> char16_t conversion... 12 CharString type; 13 SKELETON_UCHAR_TO_CHAR(type, stemString, 0, firstHyphen, status); 14 CharString subType; 15 SKELETON_UCHAR_TO_CHAR(subType, stemString, firstHyphen + 1, stemString.length(), status); 16 17 - // Note: the largest type as of this writing (Aug 2020) is "volume", which has 33 units. 18 - static constexpr int32_t CAPACITY = 40; 19 + static constexpr int32_t CAPACITY = 50; 20 MeasureUnit units[CAPACITY]; 21 UErrorCode localStatus = U_ZERO_ERROR; 22 int32_t numUnits = MeasureUnit::getAvailable(type.data(), units, CAPACITY, localStatus); 23 if (U_FAILURE(localStatus)) { 24 // More than 30 units in this type? 25 status = U_INTERNAL_PROGRAM_ERROR; 26 return; 27 }