summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2021-11-19 09:12:18 +0100
committerHossein <hossein@libreoffice.org>2021-11-19 11:26:09 +0100
commit9cad66da644e1721f9a49c2b5fffd86da08f78c5 (patch)
tree078edf81008d18f3acb0a05ba988452e6320b9b2 /i18npool
parent96d19777abfdf74c9776470e39ee3ec7e1b2e256 (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')
-rw-r--r--i18npool/inc/calendar_hijri.hxx18
-rw-r--r--i18npool/source/calendar/calendar_hijri.cxx19
2 files changed, 6 insertions, 31 deletions
diff --git a/i18npool/inc/calendar_hijri.hxx b/i18npool/inc/calendar_hijri.hxx
index c11a507bb420..707c877710a0 100644
--- a/i18npool/inc/calendar_hijri.hxx
+++ b/i18npool/inc/calendar_hijri.hxx
@@ -37,24 +37,6 @@ private:
void mapToGregorian() override;
void mapFromGregorian() override;
- // Synodic Period (mean time between 2 successive new moon: 29d, 12 hr, 44min, 3sec
- static const double SynPeriod;
-
- static const double SynMonth; // Solar days in a year/SynPeriod
-
- // Julian day on Jan 1, 1900
- static const double jd1900;
-
- // Reference point: September 1984 25d 3h 10m UT. == 1405 Hijri == 1048 Synodial month from 1900
- static const sal_Int32 SynRef;
- static const sal_Int32 GregRef;
-
- // Period between 1.30pm - 6:30pm
- static const double EveningPeriod;
-
- // "Leap" years
- static const sal_Int32 LeapYear[];
-
private:
static double NewMoon(sal_Int32 n);
static void getHijri(sal_Int32 *day, sal_Int32 *month, sal_Int32 *year);
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 */