# HG changeset patch # User Sebastien Decugis # Date 1355957722 -3600 # Node ID b772af2008652c6ccac90c984bd0bd75d4c9b4e8 # Parent ebe479bfcd4b5a714be69b86092259c551cae698 Add a few const declaration so that C++ is less picky diff -r ebe479bfcd4b -r b772af200865 include/freeDiameter/libfdproto.h --- a/include/freeDiameter/libfdproto.h Sat Dec 15 19:06:21 2012 +0100 +++ b/include/freeDiameter/libfdproto.h Wed Dec 19 23:55:22 2012 +0100 @@ -888,7 +888,7 @@ * EINVAL : A parameter is invalid. * ENOENT : No matching object has been found, and result was NULL. */ -int fd_dict_search ( struct dictionary * dict, enum dict_object_type type, int criteria, void * what, struct dict_object ** result, int retval ); +int fd_dict_search ( struct dictionary * dict, enum dict_object_type type, int criteria, const void * what, struct dict_object ** result, int retval ); /* Special case: get the generic error command object */ int fd_dict_get_error_cmd(struct dictionary * dict, struct dict_object ** obj); @@ -1348,13 +1348,13 @@ /* Only one of the following fields must be set. */ struct dict_object * vendor; /* most efficient if already known, set to NULL to ignore */ vendor_id_t vendor_id; /* set to 0 to ignore -- prefer AVP_BY_CODE or AVP_BY_NAME for vendor 0 */ - char * vendor_name; /* set to NULL to ignore */ + const char * vendor_name; /* set to NULL to ignore */ } avp_vendor; struct { /* Only one of the following fields must be set */ avp_code_t avp_code; /* set to 0 to ignore */ - char * avp_name; /* set to NULL to ignore */ + const char * avp_name; /* set to NULL to ignore */ } avp_data; }; diff -r ebe479bfcd4b -r b772af200865 libfdproto/dictionary.c --- a/libfdproto/dictionary.c Sat Dec 15 19:06:21 2012 +0100 +++ b/libfdproto/dictionary.c Wed Dec 19 23:55:22 2012 +0100 @@ -155,13 +155,13 @@ static void dump_rule_data ( void * data ); /* Forward declarations of search functions */ -static int search_vendor ( struct dictionary * dict, int criteria, void * what, struct dict_object **result ); -static int search_application ( struct dictionary * dict, int criteria, void * what, struct dict_object **result ); -static int search_type ( struct dictionary * dict, int criteria, void * what, struct dict_object **result ); -static int search_enumval ( struct dictionary * dict, int criteria, void * what, struct dict_object **result ); -static int search_avp ( struct dictionary * dict, int criteria, void * what, struct dict_object **result ); -static int search_cmd ( struct dictionary * dict, int criteria, void * what, struct dict_object **result ); -static int search_rule ( struct dictionary * dict, int criteria, void * what, struct dict_object **result ); +static int search_vendor ( struct dictionary * dict, int criteria, const void * what, struct dict_object **result ); +static int search_application ( struct dictionary * dict, int criteria, const void * what, struct dict_object **result ); +static int search_type ( struct dictionary * dict, int criteria, const void * what, struct dict_object **result ); +static int search_enumval ( struct dictionary * dict, int criteria, const void * what, struct dict_object **result ); +static int search_avp ( struct dictionary * dict, int criteria, const void * what, struct dict_object **result ); +static int search_cmd ( struct dictionary * dict, int criteria, const void * what, struct dict_object **result ); +static int search_rule ( struct dictionary * dict, int criteria, const void * what, struct dict_object **result ); /* The following array contains lot of data about the different types of objects, for automated handling */ static struct { @@ -172,7 +172,7 @@ enum dict_object_type parenttype; /* The type of the parent, when relevant */ int eyecatcher; /* A kind of signature for this object */ void (*dump_data)(void * data ); /* The function to dump the data section */ - int (*search_fct)(struct dictionary * dict, int criteria, void * what, struct dict_object **result );; /* The function to search an object of this type */ + int (*search_fct)(struct dictionary * dict, int criteria, const void * what, struct dict_object **result );; /* The function to search an object of this type */ int haslist[NB_LISTS_PER_OBJ]; /* Tell if this list is used */ } dict_obj_info[] = { { 0, "(error)", 0, 0, 0, 0, NULL, NULL, {0, 0, 0} } @@ -723,7 +723,7 @@ ret = ENOENT; \ } -static int search_vendor ( struct dictionary * dict, int criteria, void * what, struct dict_object **result ) +static int search_vendor ( struct dictionary * dict, int criteria, const void * what, struct dict_object **result ) { int ret = 0; vendor_id_t id; @@ -754,7 +754,7 @@ return ret; } -static int search_application ( struct dictionary * dict, int criteria, void * what, struct dict_object **result ) +static int search_application ( struct dictionary * dict, int criteria, const void * what, struct dict_object **result ) { int ret = 0; application_id_t id; @@ -791,7 +791,7 @@ return ret; } -static int search_type ( struct dictionary * dict, int criteria, void * what, struct dict_object **result ) +static int search_type ( struct dictionary * dict, int criteria, const void * what, struct dict_object **result ) { int ret = 0; @@ -822,7 +822,7 @@ return ret; } -static int search_enumval ( struct dictionary * dict, int criteria, void * what, struct dict_object **result ) +static int search_enumval ( struct dictionary * dict, int criteria, const void * what, struct dict_object **result ) { int ret = 0; @@ -927,7 +927,7 @@ return ret; } -static int search_avp ( struct dictionary * dict, int criteria, void * what, struct dict_object **result ) +static int search_avp ( struct dictionary * dict, int criteria, const void * what, struct dict_object **result ) { int ret = 0; @@ -1036,7 +1036,7 @@ return ret; } -static int search_cmd ( struct dictionary * dict, int criteria, void * what, struct dict_object **result ) +static int search_cmd ( struct dictionary * dict, int criteria, const void * what, struct dict_object **result ) { int ret = 0; @@ -1109,7 +1109,7 @@ return ret; } -static int search_rule ( struct dictionary * dict, int criteria, void * what, struct dict_object **result ) +static int search_rule ( struct dictionary * dict, int criteria, const void * what, struct dict_object **result ) { int ret = 0; @@ -1922,7 +1922,7 @@ } -int fd_dict_search ( struct dictionary * dict, enum dict_object_type type, int criteria, void * what, struct dict_object **result, int retval ) +int fd_dict_search ( struct dictionary * dict, enum dict_object_type type, int criteria, const void * what, struct dict_object **result, int retval ) { int ret = 0;