diff options
author | Hossein <hossein@libreoffice.org> | 2021-11-19 09:12:18 +0100 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2021-11-19 11:26:09 +0100 |
commit | 9cad66da644e1721f9a49c2b5fffd86da08f78c5 (patch) | |
tree | 078edf81008d18f3acb0a05ba988452e6320b9b2 /i18npool/source/calendar | |
parent | 96d19777abfdf74c9776470e39ee3ec7e1b2e256 (diff) |
Cleanup locally used variables in Calendar_hijri
* Some variables that were only used in the calendar_hijri.cxx
are now moved out of the header file, and they are no loner
member variables of the the class Calendar_hijri. They are now
placed in the the i18npool namespace.
* Removed unused variables SynMonth, EveningPeriod and LeapYear
* Moved a global variable definition to the member function that was
the only place it was used. It is now a local variable.
Change-Id: I8a8b25765bd8ed5640b1a0cfa46ec9903b460a53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125433
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'i18npool/source/calendar')
-rw-r--r-- | i18npool/source/calendar/calendar_hijri.cxx | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/i18npool/source/calendar/calendar_hijri.cxx b/i18npool/source/calendar/calendar_hijri.cxx index 2944f455bb37..3d24150f8bf8 100644 --- a/i18npool/source/calendar/calendar_hijri.cxx +++ b/i18npool/source/calendar/calendar_hijri.cxx @@ -30,26 +30,17 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::i18n; -#define GREGORIAN_CROSSOVER 2299161 - namespace i18npool { // Synodic Period (mean time between 2 successive new moon: 29d, 12 hr, 44min, 3sec -const double Calendar_hijri::SynPeriod = 29.53058868; -const double Calendar_hijri::SynMonth = 365.25/29.53058868; // Solar days in a year/SynPeriod +constexpr double SynPeriod = 29.53058868; // Julian day on Jan 1, 1900 -const double Calendar_hijri::jd1900 = 2415020.75933; +constexpr double jd1900 = 2415020.75933; // Reference point: March 26, 2001 == 1422 Hijri == 1252 Synodial month from 1900 -const sal_Int32 Calendar_hijri::SynRef = 1252; -const sal_Int32 Calendar_hijri::GregRef = 1422; - -const double Calendar_hijri::EveningPeriod = 6.0; - -const sal_Int32 Calendar_hijri::LeapYear[] = { - 2, 5, 7, 10, 13, 16, 18, 21, 24, 26, 29 -}; +constexpr sal_Int32 SynRef = 1252; +constexpr sal_Int32 GregRef = 1422; Calendar_hijri::Calendar_hijri() { @@ -249,6 +240,8 @@ Calendar_hijri::getGregorianDay(sal_Int32 lJulianDay, sal_Int32 *pnDay, sal_Int3 /* working variables */ tools::Long lFactorA, lFactorB, lFactorC, lFactorD, lFactorE; + constexpr sal_Int32 GREGORIAN_CROSSOVER = 2299161; + /* test whether to adjust for the Gregorian calendar crossover */ if (lJulianDay >= GREGORIAN_CROSSOVER) { /* calculate a small adjustment */ |