diff --git a/libgnucash/engine/CMakeLists.txt b/libgnucash/engine/CMakeLists.txt index ba85668b02..7639012ec7 100644 --- a/libgnucash/engine/CMakeLists.txt +++ b/libgnucash/engine/CMakeLists.txt @@ -137,7 +137,7 @@ add_custom_target(iso-4217-c DEPENDS ${ISO_4217_C}) set (engine_SOURCES Account.cpp - Recurrence.c + Recurrence.cpp Query.c SchedXaction.c SX-book.c diff --git a/libgnucash/engine/Recurrence.c b/libgnucash/engine/Recurrence.cpp similarity index 98% rename from libgnucash/engine/Recurrence.c rename to libgnucash/engine/Recurrence.cpp index f507396acf..e4f378a0c2 100644 --- a/libgnucash/engine/Recurrence.c +++ b/libgnucash/engine/Recurrence.cpp @@ -41,12 +41,12 @@ static QofLogModule log_module = LOG_MOD; static GDate invalid_gdate; /* Do not intl. These are used for xml storage. */ -static gchar *period_type_strings[NUM_PERIOD_TYPES] = +static const gchar *period_type_strings[NUM_PERIOD_TYPES] = { "once", "day", "week", "month", "end of month", "nth weekday", "last weekday", "year", }; -static gchar *weekend_adj_strings[NUM_WEEKEND_ADJS] = +static const gchar *weekend_adj_strings[NUM_WEEKEND_ADJS] = { "none", "back", "forward", }; @@ -447,7 +447,7 @@ recurrenceListNextInstance(const GList *rlist, const GDate *ref, GDate *next) for (iter = rlist; iter; iter = iter->next) { - const Recurrence *r = iter->data; + auto r = static_cast(iter->data); recurrenceNextInstance(r, ref, &nextSingle); if (!g_date_valid(&nextSingle)) continue; @@ -463,8 +463,8 @@ recurrenceListNextInstance(const GList *rlist, const GDate *ref, GDate *next) gchar * recurrenceToString(const Recurrence *r) { - gchar *tmpDate; - gchar *tmpPeriod, *ret; + gchar *tmpDate, *ret; + const gchar *tmpPeriod; g_return_val_if_fail(g_date_valid(&r->start), NULL); tmpDate = g_new0(gchar, MAX_DATE_LENGTH + 1); @@ -531,8 +531,8 @@ recurrencePeriodTypeFromString(const gchar *str) for (i = 0; i < NUM_PERIOD_TYPES; i++) if (g_strcmp0(period_type_strings[i], str) == 0) - return i; - return -1; + return static_cast(i); + return static_cast(-1); } const gchar * @@ -548,8 +548,8 @@ recurrenceWeekendAdjustFromString(const gchar *str) for (i = 0; i < NUM_WEEKEND_ADJS; i++) if (g_strcmp0(weekend_adj_strings[i], str) == 0) - return i; - return -1; + return static_cast(i); + return static_cast(-1); } gboolean diff --git a/po/POTFILES.in b/po/POTFILES.in index 0bf47323ed..6370bf2da4 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -683,7 +683,7 @@ libgnucash/engine/qof-string-cache.cpp libgnucash/engine/qofutil.cpp libgnucash/engine/qof-win32.cpp libgnucash/engine/Query.c -libgnucash/engine/Recurrence.c +libgnucash/engine/Recurrence.cpp libgnucash/engine/SchedXaction.c libgnucash/engine/Scrub2.c libgnucash/engine/Scrub3.c