Skip to content

Commit

Permalink
[Recurrence.cpp] convert to cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherlam committed Feb 9, 2024
1 parent 783c3df commit 7d8d8f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion libgnucash/engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
};
Expand Down Expand Up @@ -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<const Recurrence *>(iter->data);

recurrenceNextInstance(r, ref, &nextSingle);
if (!g_date_valid(&nextSingle)) continue;
Expand All @@ -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);
Expand Down Expand Up @@ -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<PeriodType>(i);
return static_cast<PeriodType>(-1);
}

const gchar *
Expand All @@ -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<WeekendAdjust>(i);
return static_cast<WeekendAdjust>(-1);
}

gboolean
Expand Down
2 changes: 1 addition & 1 deletion po/POTFILES.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7d8d8f8

Please sign in to comment.