]> granicus.if.org Git - icu/commitdiff
ICU-21579 Fix warnings in number formatting code release-70-1
authorShane F. Carr <shane@unicode.org>
Wed, 27 Oct 2021 22:02:46 +0000 (15:02 -0700)
committerShane F. Carr <shane@unicode.org>
Thu, 28 Oct 2021 00:19:31 +0000 (17:19 -0700)
icu4c/source/i18n/formattedvalue.cpp
icu4c/source/i18n/number_skeletons.cpp

index 05a40aea2989a24d814a832d6b1c0bf7a68f9f7b..1030661f2200fac4a7ae7d92bbb3a67a9b583712 100644 (file)
@@ -209,6 +209,8 @@ ufmtval_getString(
     if (pLength != nullptr) {
         *pLength = readOnlyAlias.length();
     }
+    // Note: this line triggers -Wreturn-local-addr, but it is safe because toTempString is
+    // defined to return memory owned by the ufmtval argument.
     return readOnlyAlias.getBuffer();
 }
 
index ba9eee6b5d023e4d61586d6f1bdfa71f16e53828..de70c5cedff3ca185579e49d3c3a02830e937d74 100644 (file)
@@ -1358,7 +1358,9 @@ bool blueprint_helpers::parseFracSigOption(const StringSegment& segment, MacroPr
             priority = UNUM_ROUNDING_PRIORITY_STRICT;
             offset++;
         } else {
-            U_ASSERT(offset < segment.length());
+            // Invalid digits option for fraction rounder
+            status = U_NUMBER_SKELETON_SYNTAX_ERROR;
+            return false;
         }
         if (offset < segment.length()) {
             // Invalid digits option for fraction rounder