diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-11-27 22:44:41 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-11-27 22:44:41 +0000 |
commit | acaf3c90b32704ffb34b452c86835577e0fdc38e (patch) | |
tree | 8e47f1f9106bced64150a9789ce39819706bf564 /epan | |
parent | f97b0d79495b032a2feb3a96f400faea45a181b5 (diff) |
Cast various "const gpointer" arguments to const pointers rather than
non-const pointers.
svn path=/trunk/; revision=6683
Diffstat (limited to 'epan')
-rw-r--r-- | epan/circuit.c | 15 | ||||
-rw-r--r-- | epan/conversation.c | 33 | ||||
-rw-r--r-- | epan/frame_data.c | 8 |
3 files changed, 32 insertions, 24 deletions
diff --git a/epan/circuit.c b/epan/circuit.c index 1c4820ef23..e8cbbef0da 100644 --- a/epan/circuit.c +++ b/epan/circuit.c @@ -1,7 +1,7 @@ /* circuit.c * Routines for building lists of packets that are part of a "circuit" * - * $Id: circuit.c,v 1.4 2002/11/08 01:00:07 guy Exp $ + * $Id: circuit.c,v 1.5 2002/11/27 22:44:41 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -62,7 +62,7 @@ static GMemChunk *circuit_proto_data_area = NULL; static guint circuit_hash(gconstpointer v) { - circuit_key *key = (circuit_key *)v; + const circuit_key *key = (const circuit_key *)v; return key->ctype ^ key->circuit_id; } @@ -73,8 +73,8 @@ circuit_hash(gconstpointer v) static gint circuit_match(gconstpointer v, gconstpointer w) { - circuit_key *v1 = (circuit_key *)v; - circuit_key *v2 = (circuit_key *)w; + const circuit_key *v1 = (const circuit_key *)v; + const circuit_key *v2 = (const circuit_key *)w; return v1->ctype == v2->ctype && v1->circuit_id == v2->circuit_id; } @@ -236,9 +236,12 @@ close_circuit(circuit_t *circuit, guint32 last_frame) static gint p_compare(gconstpointer a, gconstpointer b) { - if (((circuit_proto_data *)a)->proto > ((circuit_proto_data *)b)->proto) + const circuit_proto_data *ap = (const circuit_proto_data *)a; + const circuit_proto_data *bp = (const circuit_proto_data *)b; + + if (ap->proto > bp->proto) return 1; - else if (((circuit_proto_data *)a)->proto == ((circuit_proto_data *)b)->proto) + else if (ap->proto == bp->proto) return 0; else return -1; diff --git a/epan/conversation.c b/epan/conversation.c index 44fe761fbb..09a5f5c240 100644 --- a/epan/conversation.c +++ b/epan/conversation.c @@ -1,7 +1,7 @@ /* conversation.c * Routines for building lists of packets that are part of a "conversation" * - * $Id: conversation.c,v 1.21 2002/10/29 07:22:55 guy Exp $ + * $Id: conversation.c,v 1.22 2002/11/27 22:44:41 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -94,7 +94,7 @@ static GMemChunk *conv_proto_data_area = NULL; static guint conversation_hash_exact(gconstpointer v) { - conversation_key *key = (conversation_key *)v; + const conversation_key *key = (const conversation_key *)v; guint hash_val; int i; @@ -118,8 +118,8 @@ conversation_hash_exact(gconstpointer v) static gint conversation_match_exact(gconstpointer v, gconstpointer w) { - conversation_key *v1 = (conversation_key *)v; - conversation_key *v2 = (conversation_key *)w; + const conversation_key *v1 = (const conversation_key *)v; + const conversation_key *v2 = (const conversation_key *)w; if (v1->ptype != v2->ptype) return 0; /* different types of port */ @@ -171,7 +171,7 @@ conversation_match_exact(gconstpointer v, gconstpointer w) static guint conversation_hash_no_addr2(gconstpointer v) { - conversation_key *key = (conversation_key *)v; + const conversation_key *key = (const conversation_key *)v; guint hash_val; int i; @@ -195,8 +195,8 @@ conversation_hash_no_addr2(gconstpointer v) static gint conversation_match_no_addr2(gconstpointer v, gconstpointer w) { - conversation_key *v1 = (conversation_key *)v; - conversation_key *v2 = (conversation_key *)w; + const conversation_key *v1 = (const conversation_key *)v; + const conversation_key *v2 = (const conversation_key *)w; if (v1->ptype != v2->ptype) return 0; /* different types of port */ @@ -229,7 +229,7 @@ conversation_match_no_addr2(gconstpointer v, gconstpointer w) static guint conversation_hash_no_port2(gconstpointer v) { - conversation_key *key = (conversation_key *)v; + const conversation_key *key = (const conversation_key *)v; guint hash_val; int i; @@ -254,8 +254,8 @@ conversation_hash_no_port2(gconstpointer v) static gint conversation_match_no_port2(gconstpointer v, gconstpointer w) { - conversation_key *v1 = (conversation_key *)v; - conversation_key *v2 = (conversation_key *)w; + const conversation_key *v1 = (const conversation_key *)v; + const conversation_key *v2 = (const conversation_key *)w; if (v1->ptype != v2->ptype) return 0; /* different types of port */ @@ -288,7 +288,7 @@ conversation_match_no_port2(gconstpointer v, gconstpointer w) static guint conversation_hash_no_addr2_or_port2(gconstpointer v) { - conversation_key *key = (conversation_key *)v; + const conversation_key *key = (const conversation_key *)v; guint hash_val; int i; @@ -310,8 +310,8 @@ conversation_hash_no_addr2_or_port2(gconstpointer v) static gint conversation_match_no_addr2_or_port2(gconstpointer v, gconstpointer w) { - conversation_key *v1 = (conversation_key *)v; - conversation_key *v2 = (conversation_key *)w; + const conversation_key *v1 = (const conversation_key *)v; + const conversation_key *v2 = (const conversation_key *)w; if (v1->ptype != v2->ptype) return 0; /* different types of port */ @@ -834,9 +834,12 @@ find_conversation(address *addr_a, address *addr_b, port_type ptype, static gint p_compare(gconstpointer a, gconstpointer b) { - if (((conv_proto_data *)a)->proto > ((conv_proto_data *)b)->proto) + const conv_proto_data *ap = (const conv_proto_data *)a; + const conv_proto_data *bp = (const conv_proto_data *)b; + + if (ap->proto > bp->proto) return 1; - else if (((conv_proto_data *)a)->proto == ((conv_proto_data *)b)->proto) + else if (ap->proto == bp->proto) return 0; else return -1; diff --git a/epan/frame_data.c b/epan/frame_data.c index e4be1a8385..4674bb186b 100644 --- a/epan/frame_data.c +++ b/epan/frame_data.c @@ -1,7 +1,7 @@ /* frame_data.c * Routines for packet disassembly * - * $Id: frame_data.c,v 1.3 2002/08/28 20:40:44 jmayer Exp $ + * $Id: frame_data.c,v 1.4 2002/11/27 22:44:41 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -79,10 +79,12 @@ frame_data_cleanup(void) */ static gint p_compare(gconstpointer a, gconstpointer b) { + const frame_proto_data *ap = (const frame_proto_data *)a; + const frame_proto_data *bp = (const frame_proto_data *)b; - if (((frame_proto_data *)a) -> proto > ((frame_proto_data *)b) -> proto) + if (ap -> proto > bp -> proto) return 1; - else if (((frame_proto_data *)a) -> proto == ((frame_proto_data *)b) -> proto) + else if (ap -> proto == bp -> proto) return 0; else return -1; |