diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-21 12:31:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-21 14:58:51 +0200 |
commit | 29489b33b435683021b72cb2bce27aba8cb7a430 (patch) | |
tree | 8e4e1c59d56d5ed0d0ca4d088419067041e4553a /i18npool/source/calendar | |
parent | a4244c0f05b95ded277a3a7ed217bf0451daa996 (diff) |
loplugin:flatten
Change-Id: I3b4226a9d089ec9aedab95d96e50a068f57a76c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123991
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool/source/calendar')
-rw-r--r-- | i18npool/source/calendar/calendar_gregorian.cxx | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx index df998b3c6cf3..53fe9b1c70bd 100644 --- a/i18npool/source/calendar/calendar_gregorian.cxx +++ b/i18npool/source/calendar/calendar_gregorian.cxx @@ -452,18 +452,19 @@ void Calendar_gregorian::mapFromGregorian() // By using eraArray, it can take care Japanese and Taiwan ROC calendar. void Calendar_gregorian::mapToGregorian() { - if (eraArray && (fieldSet & FIELDS)) { - sal_Int16 e = fieldValue[CalendarFieldIndex::ERA]; - sal_Int32 y; - if (e == 0) - y = eraArray[0].year - cast16To32(fieldValue[CalendarFieldIndex::YEAR]); - else - y = eraArray[e-1].year + cast16To32(fieldValue[CalendarFieldIndex::YEAR] - 1); + if (!eraArray || !(fieldSet & FIELDS)) + return; - fieldSetValue[CalendarFieldIndex::ERA] = y <= 0 ? 0 : 1; - fieldSetValue[CalendarFieldIndex::YEAR] = cast32To16(y <= 0 ? 1 - y : y); - fieldSet |= FIELDS; - } + sal_Int16 e = fieldValue[CalendarFieldIndex::ERA]; + sal_Int32 y; + if (e == 0) + y = eraArray[0].year - cast16To32(fieldValue[CalendarFieldIndex::YEAR]); + else + y = eraArray[e-1].year + cast16To32(fieldValue[CalendarFieldIndex::YEAR] - 1); + + fieldSetValue[CalendarFieldIndex::ERA] = y <= 0 ? 0 : 1; + fieldSetValue[CalendarFieldIndex::YEAR] = cast32To16(y <= 0 ? 1 - y : y); + fieldSet |= FIELDS; } /// @throws RuntimeException |