diff options
author | Anders Broman <anders.broman@ericsson.com> | 2011-11-20 12:43:04 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2011-11-20 12:43:04 +0000 |
commit | 62866c78a006cb680358cda2d40d2140cfb0b97d (patch) | |
tree | e35b0a570aceccc6f2c60e9ab90574475e6eedee | |
parent | 8fdb6af097162f3fdb41a1db045c40dc1fb61f03 (diff) |
Get rid of Warnings.
svn path=/trunk/; revision=39957
-rw-r--r-- | epan/dissectors/packet-amqp.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-dmp.c | 24 | ||||
-rw-r--r-- | epan/dissectors/packet-dns.c | 66 | ||||
-rw-r--r-- | epan/dissectors/packet-dns.h | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-per.h | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-t125.c | 12 | ||||
-rw-r--r-- | epan/emem.h | 2 |
7 files changed, 59 insertions, 57 deletions
diff --git a/epan/dissectors/packet-amqp.c b/epan/dissectors/packet-amqp.c index c4885f1ef4..d6e00d17d1 100644 --- a/epan/dissectors/packet-amqp.c +++ b/epan/dissectors/packet-amqp.c @@ -2967,7 +2967,7 @@ dissect_amqp_0_10_execution(tvbuff_t *tvb, proto_item *args_tree; proto_item *ti; proto_item *flags_item; - guint8 class = 0, method; + guint8 amqp_class = 0, method; guint8 flag1, flag2; guint16 size; guint32 struct_size; @@ -3060,14 +3060,14 @@ dissect_amqp_0_10_execution(tvbuff_t *tvb, } if (flag1 & 0x04) { /* class-code (uint8) */ - class = tvb_get_guint8(tvb, offset); + amqp_class = tvb_get_guint8(tvb, offset); proto_tree_add_item(args_tree, hf_amqp_0_10_class, tvb, offset, 1, ENC_BIG_ENDIAN); AMQP_INCREMENT(offset, 1, length); } if (flag1 & 0x08) { /* command-code (uint8) */ - switch(class) { + switch(amqp_class) { case AMQP_0_10_CLASS_CONNECTION: class_hf = hf_amqp_0_10_connection_method; break; @@ -3107,7 +3107,7 @@ dissect_amqp_0_10_execution(tvbuff_t *tvb, tvb, offset, 1, ENC_BIG_ENDIAN); else expert_add_info_format(pinfo, args_tree, PI_PROTOCOL, PI_WARN, - "Invalid class code %x", class); + "Invalid class code %x", amqp_class); AMQP_INCREMENT(offset, 1, length); } if (flag1 & 0x10) { diff --git a/epan/dissectors/packet-dmp.c b/epan/dissectors/packet-dmp.c index d142a0b33d..4e2b528f6e 100644 --- a/epan/dissectors/packet-dmp.c +++ b/epan/dissectors/packet-dmp.c @@ -547,7 +547,7 @@ static guint dmp_struct_length = 1; typedef struct _dmp_security_class_t { guint nation; - guint class; + guint dmp_class; char *name; } dmp_security_class_t; @@ -1004,17 +1004,17 @@ static const value_string thales_ipm_id_modifier[] = { }; UAT_VS_DEF(dmp_security_class, nation, dmp_security_class_t, 0, "None"); -UAT_DEC_CB_DEF(dmp_security_class, class, dmp_security_class_t); +UAT_DEC_CB_DEF(dmp_security_class, dmp_class, dmp_security_class_t); UAT_CSTRING_CB_DEF(dmp_security_class, name, dmp_security_class_t); static void * dmp_class_copy_cb(void *dest, const void *orig, size_t len _U_) { - dmp_security_class_t *u = dest; - const dmp_security_class_t *o = orig; + dmp_security_class_t *u = (dmp_security_class_t *)dest; + const dmp_security_class_t *o = (const dmp_security_class_t *)orig; u->nation = o->nation; - u->class = o->class; + u->dmp_class = o->dmp_class; u->name = g_strdup(o->name); return dest; @@ -1023,7 +1023,7 @@ dmp_class_copy_cb(void *dest, const void *orig, size_t len _U_) static void dmp_class_free_cb(void *r) { - dmp_security_class_t *u = r; + dmp_security_class_t *u = (dmp_security_class_t *)r; g_free(u->name); } @@ -1035,7 +1035,7 @@ static gchar *dmp_national_sec_class (guint nation, guint dmp_sec_class) for (i = 0; i < num_dmp_security_classes; i++) { dmp_security_class_t *u = &(dmp_security_classes[i]); - if (u->nation == nation && u->class == dmp_sec_class) { + if (u->nation == nation && u->dmp_class == dmp_sec_class) { return u->name; } } @@ -1386,7 +1386,7 @@ static void register_dmp_id (packet_info *pinfo, guint8 reason) nstime_set_zero(&msg_time); - dmp_key = se_alloc (sizeof (dmp_id_key)); + dmp_key = se_new (dmp_id_key); if (!pinfo->fd->flags.visited && (dmp.msg_type == REPORT || dmp.msg_type == NOTIF)) @@ -1443,7 +1443,7 @@ static void register_dmp_id (packet_info *pinfo, guint8 reason) } } else { /* New message */ - dmp_data = se_alloc0 (sizeof (dmp_id_val)); + dmp_data = se_new0 (dmp_id_val); dmp_data->msg_type = dmp.msg_type; if (dmp.msg_type == ACK) { @@ -1469,12 +1469,12 @@ static void register_dmp_id (packet_info *pinfo, guint8 reason) } } - pkg_data = se_alloc (sizeof (dmp_id_val)); + pkg_data = se_new (dmp_id_val); *pkg_data = *dmp_data; p_add_proto_data (pinfo->fd, proto_dmp, pkg_data); } else { /* Fetch last values from data saved in packet */ - pkg_data = p_get_proto_data (pinfo->fd, proto_dmp); + pkg_data = (dmp_id_val *)p_get_proto_data (pinfo->fd, proto_dmp); if (dmp_data && pkg_data && dmp.msg_type != ACK && pkg_data->ack_id == 0) { pkg_data->ack_id = dmp_data->ack_id; @@ -4964,7 +4964,7 @@ void proto_register_dmp (void) static uat_field_t attributes_flds[] = { UAT_FLD_VS(dmp_security_class,nation, "Nation", nat_pol_id, 0), - UAT_FLD_DEC(dmp_security_class,class, "Classification", "Security Classification"), + UAT_FLD_DEC(dmp_security_class,dmp_class, "Classification", "Security Classification"), UAT_FLD_CSTRING(dmp_security_class,name, "Name", "Classification Name"), UAT_END_FIELDS }; diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index fca90a7369..721627bd6b 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -645,9 +645,9 @@ static const value_string dns_classes[] = { }; const char * -dns_class_name(int class) +dns_class_name(int dns_class) { - return val_to_str(class, dns_classes, "Unknown (%u)"); + return val_to_str(dns_class, dns_classes, "Unknown (%u)"); } /* This function returns the number of bytes consumed and the expanded string @@ -845,7 +845,7 @@ get_dns_name_type_class(tvbuff_t *tvb, int offset, int dns_data_offset, int len; int name_len; int type; - int class; + int dns_class; int start_offset = offset; /* XXX Fix data length */ @@ -855,11 +855,11 @@ get_dns_name_type_class(tvbuff_t *tvb, int offset, int dns_data_offset, type = tvb_get_ntohs(tvb, offset); offset += 2; - class = tvb_get_ntohs(tvb, offset); + dns_class = tvb_get_ntohs(tvb, offset); offset += 2; *type_ret = type; - *class_ret = class; + *class_ret = dns_class; *name_len_ret = name_len; len = offset - start_offset; @@ -921,7 +921,7 @@ dissect_dns_query(tvbuff_t *tvb, int offset, int dns_data_offset, gchar *name_out; int name_len; int type; - int class; + int dns_class; int qu; const char *type_name; int data_offset; @@ -932,12 +932,12 @@ dissect_dns_query(tvbuff_t *tvb, int offset, int dns_data_offset, data_start = data_offset = offset; len = get_dns_name_type_class(tvb, offset, dns_data_offset, &name, &name_len, - &type, &class); + &type, &dns_class); data_offset += len; if (is_mdns) { /* Split the QU flag and the class */ - qu = class & C_QU; - class &= ~C_QU; + qu = dns_class & C_QU; + dns_class &= ~C_QU; } else qu = 0; @@ -956,7 +956,7 @@ dissect_dns_query(tvbuff_t *tvb, int offset, int dns_data_offset, } if (dns_tree != NULL) { tq = proto_tree_add_text(dns_tree, tvb, offset, len, "%s: type %s, class %s", - name_out, type_name, dns_class_name(class)); + name_out, type_name, dns_class_name(dns_class)); if (is_mdns) proto_item_append_text(tq, ", \"%s\" question", qu ? "QU" : "QM"); q_tree = proto_item_add_subtree(tq, ett_dns_qd); @@ -969,10 +969,10 @@ dissect_dns_query(tvbuff_t *tvb, int offset, int dns_data_offset, offset += 2; if (is_mdns) { - proto_tree_add_uint(q_tree, hf_dns_qry_class_mdns, tvb, offset, 2, class); + proto_tree_add_uint(q_tree, hf_dns_qry_class_mdns, tvb, offset, 2, dns_class); proto_tree_add_boolean(q_tree, hf_dns_qry_qu, tvb, offset, 2, qu); } else - proto_tree_add_uint(q_tree, hf_dns_qry_class, tvb, offset, 2, class); + proto_tree_add_uint(q_tree, hf_dns_qry_class, tvb, offset, 2, dns_class); offset += 2; } @@ -983,7 +983,7 @@ dissect_dns_query(tvbuff_t *tvb, int offset, int dns_data_offset, static proto_tree * add_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset, - const guchar *name, int namelen, int type, int class, int flush, + const guchar *name, int namelen, int type, int dns_class, int flush, guint ttl, gushort data_len, gboolean is_mdns) { proto_tree *rr_tree; @@ -1019,10 +1019,10 @@ add_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset, "Type: %s", dns_type_description(type)); offset += 2; if (is_mdns) { - proto_tree_add_uint(rr_tree, hf_dns_rr_class_mdns, tvb, offset, 2, class); + proto_tree_add_uint(rr_tree, hf_dns_rr_class_mdns, tvb, offset, 2, dns_class); proto_tree_add_boolean(rr_tree, hf_dns_rr_cache_flush, tvb, offset, 2, flush); } else - proto_tree_add_uint(rr_tree, hf_dns_rr_class, tvb, offset, 2, class); + proto_tree_add_uint(rr_tree, hf_dns_rr_class, tvb, offset, 2, dns_class); offset += 2; proto_tree_add_uint_format(rr_tree, hf_dns_rr_ttl, tvb, offset, 4, ttl, "Time to live: %s", time_secs_to_str(ttl)); @@ -1034,7 +1034,7 @@ add_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset, static proto_tree * add_opt_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset, - const char *name, int namelen, int type, int class, int flush, + const char *name, int namelen, int type, int dns_class, int flush, guint ttl, gushort data_len, gboolean is_mdns) { proto_tree *rr_tree, *Z_tree; @@ -1048,13 +1048,13 @@ add_opt_rr_to_tree(proto_item *trr, int rr_type, tvbuff_t *tvb, int offset, offset += 2; if (is_mdns) { proto_tree_add_text(rr_tree, tvb, offset, 2, "%s", - decode_numeric_bitfield(class, 0x7fff, 16, + decode_numeric_bitfield(dns_class, 0x7fff, 16, "UDP payload size: %u")); proto_tree_add_boolean(rr_tree, hf_dns_rr_cache_flush, tvb, offset, 2, flush); } else { proto_tree_add_text(rr_tree, tvb, offset, 2, "UDP payload size: %u", - class & 0xffff); + dns_class & 0xffff); } offset += 2; proto_tree_add_text(rr_tree, tvb, offset, 1, "Higher bits in extended RCODE: 0x%x", @@ -1199,7 +1199,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, gchar *name_out; int name_len; int type; - int class; + int dns_class; int flush; const char *class_name; const char *type_name; @@ -1215,18 +1215,18 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, cur_offset = offsetx; len = get_dns_name_type_class(tvb, offsetx, dns_data_offset, &name, &name_len, - &type, &class); + &type, &dns_class); data_offset += len; cur_offset += len; if (is_mdns) { /* Split the FLUSH flag and the class */ - flush = class & C_FLUSH; - class &= ~C_FLUSH; + flush = dns_class & C_FLUSH; + dns_class &= ~C_FLUSH; } else flush = 0; type_name = dns_type_name(type); - class_name = dns_class_name(class); + class_name = dns_class_name(dns_class); ttl = tvb_get_ntohl(tvb, data_offset); data_offset += 4; @@ -1253,13 +1253,13 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, "%s: type %s, class %s", name_out, type_name, class_name); rr_tree = add_rr_to_tree(trr, ett_dns_rr, tvb, offsetx, name, name_len, - type, class, flush, ttl, data_len, is_mdns); + type, dns_class, flush, ttl, data_len, is_mdns); } else { trr = proto_tree_add_text(dns_tree, tvb, offsetx, (data_offset - data_start) + data_len, "%s: type %s", name_out, type_name); rr_tree = add_opt_rr_to_tree(trr, ett_dns_rr, tvb, offsetx, name, name_len, - type, class, flush, ttl, data_len, is_mdns); + type, dns_class, flush, ttl, data_len, is_mdns); } if (is_mdns && flush) proto_item_append_text(trr, ", cache flush"); @@ -1282,7 +1282,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, proto_item_append_text(trr, ", addr %s", addr); proto_tree_add_item(rr_tree, hf_dns_rr_addr, tvb, cur_offset, 4, ENC_BIG_ENDIAN); - if ((class & 0x7f) == C_IN) { + if ((dns_class & 0x7f) == C_IN) { tvb_memcpy(tvb, &addr_int, cur_offset, sizeof(addr_int)); add_ipv4_name(addr_int, name); } @@ -1830,7 +1830,7 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset, proto_item_append_text(trr, ", addr %s", addr6); proto_tree_add_text(rr_tree, tvb, cur_offset, 16, "Addr: %s", addr6); - if ((class & 0x7f) == C_IN) { + if ((dns_class & 0x7f) == C_IN) { tvb_memcpy(tvb, &addr_in6, cur_offset, sizeof(addr_in6)); add_ipv6_name(&addr_in6, name); } @@ -3146,35 +3146,35 @@ dissect_dns_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* * Do we already have a state structure for this conv */ - dns_info = conversation_get_proto_data(conversation, proto_dns); + dns_info = (dns_conv_info_t *)conversation_get_proto_data(conversation, proto_dns); if (!dns_info) { /* No. Attach that information to the conversation, and add * it to the list of information structures. */ - dns_info = se_alloc(sizeof(dns_conv_info_t)); + dns_info = se_new(dns_conv_info_t); dns_info->pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "dns_pdus"); conversation_add_proto_data(conversation, proto_dns, dns_info); } if(!pinfo->fd->flags.visited){ if(!(flags&F_RESPONSE)){ /* This is a request */ - dns_trans=se_alloc(sizeof(dns_transaction_t)); + dns_trans=se_new(dns_transaction_t); dns_trans->req_frame=pinfo->fd->num; dns_trans->rep_frame=0; dns_trans->req_time=pinfo->fd->abs_ts; se_tree_insert32(dns_info->pdus, id, (void *)dns_trans); } else { - dns_trans=se_tree_lookup32(dns_info->pdus, id); + dns_trans=(dns_transaction_t *)se_tree_lookup32(dns_info->pdus, id); if(dns_trans){ dns_trans->rep_frame=pinfo->fd->num; } } } else { - dns_trans=se_tree_lookup32(dns_info->pdus, id); + dns_trans=(dns_transaction_t *)se_tree_lookup32(dns_info->pdus, id); } if(!dns_trans){ /* create a "fake" pana_trans structure */ - dns_trans=ep_alloc(sizeof(dns_transaction_t)); + dns_trans=ep_new(dns_transaction_t); dns_trans->req_frame=0; dns_trans->rep_frame=0; dns_trans->req_time=pinfo->fd->abs_ts; diff --git a/epan/dissectors/packet-dns.h b/epan/dissectors/packet-dns.h index b6135e5cf7..048ee37d67 100644 --- a/epan/dissectors/packet-dns.h +++ b/epan/dissectors/packet-dns.h @@ -27,7 +27,7 @@ #ifndef __PACKET_DNS_H__ #define __PACKET_DNS_H__ -const char *dns_class_name(int class); +const char *dns_class_name(int dns_class); int expand_dns_name(tvbuff_t *, int, int, int, const guchar **); /* Just like expand_dns_name, but pretty-prints empty names. */ diff --git a/epan/dissectors/packet-per.h b/epan/dissectors/packet-per.h index 0c3c95a96b..97aa8823d0 100644 --- a/epan/dissectors/packet-per.h +++ b/epan/dissectors/packet-per.h @@ -92,7 +92,7 @@ extern guint32 dissect_per_set_of(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *act extern guint32 dissect_per_object_identifier(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, tvbuff_t **value_tvb); extern guint32 dissect_per_object_identifier_str(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, const char **value_stringx); -extern guint32 dissect_per_boolean(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, gboolean *bool); +extern guint32 dissect_per_boolean(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, gboolean *bool_val); extern guint32 dissect_per_integer(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, gint32 *value); diff --git a/epan/dissectors/packet-t125.c b/epan/dissectors/packet-t125.c index a581d06d53..22d41a67c2 100644 --- a/epan/dissectors/packet-t125.c +++ b/epan/dissectors/packet-t125.c @@ -392,7 +392,7 @@ dissect_t125(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree) { proto_item *item = NULL; proto_tree *tree = NULL; - gint8 class; + gint8 ber_class; gboolean pc; gint32 tag; @@ -404,9 +404,9 @@ dissect_t125(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree) item = proto_tree_add_item(parent_tree, proto_t125, tvb, 0, tvb_length(tvb), ENC_NA); tree = proto_item_add_subtree(item, ett_t125); - get_ber_identifier(tvb, 0, &class, &pc, &tag); + get_ber_identifier(tvb, 0, &ber_class, &pc, &tag); - if ( (class==BER_CLASS_APP) && (tag>=101) && (tag<=104) ){ + if ( (ber_class==BER_CLASS_APP) && (tag>=101) && (tag<=104) ){ dissect_ConnectMCSPDU_PDU(tvb, pinfo, tree); } else { t124_set_top_tree(top_tree); @@ -419,7 +419,7 @@ dissect_t125(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree) static gboolean dissect_t125_heur(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree) { - gint8 class; + gint8 ber_class; gboolean pc; gint32 tag; guint32 choice_index = 100; @@ -428,14 +428,14 @@ dissect_t125_heur(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo); /* could be BER */ - get_ber_identifier(tvb, 0, &class, &pc, &tag); + get_ber_identifier(tvb, 0, &ber_class, &pc, &tag); /* or PER */ dissect_per_constrained_integer(tvb, 0, &asn1_ctx, NULL, hf_t125_heur, 0, 42, &choice_index, FALSE); /* is this strong enough ? */ - if ( ((class==BER_CLASS_APP) && ((tag>=101) && (tag<=104))) || + if ( ((ber_class==BER_CLASS_APP) && ((tag>=101) && (tag<=104))) || (choice_index <=42)) { dissect_t125(tvb, pinfo, parent_tree); diff --git a/epan/emem.h b/epan/emem.h index 8989abbf4e..ffa9704df5 100644 --- a/epan/emem.h +++ b/epan/emem.h @@ -135,9 +135,11 @@ void* ep_stack_pop(ep_stack_t stack); /** Allocate memory with a capture lifetime scope */ void *se_alloc(size_t size) G_GNUC_MALLOC; +#define se_new(type) ((type*)se_alloc(sizeof(type))) /** Allocate memory with a capture lifetime scope and fill it with zeros*/ void* se_alloc0(size_t size) G_GNUC_MALLOC; +#define se_new0(type) ((type*)se_alloc0(sizeof(type))) /** Duplicate a string with a capture lifetime scope */ gchar* se_strdup(const gchar* src) G_GNUC_MALLOC; |