epan: remove redundant casts.

Found by clang-tidy.

Change-Id: Iaf6cf84c33b03ddfcd39a333b49f4987002afa56
Reviewed-on: https://code.wireshark.org/review/31338
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Dario Lombardo 2019-01-03 17:53:42 +01:00 committed by Guy Harris
parent 58b71c754c
commit b67b47558d
9 changed files with 17 additions and 17 deletions

View File

@ -892,7 +892,7 @@ fill_dummy_ip4(const guint addr, hashipv4_t* volatile tp)
gchar* paddr; gchar* paddr;
gsize i; gsize i;
host_addr = addr & (~(guint32)subnet_entry.mask); host_addr = addr & (~subnet_entry.mask);
ip_to_str_buf((guint8 *)&host_addr, buffer, WS_INET_ADDRSTRLEN); ip_to_str_buf((guint8 *)&host_addr, buffer, WS_INET_ADDRSTRLEN);
paddr = buffer; paddr = buffer;

View File

@ -302,7 +302,7 @@ static void
free_string_like_preference(pref_t *pref) free_string_like_preference(pref_t *pref)
{ {
DIAG_OFF(cast-qual) DIAG_OFF(cast-qual)
g_free((char *)*pref->varp.string); g_free(*pref->varp.string);
DIAG_ON(cast-qual) DIAG_ON(cast-qual)
*pref->varp.string = NULL; *pref->varp.string = NULL;
g_free(pref->default_val.string); g_free(pref->default_val.string);

View File

@ -5958,7 +5958,7 @@ proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence,
case FT_BOOLEAN: case FT_BOOLEAN:
number64 = fvalue_get_uinteger64(&finfo->value); number64 = fvalue_get_uinteger64(&finfo->value);
tfstring = (const true_false_string *)&tfs_true_false; tfstring = &tfs_true_false;
if (hfinfo->strings) { if (hfinfo->strings) {
tfstring = (const struct true_false_string*) hfinfo->strings; tfstring = (const struct true_false_string*) hfinfo->strings;
} }
@ -8698,7 +8698,7 @@ fill_label_boolean(field_info *fi, gchar *label_str)
guint64 value; guint64 value;
header_field_info *hfinfo = fi->hfinfo; header_field_info *hfinfo = fi->hfinfo;
const true_false_string *tfstring = (const true_false_string *)&tfs_true_false; const true_false_string *tfstring = &tfs_true_false;
if (hfinfo->strings) { if (hfinfo->strings) {
tfstring = (const struct true_false_string*) hfinfo->strings; tfstring = (const struct true_false_string*) hfinfo->strings;
@ -11579,13 +11579,13 @@ _proto_tree_add_bits_ret_val(proto_tree *tree, const int hfindex, tvbuff_t *tvb,
switch (hf_field->type) { switch (hf_field->type) {
case FT_BOOLEAN: case FT_BOOLEAN:
/* Boolean field */ /* Boolean field */
tfstring = (const true_false_string *) &tfs_true_false; tfstring = &tfs_true_false;
if (hf_field->strings) if (hf_field->strings)
tfstring = (const true_false_string *)hf_field->strings; tfstring = (const true_false_string *)hf_field->strings;
return proto_tree_add_boolean_format(tree, hfindex, tvb, offset, length, (guint32)value, return proto_tree_add_boolean_format(tree, hfindex, tvb, offset, length, (guint32)value,
"%s = %s: %s", "%s = %s: %s",
bf_str, hf_field->name, bf_str, hf_field->name,
(guint64)value ? tfstring->true_string : tfstring->false_string); value ? tfstring->true_string : tfstring->false_string);
break; break;
case FT_CHAR: case FT_CHAR:
@ -11760,14 +11760,14 @@ proto_tree_add_split_bits_item_ret_val(proto_tree *tree, const int hfindex, tvbu
switch (hf_field->type) { switch (hf_field->type) {
case FT_BOOLEAN: /* it is a bit odd to have a boolean encoded as split-bits, but possible, I suppose? */ case FT_BOOLEAN: /* it is a bit odd to have a boolean encoded as split-bits, but possible, I suppose? */
/* Boolean field */ /* Boolean field */
tfstring = (const true_false_string *) &tfs_true_false; tfstring = &tfs_true_false;
if (hf_field->strings) if (hf_field->strings)
tfstring = (const true_false_string *) hf_field->strings; tfstring = (const true_false_string *) hf_field->strings;
return proto_tree_add_boolean_format(tree, hfindex, return proto_tree_add_boolean_format(tree, hfindex,
tvb, octet_offset, octet_length, (guint32)value, tvb, octet_offset, octet_length, (guint32)value,
"%s = %s: %s", "%s = %s: %s",
bf_str, hf_field->name, bf_str, hf_field->name,
(guint64)value ? tfstring->true_string : tfstring->false_string); value ? tfstring->true_string : tfstring->false_string);
break; break;
case FT_CHAR: case FT_CHAR:

View File

@ -156,7 +156,7 @@ range_convert_str_work(wmem_allocator_t *scope, range_t **rangep, const gchar *e
} }
} }
p = endp; p = endp;
range->ranges[range->nranges].low = (guint32)val; range->ranges[range->nranges].low = val;
/* Skip white space. */ /* Skip white space. */
while ((c = *p) == ' ' || c == '\t') while ((c = *p) == ' ' || c == '\t')
@ -202,7 +202,7 @@ range_convert_str_work(wmem_allocator_t *scope, range_t **rangep, const gchar *e
} }
} }
p = endp; p = endp;
range->ranges[range->nranges].high = (guint32)val; range->ranges[range->nranges].high = val;
/* Skip white space. */ /* Skip white space. */
while ((c = *p) == ' ' || c == '\t') while ((c = *p) == ' ' || c == '\t')

View File

@ -484,7 +484,7 @@ new_stat_node(stats_tree *st, const gchar *name, int parent_id, stat_node_dataty
node->burst_time = -1.0; node->burst_time = -1.0;
node->name = g_strdup(name); node->name = g_strdup(name);
node->st = (stats_tree*) st; node->st = st;
node->hash = with_hash ? g_hash_table_new(g_str_hash,g_str_equal) : NULL; node->hash = with_hash ? g_hash_table_new(g_str_hash,g_str_equal) : NULL;
if (as_parent_node) { if (as_parent_node) {
@ -1170,7 +1170,7 @@ stats_tree_get_values_from_node (const stat_node* node)
g_strdup_printf("%.4f",((double)node->max_burst)/prefs.st_burst_windowlen)): g_strdup_printf("%.4f",((double)node->max_burst)/prefs.st_burst_windowlen)):
g_strdup("-")); g_strdup("-"));
values[COL_BURSTTIME] = (!prefs.st_enable_burstinfo)?g_strdup(""): values[COL_BURSTTIME] = (!prefs.st_enable_burstinfo)?g_strdup(""):
(node->max_burst?g_strdup_printf("%.3f",((double)node->burst_time/1000.0)):g_strdup("-")); (node->max_burst?g_strdup_printf("%.3f",(node->burst_time/1000.0)):g_strdup("-"));
} }
return values; return values;
} }

View File

@ -753,7 +753,7 @@ void tap_cleanup(void)
while(head_dl){ while(head_dl){
elem_dl = head_dl; elem_dl = head_dl;
head_dl = head_dl->next; head_dl = head_dl->next;
g_free((char*)elem_dl->name); g_free(elem_dl->name);
g_free((gpointer)elem_dl); g_free((gpointer)elem_dl);
} }

View File

@ -80,7 +80,7 @@ static tvbparse_elem_t* new_tok(tvbparse_t* tt,
if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_NEWTOK) g_warning("new_tok: id=%i offset=%u len=%u",id,offset,len); if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_NEWTOK) g_warning("new_tok: id=%i offset=%u len=%u",id,offset,len);
#endif #endif
tok = (tvbparse_elem_t *)wmem_new(wmem_packet_scope(), tvbparse_elem_t); tok = wmem_new(wmem_packet_scope(), tvbparse_elem_t);
tok->tvb = tt->tvb; tok->tvb = tt->tvb;
tok->id = id; tok->id = id;
@ -1213,7 +1213,7 @@ tvbparse_t* tvbparse_init(tvbuff_t* tvb,
int len, int len,
void* data, void* data,
const tvbparse_wanted_t* ignore) { const tvbparse_wanted_t* ignore) {
tvbparse_t* tt = (tvbparse_t *)wmem_new(wmem_packet_scope(), tvbparse_t); tvbparse_t* tt = wmem_new(wmem_packet_scope(), tvbparse_t);
#ifdef TVBPARSE_DEBUG #ifdef TVBPARSE_DEBUG
if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_TT) g_warning("tvbparse_init: offset=%i len=%i",offset,len); if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_TT) g_warning("tvbparse_init: offset=%i len=%i",offset,len);

View File

@ -310,7 +310,7 @@ tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
#endif #endif
if (uncompr != NULL) { if (uncompr != NULL) {
uncompr_tvb = tvb_new_real_data((guint8*) uncompr, bytes_out, bytes_out); uncompr_tvb = tvb_new_real_data(uncompr, bytes_out, bytes_out);
tvb_set_free_cb(uncompr_tvb, g_free); tvb_set_free_cb(uncompr_tvb, g_free);
} }
wmem_free(NULL, compr); wmem_free(NULL, compr);

View File

@ -796,7 +796,7 @@ char* uat_unesc(const char* si, guint in_len, guint* len_p) {
const char* s; const char* s;
const char* in_end = si+in_len; const char* in_end = si+in_len;
for (s = (const char *)si; s < in_end; s++) { for (s = si; s < in_end; s++) {
switch(*s) { switch(*s) {
case '\\': case '\\':
switch(*(++s)) { switch(*(++s)) {