Make some parameters const

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16764 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Phil Longstaff 2007-12-29 19:40:28 +00:00
parent 2c602edbd9
commit 0ed4af2ef1
25 changed files with 170 additions and 172 deletions

View File

@ -279,7 +279,7 @@ int gnc_date_my_last_mday (int month, int year)
param tm: the time value in question
return the last day of the month, integer.
*/
int date_get_last_mday(struct tm *tm)
int date_get_last_mday(const struct tm *tm)
{
return gnc_date_my_last_mday (tm->tm_mon+1, tm->tm_year+1900);
}
@ -291,7 +291,7 @@ int date_get_last_mday(struct tm *tm)
param tm: the time value in question
return TRUE if tm_mday matches the last day of the month, else FALSE.
*/
gboolean date_is_last_mday(struct tm *tm)
gboolean date_is_last_mday(const struct tm *tm)
{
return(tm->tm_mday == date_get_last_mday(tm));
}
@ -472,7 +472,7 @@ qof_print_date_buff (char * buff, size_t len, time_t t)
}
size_t
qof_print_gdate( char *buf, size_t len, GDate *gd )
qof_print_gdate( char *buf, size_t len, const GDate *gd )
{
return qof_print_date_dmy_buff( buf, len,
g_date_get_day(gd),
@ -1292,7 +1292,7 @@ gnc_dmy2timespec_end (int day, int month, int year)
\********************************************************************/
long int
gnc_timezone (struct tm *tm)
gnc_timezone (const struct tm *tm)
{
g_return_val_if_fail (tm != NULL, 0);

View File

@ -267,7 +267,7 @@ time_t xaccDMYToSec (gint day, gint month, gint year);
* daylight savings time! Timezone stuff under unix is not
* standardized and is a big mess.
*/
glong gnc_timezone (struct tm *tm);
glong gnc_timezone (const struct tm *tm);
// @}
/* ------------------------------------------------------------------------ */
@ -380,7 +380,7 @@ size_t qof_print_date_dmy_buff (gchar * buff, size_t buflen, int day, int month,
size_t qof_print_date_buff (char * buff, size_t buflen, time_t secs);
/** Convenience; calls through to qof_print_date_dmy_buff(). **/
size_t qof_print_gdate( char *buf, size_t bufflen, GDate *gd );
size_t qof_print_gdate( char *buf, size_t bufflen, const GDate *gd );
/** Convenience; calls through to qof_print_date_dmy_buff().
* Return: string, which should be freed when no longer needed.
@ -499,10 +499,10 @@ time_t gnc_timet_get_day_start(time_t time_val);
time_t gnc_timet_get_day_end(time_t time_val);
/** Get the numerical last date of the month. (28, 29, 30, 31) */
int date_get_last_mday(struct tm *tm);
int date_get_last_mday(const struct tm *tm);
/** Is the mday field the last day of the specified month.*/
gboolean date_is_last_mday(struct tm *tm);
gboolean date_is_last_mday(const struct tm *tm);
/** \deprecated Use date_get_last_mday() */
int gnc_date_my_last_mday (int month, int year);

View File

@ -129,7 +129,7 @@ kvp_frame_delete(KvpFrame * frame)
}
gboolean
kvp_frame_is_empty(KvpFrame * frame)
kvp_frame_is_empty(const KvpFrame * frame)
{
if (!frame) return TRUE;
if (!frame->hash) return TRUE;
@ -921,7 +921,7 @@ kvp_frame_get_value(const KvpFrame *frame, const char *path)
/* ============================================================ */
KvpFrame *
kvp_frame_get_frame_gslist (KvpFrame *frame, GSList *key_path)
kvp_frame_get_frame_gslist (KvpFrame *frame, const GSList *key_path)
{
if (!frame) return frame;
@ -1010,7 +1010,7 @@ kvp_frame_get_slot_path (KvpFrame *frame,
KvpValue *
kvp_frame_get_slot_path_gslist (KvpFrame *frame,
GSList *key_path)
const GSList *key_path)
{
if (!frame || !key_path) return NULL;

View File

@ -126,7 +126,7 @@ void kvp_frame_delete(KvpFrame * frame);
KvpFrame * kvp_frame_copy(const KvpFrame * frame);
/** Return TRUE if the KvpFrame is empty */
gboolean kvp_frame_is_empty(KvpFrame * frame);
gboolean kvp_frame_is_empty(const KvpFrame * frame);
/** @} */
@ -395,7 +395,7 @@ KvpFrame * kvp_frame_get_frame_path (KvpFrame *frame, const gchar *,...);
* Note that this is *VERY DIFFERENT FROM* kvp_frame_get_frame()
*/
KvpFrame * kvp_frame_get_frame_gslist (KvpFrame *frame,
GSList *key_path);
const GSList *key_path);
/** This routine returns the last frame of the path.
* If the frame path doesn't exist, it is created.
@ -502,7 +502,7 @@ KvpValue * kvp_frame_get_slot_path (KvpFrame *frame,
* path, or NULL if any portion of the path doesn't exist.
*/
KvpValue * kvp_frame_get_slot_path_gslist (KvpFrame *frame,
GSList *key_path);
const GSList *key_path);
/**
* Similar returns as strcmp.

View File

@ -153,7 +153,7 @@ qof_backend_run_begin(QofBackend *be, QofInstance *inst)
}
gboolean
qof_backend_begin_exists(QofBackend *be)
qof_backend_begin_exists(const QofBackend *be)
{
if(be->begin) { return TRUE; }
else { return FALSE; }
@ -179,7 +179,7 @@ void qof_backend_prepare_frame(QofBackend *be)
be->config_count = 0;
}
void qof_backend_prepare_option(QofBackend *be, QofBackendOption *option)
void qof_backend_prepare_option(QofBackend *be, const QofBackendOption *option)
{
KvpValue *value;
gchar *temp;
@ -376,7 +376,7 @@ qof_backend_get_config(QofBackend *be)
}
gboolean
qof_backend_commit_exists(QofBackend *be)
qof_backend_commit_exists(const QofBackend *be)
{
if(!be) { return FALSE; }
if(be->commit) { return TRUE; }

View File

@ -165,11 +165,11 @@ typedef void (*QofBePercentageFunc) (const char *message, double percent);
void qof_backend_run_begin(QofBackend *be, QofInstance *inst);
gboolean qof_backend_begin_exists(QofBackend *be);
gboolean qof_backend_begin_exists(const QofBackend *be);
void qof_backend_run_commit(QofBackend *be, QofInstance *inst);
gboolean qof_backend_commit_exists(QofBackend *be);
gboolean qof_backend_commit_exists(const QofBackend *be);
//@}
/** The qof_backend_set_error() routine pushes an error code onto the error
@ -214,7 +214,7 @@ typedef struct QofBackendOption_s {
void qof_backend_prepare_frame(QofBackend *be);
/** Add an option to the backend_configuration. Repeat for more. */
void qof_backend_prepare_option(QofBackend *be, QofBackendOption *option);
void qof_backend_prepare_option(QofBackend *be, const QofBackendOption *option);
/** Complete the backend_configuration and return the frame. */
KvpFrame* qof_backend_complete_frame(QofBackend *be);

View File

@ -366,7 +366,7 @@ void qof_book_set_version (QofBook *book, gint32 version)
}
gint64
qof_book_get_counter (QofBook *book, const char *counter_name)
qof_book_get_counter (const QofBook *book, const char *counter_name)
{
QofBackend *be;
KvpFrame *kvp;

View File

@ -264,7 +264,7 @@ gboolean qof_book_equal (const QofBook *book_1, const QofBook *book_2);
/** This will 'get and increment' the named counter for this book.
* The return value is -1 on error or the incremented counter.
*/
gint64 qof_book_get_counter (QofBook *book, const char *counter_name);
gint64 qof_book_get_counter (const QofBook *book, const char *counter_name);
/** deprecated */
#define qof_book_get_guid(X) qof_entity_get_guid (QOF_INSTANCE(X))

View File

@ -627,7 +627,7 @@ qof_book_merge_commit_rule_create_objects(QofBookMergeData *mergeData,
* Returns the corresponding target entity to the given importEnt
*/
static QofInstance*
qof_book_merge_map_entity(QofBookMergeData *mergeData, QofInstance* importEnt)
qof_book_merge_map_entity(const QofBookMergeData *mergeData, const QofInstance* importEnt)
{
QofBookMergeRule *currentRule;
GList *node;

View File

@ -260,11 +260,11 @@ qof_collection_lookup_entity (const QofCollection *col, const GUID * guid)
}
QofCollection *
qof_collection_from_glist (QofIdType type, GList *glist)
qof_collection_from_glist (QofIdType type, const GList *glist)
{
QofCollection *coll;
QofInstance *ent;
GList *list;
const GList *list;
coll = qof_collection_new(type);
for(list = glist; list != NULL; list = list->next)

View File

@ -252,7 +252,7 @@ qof_collection_compare (QofCollection *target, QofCollection *merge);
on success.
*/
QofCollection*
qof_collection_from_glist (QofIdType type, GList *glist);
qof_collection_from_glist (QofIdType type, const GList *glist);
/** @} */
/** @} */

View File

@ -633,7 +633,7 @@ void qof_instance_reset_editlevel (gpointer ptr)
}
gboolean
qof_instance_check_edit(const QofInstance *inst)
qof_instance_check_edit(const QofInstance *inst)
{
g_return_val_if_fail(QOF_IS_INSTANCE(inst), FALSE);
return (GET_PRIVATE(inst)->editlevel > 0);

View File

@ -382,7 +382,7 @@ qof_log_level_to_string(QofLogLevel log_level)
}
QofLogLevel
qof_log_level_from_string(gchar *str)
qof_log_level_from_string(const gchar *str)
{
if (g_ascii_strncasecmp("error", str, 5) == 0) return QOF_LOG_FATAL;
if (g_ascii_strncasecmp("crit", str, 4) == 0) return QOF_LOG_ERROR;

View File

@ -101,7 +101,7 @@
DEFINE_ENUM (QofLogLevel, LOG_LEVEL_LIST)
gchar* qof_log_level_to_string(QofLogLevel lvl);
QofLogLevel qof_log_level_from_string(gchar *str);
QofLogLevel qof_log_level_from_string(const gchar *str);
/** Indents one level; see ENTER macro. **/
void qof_log_indent(void);

View File

@ -30,7 +30,7 @@ typedef struct _QofQueryTerm QofQueryTerm;
typedef struct _QofQuerySort QofQuerySort;
/* Functions to get Query information */
int qof_query_get_max_results (QofQuery *q);
int qof_query_get_max_results (const QofQuery *q);
/* Functions to get and look at QueryTerms */
@ -43,11 +43,11 @@ int qof_query_get_max_results (QofQuery *q);
* Note that you should NOT modify this list in any way. It belongs
* to the query.
*/
GList * qof_query_get_terms (QofQuery *q);
GList * qof_query_get_terms (const QofQuery *q);
GSList * qof_query_term_get_param_path (QofQueryTerm *queryterm);
QofQueryPredData *qof_query_term_get_pred_data (QofQueryTerm *queryterm);
gboolean qof_query_term_is_inverted (QofQueryTerm *queryterm);
GSList * qof_query_term_get_param_path (const QofQueryTerm *queryterm);
QofQueryPredData *qof_query_term_get_pred_data (const QofQueryTerm *queryterm);
gboolean qof_query_term_is_inverted (const QofQueryTerm *queryterm);
/* Functions to get and look at QuerySorts */
@ -58,8 +58,8 @@ gboolean qof_query_term_is_inverted (QofQueryTerm *queryterm);
void qof_query_get_sorts (QofQuery *q, QofQuerySort **primary,
QofQuerySort **secondary, QofQuerySort **tertiary);
GSList * qof_query_sort_get_param_path (QofQuerySort *querysort);
gint qof_query_sort_get_sort_options (QofQuerySort *querysort);
gboolean qof_query_sort_get_increasing (QofQuerySort *querysort);
GSList * qof_query_sort_get_param_path (const QofQuerySort *querysort);
gint qof_query_sort_get_sort_options (const QofQuerySort *querysort);
gboolean qof_query_sort_get_increasing (const QofQuerySort *querysort);
#endif /* QOF_QUERY_P_H */

View File

@ -180,7 +180,7 @@ static void free_query_term (QofQueryTerm *qt)
g_free (qt);
}
static QofQueryTerm * copy_query_term (QofQueryTerm *qt)
static QofQueryTerm * copy_query_term (const QofQueryTerm *qt)
{
QofQueryTerm *new_qt;
if (!qt) return NULL;
@ -193,10 +193,10 @@ static QofQueryTerm * copy_query_term (QofQueryTerm *qt)
return new_qt;
}
static GList * copy_and_terms (GList *and_terms)
static GList * copy_and_terms (const GList *and_terms)
{
GList *and = NULL;
GList *cur_and;
const GList *cur_and;
for(cur_and = and_terms; cur_and; cur_and = cur_and->next)
{
@ -207,10 +207,10 @@ static GList * copy_and_terms (GList *and_terms)
}
static GList *
copy_or_terms(GList * or_terms)
copy_or_terms(const GList * or_terms)
{
GList * or = NULL;
GList * cur_or;
const GList * cur_or;
for(cur_or = or_terms; cur_or; cur_or = cur_or->next)
{
@ -270,8 +270,8 @@ static void free_members (QofQuery *q)
q->results = NULL;
}
static int cmp_func (QofQuerySort *sort, QofSortFunc default_sort,
gconstpointer a, gconstpointer b)
static int cmp_func (const QofQuerySort *sort, QofSortFunc default_sort,
const gconstpointer a, const gconstpointer b)
{
QofParam *param = NULL;
GSList *node;
@ -319,10 +319,10 @@ static int cmp_func (QofQuerySort *sort, QofSortFunc default_sort,
return sort->obj_cmp (conva, convb);
}
static int sort_func (gconstpointer a, gconstpointer b, gpointer q)
static int sort_func (const gconstpointer a, const gconstpointer b, const gpointer q)
{
int retval;
QofQuery *sortQuery = q;
const QofQuery *sortQuery = q;
g_return_val_if_fail (sortQuery, 0);
@ -355,11 +355,11 @@ static int sort_func (gconstpointer a, gconstpointer b, gpointer q)
*/
static int
check_object (QofQuery *q, gpointer object)
check_object (const QofQuery *q, gpointer object)
{
GList * and_ptr;
GList * or_ptr;
QofQueryTerm * qt;
const GList * and_ptr;
const GList * or_ptr;
const QofQueryTerm * qt;
int and_terms_ok=1;
for(or_ptr = q->terms; or_ptr; or_ptr = or_ptr->next)
@ -370,7 +370,7 @@ check_object (QofQuery *q, gpointer object)
qt = (QofQueryTerm *)(and_ptr->data);
if (qt->param_fcns && qt->pred_fcn)
{
GSList *node;
const GSList *node;
QofParam *param = NULL;
gpointer conv_obj = object;
@ -556,7 +556,7 @@ static void check_item_cb (gpointer object, gpointer user_data)
return;
}
static int param_list_cmp (GSList *l1, GSList *l2)
static int param_list_cmp (const GSList *l1, const GSList *l2)
{
while (1) {
int ret;
@ -1311,39 +1311,39 @@ void qof_query_shutdown (void)
qof_query_core_shutdown ();
}
int qof_query_get_max_results (QofQuery *q)
int qof_query_get_max_results (const QofQuery *q)
{
if (!q) return 0;
return q->max_results;
}
QofIdType qof_query_get_search_for (QofQuery *q)
QofIdType qof_query_get_search_for (const QofQuery *q)
{
if (!q) return NULL;
return q->search_for;
}
GList * qof_query_get_terms (QofQuery *q)
GList * qof_query_get_terms (const QofQuery *q)
{
if (!q) return NULL;
return q->terms;
}
GSList * qof_query_term_get_param_path (QofQueryTerm *qt)
GSList * qof_query_term_get_param_path (const QofQueryTerm *qt)
{
if (!qt)
return NULL;
return qt->param_list;
}
QofQueryPredData *qof_query_term_get_pred_data (QofQueryTerm *qt)
QofQueryPredData *qof_query_term_get_pred_data (const QofQueryTerm *qt)
{
if (!qt)
return NULL;
return qt->pdata;
}
gboolean qof_query_term_is_inverted (QofQueryTerm *qt)
gboolean qof_query_term_is_inverted (const QofQueryTerm *qt)
{
if (!qt)
return FALSE;
@ -1363,21 +1363,21 @@ void qof_query_get_sorts (QofQuery *q, QofQuerySort **primary,
*tertiary = &(q->tertiary_sort);
}
GSList * qof_query_sort_get_param_path (QofQuerySort *qs)
GSList * qof_query_sort_get_param_path (const QofQuerySort *qs)
{
if (!qs)
return NULL;
return qs->param_list;
}
gint qof_query_sort_get_sort_options (QofQuerySort *qs)
gint qof_query_sort_get_sort_options (const QofQuerySort *qs)
{
if (!qs)
return 0;
return qs->options;
}
gboolean qof_query_sort_get_increasing (QofQuerySort *qs)
gboolean qof_query_sort_get_increasing (const QofQuerySort *qs)
{
if (!qs)
return FALSE;
@ -1385,7 +1385,7 @@ gboolean qof_query_sort_get_increasing (QofQuerySort *qs)
}
static gboolean
qof_query_term_equal (QofQueryTerm *qt1, QofQueryTerm *qt2)
qof_query_term_equal (const QofQueryTerm *qt1, const QofQueryTerm *qt2)
{
if (qt1 == qt2) return TRUE;
if (!qt1 || !qt2) return FALSE;
@ -1396,7 +1396,7 @@ qof_query_term_equal (QofQueryTerm *qt1, QofQueryTerm *qt2)
}
static gboolean
qof_query_sort_equal (QofQuerySort* qs1, QofQuerySort* qs2)
qof_query_sort_equal (const QofQuerySort* qs1, const QofQuerySort* qs2)
{
if (qs1 == qs2) return TRUE;
if (!qs1 || !qs2) return FALSE;
@ -1409,7 +1409,7 @@ qof_query_sort_equal (QofQuerySort* qs1, QofQuerySort* qs2)
return (param_list_cmp (qs1->param_list, qs2->param_list) == 0);
}
gboolean qof_query_equal (QofQuery *q1, QofQuery *q2)
gboolean qof_query_equal (const QofQuery *q1, const QofQuery *q2)
{
GList *or1, *or2;

View File

@ -360,7 +360,7 @@ void qof_query_set_max_results (QofQuery *q, int n);
* implementation -- logical equivalences between different
* and/or trees are ignored.
*/
gboolean qof_query_equal (QofQuery *q1, QofQuery *q2);
gboolean qof_query_equal (const QofQuery *q1, const QofQuery *q2);
/** Log the Query
*
@ -371,7 +371,7 @@ gboolean qof_query_equal (QofQuery *q1, QofQuery *q2);
void qof_query_print (QofQuery *query);
/** Return the type of data we're querying for */
QofIdType qof_query_get_search_for (QofQuery *q);
QofIdType qof_query_get_search_for (const QofQuery *q);
/** Return the list of books we're using */
GList * qof_query_get_books (QofQuery *q);

View File

@ -50,7 +50,7 @@ QofQueryPredicateFunc qof_query_core_get_predicate (gchar const *type);
QofCompareFunc qof_query_core_get_compare (gchar const *type);
/* Compare two predicates */
gboolean qof_query_core_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2);
gboolean qof_query_core_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2);
/* Predicate Data Structures:
*

View File

@ -35,7 +35,7 @@ static QofLogModule log_module = QOF_MOD_QUERY;
typedef void (*QueryPredDataFree) (QofQueryPredData *pdata);
/* A function to copy a query's predicate data */
typedef QofQueryPredData *(*QueryPredicateCopyFunc) (QofQueryPredData *pdata);
typedef QofQueryPredData *(*QueryPredicateCopyFunc) (const QofQueryPredData *pdata);
/* A function to take the object, apply the getter->param_getfcn,
* and return a printable string. Note that this QofParam->getfnc
@ -46,8 +46,8 @@ typedef QofQueryPredData *(*QueryPredicateCopyFunc) (QofQueryPredData *pdata);
typedef char * (*QueryToString) (gpointer object, QofParam *getter);
/* A function to test for equality of predicate data */
typedef gboolean (*QueryPredicateEqual) (QofQueryPredData *p1,
QofQueryPredData *p2);
typedef gboolean (*QueryPredicateEqual) (const QofQueryPredData *p1,
const QofQueryPredData *p2);
static QueryPredicateCopyFunc qof_query_copy_predicate (QofType type);
static QueryPredDataFree qof_query_predicate_free (QofType type);
@ -228,9 +228,9 @@ string_free_pdata (QofQueryPredData *pd)
}
static QofQueryPredData *
string_copy_predicate (QofQueryPredData *pd)
string_copy_predicate (const QofQueryPredData *pd)
{
query_string_t pdata = (query_string_t) pd;
const query_string_t pdata = (const query_string_t) pd;
VERIFY_PDATA_R (query_string_type);
@ -240,10 +240,10 @@ string_copy_predicate (QofQueryPredData *pd)
}
static gboolean
string_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2)
string_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
{
query_string_t pd1 = (query_string_t) p1;
query_string_t pd2 = (query_string_t) p2;
const query_string_t pd1 = (const query_string_t) p1;
const query_string_t pd2 = (const query_string_t) p2;
if (pd1->options != pd2->options) return FALSE;
if (pd1->is_regex != pd2->is_regex) return FALSE;
@ -375,9 +375,9 @@ date_free_pdata (QofQueryPredData *pd)
}
static QofQueryPredData *
date_copy_predicate (QofQueryPredData *pd)
date_copy_predicate (const QofQueryPredData *pd)
{
query_date_t pdata = (query_date_t)pd;
const query_date_t pdata = (const query_date_t)pd;
VERIFY_PDATA_R (query_date_type);
@ -385,10 +385,10 @@ date_copy_predicate (QofQueryPredData *pd)
}
static gboolean
date_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2)
date_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
{
query_date_t pd1 = (query_date_t) p1;
query_date_t pd2 = (query_date_t) p2;
const query_date_t pd1 = (const query_date_t) p1;
const query_date_t pd2 = (const query_date_t) p2;
if (pd1->options != pd2->options) return FALSE;
return timespec_equal (&(pd1->date), &(pd2->date));
@ -409,9 +409,9 @@ qof_query_date_predicate (QofQueryCompare how,
}
gboolean
qof_query_date_predicate_get_date (QofQueryPredData *pd, Timespec *date)
qof_query_date_predicate_get_date (const QofQueryPredData *pd, Timespec *date)
{
query_date_t pdata = (query_date_t)pd;
const query_date_t pdata = (const query_date_t)pd;
if (pdata->pd.type_name != query_date_type)
return FALSE;
@ -509,18 +509,18 @@ numeric_free_pdata (QofQueryPredData* pd)
}
static QofQueryPredData *
numeric_copy_predicate (QofQueryPredData *pd)
numeric_copy_predicate (const QofQueryPredData *pd)
{
query_numeric_t pdata = (query_numeric_t)pd;
const query_numeric_t pdata = (const query_numeric_t)pd;
VERIFY_PDATA_R (query_numeric_type);
return qof_query_numeric_predicate (pd->how, pdata->options, pdata->amount);
}
static gboolean
numeric_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2)
numeric_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
{
query_numeric_t pd1 = (query_numeric_t) p1;
query_numeric_t pd2 = (query_numeric_t) p2;
const query_numeric_t pd1 = (const query_numeric_t) p1;
const query_numeric_t pd2 = (const query_numeric_t) p2;
if (pd1->options != pd2->options) return FALSE;
return gnc_numeric_equal (pd1->amount, pd2->amount);
@ -684,18 +684,18 @@ guid_free_pdata (QofQueryPredData *pd)
}
static QofQueryPredData *
guid_copy_predicate (QofQueryPredData *pd)
guid_copy_predicate (const QofQueryPredData *pd)
{
query_guid_t pdata = (query_guid_t)pd;
const query_guid_t pdata = (const query_guid_t)pd;
VERIFY_PDATA_R (query_guid_type);
return qof_query_guid_predicate (pdata->options, pdata->guids);
}
static gboolean
guid_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2)
guid_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
{
query_guid_t pd1 = (query_guid_t) p1;
query_guid_t pd2 = (query_guid_t) p2;
const query_guid_t pd1 = (const query_guid_t) p1;
const query_guid_t pd2 = (const query_guid_t) p2;
GList *l1 = pd1->guids, *l2 = pd2->guids;
if (pd1->options != pd2->options) return FALSE;
@ -788,18 +788,18 @@ int32_free_pdata (QofQueryPredData *pd)
}
static QofQueryPredData *
int32_copy_predicate (QofQueryPredData *pd)
int32_copy_predicate (const QofQueryPredData *pd)
{
query_int32_t pdata = (query_int32_t)pd;
const query_int32_t pdata = (const query_int32_t)pd;
VERIFY_PDATA_R (query_int32_type);
return qof_query_int32_predicate (pd->how, pdata->val);
}
static gboolean
int32_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2)
int32_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
{
query_int32_t pd1 = (query_int32_t) p1;
query_int32_t pd2 = (query_int32_t) p2;
const query_int32_t pd1 = (const query_int32_t) p1;
const query_int32_t pd2 = (const query_int32_t) p2;
return (pd1->val == pd2->val);
}
@ -879,18 +879,18 @@ int64_free_pdata (QofQueryPredData *pd)
}
static QofQueryPredData *
int64_copy_predicate (QofQueryPredData *pd)
int64_copy_predicate (const QofQueryPredData *pd)
{
query_int64_t pdata = (query_int64_t)pd;
const query_int64_t pdata = (const query_int64_t)pd;
VERIFY_PDATA_R (query_int64_type);
return qof_query_int64_predicate (pd->how, pdata->val);
}
static gboolean
int64_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2)
int64_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
{
query_int64_t pd1 = (query_int64_t) p1;
query_int64_t pd2 = (query_int64_t) p2;
const query_int64_t pd1 = (const query_int64_t) p1;
const query_int64_t pd2 = (const query_int64_t) p2;
return (pd1->val == pd2->val);
}
@ -970,18 +970,18 @@ double_free_pdata (QofQueryPredData *pd)
}
static QofQueryPredData *
double_copy_predicate (QofQueryPredData *pd)
double_copy_predicate (const QofQueryPredData *pd)
{
query_double_t pdata = (query_double_t)pd;
const query_double_t pdata = (const query_double_t)pd;
VERIFY_PDATA_R (query_double_type);
return qof_query_double_predicate (pd->how, pdata->val);
}
static gboolean
double_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2)
double_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
{
query_double_t pd1 = (query_double_t) p1;
query_double_t pd2 = (query_double_t) p2;
const query_double_t pd1 = (const query_double_t) p1;
const query_double_t pd2 = (const query_double_t) p2;
return (pd1->val == pd2->val);
}
@ -1050,18 +1050,18 @@ boolean_free_pdata (QofQueryPredData *pd)
}
static QofQueryPredData *
boolean_copy_predicate (QofQueryPredData *pd)
boolean_copy_predicate (const QofQueryPredData *pd)
{
query_boolean_t pdata = (query_boolean_t)pd;
const query_boolean_t pdata = (const query_boolean_t)pd;
VERIFY_PDATA_R (query_boolean_type);
return qof_query_boolean_predicate (pd->how, pdata->val);
}
static gboolean
boolean_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2)
boolean_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
{
query_boolean_t pd1 = (query_boolean_t) p1;
query_boolean_t pd2 = (query_boolean_t) p2;
const query_boolean_t pd1 = (const query_boolean_t) p1;
const query_boolean_t pd2 = (const query_boolean_t) p2;
return (pd1->val == pd2->val);
}
@ -1133,18 +1133,18 @@ char_free_pdata (QofQueryPredData *pd)
}
static QofQueryPredData *
char_copy_predicate (QofQueryPredData *pd)
char_copy_predicate (const QofQueryPredData *pd)
{
query_char_t pdata = (query_char_t)pd;
const query_char_t pdata = (const query_char_t)pd;
VERIFY_PDATA_R (query_char_type);
return qof_query_char_predicate (pdata->options, pdata->char_list);
}
static gboolean
char_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2)
char_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
{
query_char_t pd1 = (query_char_t) p1;
query_char_t pd2 = (query_char_t) p2;
const query_char_t pd1 = (const query_char_t) p1;
const query_char_t pd2 = (const query_char_t) p2;
if (pd1->options != pd2->options) return FALSE;
return (safe_strcmp (pd1->char_list, pd2->char_list) == 0);
@ -1235,18 +1235,18 @@ kvp_free_pdata (QofQueryPredData *pd)
}
static QofQueryPredData *
kvp_copy_predicate (QofQueryPredData *pd)
kvp_copy_predicate (const QofQueryPredData *pd)
{
query_kvp_t pdata = (query_kvp_t)pd;
const query_kvp_t pdata = (const query_kvp_t)pd;
VERIFY_PDATA_R (query_kvp_type);
return qof_query_kvp_predicate (pd->how, pdata->path, pdata->value);
}
static gboolean
kvp_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2)
kvp_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
{
query_kvp_t pd1 = (query_kvp_t) p1;
query_kvp_t pd2 = (query_kvp_t) p2;
const query_kvp_t pd1 = (const query_kvp_t) p1;
const query_kvp_t pd2 = (const query_kvp_t) p2;
GSList *n1, *n2;
n1 = pd1->path;
@ -1426,23 +1426,21 @@ collect_free_pdata (QofQueryPredData *pd)
}
static QofQueryPredData *
collect_copy_predicate (QofQueryPredData *pd)
collect_copy_predicate (const QofQueryPredData *pd)
{
query_coll_t pdata = (query_coll_t) pd;
const query_coll_t pdata = (const query_coll_t) pd;
VERIFY_PDATA_R (query_collect_type);
return qof_query_collect_predicate (pdata->options, pdata->coll);
}
static gboolean
collect_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2)
collect_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
{
query_coll_t pd1;
query_coll_t pd2;
const query_coll_t pd1 = (const query_coll_t) p1;
const query_coll_t pd2 = (const query_coll_t) p2;
gint result;
pd1 = (query_coll_t) p1;
pd2 = (query_coll_t) p2;
result = qof_collection_compare(pd1->coll, pd2->coll);
if(result == 0) { return TRUE; }
return FALSE;
@ -1588,18 +1586,18 @@ choice_free_pdata (QofQueryPredData *pd)
}
static QofQueryPredData *
choice_copy_predicate (QofQueryPredData *pd)
choice_copy_predicate (const QofQueryPredData *pd)
{
query_choice_t pdata = (query_choice_t)pd;
const query_choice_t pdata = (const query_choice_t)pd;
VERIFY_PDATA_R (query_choice_type);
return qof_query_choice_predicate (pdata->options, pdata->guids);
}
static gboolean
choice_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2)
choice_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
{
query_choice_t pd1 = (query_choice_t) p1;
query_choice_t pd2 = (query_choice_t) p2;
const query_choice_t pd1 = (const query_choice_t) p1;
const query_choice_t pd2 = (const query_choice_t) p2;
GList *l1 = pd1->guids, *l2 = pd2->guids;
if (pd1->options != pd2->options) return FALSE;
@ -1821,7 +1819,7 @@ qof_query_core_predicate_free (QofQueryPredData *pdata)
}
QofQueryPredData *
qof_query_core_predicate_copy (QofQueryPredData *pdata)
qof_query_core_predicate_copy (const QofQueryPredData *pdata)
{
QueryPredicateCopyFunc copy;
@ -1849,7 +1847,7 @@ qof_query_core_to_string (QofType type, gpointer object,
}
gboolean
qof_query_core_predicate_equal (QofQueryPredData *p1, QofQueryPredData *p2)
qof_query_core_predicate_equal (const QofQueryPredData *p1, const QofQueryPredData *p2)
{
QueryPredicateEqual pred_equal;

View File

@ -175,13 +175,13 @@ QofQueryPredData *qof_query_kvp_predicate_path (QofQueryCompare how,
const KvpValue *value);
/** Copy a predicate. */
QofQueryPredData *qof_query_core_predicate_copy (QofQueryPredData *pdata);
QofQueryPredData *qof_query_core_predicate_copy (const QofQueryPredData *pdata);
/** Destroy a predicate. */
void qof_query_core_predicate_free (QofQueryPredData *pdata);
/** Retrieve a predicate. */
gboolean qof_query_date_predicate_get_date (QofQueryPredData *pd, Timespec *date);
gboolean qof_query_date_predicate_get_date (const QofQueryPredData *pd, Timespec *date);
/** Return a printable string for a core data object. Caller needs
* to g_free() the returned string.
*/

View File

@ -67,7 +67,7 @@ struct _QofSession
};
QofBackend * qof_session_get_backend (QofSession *session);
QofBackend * qof_session_get_backend (const QofSession *session);
void qof_session_push_error (QofSession *session, QofBackendError err,
const char *message);

View File

@ -165,7 +165,7 @@ get_default_error_message(QofBackendError err)
}
const char *
qof_session_get_error_message(QofSession *session)
qof_session_get_error_message(const QofSession *session)
{
if(!session) return "";
if(!session->error_message)
@ -234,7 +234,7 @@ qof_session_set_current_session (QofSession *session)
}
QofBook *
qof_session_get_book (QofSession *session)
qof_session_get_book (const QofSession *session)
{
GList *node;
if (!session) return NULL;
@ -282,14 +282,14 @@ qof_session_add_book (QofSession *session, QofBook *addbook)
}
QofBackend *
qof_session_get_backend (QofSession *session)
qof_session_get_backend (const QofSession *session)
{
if (!session) return NULL;
return session->backend;
}
const char *
qof_session_get_file_path (QofSession *session)
qof_session_get_file_path (const QofSession *session)
{
if (!session) return NULL;
if (!session->backend) return NULL;
@ -297,7 +297,7 @@ qof_session_get_file_path (QofSession *session)
}
const char *
qof_session_get_url (QofSession *session)
qof_session_get_url (const QofSession *session)
{
if (!session) return NULL;
return session->book_id;
@ -865,7 +865,7 @@ struct backend_providers backend_list[] = {
};
static void
qof_session_load_backend(QofSession * session, char * access_method)
qof_session_load_backend(QofSession * session, const char * access_method)
{
GSList *p;
GList *node;
@ -1176,7 +1176,7 @@ qof_session_load (QofSession *session,
/* ====================================================================== */
gboolean
qof_session_save_may_clobber_data (QofSession *session)
qof_session_save_may_clobber_data (const QofSession *session)
{
if (!session) return FALSE;
if (!session->backend) return FALSE;
@ -1447,7 +1447,7 @@ qof_session_swap_data (QofSession *session_1, QofSession *session_2)
/* ====================================================================== */
gboolean
qof_session_events_pending (QofSession *session)
qof_session_events_pending (const QofSession *session)
{
if (!session) return FALSE;
if (!session->backend) return FALSE;

View File

@ -173,7 +173,7 @@ void qof_session_load (QofSession *session,
* for any failure. Calling this routine returns the current error.
*/
QofBackendError qof_session_get_error (QofSession *session);
const char * qof_session_get_error_message(QofSession *session);
const char * qof_session_get_error_message(const QofSession *session);
/**
* The qof_session_pop_error() routine can be used to obtain the reason
@ -197,7 +197,7 @@ QofBackendError qof_session_pop_error (QofSession *session);
*/
void qof_session_add_book (QofSession *session, QofBook *book);
QofBook * qof_session_get_book (QofSession *session);
QofBook * qof_session_get_book (const QofSession *session);
/**
* The qof_session_get_file_path() routine returns the fully-qualified file
@ -213,9 +213,9 @@ QofBook * qof_session_get_book (QofSession *session);
* URL's for local files take the form of
* file:/some/where/some/file.gml
*/
const char * qof_session_get_file_path (QofSession *session);
const char * qof_session_get_file_path (const QofSession *session);
const char * qof_session_get_url (QofSession *session);
const char * qof_session_get_url (const QofSession *session);
/**
* The qof_session_not_saved() subroutine will return TRUE
@ -225,7 +225,7 @@ gboolean qof_session_not_saved(QofSession *session);
gboolean qof_session_save_in_progress(QofSession *session);
/** Allows the backend to warn the user if a dataset already exists. */
gboolean qof_session_save_may_clobber_data (QofSession *session);
gboolean qof_session_save_may_clobber_data (const QofSession *session);
/** The qof_session_save() method will commit all changes that have been
* made to the session. For the file backend, this is nothing
@ -409,7 +409,7 @@ backends may return a ::QofBackendError.
* backend has pending events which must be processed to bring
* the engine up to date with the backend.
*/
gboolean qof_session_events_pending (QofSession *session);
gboolean qof_session_events_pending (const QofSession *session);
/** The qof_session_process_events() method will process any events
* indicated by the qof_session_events_pending() method. It returns

View File

@ -47,7 +47,7 @@ cannot be considered "standard" or public parts of QOF. */
static QofLogModule log_module = GNC_MOD_ENGINE;
Timespec
gnc_transaction_get_date_posted(Transaction *t)
gnc_transaction_get_date_posted(const Transaction *t)
{
Timespec result;
xaccTransGetDatePostedTS(t, &result);
@ -55,7 +55,7 @@ gnc_transaction_get_date_posted(Transaction *t)
}
Timespec
gnc_transaction_get_date_entered(Transaction *t)
gnc_transaction_get_date_entered(const Transaction *t)
{
Timespec result;
xaccTransGetDateEnteredTS(t, &result);
@ -63,7 +63,7 @@ gnc_transaction_get_date_entered(Transaction *t)
}
Timespec
gnc_split_get_date_reconciled(Split *s)
gnc_split_get_date_reconciled(const Split *s)
{
Timespec result;
xaccSplitGetDateReconciledTS(s, &result);
@ -382,10 +382,10 @@ gnc_scm2kvp_match_where (SCM where_scm)
}
static SCM
gnc_guid_glist2scm (GList *account_guids)
gnc_guid_glist2scm (const GList *account_guids)
{
SCM guids = SCM_EOL;
GList *node;
const GList *node;
for (node = account_guids; node; node = node->next)
{
@ -460,10 +460,10 @@ gnc_query_scm2numeric (SCM pair)
}
static SCM
gnc_query_path2scm (GSList *path)
gnc_query_path2scm (const GSList *path)
{
SCM path_scm = SCM_EOL;
GSList *node;
const GSList *node;
for (node = path; node; node = node->next)
{
@ -522,7 +522,7 @@ gnc_scm2KvpValueTypeype (SCM value_type_scm)
static SCM gnc_kvp_frame2scm (KvpFrame *frame);
static SCM
gnc_kvp_value2scm (KvpValue *value)
gnc_kvp_value2scm (const KvpValue *value)
{
SCM value_scm = SCM_EOL;
KvpValueType value_t;
@ -770,7 +770,7 @@ gnc_scm2KvpFrame (SCM frame_scm)
}
static SCM
gnc_queryterm2scm (QofQueryTerm *qt)
gnc_queryterm2scm (const QofQueryTerm *qt)
{
SCM qt_scm = SCM_EOL;
QofQueryPredData *pd = NULL;
@ -1413,10 +1413,10 @@ gnc_scm2query_term_query (SCM query_term_scm, query_version_t vers)
}
static SCM
gnc_query_terms2scm (GList *terms)
gnc_query_terms2scm (const GList *terms)
{
SCM or_terms = SCM_EOL;
GList *or_node;
const GList *or_node;
for (or_node = terms; or_node; or_node = or_node->next)
{
@ -1524,7 +1524,7 @@ gnc_scm2query_or_terms (SCM or_terms, query_version_t vers)
}
static SCM
gnc_query_sort2scm (QofQuerySort *qs)
gnc_query_sort2scm (const QofQuerySort *qs)
{
SCM sort_scm = SCM_EOL;
GSList *path;
@ -2191,13 +2191,13 @@ gnc_commodity_to_scm (const gnc_commodity *commodity)
}
SCM
gnc_book_to_scm (QofBook *book)
gnc_book_to_scm (const QofBook *book)
{
return gnc_generic_to_scm(book, "_p_QofBook");
}
SCM
qof_session_to_scm (QofSession *session)
qof_session_to_scm (const QofSession *session)
{
return gnc_generic_to_scm(session, "_p_QofSession");
}

View File

@ -33,10 +33,10 @@
#include "Query.h"
#include "Transaction.h"
Timespec gnc_transaction_get_date_posted(Transaction *t);
Timespec gnc_transaction_get_date_entered(Transaction *t);
Timespec gnc_transaction_get_date_posted(const Transaction *t);
Timespec gnc_transaction_get_date_entered(const Transaction *t);
Timespec gnc_split_get_date_reconciled(Split *s);
Timespec gnc_split_get_date_reconciled(const Split *s);
void gnc_transaction_set_date_posted(Transaction *t, const Timespec d);
void gnc_transaction_set_date_entered(Transaction *t, const Timespec d);
@ -71,7 +71,7 @@ gnc_numeric gnc_scm_to_numeric(SCM arg);
int gnc_numeric_p(SCM arg);
gnc_commodity * gnc_scm_to_commodity(SCM scm);
SCM gnc_commodity_to_scm (const gnc_commodity *commodity);
SCM gnc_book_to_scm (QofBook *book);
SCM qof_session_to_scm (QofSession *session);
SCM gnc_book_to_scm (const QofBook *book);
SCM qof_session_to_scm (const QofSession *session);
#endif