Get rid of Warnings.
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 20 Nov 2011 12:43:04 +0000 (12:43 +0000)
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Sun, 20 Nov 2011 12:43:04 +0000 (12:43 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@39957 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-amqp.c
epan/dissectors/packet-dmp.c
epan/dissectors/packet-dns.c
epan/dissectors/packet-dns.h
epan/dissectors/packet-per.h
epan/dissectors/packet-t125.c
epan/emem.h

index c4885f1ef4b3f130d0b73ca535858958bb1bed10..d6e00d17d1bc638bf2add588e0fdecfea1437bed 100644 (file)
@@ -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) {
index d142a0b33d01e63bdc988d7b180b3aad43af2cc4..4e2b528f6e5c822b65b9f98f354f8004ae77ab2d 100644 (file)
@@ -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
   };
index fca90a736970e17666e793331abd19724ed46666..721627bd6b8a79b7df8c10c61043bde2bf2767d0 100644 (file)
@@ -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;
index b6135e5cf7bdba3ec962eb8eaf140490756ef8db..048ee37d67024ea435fcc372c80100e29cf001c6 100644 (file)
@@ -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. */
index 0c3c95a96bb981e738d4f257a6dbdc28f720742d..97aa8823d0f25a081c42ffd9dfabf2bf332a3893 100644 (file)
@@ -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);
 
index a581d06d53a996ddb04bf67c1b89bdd435800cf3..22d41a67c222f91ba64d64eeaf328957ae32f430 100644 (file)
@@ -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);
index 8989abbf4e2ca0f051ba31a5f9f030505e2db70a..ffa9704df586b4205b65ed55f44036680381bf88 100644 (file)
@@ -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;