Skip to content

Commit

Permalink
And more const-correctnes in SchedXaction.h
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19462 57a11ea4-9604-0410-9ed3-97b8803252fd
  • Loading branch information
cstim committed Aug 22, 2010
1 parent b5fd6ec commit de83edb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/backend/xml/gnc-schedxaction-xml-v2.c
Expand Up @@ -312,7 +312,7 @@ sx_advRemind_handler( xmlNodePtr node, gpointer sx_pdata )
static
gboolean
sx_set_date( xmlNodePtr node, SchedXaction *sx,
void (*settor)( SchedXaction *sx, GDate *d ) )
void (*settor)( SchedXaction *sx, const GDate *d ) )
{
GDate *date;
date = dom_tree_to_gdate( node );
Expand Down
6 changes: 3 additions & 3 deletions src/engine/SchedXaction.c
Expand Up @@ -581,7 +581,7 @@ xaccSchedXactionGetStartDate(const SchedXaction *sx )
}

void
xaccSchedXactionSetStartDate( SchedXaction *sx, GDate* newStart )
xaccSchedXactionSetStartDate( SchedXaction *sx, const GDate* newStart )
{
gnc_sx_begin_edit(sx);
sx->start_date = *newStart;
Expand All @@ -602,7 +602,7 @@ xaccSchedXactionGetEndDate(const SchedXaction *sx )
}

void
xaccSchedXactionSetEndDate( SchedXaction *sx, GDate *newEnd )
xaccSchedXactionSetEndDate( SchedXaction *sx, const GDate *newEnd )
{
if ( g_date_valid( newEnd )
&& g_date_compare( newEnd, &sx->start_date ) < 0 )
Expand All @@ -629,7 +629,7 @@ xaccSchedXactionGetLastOccurDate(const SchedXaction *sx )
}

void
xaccSchedXactionSetLastOccurDate(SchedXaction *sx, GDate* new_last_occur)
xaccSchedXactionSetLastOccurDate(SchedXaction *sx, const GDate* new_last_occur)
{
if (g_date_valid(&sx->last_date)
&& g_date_compare(&sx->last_date, new_last_occur) == 0)
Expand Down
6 changes: 3 additions & 3 deletions src/engine/SchedXaction.h
Expand Up @@ -161,7 +161,7 @@ gchar *xaccSchedXactionGetName( const SchedXaction *sx );
void xaccSchedXactionSetName( SchedXaction *sx, const gchar *newName );

const GDate* xaccSchedXactionGetStartDate(const SchedXaction *sx );
void xaccSchedXactionSetStartDate( SchedXaction *sx, GDate* newStart );
void xaccSchedXactionSetStartDate( SchedXaction *sx, const GDate* newStart );

int xaccSchedXactionHasEndDate( const SchedXaction *sx );
/**
Expand All @@ -171,10 +171,10 @@ const GDate* xaccSchedXactionGetEndDate(const SchedXaction *sx );
/**
* Set to an invalid GDate to turn off 'end-date' definition.
*/
void xaccSchedXactionSetEndDate( SchedXaction *sx, GDate* newEnd );
void xaccSchedXactionSetEndDate( SchedXaction *sx, const GDate* newEnd );

const GDate* xaccSchedXactionGetLastOccurDate(const SchedXaction *sx );
void xaccSchedXactionSetLastOccurDate( SchedXaction *sx, GDate* newLastOccur );
void xaccSchedXactionSetLastOccurDate( SchedXaction *sx, const GDate* newLastOccur );

/**
* Returns true if the scheduled transaction has a defined number of
Expand Down
10 changes: 5 additions & 5 deletions src/engine/test-core/test-engine-stuff.c
Expand Up @@ -2189,23 +2189,23 @@ make_trans_query (Transaction *trans, TestQueryTypes query_types)
}

static Recurrence*
daily_freq(GDate* start, int multiplier)
daily_freq(const GDate* start, int multiplier)
{
Recurrence *r = g_new0(Recurrence, 1);
recurrenceSet(r, multiplier, PERIOD_DAY, start, WEEKEND_ADJ_NONE);
return r;
}

static Recurrence*
once_freq(GDate *when)
once_freq(const GDate *when)
{
Recurrence *r = g_new0(Recurrence, 1);
recurrenceSet(r, 1, PERIOD_ONCE, when, WEEKEND_ADJ_NONE);
return r;
}

static SchedXaction*
add_sx(gchar *name, GDate *start, GDate *end, GDate *last_occur, Recurrence *r)
add_sx(gchar *name, const GDate *start, const GDate *end, const GDate *last_occur, Recurrence *r)
{
QofBook *book = qof_session_get_book(gnc_get_current_session());
SchedXaction *sx = xaccSchedXactionMalloc(book);
Expand All @@ -2227,13 +2227,13 @@ add_sx(gchar *name, GDate *start, GDate *end, GDate *last_occur, Recurrence *r)
}

SchedXaction*
add_daily_sx(gchar *name, GDate *start, GDate *end, GDate *last_occur)
add_daily_sx(gchar *name, const GDate *start, const GDate *end, const GDate *last_occur)
{
return add_sx(name, start, end, last_occur, daily_freq(start, 1));
}

SchedXaction*
add_once_sx(gchar *name, GDate *when)
add_once_sx(gchar *name, const GDate *when)
{
return add_sx(name, when, NULL, NULL, once_freq(when));
}
Expand Down
4 changes: 2 additions & 2 deletions src/engine/test-core/test-engine-stuff.h
Expand Up @@ -89,8 +89,8 @@ void make_random_changes_to_level (QofBook *book, Account *parent);
void make_random_changes_to_book (QofBook *book);
void make_random_changes_to_session (QofSession *session);

SchedXaction* add_daily_sx(gchar *name, GDate *start, GDate *end, GDate *last_occur);
SchedXaction* add_once_sx(gchar *name, GDate *when);
SchedXaction* add_daily_sx(gchar *name, const GDate *start, const GDate *end, const GDate *last_occur);
SchedXaction* add_once_sx(gchar *name, const GDate *when);
void remove_sx(SchedXaction *sx);

#endif

0 comments on commit de83edb

Please sign in to comment.