summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2009-04-20 18:34:06 +0000
committerGuy Harris <guy@alum.mit.edu>2009-04-20 18:34:06 +0000
commit4ab2ca88912b2a06ec70783141116cbf4e88c4ca (patch)
tree7639cecdeb198ac567f4d6d81700036e6b0217fe /epan
parentbe420138587708e2bdd56679f48cdc4e565b30d1 (diff)
downloadwireshark-4ab2ca88912b2a06ec70783141116cbf4e88c4ca.tar.gz
Constify some items to squelch some compiler warnings in the Windows
buildbot; based on a patch from Chris Maynard, with some additional changes to squelch GCC warnings on UN*X. svn path=/trunk/; revision=28093
Diffstat (limited to 'epan')
-rw-r--r--epan/dfilter/dfilter-macro.c2
-rw-r--r--epan/uat.c14
-rw-r--r--epan/uat.h34
3 files changed, 25 insertions, 25 deletions
diff --git a/epan/dfilter/dfilter-macro.c b/epan/dfilter/dfilter-macro.c
index 531aff9111..0de956aaa6 100644
--- a/epan/dfilter/dfilter-macro.c
+++ b/epan/dfilter/dfilter-macro.c
@@ -570,7 +570,7 @@ static void* macro_copy(void* dest, const void* orig, unsigned len _U_) {
return d;
}
-static gboolean macro_name_chk(void* r _U_, const char* in_name, unsigned name_len, void* u1 _U_, void* u2 _U_, const char** error) {
+static gboolean macro_name_chk(void* r _U_, const char* in_name, unsigned name_len, const void* u1 _U_, const void* u2 _U_, const char** error) {
guint i;
if (name_len == 0) {
diff --git a/epan/uat.c b/epan/uat.c
index c65d301217..792e360efd 100644
--- a/epan/uat.c
+++ b/epan/uat.c
@@ -386,7 +386,7 @@ void uat_load_all(void) {
}
-gboolean uat_fld_chk_str(void* u1 _U_, const char* strptr, unsigned len _U_, void* u2 _U_, void* u3 _U_, const char** err) {
+gboolean uat_fld_chk_str(void* u1 _U_, const char* strptr, unsigned len _U_, const void* u2 _U_, const void* u3 _U_, const char** err) {
if (strptr == NULL) {
*err = "NULL pointer";
return FALSE;
@@ -396,7 +396,7 @@ gboolean uat_fld_chk_str(void* u1 _U_, const char* strptr, unsigned len _U_, voi
return TRUE;
}
-gboolean uat_fld_chk_proto(void* u1 _U_, const char* strptr, unsigned len, void* u2 _U_, void* u3 _U_, const char** err) {
+gboolean uat_fld_chk_proto(void* u1 _U_, const char* strptr, unsigned len, const void* u2 _U_, const void* u3 _U_, const char** err) {
if (len) {
char* name = ep_strndup(strptr,len);
ascii_strdown_inplace(name);
@@ -415,7 +415,7 @@ gboolean uat_fld_chk_proto(void* u1 _U_, const char* strptr, unsigned len, void*
}
}
-gboolean uat_fld_chk_num_dec(void* u1 _U_, const char* strptr, unsigned len, void* u2 _U_, void* u3 _U_, const char** err) {
+gboolean uat_fld_chk_num_dec(void* u1 _U_, const char* strptr, unsigned len, const void* u2 _U_, const void* u3 _U_, const char** err) {
if (len > 0) {
char* str = ep_strndup(strptr,len);
long i = strtol(str,&str,10);
@@ -430,7 +430,7 @@ gboolean uat_fld_chk_num_dec(void* u1 _U_, const char* strptr, unsigned len, voi
return TRUE;
}
-gboolean uat_fld_chk_num_hex(void* u1 _U_, const char* strptr, unsigned len, void* u2 _U_, void* u3 _U_, const char** err) {
+gboolean uat_fld_chk_num_hex(void* u1 _U_, const char* strptr, unsigned len, const void* u2 _U_, const void* u3 _U_, const char** err) {
if (len > 0) {
char* str = ep_strndup(strptr,len);
long i = strtol(str,&str,16);
@@ -445,10 +445,10 @@ gboolean uat_fld_chk_num_hex(void* u1 _U_, const char* strptr, unsigned len, voi
return TRUE;
}
-gboolean uat_fld_chk_enum(void* u1 _U_, const char* strptr, unsigned len, void* v, void* u3 _U_, const char** err) {
+gboolean uat_fld_chk_enum(void* u1 _U_, const char* strptr, unsigned len, const void* v, const void* u3 _U_, const char** err) {
char* str = ep_strndup(strptr,len);
guint i;
- value_string* vs = v;
+ const value_string* vs = v;
for(i=0;vs[i].strptr;i++) {
if (g_str_equal(vs[i].strptr,str)) {
@@ -461,7 +461,7 @@ gboolean uat_fld_chk_enum(void* u1 _U_, const char* strptr, unsigned len, void*
return FALSE;
}
-gboolean uat_fld_chk_range(void* u1 _U_, const char* strptr, unsigned len, void* v _U_, void* u3, const char** err) {
+gboolean uat_fld_chk_range(void* u1 _U_, const char* strptr, unsigned len, const void* v _U_, const void* u3, const char** err) {
char* str = ep_strndup(strptr,len);
range_t* r = NULL;
convert_ret_t ret = range_convert_str(&r, str,GPOINTER_TO_UINT(u3));
diff --git a/epan/uat.h b/epan/uat.h
index 915df27808..a901330692 100644
--- a/epan/uat.h
+++ b/epan/uat.h
@@ -104,7 +104,7 @@ typedef void (*uat_update_cb_t)(void* , const char** );
* optional, if not given any input is considered OK and the set cb will be called
* chk(record, ptr, len, chk_data, fld_data, &error)
*/
-typedef gboolean (*uat_fld_chk_cb_t)(void*, const char*, unsigned, void*, void*, const char**);
+typedef gboolean (*uat_fld_chk_cb_t)(void*, const char*, unsigned, const void*, const void*, const char**);
/*
* Set Field CB
@@ -116,14 +116,14 @@ typedef gboolean (*uat_fld_chk_cb_t)(void*, const char*, unsigned, void*, void*,
* it is mandatory
* set(record, ptr, len, set_data, fld_data)
*/
-typedef void (*uat_fld_set_cb_t)(void*, const char*, unsigned, void*, void*);
+typedef void (*uat_fld_set_cb_t)(void*, const char*, unsigned, const void*, const void*);
/*
* given a record returns a string representation of the field
* mandatory
* tostr(record, &out_ptr, &out_len, tostr_data, fld_data)
*/
-typedef void (*uat_fld_tostr_cb_t)(void*, const char**, unsigned*, void*, void*);
+typedef void (*uat_fld_tostr_cb_t)(void*, const char**, unsigned*, const void*, const void*);
/***********
* Text Mode
@@ -188,12 +188,12 @@ typedef struct _uat_field_t {
} cb;
struct {
- void* chk;
- void* set;
- void* tostr;
+ const void* chk;
+ const void* set;
+ const void* tostr;
} cbdata;
- void* fld_data;
+ const void* fld_data;
const char* desc;
struct _fld_data_t* priv;
@@ -276,15 +276,15 @@ uat_t* uat_get_table_by_name(const char* name);
/*
* Some common uat_fld_chk_cbs
*/
-gboolean uat_fld_chk_str(void*, const char*, unsigned, void*,void*, const char** err);
-gboolean uat_fld_chk_proto(void*, const char*, unsigned, void*,void*, const char** err);
-gboolean uat_fld_chk_num_dec(void*, const char*, unsigned, void*, void*, const char** err);
-gboolean uat_fld_chk_num_hex(void*, const char*, unsigned, void*, void*, const char** err);
-gboolean uat_fld_chk_enum(void*, const char*, unsigned, void*, void*, const char**);
-gboolean uat_fld_chk_range(void*, const char*, unsigned, void*, void*, const char**);
+gboolean uat_fld_chk_str(void*, const char*, unsigned, const void*, const void*, const char** err);
+gboolean uat_fld_chk_proto(void*, const char*, unsigned, const void*, const void*, const char** err);
+gboolean uat_fld_chk_num_dec(void*, const char*, unsigned, const void*, const void*, const char** err);
+gboolean uat_fld_chk_num_hex(void*, const char*, unsigned, const void*, const void*, const char** err);
+gboolean uat_fld_chk_enum(void*, const char*, unsigned, const void*, const void*, const char**);
+gboolean uat_fld_chk_range(void*, const char*, unsigned, const void*, const void*, const char**);
#define CHK_STR_IS_DECL(what) \
-gboolean uat_fld_chk_str_ ## what (void*, const char*, unsigned, void*, void*, const char**)
+gboolean uat_fld_chk_str_ ## what (void*, const char*, unsigned, const void*, const void*, const char**)
typedef void (*uat_cb_t)(void* uat,void* user_data);
void uat_foreach_table(uat_cb_t cb,void* user_data);
@@ -303,7 +303,7 @@ CHK_STR_IS_DECL(isdigit);
CHK_STR_IS_DECL(isxdigit);
#define CHK_STR_IS_DEF(what) \
-gboolean uat_fld_chk_str_ ## what (void* u1 _U_, const char* strptr, unsigned len, void* u2 _U_, void* u3 _U_, const char** err) { \
+gboolean uat_fld_chk_str_ ## what (void* u1 _U_, const char* strptr, unsigned len, const void* u2 _U_, const void* u3 _U_, const char** err) { \
guint i; for (i=0;i<len;i++) { \
char c = strptr[i]; \
if (! what((int)c)) { \
@@ -322,11 +322,11 @@ gboolean uat_fld_chk_str_ ## what (void* u1 _U_, const char* strptr, unsigned le
* a simple c-string contained in (((rec_t*)rec)->(field_name))
*/
#define UAT_CSTRING_CB_DEF(basename,field_name,rec_t) \
-static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, void* u1 _U_, void* u2 _U_) {\
+static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, const void* u1 _U_, const void* u2 _U_) {\
char* new_buf = g_strndup(buf,len); \
g_free((((rec_t*)rec)->field_name)); \
(((rec_t*)rec)->field_name) = new_buf; } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, void* u1 _U_, void* u2 _U_) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) {\
if (((rec_t*)rec)->field_name ) { \
*out_ptr = (((rec_t*)rec)->field_name); \
*out_len = (unsigned)strlen((((rec_t*)rec)->field_name)); \