diff options
author | Dario Lombardo <lomato@gmail.com> | 2019-01-03 17:53:42 +0100 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-01-03 23:39:43 +0000 |
commit | b67b47558d1bfff404e483156a98ac3c50433609 (patch) | |
tree | 7acdae1f163e854b08c37c9d8144b6dcc7a46725 /epan | |
parent | 58b71c754cdf829f0a33bad94d2fcde6e12c0342 (diff) |
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>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/addr_resolv.c | 2 | ||||
-rw-r--r-- | epan/prefs.c | 2 | ||||
-rw-r--r-- | epan/proto.c | 12 | ||||
-rw-r--r-- | epan/range.c | 4 | ||||
-rw-r--r-- | epan/stats_tree.c | 4 | ||||
-rw-r--r-- | epan/tap.c | 2 | ||||
-rw-r--r-- | epan/tvbparse.c | 4 | ||||
-rw-r--r-- | epan/tvbuff_zlib.c | 2 | ||||
-rw-r--r-- | epan/uat.c | 2 |
9 files changed, 17 insertions, 17 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c index 0a7138be7c..e44ef1f4a3 100644 --- a/epan/addr_resolv.c +++ b/epan/addr_resolv.c @@ -892,7 +892,7 @@ fill_dummy_ip4(const guint addr, hashipv4_t* volatile tp) gchar* paddr; 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); paddr = buffer; diff --git a/epan/prefs.c b/epan/prefs.c index 3c7a85f868..0f67b3ffd6 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -302,7 +302,7 @@ static void free_string_like_preference(pref_t *pref) { DIAG_OFF(cast-qual) - g_free((char *)*pref->varp.string); + g_free(*pref->varp.string); DIAG_ON(cast-qual) *pref->varp.string = NULL; g_free(pref->default_val.string); diff --git a/epan/proto.c b/epan/proto.c index 2d698114db..b781a775fa 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -5958,7 +5958,7 @@ proto_custom_set(proto_tree* tree, GSList *field_ids, gint occurrence, case FT_BOOLEAN: number64 = fvalue_get_uinteger64(&finfo->value); - tfstring = (const true_false_string *)&tfs_true_false; + tfstring = &tfs_true_false; if (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; 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) { 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) { case FT_BOOLEAN: /* Boolean field */ - tfstring = (const true_false_string *) &tfs_true_false; + tfstring = &tfs_true_false; if (hf_field->strings) tfstring = (const true_false_string *)hf_field->strings; return proto_tree_add_boolean_format(tree, hfindex, tvb, offset, length, (guint32)value, "%s = %s: %s", bf_str, hf_field->name, - (guint64)value ? tfstring->true_string : tfstring->false_string); + value ? tfstring->true_string : tfstring->false_string); break; 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) { case FT_BOOLEAN: /* it is a bit odd to have a boolean encoded as split-bits, but possible, I suppose? */ /* Boolean field */ - tfstring = (const true_false_string *) &tfs_true_false; + tfstring = &tfs_true_false; if (hf_field->strings) tfstring = (const true_false_string *) hf_field->strings; return proto_tree_add_boolean_format(tree, hfindex, tvb, octet_offset, octet_length, (guint32)value, "%s = %s: %s", bf_str, hf_field->name, - (guint64)value ? tfstring->true_string : tfstring->false_string); + value ? tfstring->true_string : tfstring->false_string); break; case FT_CHAR: diff --git a/epan/range.c b/epan/range.c index 0dce529554..7c026eb6cb 100644 --- a/epan/range.c +++ b/epan/range.c @@ -156,7 +156,7 @@ range_convert_str_work(wmem_allocator_t *scope, range_t **rangep, const gchar *e } } p = endp; - range->ranges[range->nranges].low = (guint32)val; + range->ranges[range->nranges].low = val; /* Skip white space. */ 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; - range->ranges[range->nranges].high = (guint32)val; + range->ranges[range->nranges].high = val; /* Skip white space. */ while ((c = *p) == ' ' || c == '\t') diff --git a/epan/stats_tree.c b/epan/stats_tree.c index ad0b7eb040..55e317f898 100644 --- a/epan/stats_tree.c +++ b/epan/stats_tree.c @@ -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->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; 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("-")); 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; } diff --git a/epan/tap.c b/epan/tap.c index e0e3a22beb..126133f753 100644 --- a/epan/tap.c +++ b/epan/tap.c @@ -753,7 +753,7 @@ void tap_cleanup(void) while(head_dl){ elem_dl = head_dl; head_dl = head_dl->next; - g_free((char*)elem_dl->name); + g_free(elem_dl->name); g_free((gpointer)elem_dl); } diff --git a/epan/tvbparse.c b/epan/tvbparse.c index 2a6e1e7699..a724ce6713 100644 --- a/epan/tvbparse.c +++ b/epan/tvbparse.c @@ -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); #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->id = id; @@ -1213,7 +1213,7 @@ tvbparse_t* tvbparse_init(tvbuff_t* tvb, int len, void* data, 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 if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_TT) g_warning("tvbparse_init: offset=%i len=%i",offset,len); diff --git a/epan/tvbuff_zlib.c b/epan/tvbuff_zlib.c index 0ed07ad4fd..d3cdeccb13 100644 --- a/epan/tvbuff_zlib.c +++ b/epan/tvbuff_zlib.c @@ -310,7 +310,7 @@ tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen) #endif 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); } wmem_free(NULL, compr); diff --git a/epan/uat.c b/epan/uat.c index fb88ab7b56..ab3b0e99e7 100644 --- a/epan/uat.c +++ b/epan/uat.c @@ -796,7 +796,7 @@ char* uat_unesc(const char* si, guint in_len, guint* len_p) { const char* s; 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) { case '\\': switch(*(++s)) { |