summaryrefslogtreecommitdiff
path: root/epan
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2015-12-30 07:45:35 +0000
committerGuy Harris <guy@alum.mit.edu>2015-12-31 22:56:34 +0000
commit146c4b701696cb54e9e5ad4668e3ad88743c546e (patch)
treebcf117678f9def35304e63d0843dc46889199962 /epan
parentc14df7f7a80b3650eff08e46c9fbfbd522b435dc (diff)
downloadwireshark-146c4b701696cb54e9e5ad4668e3ad88743c546e.tar.gz
uat: Fix warnings [-Wcast-qual]
uat_fld_tostr_cb_t callback *out_ptr argument is g_mallocated and is to be freed by the caller so drop constness requirement to fix the corresponding g_free warnings. Change-Id: I1be25fa3e2f54fb32058ac0b5c1631b193b07701 Reviewed-on: https://code.wireshark.org/review/12943 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-lbm.h4
-rw-r--r--epan/uat.c4
-rw-r--r--epan/uat.h22
3 files changed, 15 insertions, 15 deletions
diff --git a/epan/dissectors/packet-lbm.h b/epan/dissectors/packet-lbm.h
index 34a1bf6dec..376595929a 100644
--- a/epan/dissectors/packet-lbm.h
+++ b/epan/dissectors/packet-lbm.h
@@ -127,7 +127,7 @@ typedef guint64 lbm_uint64_t;
inet_aton(new_buf, &addr); \
(((rec_t*)rec)->field_name ## _val_h) = g_ntohl(addr.s_addr); \
} \
- static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) \
+ static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) \
{\
if (((rec_t*)rec)->field_name ) \
{ \
@@ -170,7 +170,7 @@ typedef guint64 lbm_uint64_t;
inet_aton(new_buf, &addr); \
(((rec_t*)rec)->field_name ## _val_h) = g_ntohl(addr.s_addr); \
} \
- static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) \
+ static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) \
{\
if (((rec_t*)rec)->field_name ) \
{ \
diff --git a/epan/uat.c b/epan/uat.c
index 0301d0cde5..c0a4570a12 100644
--- a/epan/uat.c
+++ b/epan/uat.c
@@ -250,7 +250,7 @@ uat_t* uat_get_table_by_name(const char* name) {
static void putfld(FILE* fp, void* rec, uat_field_t* f) {
guint fld_len;
- const char* fld_ptr;
+ char* fld_ptr;
f->cb.tostr(rec,&fld_ptr,&fld_len,f->cbdata.tostr,f->fld_data);
@@ -290,7 +290,7 @@ static void putfld(FILE* fp, void* rec, uat_field_t* f) {
g_assert_not_reached();
}
- g_free((char*)fld_ptr);
+ g_free(fld_ptr);
}
gboolean uat_save(uat_t* uat, char** error) {
diff --git a/epan/uat.h b/epan/uat.h
index 4dc7d51cb7..d98cc86937 100644
--- a/epan/uat.h
+++ b/epan/uat.h
@@ -151,7 +151,7 @@ typedef void (*uat_fld_set_cb_t)(void*, const char*, unsigned, const void*, cons
* given a record returns a string representation of the field
* mandatory
*/
-typedef void (*uat_fld_tostr_cb_t)(void*, const char**, unsigned*, const void*, const void*);
+typedef void (*uat_fld_tostr_cb_t)(void*, char**, unsigned*, const void*, const void*);
/***********
* Text Mode
@@ -374,7 +374,7 @@ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, g
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, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
if (((rec_t*)rec)->field_name ) { \
*out_ptr = g_strdup((((rec_t*)rec)->field_name)); \
*out_len = (unsigned)strlen((((rec_t*)rec)->field_name)); \
@@ -429,7 +429,7 @@ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, g
char* new_val = uat_unesc(buf,len,&(((rec_t*)rec)->len_element)); \
g_free((((rec_t*)rec)->ptr_element)); \
(((rec_t*)rec)->ptr_element) = new_val; }\
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
if (((rec_t*)rec)->ptr_element ) { \
*out_ptr = uat_esc(((rec_t*)rec)->ptr_element, (((rec_t*)rec)->len_element)); \
*out_len = (unsigned)strlen(*out_ptr); \
@@ -455,8 +455,8 @@ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, g
g_free((((rec_t*)rec)->ptr_element)); \
(((rec_t*)rec)->ptr_element) = new_buf; \
(((rec_t*)rec)->len_element) = len; } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
- *out_ptr = ((rec_t*)rec)->ptr_element ? (const char*)g_memdup(((rec_t*)rec)->ptr_element,((rec_t*)rec)->len_element) : g_strdup(""); \
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
+ *out_ptr = ((rec_t*)rec)->ptr_element ? (char*)g_memdup(((rec_t*)rec)->ptr_element,((rec_t*)rec)->len_element) : g_strdup(""); \
*out_len = ((rec_t*)rec)->len_element; }
#define UAT_FLD_BUFFER(basename,field_name,title,desc) \
@@ -472,7 +472,7 @@ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, g
char* tmp_str = g_strndup(buf,len); \
((rec_t*)rec)->field_name = (guint)strtol(tmp_str,NULL,10); \
g_free(tmp_str); } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
*out_ptr = g_strdup_printf("%d",((rec_t*)rec)->field_name); \
*out_len = (unsigned)strlen(*out_ptr); }
@@ -492,7 +492,7 @@ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, g
char* tmp_str = g_strndup(buf,len); \
((rec_t*)rec)->field_name = (guint)strtol(tmp_str,NULL,16); \
g_free(tmp_str); } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
*out_ptr = g_strdup_printf("%x",((rec_t*)rec)->field_name); \
*out_len = (unsigned)strlen(*out_ptr); }
@@ -520,7 +520,7 @@ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, g
} \
} \
g_free(str); } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, const void* vs, const void* UNUSED_PARAMETER(u2)) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* vs, const void* UNUSED_PARAMETER(u2)) {\
guint i; \
for(i=0;((const value_string*)vs)[i].strptr;i++) { \
if ( ((const value_string*)vs)[i].value == ((rec_t*)rec)->field_name ) { \
@@ -546,7 +546,7 @@ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, g
} \
} \
g_free(str);} \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(vs), const void* UNUSED_PARAMETER(u2)) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(vs), const void* UNUSED_PARAMETER(u2)) {\
if (((rec_t*)rec)->field_name ) { \
*out_ptr = g_strdup((((rec_t*)rec)->field_name)); \
*out_len = (unsigned)strlen((((rec_t*)rec)->field_name)); \
@@ -573,7 +573,7 @@ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, g
((rec_t*)rec)->dissector_field = find_dissector("data"); \
((rec_t*)rec)->name_field = NULL; \
} } \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
if ( ((rec_t*)rec)->name_field ) { \
*out_ptr = g_strdup((((rec_t*)rec)->name_field)); \
*out_len = (unsigned)strlen(*out_ptr); \
@@ -594,7 +594,7 @@ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, g
range_convert_str(&(((rec_t*)rec)->field_name), rng,GPOINTER_TO_UINT(u2)); \
g_free(rng); \
} \
-static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
+static void basename ## _ ## field_name ## _tostr_cb(void* rec, char** out_ptr, unsigned* out_len, const void* UNUSED_PARAMETER(u1), const void* UNUSED_PARAMETER(u2)) {\
if ( ((rec_t*)rec)->field_name ) { \
*out_ptr = range_convert_range(NULL, ((rec_t*)rec)->field_name); \
*out_len = (unsigned)strlen(*out_ptr); \