diff options
-rw-r--r-- | epan/dissectors/packet-lbm.h | 4 | ||||
-rw-r--r-- | epan/uat.c | 4 | ||||
-rw-r--r-- | epan/uat.h | 22 | ||||
-rw-r--r-- | ui/gtk/uat_gui.c | 4 | ||||
-rw-r--r-- | ui/qt/uat_dialog.cpp | 10 |
5 files changed, 22 insertions, 22 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); \ diff --git a/ui/gtk/uat_gui.c b/ui/gtk/uat_gui.c index fa770fa6b1..3e653a8147 100644 --- a/ui/gtk/uat_gui.c +++ b/ui/gtk/uat_gui.c @@ -169,7 +169,7 @@ static void limit_buttons(uat_t *uat) { static char *fld_tostr(void *rec, uat_field_t *f) { guint len; - const char *ptr; + char *ptr; char *out; f->cb.tostr(rec, &ptr, &len, f->cbdata.tostr, f->fld_data); @@ -199,7 +199,7 @@ static char *fld_tostr(void *rec, uat_field_t *f) { break; } - g_free((char*)ptr); + g_free(ptr); return out; } diff --git a/ui/qt/uat_dialog.cpp b/ui/qt/uat_dialog.cpp index d6a7b8a4d6..6bb89f763f 100644 --- a/ui/qt/uat_dialog.cpp +++ b/ui/qt/uat_dialog.cpp @@ -162,8 +162,8 @@ QString UatDialog::fieldString(guint row, guint column) void *rec = UAT_INDEX_PTR(uat_, row); uat_field_t *field = &uat_->fields[column]; - guint length; - const char *str; + guint length; + char *str; field->cb.tostr(rec, &str, &length, field->cbdata.tostr, field->fld_data); @@ -189,7 +189,7 @@ QString UatDialog::fieldString(guint row, guint column) break; } - g_free((char*)str); + g_free(str); return string_rep; } @@ -497,10 +497,10 @@ void UatDialog::addRecord(bool copy_from_current) switch (field->mode) { case PT_TXTMOD_ENUM: guint length; - const char *str; + char *str; field->cb.tostr(rec, &str, &length, field->cbdata.tostr, field->fld_data); field->cb.set(rec, str, length, field->cbdata.set, field->fld_data); - g_free((char*)str); + g_free(str); break; case PT_TXTMOD_NONE: break; |