Eliminate more unnecessary casting away of constness.
authorGuy Harris <guy@alum.mit.edu>
Mon, 28 Dec 2015 20:43:46 +0000 (12:43 -0800)
committerGuy Harris <guy@alum.mit.edu>
Mon, 28 Dec 2015 20:46:26 +0000 (20:46 +0000)
Change-Id: I3d2d83d60f798703ea3fa16ba2d6e95a00f88469
Reviewed-on: https://code.wireshark.org/review/12885
Reviewed-by: Guy Harris <guy@alum.mit.edu>
epan/conversation_table.c
epan/dissectors/packet-dcerpc.c
epan/dissectors/packet-devicenet.c
epan/dissectors/packet-dns.c
epan/dissectors/packet-epl.c
epan/dissectors/packet-hpfeeds.c
epan/dissectors/packet-qnet6.c
epan/dissectors/packet-radius.c
epan/dissectors/packet-rtps.c

index a907b5fff8cdf5f09cf2f00d5b0157abf19a399a..04f8620001ac4ca8c6a732114fe59623f428a28f 100644 (file)
@@ -128,8 +128,8 @@ register_ct_t* get_conversation_by_proto_id(int proto_id)
 static gint
 insert_sorted_by_table_name(gconstpointer aparam, gconstpointer bparam)
 {
-    const register_ct_t *a = (register_ct_t *)aparam;
-    const register_ct_t *b = (register_ct_t *)bparam;
+    const register_ct_t *a = (const register_ct_t *)aparam;
+    const register_ct_t *b = (const register_ct_t *)bparam;
 
     return g_ascii_strcasecmp(proto_get_protocol_short_name(find_protocol_by_id(a->proto_id)), proto_get_protocol_short_name(find_protocol_by_id(b->proto_id)));
 }
index 4d77f6071ac6aa23ac8c5e594344dac8e6c4bfb8..cdb598dc28ac83b018f6cd480400260f1bcafbcd 100644 (file)
@@ -1078,7 +1078,7 @@ dcerpc_fragment_temporary_key(const packet_info *pinfo, const guint32 id,
                               const void *data)
 {
     dcerpc_fragment_key *key = g_slice_new(dcerpc_fragment_key);
-    e_dce_dg_common_hdr_t *hdr = (e_dce_dg_common_hdr_t *)data;
+    const e_dce_dg_common_hdr_t *hdr = (const e_dce_dg_common_hdr_t *)data;
 
     key->src = pinfo->src;
     key->dst = pinfo->dst;
@@ -1094,7 +1094,7 @@ dcerpc_fragment_persistent_key(const packet_info *pinfo, const guint32 id,
                                const void *data)
 {
     dcerpc_fragment_key *key = g_slice_new(dcerpc_fragment_key);
-    e_dce_dg_common_hdr_t *hdr = (e_dce_dg_common_hdr_t *)data;
+    const e_dce_dg_common_hdr_t *hdr = (const e_dce_dg_common_hdr_t *)data;
 
     copy_address(&key->src, &pinfo->src);
     copy_address(&key->dst, &pinfo->dst);
@@ -1939,7 +1939,7 @@ dcerpcstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const
     guint i = 0;
     srt_stat_table *dcerpc_srt_table;
     srt_data_t *data = (srt_data_t *)pss;
-    const dcerpc_info *ri = (dcerpc_info *)prv;
+    const dcerpc_info *ri = (const dcerpc_info *)prv;
     dcerpcstat_tap_data_t* tap_data;
 
     dcerpc_srt_table = g_array_index(data->srt_array, srt_stat_table*, i);
index 15087046cb5fa2e4f9028adaeabe2a2b1baa9afa..b79af89aa9cfd9d0026621443499ae81ab521f77 100644 (file)
@@ -788,7 +788,7 @@ static int dissect_devicenet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
 
 static int devicenet_addr_to_str(const address* addr, gchar *buf, int buf_len _U_)
 {
-    guint8 addrdata = *((guint8*)addr->data) & 0x3F;
+    guint8 addrdata = *((const guint8*)addr->data) & 0x3F;
     gchar *start_buf = buf;
 
     buf = uint_to_str_back(buf, addrdata);
index ea9bd5bd5dd4010faa7b7866d36a1c000d10bd9b..800f5661a27a16e1e0242a34ae9ce663750ebacc 100644 (file)
@@ -4044,7 +4044,7 @@ static void dns_stats_tree_init(stats_tree* st)
 
 static int dns_stats_tree_packet(stats_tree* st, packet_info* pinfo _U_, epan_dissect_t* edt _U_, const void* p)
 {
-    struct DnsTap *pi = (struct DnsTap *)p;
+    const struct DnsTap *pi = (const struct DnsTap *)p;
     tick_stat_node(st, st_str_packets, 0, FALSE);
     stats_tree_tick_pivot(st, st_node_packet_qr,
             val_to_str(pi->packet_qr, dns_qr_vals, "Unknown qr (%d)"));
index ac707a0ed1bed95f3357f06e833184cf17109ed2..7ca2201b14710929763ecbe9cc6df0bb47389e0f 100644 (file)
@@ -1518,7 +1518,7 @@ static GHashTable *epl_duplication_table = NULL;
 static guint
 epl_duplication_hash(gconstpointer k)
 {
-       duplication_key *key = (duplication_key*)k;
+       const duplication_key *key = (const duplication_key*)k;
        guint hash;
 
        hash = ((key->src)<<24) | ((key->dest)<<16)|
@@ -1531,8 +1531,8 @@ epl_duplication_hash(gconstpointer k)
 static gint
 epl_duplication_equal(gconstpointer k1, gconstpointer k2)
 {
-       duplication_key *key1 = (duplication_key*)k1;
-       duplication_key *key2 = (duplication_key*)k2;
+       const duplication_key *key1 = (const duplication_key*)k1;
+       const duplication_key *key2 = (const duplication_key*)k2;
        gint hash;
 
        hash = (key1->src == key2->src)&&(key1->dest == key2->dest)&&
index e1795f6616bfb2099a895e7ae93f5644d9d01b46..059492f259df3ec414c73d70acb7de56c1bf96a9 100644 (file)
@@ -219,7 +219,7 @@ static void hpfeeds_stats_tree_init(stats_tree* st)
 
 static int hpfeeds_stats_tree_packet(stats_tree* st _U_, packet_info* pinfo _U_, epan_dissect_t* edt _U_, const void* p)
 {
-    struct HpfeedsTap *pi = (struct HpfeedsTap *)p;
+    const struct HpfeedsTap *pi = (const struct HpfeedsTap *)p;
     wmem_list_frame_t* head = wmem_list_head(channels_list);
     wmem_list_frame_t* cur = head;
     struct channel_node* ch_node;
index 4e214858ac3da505a184eaa1fabe5b7676cad0a5..178e3fba2868c48990749e8fc6be6db01b47ccd4 100644 (file)
@@ -1619,8 +1619,8 @@ dissect_qnet6_lr(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint *
         {
           col_add_fstr(pinfo->cinfo, COL_INFO,
                         "Who is \"%s.%s\"? Tell \"%s.%s\"@%02x:%02x:%02x:%02x:%02x:%02x",
-                        name[3] ? (char*)name[3] : "?", name[4] ? (char*)name[4] : "?",
-                        name[0] ? (char*)name[0] : "?", name[1] ? (char*)name[1] : "?",
+                        name[3] ? (const char*)name[3] : "?", name[4] ? (const char*)name[4] : "?",
+                        name[0] ? (const char*)name[0] : "?", name[1] ? (const char*)name[1] : "?",
                         *(p + 2), *(p + 3), *(p + 4),
                         *(p + 5), *(p + 6), *(p + 7));
         }
@@ -1631,8 +1631,8 @@ dissect_qnet6_lr(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, gint *
         {
           col_add_fstr(pinfo->cinfo, COL_INFO,
                         "To \"%s.%s\", \"%s.%s\" is at %02x:%02x:%02x:%02x:%02x:%02x",
-                        name[3] ? (char*)name[3] : "?", name[4] ? (char*)name[4] : "?",
-                        name[0] ? (char*)name[0] : "?", name[1] ? (char*)name[1] : "?",
+                        name[3] ? (const char*)name[3] : "?", name[4] ? (const char*)name[4] : "?",
+                        name[0] ? (const char*)name[0] : "?", name[1] ? (const char*)name[1] : "?",
                         *(p + 2), *(p + 3), *(p + 4),
                         *(p + 5), *(p + 6), *(p + 7));
         }
index c318fb004dbc545fa0f6d2f1d33fc545e671e202..23b3dc3fb952089d3c41ab1a5f7633ab31056e74 100644 (file)
@@ -289,7 +289,7 @@ radiusstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const
 {
        rtd_data_t* rtd_data = (rtd_data_t*)prs;
        rtd_stat_table* rs = &rtd_data->stat_table;
-       const radius_info_t *ri = (radius_info_t *)pri;
+       const radius_info_t *ri = (const radius_info_t *)pri;
        nstime_t delta;
        radius_category radius_cat = RADIUS_CAT_OTHERS;
        int ret = 0;
index e42b4eb13490668260065104120af02734fcbfce..0044b7a41a7dfdd95d4e41812db1ba99673909f2 100644 (file)
@@ -2830,13 +2830,13 @@ static void rtps_util_store_type_mapping(tvbuff_t *tvb, gint offset,
   }
 }
 static guint hash_by_guid(gconstpointer key) {
-  endpoint_guid * guid = (endpoint_guid *) key;
+  const endpoint_guid * guid = (const endpoint_guid *) key;
   return g_int_hash(&(guid->app_id));
 }
 
 static gboolean compare_by_guid(gconstpointer a, gconstpointer b) {
-  endpoint_guid * guid_a = (endpoint_guid *) a;
-  endpoint_guid * guid_b = (endpoint_guid *) b;
+  const endpoint_guid * guid_a = (const endpoint_guid *) a;
+  const endpoint_guid * guid_b = (const endpoint_guid *) b;
   return memcmp(guid_a, guid_b, sizeof(endpoint_guid)) == 0;
 }