From a10b98284c44bcafc86ee440ce936cfe305fe01b Mon Sep 17 00:00:00 2001 From: Anders Broman Date: Tue, 19 Mar 2013 04:54:30 +0000 Subject: [PATCH] From beroset: remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 svn path=/trunk/; revision=48412 --- asn1/spnego/packet-spnego-template.c | 20 ++++++++++---------- epan/dissectors/packet-fcp.c | 14 +++++++------- epan/dissectors/packet-fcswils.c | 12 ++++++------ epan/dissectors/packet-fp_hint.c | 12 ++++++------ epan/dissectors/packet-icmp.c | 14 +++++++------- epan/dissectors/packet-ipx.c | 12 ++++++------ epan/dissectors/packet-ipx.h | 15 ++++++++------- epan/dissectors/packet-ositp.c | 14 +++++++------- epan/dissectors/packet-reload.c | 14 +++++++------- epan/dissectors/packet-selfm.c | 14 +++++++------- epan/dissectors/packet-spnego.c | 20 ++++++++++---------- epan/dissectors/packet-tacacs.c | 12 ++++++------ epan/dissectors/packet-udp.c | 12 ++++++------ epan/dissectors/packet-xmpp-core.c | 14 +++++++------- epan/dissectors/packet-xmpp-gtalk.c | 2 +- epan/dissectors/packet-xmpp.c | 4 ++-- epan/ex-opt.c | 12 ++++++------ epan/stream.c | 14 +++++++------- ui/iface_lists.c | 12 ++++++------ 19 files changed, 122 insertions(+), 121 deletions(-) diff --git a/asn1/spnego/packet-spnego-template.c b/asn1/spnego/packet-spnego-template.c index da381540d1..357cd9f2f2 100644 --- a/asn1/spnego/packet-spnego-template.c +++ b/asn1/spnego/packet-spnego-template.c @@ -337,23 +337,23 @@ arcfour_mic_key(void *key_data, size_t key_size, int key_type, memcpy(L40 + 10, T, sizeof(T)); md5_hmac( L40, 14, - key_data, + (guint8 *)key_data, key_size, - k5_data); + k5_data); memset(&k5_data[7], 0xAB, 9); } else { md5_hmac( T, 4, - key_data, + (guint8 *)key_data, key_size, - k5_data); + k5_data); } md5_hmac( - cksum_data, cksum_size, - k5_data, + (guint8 *)cksum_data, cksum_size, + (guint8 *)k5_data, 16, - key6_data); + (guint8 *)key6_data); return 0; } @@ -402,9 +402,9 @@ arcfour_mic_cksum(guint8 *key_data, int key_length, t[2] = (rc4_usage >> 16) & 0xFF; t[3] = (rc4_usage >> 24) & 0xFF; md5_append(&ms, t, 4); - md5_append(&ms, v1, l1); - md5_append(&ms, v2, l2); - md5_append(&ms, v3, l3); + md5_append(&ms, (guint8 *)v1, l1); + md5_append(&ms, (guint8 *)v2, l2); + md5_append(&ms, (guint8 *)v3, l3); md5_finish(&ms, digest); md5_hmac(digest, 16, ksign_c, 16, cksum); diff --git a/epan/dissectors/packet-fcp.c b/epan/dissectors/packet-fcp.c index fb09cfda96..e1b7c30089 100644 --- a/epan/dissectors/packet-fcp.c +++ b/epan/dissectors/packet-fcp.c @@ -429,18 +429,18 @@ dissect_fcp_cmnd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, pro fchdr->itlq->lun = lun; if (!pinfo->fd->flags.visited) { - proto_data = se_alloc(sizeof(fcp_proto_data_t)); + proto_data = se_new(fcp_proto_data_t); proto_data->lun = lun; p_add_proto_data(pinfo->fd, proto_fcp, proto_data); } request_data = (fcp_request_data_t*)se_tree_lookup32(fcp_conv_data->luns, lun); if (!request_data) { - request_data = se_alloc(sizeof(fcp_request_data_t)); + request_data = se_new(fcp_request_data_t); request_data->request_frame = pinfo->fd->num; request_data->response_frame = 0; request_data->request_time = pinfo->fd->abs_ts; - request_data->itl = se_alloc(sizeof(itl_nexus_t)); + request_data->itl = se_new(itl_nexus_t); request_data->itl->cmdset = 0xff; request_data->itl->conversation = conversation; se_tree_insert32(fcp_conv_data->luns, lun, request_data); @@ -704,10 +704,10 @@ dissect_fcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) pinfo->ptype, pinfo->srcport, pinfo->destport, 0); if (fc_conv != NULL) { - fcp_conv_data = conversation_get_proto_data(fc_conv, proto_fcp); + fcp_conv_data = (fcp_conv_data_t *)conversation_get_proto_data(fc_conv, proto_fcp); } if (!fcp_conv_data) { - fcp_conv_data = se_alloc(sizeof(fcp_conv_data_t)); + fcp_conv_data = se_new(fcp_conv_data_t); fcp_conv_data->luns = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "FCP Luns"); conversation_add_proto_data(fc_conv, proto_fcp, fcp_conv_data); } @@ -716,11 +716,11 @@ dissect_fcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) The only way that consistently works is to save the lun on the first pass when packets are guaranteed to be parsed consecutively */ if (!pinfo->fd->flags.visited) { - proto_data = se_alloc(sizeof(fcp_proto_data_t)); + proto_data = se_new(fcp_proto_data_t); proto_data->lun = fchdr->itlq->lun; p_add_proto_data(pinfo->fd, proto_fcp, proto_data); } else { - proto_data = p_get_proto_data(pinfo->fd, proto_fcp); + proto_data = (fcp_proto_data_t *)p_get_proto_data(pinfo->fd, proto_fcp); fchdr->itlq->lun = proto_data->lun; } diff --git a/epan/dissectors/packet-fcswils.c b/epan/dissectors/packet-fcswils.c index f286aea450..5eec554b0a 100644 --- a/epan/dissectors/packet-fcswils.c +++ b/epan/dissectors/packet-fcswils.c @@ -435,8 +435,8 @@ static gint get_zoneobj_len(tvbuff_t *tvb, gint offset); static gint fcswils_equal(gconstpointer v, gconstpointer w) { - const fcswils_conv_key_t *v1 = v; - const fcswils_conv_key_t *v2 = w; + const fcswils_conv_key_t *v1 = (const fcswils_conv_key_t *)v; + const fcswils_conv_key_t *v2 = (const fcswils_conv_key_t *)w; return (v1->conv_idx == v2->conv_idx); } @@ -444,7 +444,7 @@ fcswils_equal(gconstpointer v, gconstpointer w) static guint fcswils_hash(gconstpointer v) { - const fcswils_conv_key_t *key = v; + const fcswils_conv_key_t *key = (const fcswils_conv_key_t *)v; guint val; val = key->conv_idx; @@ -758,7 +758,7 @@ dissect_swils_elp(tvbuff_t *tvb, proto_tree *elp_tree, guint8 isreq _U_) char *flagsbuf; gint stroff, returned_length; - flagsbuf=ep_alloc(MAX_FLAGS_LEN); + flagsbuf=(char *)ep_alloc(MAX_FLAGS_LEN); stroff = 0; returned_length = g_snprintf(flagsbuf+stroff, MAX_FLAGS_LEN-stroff, @@ -1806,10 +1806,10 @@ dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) cdata->opcode = opcode; } else { - req_key = se_alloc(sizeof(fcswils_conv_key_t)); + req_key = se_new(fcswils_conv_key_t); req_key->conv_idx = conversation->index; - cdata = se_alloc(sizeof(fcswils_conv_data_t)); + cdata = se_new(fcswils_conv_data_t); cdata->opcode = opcode; g_hash_table_insert(fcswils_req_hash, req_key, cdata); diff --git a/epan/dissectors/packet-fp_hint.c b/epan/dissectors/packet-fp_hint.c index bce45f74df..df9c238eaf 100644 --- a/epan/dissectors/packet-fp_hint.c +++ b/epan/dissectors/packet-fp_hint.c @@ -147,14 +147,14 @@ static guint16 assign_rb_info(tvbuff_t *tvb, packet_info *pinfo, guint16 offset, struct umts_mac_info *macinf; struct rlc_info *rlcinf; - macinf = p_get_proto_data(pinfo->fd, proto_umts_mac); - rlcinf = p_get_proto_data(pinfo->fd, proto_rlc); + macinf = (umts_mac_info *)p_get_proto_data(pinfo->fd, proto_umts_mac); + rlcinf = (rlc_info *)p_get_proto_data(pinfo->fd, proto_rlc); if (!macinf) { - macinf = se_alloc0(sizeof(struct umts_mac_info)); + macinf = se_new0(struct umts_mac_info); p_add_proto_data(pinfo->fd, proto_umts_mac, macinf); } if (!rlcinf) { - rlcinf = se_alloc0(sizeof(struct rlc_info)); + rlcinf = se_new0(struct rlc_info); p_add_proto_data(pinfo->fd, proto_rlc, rlcinf); } @@ -428,9 +428,9 @@ static void attach_info(tvbuff_t *tvb, packet_info *pinfo, guint16 offset, guint { fp_info *fpi; - fpi = p_get_proto_data(pinfo->fd, proto_fp); + fpi = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp); if (!fpi) { - fpi = se_alloc0(sizeof(fp_info)); + fpi = se_new0(fp_info); p_add_proto_data(pinfo->fd, proto_fp, fpi); } diff --git a/epan/dissectors/packet-icmp.c b/epan/dissectors/packet-icmp.c index 90c84ad470..d7c8cad94f 100644 --- a/epan/dissectors/packet-icmp.c +++ b/epan/dissectors/packet-icmp.c @@ -1019,9 +1019,9 @@ static icmp_transaction_t *transaction_start(packet_info * pinfo, /* Handle the conversation tracking */ conversation = _find_or_create_conversation(pinfo); - icmp_info = conversation_get_proto_data(conversation, proto_icmp); + icmp_info = (icmp_conv_info_t *)conversation_get_proto_data(conversation, proto_icmp); if (icmp_info == NULL) { - icmp_info = se_alloc(sizeof(icmp_conv_info_t)); + icmp_info = se_new(icmp_conv_info_t); icmp_info->unmatched_pdus = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "icmp_unmatched_pdus"); @@ -1041,7 +1041,7 @@ static icmp_transaction_t *transaction_start(packet_info * pinfo, icmp_key[1].length = 0; icmp_key[1].key = NULL; - icmp_trans = se_alloc(sizeof(icmp_transaction_t)); + icmp_trans = se_new(icmp_transaction_t); icmp_trans->rqst_frame = PINFO_FD_NUM(pinfo); icmp_trans->resp_frame = 0; icmp_trans->rqst_time = pinfo->fd->abs_ts; @@ -1060,7 +1060,7 @@ static icmp_transaction_t *transaction_start(packet_info * pinfo, icmp_key[2].key = NULL; icmp_trans = - se_tree_lookup32_array(icmp_info->matched_pdus, + (icmp_transaction_t *)se_tree_lookup32_array(icmp_info->matched_pdus, icmp_key); } if (icmp_trans == NULL) { @@ -1101,7 +1101,7 @@ static icmp_transaction_t *transaction_end(packet_info * pinfo, return NULL; } - icmp_info = conversation_get_proto_data(conversation, proto_icmp); + icmp_info = (icmp_conv_info_t *)conversation_get_proto_data(conversation, proto_icmp); if (icmp_info == NULL) { return NULL; } @@ -1114,7 +1114,7 @@ static icmp_transaction_t *transaction_end(packet_info * pinfo, icmp_key[1].length = 0; icmp_key[1].key = NULL; icmp_trans = - se_tree_lookup32_array(icmp_info->unmatched_pdus, + (icmp_transaction_t *)se_tree_lookup32_array(icmp_info->unmatched_pdus, icmp_key); if (icmp_trans == NULL) { return NULL; @@ -1155,7 +1155,7 @@ static icmp_transaction_t *transaction_end(packet_info * pinfo, icmp_key[2].key = NULL; icmp_trans = - se_tree_lookup32_array(icmp_info->matched_pdus, + (icmp_transaction_t *)se_tree_lookup32_array(icmp_info->matched_pdus, icmp_key); if (icmp_trans == NULL) { diff --git a/epan/dissectors/packet-ipx.c b/epan/dissectors/packet-ipx.c index 5125ccd67f..028caa24c5 100644 --- a/epan/dissectors/packet-ipx.c +++ b/epan/dissectors/packet-ipx.c @@ -488,12 +488,12 @@ spx_hash_insert(conversation_t *conversation, guint32 spx_src, guint16 spx_seq) spx_hash_value *value; /* Now remember the packet, so we can find it if we later. */ - key = se_alloc(sizeof(spx_hash_key)); + key = se_new(spx_hash_key); key->conversation = conversation; key->spx_src = spx_src; key->spx_seq = spx_seq; - value = se_alloc0(sizeof(spx_hash_value)); + value = se_new0(spx_hash_value); g_hash_table_insert(spx_hash, key, value); @@ -510,7 +510,7 @@ spx_hash_lookup(conversation_t *conversation, guint32 spx_src, guint32 spx_seq) key.spx_src = spx_src; key.spx_seq = spx_seq; - return g_hash_table_lookup(spx_hash, &key); + return (spx_hash_value *)g_hash_table_lookup(spx_hash, &key); } /* ================================================================= */ @@ -728,7 +728,7 @@ dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * Found in the hash table. Mark this frame as * a retransmission. */ - spx_rexmit_info_p = se_alloc(sizeof(spx_rexmit_info)); + spx_rexmit_info_p = se_new(spx_rexmit_info); spx_rexmit_info_p->num = pkt_value->num; p_add_proto_data(pinfo->fd, proto_spx, spx_rexmit_info_p); @@ -740,7 +740,7 @@ dissect_spx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * data indicates which frame had the original * transmission. */ - spx_rexmit_info_p = p_get_proto_data(pinfo->fd, + spx_rexmit_info_p = (spx_rexmit_info *)p_get_proto_data(pinfo->fd, proto_spx); } } @@ -862,7 +862,7 @@ dissect_ipxrip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *rip_tree; proto_item *ti, *hidden_item; guint16 operation; - struct ipx_rt_def route; + ipx_rt_def_t route; int cursor; int available_length; diff --git a/epan/dissectors/packet-ipx.h b/epan/dissectors/packet-ipx.h index c109881f1a..b0fefa0748 100644 --- a/epan/dissectors/packet-ipx.h +++ b/epan/dissectors/packet-ipx.h @@ -67,16 +67,17 @@ struct sap_query #define IPX_RIP_REQUEST (0x1) #define IPX_RIP_RESPONSE (0x2) +typedef struct _ipx_rt_def +{ + guint32 network ; + guint16 hops ; + guint16 ticks ; +} ipx_rt_def_t; + struct ipx_rip_packet { guint16 operation ; - struct ipx_rt_def - { - guint32 network ; - guint16 hops ; - guint16 ticks ; - } - rt[1] ; + ipx_rt_def_t rt[1] ; }; #define IPX_BROADCAST_NODE ("\xff\xff\xff\xff\xff\xff") diff --git a/epan/dissectors/packet-ositp.c b/epan/dissectors/packet-ositp.c index d33d6854f8..9011cd04e8 100644 --- a/epan/dissectors/packet-ositp.c +++ b/epan/dissectors/packet-ositp.c @@ -356,7 +356,7 @@ static gchar *print_tsap(const guchar *tsap, int length) gboolean allprintable; gint idx = 0, returned_length; - cur=ep_alloc(MAX_TSAP_LEN * 2 + 3); + cur=(gchar *)ep_alloc(MAX_TSAP_LEN * 2 + 3); cur[0] = '\0'; if (length <= 0 || length > MAX_TSAP_LEN) g_snprintf(cur, MAX_TSAP_LEN * 2 + 3, ""); @@ -435,8 +435,8 @@ static gboolean ositp_decode_var_part(tvbuff_t *tvb, int offset, } checksum_ok = check_atn_ec_16(tvb, tpdu_len , offset, offset_iso8073_checksum, - pinfo->dst.len, pinfo->dst.data, - pinfo->src.len, pinfo->src.data); + pinfo->dst.len, (guint8 *)pinfo->dst.data, + pinfo->src.len, (guint8 *)pinfo->src.data); proto_tree_add_text(tree, tvb, offset, length, "ATN extended checksum : 0x%04x (%s)", tvb_get_ntohs(tvb, offset), @@ -466,8 +466,8 @@ static gboolean ositp_decode_var_part(tvbuff_t *tvb, int offset, } checksum_ok = check_atn_ec_32( tvb, tpdu_len , offset, offset_iso8073_checksum, - pinfo->dst.len, pinfo->dst.data, - pinfo->src.len, pinfo->src.data); + pinfo->dst.len, (guint8 *)pinfo->dst.data, + pinfo->src.len, (guint8 *)pinfo->src.data); proto_tree_add_text(tree, tvb, offset, length, "ATN extended checksum : 0x%08x (%s)", tvb_get_ntohl(tvb, offset), @@ -992,10 +992,10 @@ static int ositp_decode_DT(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu, else fragment = TRUE; is_extended = FALSE; - prev_dst_ref = p_get_proto_data (pinfo->fd, proto_clnp); + prev_dst_ref = (guint32 *)p_get_proto_data (pinfo->fd, proto_clnp); if (!prev_dst_ref) { /* First COTP in frame - save previous dst_ref as offset */ - prev_dst_ref = se_alloc (sizeof (guint32)); + prev_dst_ref = se_new(guint32); *prev_dst_ref = cotp_dst_ref; p_add_proto_data (pinfo->fd, proto_clnp, prev_dst_ref); } else if (cotp_frame_reset) { diff --git a/epan/dissectors/packet-reload.c b/epan/dissectors/packet-reload.c index 7d82144756..509696450b 100644 --- a/epan/dissectors/packet-reload.c +++ b/epan/dissectors/packet-reload.c @@ -3971,12 +3971,12 @@ dissect_reload_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* * Do we already have a state structure for this conv */ - reload_info = conversation_get_proto_data(conversation, proto_reload); + reload_info = (reload_conv_info_t *)conversation_get_proto_data(conversation, proto_reload); if (!reload_info) { /* No. Attach that information to the conversation, and add * it to the list of information structures. */ - reload_info = se_alloc(sizeof(reload_conv_info_t)); + reload_info = se_new(reload_conv_info_t); reload_info->transaction_pdus = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "reload_transaction_pdus"); conversation_add_proto_data(conversation, proto_reload, reload_info); } @@ -4162,9 +4162,9 @@ dissect_reload_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!pinfo->fd->flags.visited) { - if ((reload_trans = + if ((reload_trans = (reload_transaction_t *) se_tree_lookup32_array(reload_info->transaction_pdus, transaction_id_key)) == NULL) { - reload_trans = se_alloc(sizeof(reload_transaction_t)); + reload_trans = se_new(reload_transaction_t); reload_trans->req_frame = 0; reload_trans->rep_frame = 0; reload_trans->req_time = pinfo->fd->abs_ts; @@ -4187,12 +4187,12 @@ dissect_reload_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } else { - reload_trans = se_tree_lookup32_array(reload_info->transaction_pdus, transaction_id_key); + reload_trans = (reload_transaction_t *)se_tree_lookup32_array(reload_info->transaction_pdus, transaction_id_key); } if (!reload_trans) { /* create a "fake" pana_trans structure */ - reload_trans = ep_alloc(sizeof(reload_transaction_t)); + reload_trans = ep_new(reload_transaction_t); reload_trans->req_frame = 0; reload_trans->rep_frame = 0; reload_trans->req_time = pinfo->fd->abs_ts; @@ -5885,7 +5885,7 @@ proto_register_reload(void) sizeof(kind_t), "reload_kindids", /* filename */ TRUE, /* from_profile */ - (void*) &kindidlist_uats, /* data_ptr */ + (void**) &kindidlist_uats, /* data_ptr */ &nreloadkinds, /* numitems_ptr */ UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */ NULL, /* Help section (currently a wiki page) */ diff --git a/epan/dissectors/packet-selfm.c b/epan/dissectors/packet-selfm.c index 530b6c7a75..5ecea603f6 100644 --- a/epan/dissectors/packet-selfm.c +++ b/epan/dissectors/packet-selfm.c @@ -767,7 +767,7 @@ clean_telnet_iac(packet_info *pinfo, tvbuff_t *tvb, int offset, int len) int skip, l; spos=tvb_get_ptr(tvb, offset, len); - buf=g_malloc(len); + buf=(guint8 *)g_malloc(len); dpos=buf; skip=0; l=len; @@ -800,7 +800,7 @@ static fm_config_frame* fmconfig_frame_fast(tvbuff_t *tvb) fm_config_frame *frame; /* get a new frame and initialize it */ - frame = wmem_alloc(wmem_file_scope(), sizeof(fm_config_frame)); + frame = (fm_config_frame *)wmem_alloc(wmem_file_scope(), sizeof(fm_config_frame)); /* Get data packet setup information from config message and copy into ai_info (if required) */ frame->cfg_cmd = tvb_get_ntohs(tvb, offset); @@ -824,7 +824,7 @@ static fm_config_frame* fmconfig_frame_fast(tvbuff_t *tvb) /* Update offset pointer */ offset += 6; - frame->analogs = wmem_alloc(wmem_file_scope(), frame->num_ai * sizeof(fm_analog_info)); + frame->analogs = (fm_analog_info *)wmem_alloc(wmem_file_scope(), frame->num_ai * sizeof(fm_analog_info)); /* Get AI Channel Details and copy into ai_info */ for (count = 0; count < frame->num_ai; count++) { @@ -1005,13 +1005,13 @@ dissect_fmdata_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int of /* Search for previously-encountered Configuration information to dissect the frame */ { - conv = p_get_proto_data(pinfo->fd, proto_selfm); + conv = (fm_conversation *)p_get_proto_data(pinfo->fd, proto_selfm); if (conv) { wmem_slist_frame_t *frame = wmem_slist_front(conv->fm_config_frames); /* Cycle through possible instances of multiple fm_config_data_blocks, looking for match */ while (frame && !config_found) { - cfg_data = wmem_slist_frame_data(frame); + cfg_data = (fm_config_frame *)wmem_slist_frame_data(frame); config_cmd = cfg_data->cfg_cmd; /* If the stored config_cmd matches the expected one we are looking for, mark that the config data was found */ @@ -1808,10 +1808,10 @@ dissect_selfm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Find a conversation, create a new if no one exists */ conversation = find_or_create_conversation(pinfo); - conv_data = conversation_get_proto_data(conversation, proto_selfm); + conv_data = (fm_conversation *)conversation_get_proto_data(conversation, proto_selfm); if (conv_data == NULL) { - conv_data = wmem_alloc(wmem_file_scope(), sizeof(fm_conversation)); + conv_data = (fm_conversation *)wmem_alloc(wmem_file_scope(), sizeof(fm_conversation)); conv_data->fm_config_frames = wmem_slist_new(wmem_file_scope()); conversation_add_proto_data(conversation, proto_selfm, (void *)conv_data); } diff --git a/epan/dissectors/packet-spnego.c b/epan/dissectors/packet-spnego.c index f712cd20d0..085be0235a 100644 --- a/epan/dissectors/packet-spnego.c +++ b/epan/dissectors/packet-spnego.c @@ -818,23 +818,23 @@ arcfour_mic_key(void *key_data, size_t key_size, int key_type, memcpy(L40 + 10, T, sizeof(T)); md5_hmac( L40, 14, - key_data, + (guint8 *)key_data, key_size, - k5_data); + k5_data); memset(&k5_data[7], 0xAB, 9); } else { md5_hmac( T, 4, - key_data, + (guint8 *)key_data, key_size, - k5_data); + k5_data); } md5_hmac( - cksum_data, cksum_size, - k5_data, + (guint8 *)cksum_data, cksum_size, + (guint8 *)k5_data, 16, - key6_data); + (guint8 *)key6_data); return 0; } @@ -883,9 +883,9 @@ arcfour_mic_cksum(guint8 *key_data, int key_length, t[2] = (rc4_usage >> 16) & 0xFF; t[3] = (rc4_usage >> 24) & 0xFF; md5_append(&ms, t, 4); - md5_append(&ms, v1, l1); - md5_append(&ms, v2, l2); - md5_append(&ms, v3, l3); + md5_append(&ms, (guint8 *)v1, l1); + md5_append(&ms, (guint8 *)v2, l2); + md5_append(&ms, (guint8 *)v3, l3); md5_finish(&ms, digest); md5_hmac(digest, 16, ksign_c, 16, cksum); diff --git a/epan/dissectors/packet-tacacs.c b/epan/dissectors/packet-tacacs.c index cc54ff5080..7856aa4996 100644 --- a/epan/dissectors/packet-tacacs.c +++ b/epan/dissectors/packet-tacacs.c @@ -355,7 +355,7 @@ tacplus_decrypted_tvb_setup( tvbuff_t *tvb, tvbuff_t **dst_tvb, packet_info *pin tvb_memcpy(tvb, session_id, 4,4); - buff = tvb_memdup(tvb, TAC_PLUS_HDR_SIZE, len); + buff = (guint8 *)tvb_memdup(tvb, TAC_PLUS_HDR_SIZE, len); md5_xor( buff, key, len, session_id,version, tvb_get_guint8(tvb,2) ); @@ -793,8 +793,8 @@ tacplus_print_key_entry( gpointer data, gpointer user_data ) static int cmp_conv_address( gconstpointer p1, gconstpointer p2 ) { - const tacplus_key_entry *a1=p1; - const tacplus_key_entry *a2=p2; + const tacplus_key_entry *a1=(const tacplus_key_entry *)p1; + const tacplus_key_entry *a2=(const tacplus_key_entry *)p2; gint32 ret; /* printf("p1=>"); @@ -837,8 +837,8 @@ mkipv4_address( address **addr, const char *str_addr ) { char *addr_data; - *addr=g_malloc( sizeof(address) ); - addr_data=g_malloc( 4 ); + *addr=(address *)g_malloc( sizeof(address) ); + addr_data=(char *)g_malloc( 4 ); inet_pton( AF_INET, str_addr, addr_data ); SET_ADDRESS(*addr, AT_IPv4, 4, addr_data); } @@ -846,7 +846,7 @@ static void parse_tuple( char *key_from_option ) { char *client,*key; - tacplus_key_entry *tacplus_data=g_malloc( sizeof(tacplus_key_entry) ); + tacplus_key_entry *tacplus_data=(tacplus_key_entry *)g_malloc( sizeof(tacplus_key_entry) ); /* printf("keys: %s\n", key_from_option ); */ diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c index 2249baaeaa..31dc7bb3aa 100644 --- a/epan/dissectors/packet-udp.c +++ b/epan/dissectors/packet-udp.c @@ -107,7 +107,7 @@ init_udp_conversation_data(void) struct udp_analysis *udpd; /* Initialize the udp protocol data structure to add to the udp conversation */ - udpd = se_alloc0(sizeof(struct udp_analysis)); + udpd = se_new0(struct udp_analysis); /* udpd->flow1.username = NULL; udpd->flow1.command = NULL; @@ -129,7 +129,7 @@ get_udp_conversation_data(conversation_t *conv, packet_info *pinfo) conv = find_or_create_conversation(pinfo); /* Get the data for this conversation */ - udpd=conversation_get_proto_data(conv, proto_udp); + udpd=(struct udp_analysis *)conversation_get_proto_data(conv, proto_udp); /* If the conversation was just created or it matched a * conversation with template options, udpd will not @@ -179,7 +179,7 @@ add_udp_process_info(guint32 frame_num, address *local_addr, address *remote_add return; } - udpd = conversation_get_proto_data(conv, proto_udp); + udpd = (struct udp_analysis *)conversation_get_proto_data(conv, proto_udp); if (!udpd) { return; } @@ -302,7 +302,7 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto) struct udp_analysis *udpd = NULL; proto_tree *process_tree; - udph=ep_alloc(sizeof(e_udphdr)); + udph=ep_new(e_udphdr); SET_ADDRESS(&udph->ip_src, pinfo->src.type, pinfo->src.len, pinfo->src.data); SET_ADDRESS(&udph->ip_dst, pinfo->dst.type, pinfo->dst.len, pinfo->dst.data); @@ -452,9 +452,9 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto) if (((ip_proto == IP_PROTO_UDP) && (udp_check_checksum)) || ((ip_proto == IP_PROTO_UDPLITE) && (udplite_check_checksum))) { /* Set up the fields of the pseudo-header. */ - cksum_vec[0].ptr = pinfo->src.data; + cksum_vec[0].ptr = (guint8 *)pinfo->src.data; cksum_vec[0].len = pinfo->src.len; - cksum_vec[1].ptr = pinfo->dst.data; + cksum_vec[1].ptr = (guint8 *)pinfo->dst.data; cksum_vec[1].len = pinfo->dst.len; cksum_vec[2].ptr = (const guint8 *)&phdr; switch (pinfo->src.type) { diff --git a/epan/dissectors/packet-xmpp-core.c b/epan/dissectors/packet-xmpp-core.c index 4f0697afda..b7c6c2ee67 100644 --- a/epan/dissectors/packet-xmpp-core.c +++ b/epan/dissectors/packet-xmpp-core.c @@ -149,7 +149,7 @@ xmpp_iq(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *pac attr_type = xmpp_get_attr(packet, "type"); conversation = find_or_create_conversation(pinfo); - xmpp_info = conversation_get_proto_data(conversation, proto_xmpp); + xmpp_info = (xmpp_conv_info_t *)conversation_get_proto_data(conversation, proto_xmpp); xmpp_iq_item = proto_tree_add_item(tree, hf_xmpp_iq, tvb, packet->offset, packet->length, ENC_LITTLE_ENDIAN); xmpp_iq_tree = proto_item_add_subtree(xmpp_iq_item,ett_xmpp_iq); @@ -168,28 +168,28 @@ xmpp_iq(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *pac { gchar *jingle_sid, *ibb_sid, *gtalk_sid; - jingle_sid = se_tree_lookup_string(xmpp_info->jingle_sessions, attr_id->value, EMEM_TREE_STRING_NOCASE); + jingle_sid = (gchar *)se_tree_lookup_string(xmpp_info->jingle_sessions, attr_id->value, EMEM_TREE_STRING_NOCASE); if (jingle_sid) { proto_item *it = proto_tree_add_string(tree, hf_xmpp_jingle_session, tvb, 0, 0, jingle_sid); PROTO_ITEM_SET_GENERATED(it); } - ibb_sid = se_tree_lookup_string(xmpp_info->ibb_sessions, attr_id->value, EMEM_TREE_STRING_NOCASE); + ibb_sid = (gchar *)se_tree_lookup_string(xmpp_info->ibb_sessions, attr_id->value, EMEM_TREE_STRING_NOCASE); if (ibb_sid) { proto_item *it = proto_tree_add_string(tree, hf_xmpp_ibb, tvb, 0, 0, ibb_sid); PROTO_ITEM_SET_GENERATED(it); } - gtalk_sid = se_tree_lookup_string(xmpp_info->gtalk_sessions, attr_id->value, EMEM_TREE_STRING_NOCASE); + gtalk_sid = (gchar *)se_tree_lookup_string(xmpp_info->gtalk_sessions, attr_id->value, EMEM_TREE_STRING_NOCASE); if (gtalk_sid) { proto_item *it = proto_tree_add_string(tree, hf_xmpp_gtalk, tvb, 0, 0, gtalk_sid); PROTO_ITEM_SET_GENERATED(it); } - reqresp_trans = se_tree_lookup_string(xmpp_info->req_resp, attr_id->value, EMEM_TREE_STRING_NOCASE); + reqresp_trans = (xmpp_transaction_t *)se_tree_lookup_string(xmpp_info->req_resp, attr_id->value, EMEM_TREE_STRING_NOCASE); /*displays request/response field in each iq packet*/ if (reqresp_trans) { @@ -403,7 +403,7 @@ xmpp_message(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t id = xmpp_get_attr(packet, "id"); conversation = find_or_create_conversation(pinfo); - xmpp_info = conversation_get_proto_data(conversation, proto_xmpp); + xmpp_info = (xmpp_conv_info_t *)conversation_get_proto_data(conversation, proto_xmpp); message_item = proto_tree_add_item(tree, hf_xmpp_message, tvb, packet->offset, packet->length, ENC_BIG_ENDIAN); message_tree = proto_item_add_subtree(message_item, ett_xmpp_message); @@ -423,7 +423,7 @@ xmpp_message(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t { gchar *ibb_sid; - ibb_sid = se_tree_lookup_string(xmpp_info->ibb_sessions, id->value, EMEM_TREE_STRING_NOCASE); + ibb_sid = (gchar *)se_tree_lookup_string(xmpp_info->ibb_sessions, id->value, EMEM_TREE_STRING_NOCASE); if (ibb_sid) { proto_item *it = proto_tree_add_string(tree, hf_xmpp_ibb, tvb, 0, 0, ibb_sid); diff --git a/epan/dissectors/packet-xmpp-gtalk.c b/epan/dissectors/packet-xmpp-gtalk.c index 24eca11aef..676e090490 100644 --- a/epan/dissectors/packet-xmpp-gtalk.c +++ b/epan/dissectors/packet-xmpp-gtalk.c @@ -333,7 +333,7 @@ xmpp_gtalk_usersetting(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp for(i = 0; i < g_list_length(element->elements); i++) { GList *elem_l = g_list_nth(element->elements,i); - xmpp_element_t *elem = elem_l?elem_l->data:NULL; + xmpp_element_t *elem = (xmpp_element_t *)(elem_l?elem_l->data:NULL); if(elem) { diff --git a/epan/dissectors/packet-xmpp.c b/epan/dissectors/packet-xmpp.c index 2a1cf9c27c..d816048bdc 100644 --- a/epan/dissectors/packet-xmpp.c +++ b/epan/dissectors/packet-xmpp.c @@ -406,7 +406,7 @@ dissect_xmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { col_clear(pinfo->cinfo, COL_INFO); conversation = find_or_create_conversation(pinfo); - xmpp_info = conversation_get_proto_data(conversation, proto_xmpp); + xmpp_info = (xmpp_conv_info_t *)conversation_get_proto_data(conversation, proto_xmpp); if (xmpp_info && xmpp_info->ssl_proceed && xmpp_info->ssl_proceed < pinfo->fd->num) @@ -447,7 +447,7 @@ dissect_xmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { return; if (!xmpp_info) { - xmpp_info = se_alloc(sizeof (xmpp_conv_info_t)); + xmpp_info = se_new(xmpp_conv_info_t); xmpp_info->req_resp = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "xmpp_req_resp"); xmpp_info->jingle_sessions = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "xmpp_jingle_sessions"); xmpp_info->ibb_sessions = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "xmpp_ibb_sessions"); diff --git a/epan/ex-opt.c b/epan/ex-opt.c index 6a1a85cd60..9922078432 100644 --- a/epan/ex-opt.c +++ b/epan/ex-opt.c @@ -42,7 +42,7 @@ gboolean ex_opt_add(const gchar* optarg) { splitted = g_strsplit(optarg,":",2); if (splitted[0] && splitted[1]) { - GPtrArray* this_opts = g_hash_table_lookup(ex_opts,splitted[0]); + GPtrArray* this_opts = (GPtrArray *)g_hash_table_lookup(ex_opts,splitted[0]); if (this_opts) { g_ptr_array_add(this_opts,splitted[1]); @@ -68,7 +68,7 @@ gint ex_opt_count(const gchar* key) { if (! ex_opts) return 0; - this_opts = g_hash_table_lookup(ex_opts,key); + this_opts = (GPtrArray *)g_hash_table_lookup(ex_opts,key); if (this_opts) { return this_opts->len; @@ -83,11 +83,11 @@ const gchar* ex_opt_get_nth(const gchar* key, guint index) { if (! ex_opts) return 0; - this_opts = g_hash_table_lookup(ex_opts,key); + this_opts = (GPtrArray *)g_hash_table_lookup(ex_opts,key); if (this_opts) { if (this_opts->len > index) { - return g_ptr_array_index(this_opts,index); + return (const gchar *)g_ptr_array_index(this_opts,index); } else { /* XXX: assert? */ return NULL; @@ -104,11 +104,11 @@ extern const gchar* ex_opt_get_next(const gchar* key) { if (! ex_opts) return 0; - this_opts = g_hash_table_lookup(ex_opts,key); + this_opts = (GPtrArray *)g_hash_table_lookup(ex_opts,key); if (this_opts) { if (this_opts->len) - return g_ptr_array_remove_index(this_opts,0); + return (const gchar *)g_ptr_array_remove_index(this_opts,0); else return NULL; } else { diff --git a/epan/stream.c b/epan/stream.c index 1784c7d312..66ee51b763 100644 --- a/epan/stream.c +++ b/epan/stream.c @@ -156,7 +156,7 @@ static stream_t *new_stream( stream_key_t *key ) { stream_t *val; - val = se_alloc(sizeof(stream_t)); + val = se_new(stream_t); val -> key = key; val -> pdu_counter = 0; val -> current_pdu = NULL; @@ -173,7 +173,7 @@ static stream_t *stream_hash_insert_circ( const struct circuit *circuit, int p2p { stream_key_t *key; - key = se_alloc(sizeof(stream_key_t)); + key = se_new(stream_key_t); key->is_circuit = TRUE; key->circ.circuit = circuit; key->p2p_dir = p2p_dir; @@ -185,7 +185,7 @@ static stream_t *stream_hash_insert_conv( const struct conversation *conv, int p { stream_key_t *key; - key = se_alloc(sizeof(stream_key_t)); + key = se_new(stream_key_t); key->is_circuit = FALSE; key->circ.conv = conv; key->p2p_dir = p2p_dir; @@ -216,7 +216,7 @@ static void stream_init_pdu_data(void) static stream_pdu_t *stream_new_pdu(stream_t *stream) { stream_pdu_t *pdu; - pdu = se_alloc(sizeof(stream_pdu_t)); + pdu = se_new(stream_pdu_t); pdu -> fd_head = NULL; pdu -> pdu_number = stream -> pdu_counter++; pdu -> id = pdu_counter++; @@ -283,7 +283,7 @@ static stream_pdu_fragment_t *fragment_hash_lookup( const stream_t *stream, guin key.stream = stream; key.framenum = framenum; key.offset = offset; - val = g_hash_table_lookup(fragment_hash, &key); + val = (stream_pdu_fragment_t *)g_hash_table_lookup(fragment_hash, &key); return val; } @@ -296,12 +296,12 @@ static stream_pdu_fragment_t *fragment_hash_insert( const stream_t *stream, guin fragment_key_t *key; stream_pdu_fragment_t *val; - key = se_alloc(sizeof(fragment_key_t)); + key = se_new(fragment_key_t); key->stream = stream; key->framenum = framenum; key->offset = offset; - val = se_alloc(sizeof(stream_pdu_fragment_t)); + val = se_new(stream_pdu_fragment_t); val->len = length; val->pdu = NULL; val->final_fragment = FALSE; diff --git a/ui/iface_lists.c b/ui/iface_lists.c index 7fbdf7e8ec..f19b345e6a 100644 --- a/ui/iface_lists.c +++ b/ui/iface_lists.c @@ -48,7 +48,7 @@ capture_options global_capture_opts; gint if_list_comparator_alph(const void *first_arg, const void *second_arg) { - const if_info_t *first = first_arg, *second = second_arg; + const if_info_t *first = (const if_info_t *)first_arg, *second = (const if_info_t *)second_arg; if (first != NULL && first->friendly_name != NULL && second != NULL && second->friendly_name != NULL) { @@ -98,7 +98,7 @@ scan_local_interfaces(void) if_list = capture_interface_list(&err, NULL); count = 0; for (if_entry = if_list; if_entry != NULL; if_entry = g_list_next(if_entry)) { - if_info = if_entry->data; + if_info = (if_info_t *)if_entry->data; ip_str = g_string_new(""); ips = 0; if (strstr(if_info->name, "rpcap:")) { @@ -112,7 +112,7 @@ scan_local_interfaces(void) } device.hidden = FALSE; device.locked = FALSE; - temp = g_malloc0(sizeof(if_info_t)); + temp = (if_info_t *)g_malloc0(sizeof(if_info_t)); temp->name = g_strdup(if_info->name); temp->friendly_name = g_strdup(if_info->friendly_name); temp->vendor_description = g_strdup(if_info->vendor_description); @@ -163,7 +163,7 @@ scan_local_interfaces(void) monitor_mode = prefs_capture_device_monitor_mode(if_info->name); caps = capture_get_if_capabilities(if_info->name, monitor_mode, NULL); for (; (curr_addr = g_slist_nth(if_info->addrs, ips)) != NULL; ips++) { - temp_addr = g_malloc0(sizeof(if_addr_t)); + temp_addr = (if_addr_t *)g_malloc0(sizeof(if_addr_t)); if (ips != 0) { g_string_append(ip_str, "\n"); } @@ -215,7 +215,7 @@ scan_local_interfaces(void) device.monitor_mode_supported = caps->can_set_rfmon; #endif for (lt_entry = caps->data_link_types; lt_entry != NULL; lt_entry = g_list_next(lt_entry)) { - data_link_info = lt_entry->data; + data_link_info = (data_link_info_t *)lt_entry->data; if (linktype_count == 0) { device.active_dlt = data_link_info->dlt; } @@ -372,7 +372,7 @@ hide_interface(gchar* new_hide) device = g_array_index(global_capture_opts.all_ifaces, interface_t, i); found = FALSE; for (entry = hidden_devices; entry != NULL; entry = g_list_next(entry)) { - if (strcmp(entry->data, device.name)==0) { + if (strcmp((char *)entry->data, device.name)==0) { device.hidden = TRUE; if (device.selected) { device.selected = FALSE;