From 74ed90561001c05b3e6ffb99e813615d3a87340f Mon Sep 17 00:00:00 2001 From: zhangdd_ewan Date: Sat, 26 Oct 2024 09:01:28 +0000 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20!860=20:?= =?UTF-8?q?=20=E3=80=905.0.1-release=E3=80=91DateTimeFomrat.formatRange()?= =?UTF-8?q?=E5=9C=A8zh-Hant-HK=E4=B8=8B=E6=A0=BC=E5=BC=8F=E5=8C=96?= =?UTF-8?q?=E9=97=AE=E9=A2=98'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frameworks/intl/src/date_time_format.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/intl/src/date_time_format.cpp b/frameworks/intl/src/date_time_format.cpp index 21b71399..68cc3373 100644 --- a/frameworks/intl/src/date_time_format.cpp +++ b/frameworks/intl/src/date_time_format.cpp @@ -60,7 +60,7 @@ DateTimeFormat::DateTimeFormat(const std::vector &localeTags, std:: for (size_t i = 0; i < localeTags.size(); i++) { std::string curLocale = localeTags[i]; locale = Locale::forLanguageTag(StringPiece(curLocale), status); - if (U_FAILURE(status)) { + if (status != U_ZERO_ERROR) { status = U_ZERO_ERROR; continue; } @@ -601,7 +601,7 @@ std::string DateTimeFormat::FormatRange(int64_t fromMilliseconds, int64_t toMill calendar->setTime((UDate)fromMilliseconds, status); auto toCalendar = std::unique_ptr(Calendar::createInstance(locale, status)); - if (U_FAILURE(status) || toCalendar == nullptr) { + if (status != U_ZERO_ERROR || toCalendar == nullptr) { return PseudoLocalizationProcessor(""); } toCalendar->clear(); @@ -652,7 +652,7 @@ void DateTimeFormat::GetResolvedOptions(std::map &map) } else { UErrorCode status = U_ZERO_ERROR; auto numSys = std::unique_ptr(NumberingSystem::createInstance(locale, status)); - if (U_SUCCESS(status)) { + if (status != U_ZERO_ERROR) { map.insert(std::make_pair("numberingSystem", numSys->getName())); } }