Skip to content

Commit

Permalink
ICU-21579 Fix warnings in number formatting code
Browse files Browse the repository at this point in the history
  • Loading branch information
sffc committed Oct 28, 2021
1 parent a061dfe commit a56dde8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions icu4c/source/i18n/formattedvalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
4 changes: 3 additions & 1 deletion icu4c/source/i18n/number_skeletons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a56dde8

Please sign in to comment.