From 55c498169dfc04c1539f8a659113c8f30e53862d Mon Sep 17 00:00:00 2001 From: Anders Broman Date: Mon, 18 Mar 2013 21:16:23 +0000 Subject: From beroset: remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 svn path=/trunk/; revision=48400 --- epan/dissectors/packet-btavdtp.c | 22 +++++++++++----------- epan/dissectors/packet-btrfcomm.c | 16 ++++++++-------- epan/dissectors/packet-btsdp.c | 16 ++++++++-------- epan/dissectors/packet-fmp.c | 16 ++++++++-------- epan/dissectors/packet-iax2.c | 22 +++++++++++----------- epan/dissectors/packet-icmpv6.c | 18 +++++++++--------- epan/dissectors/packet-imf.c | 16 ++++++++-------- epan/dissectors/packet-infiniband.c | 22 +++++++++++----------- epan/dissectors/packet-ip.c | 20 ++++++++++---------- epan/dissectors/packet-ipmi.c | 22 +++++++++++----------- epan/dissectors/packet-kerberos.c | 16 ++++++++-------- epan/dissectors/packet-l2tp.c | 16 ++++++++-------- epan/dissectors/packet-ldss.c | 22 +++++++++++----------- epan/dissectors/packet-mysql.c | 16 ++++++++-------- epan/dissectors/packet-nbd.c | 18 +++++++++--------- epan/dissectors/packet-ppcap.c | 16 ++++++++-------- epan/dissectors/packet-pw-cesopsn.c | 2 +- epan/dissectors/packet-pw-satop.c | 2 +- epan/dissectors/packet-smb-common.c | 6 +++--- epan/dissectors/packet-smb-mailslot.c | 4 ++-- epan/dissectors/packet-smb-pipe.c | 14 +++++++------- epan/dissectors/packet-smb.c | 22 +++++++++++----------- epan/dissectors/packet-vnc.c | 20 ++++++++++---------- epan/strutil.c | 20 ++++++++++---------- epan/to_str.c | 18 +++++++++--------- 25 files changed, 201 insertions(+), 201 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-btavdtp.c b/epan/dissectors/packet-btavdtp.c index d724d9355d..cf35e536a4 100644 --- a/epan/dissectors/packet-btavdtp.c +++ b/epan/dissectors/packet-btavdtp.c @@ -421,7 +421,7 @@ get_sep_type(guint32 frame_number, guint seid) key[2].length = 0; key[2].key = NULL; - sep = se_tree_lookup32_array_le(sep_list, key); + sep = (sep_entry_t *)se_tree_lookup32_array_le(sep_list, key); if (sep && sep->seid == seid) { return val_to_str_const(sep->type, sep_type_vals, "unknown"); } @@ -447,7 +447,7 @@ get_sep_media_type(guint32 frame_number, guint seid) key[2].length = 0; key[2].key = NULL; - sep = se_tree_lookup32_array_le(sep_list, key); + sep = (sep_entry_t *)se_tree_lookup32_array_le(sep_list, key); if (sep && sep->seid == seid) { return val_to_str_const(sep->media_type, media_type_vals, "unknown"); } @@ -505,7 +505,7 @@ dissect_sep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset) key[2].key = NULL; if (!pinfo->fd->flags.visited) { - sep_data = se_alloc(sizeof(sep_entry_t)); + sep_data = se_new(sep_entry_t); sep_data->seid = seid; sep_data->type = type; sep_data->codec = -1; @@ -965,7 +965,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!force_avdtp && !pinfo->fd->flags.visited && (l2cap_data->first_scid_frame == pinfo->fd->num || l2cap_data->first_dcid_frame == pinfo->fd->num)) { - cid_type_data = se_alloc(sizeof(cid_type_data_t)); + cid_type_data = se_new(cid_type_data_t); cid_type_data->type = STREAM_TYPE_MEDIA; cid_type_data->cid = l2cap_data->cid; cid_type_data->sep = NULL; @@ -983,7 +983,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* It is AVDTP Signaling rsp side */ cid_type_data->type = STREAM_TYPE_SIGNAL; } else { - sep = se_tree_lookup32_le(sep_open, pinfo->fd->num); + sep = (sep_entry_t *)se_tree_lookup32_le(sep_open, pinfo->fd->num); if (sep && sep->state == SEP_STATE_OPEN) { sep->state = SEP_STATE_IN_USE; @@ -1022,7 +1022,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) key[3].length = 0; key[3].key = NULL; - cid_type_data = se_tree_lookup32_array_le(cid_to_type_table, key); + cid_type_data = (cid_type_data_t *)se_tree_lookup32_array_le(cid_to_type_table, key); if (cid_type_data && cid_type_data->type == STREAM_TYPE_MEDIA && cid_type_data->cid == l2cap_data->cid) { /* AVDTP Media */ @@ -1137,7 +1137,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) key[2].length = 0; key[2].key = NULL; - sep = se_tree_lookup32_array_le(sep_list, key); + sep = (sep_entry_t *)se_tree_lookup32_array_le(sep_list, key); if (sep && sep->seid == seid) { sep->codec = codec; } @@ -1177,7 +1177,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) key[2].length = 0; key[2].key = NULL; - sep = se_tree_lookup32_array_le(sep_list, key); + sep = (sep_entry_t *)se_tree_lookup32_array_le(sep_list, key); if (sep && sep->seid == seid) { sep->codec = codec; } @@ -1205,7 +1205,7 @@ dissect_btavdtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) key[2].length = 0; key[2].key = NULL; - sep = se_tree_lookup32_array_le(sep_list, key); + sep = (sep_entry_t *)se_tree_lookup32_array_le(sep_list, key); if (sep && sep->seid == seid) { sep->state = SEP_STATE_OPEN; } @@ -2026,7 +2026,7 @@ dissect_bta2dp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) save_private_data = pinfo->private_data; - btavdtp_data = ep_alloc(sizeof(btavdtp_data_t)); + btavdtp_data = ep_new(btavdtp_data_t); btavdtp_data->codec_dissector = codec_dissector; pinfo->private_data = btavdtp_data; @@ -2139,7 +2139,7 @@ dissect_btvdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) save_private_data = pinfo->private_data; - btavdtp_data = ep_alloc(sizeof(btavdtp_data_t)); + btavdtp_data = ep_new(btavdtp_data_t); btavdtp_data->codec_dissector = codec_dissector; pinfo->private_data = btavdtp_data; diff --git a/epan/dissectors/packet-btrfcomm.c b/epan/dissectors/packet-btrfcomm.c index 734b0968e6..4ab31921f7 100644 --- a/epan/dissectors/packet-btrfcomm.c +++ b/epan/dissectors/packet-btrfcomm.c @@ -335,9 +335,9 @@ dissect_ctrl_pn(packet_info *pinfo, proto_tree *t, tvbuff_t *tvb, int offset, in else token = mcc_dlci; - dlci_state = se_tree_lookup32(dlci_table, token); + dlci_state = (dlci_state_t *)se_tree_lookup32(dlci_table, token); if (!dlci_state) { - dlci_state = se_alloc0(sizeof(dlci_state_t)); + dlci_state = se_new0(dlci_state_t); se_tree_insert32(dlci_table, token, dlci_state); } @@ -606,9 +606,9 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else token = dlci; - dlci_state = se_tree_lookup32(dlci_table, token); + dlci_state = (dlci_state_t *)se_tree_lookup32(dlci_table, token); if (!dlci_state) { - dlci_state = se_alloc0(sizeof(dlci_state_t)); + dlci_state = se_new0(dlci_state_t); se_tree_insert32(dlci_table, token, dlci_state); } } @@ -713,7 +713,7 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) next_tvb = tvb_new_subset(tvb, offset, frame_len, frame_len); - l2cap_data = pinfo->private_data; + l2cap_data = (btl2cap_data_t *)pinfo->private_data; pinfo->private_data = &rfcomm_data; rfcomm_data.interface_id = l2cap_data->interface_id; @@ -958,7 +958,7 @@ proto_register_btrfcomm(void) sizeof(uat_rfcomm_channels_t), "rfcomm_channels", TRUE, - (void*) &rfcomm_channels, + (void**) &rfcomm_channels, &num_rfcomm_channels, UAT_AFFECTS_DISSECTION, NULL, @@ -986,9 +986,9 @@ btrfcomm_sdp_tap_packet(void *arg _U_, packet_info *pinfo _U_, epan_dissect_t *e /* rfcomm channel * 2 = dlci */ token = (sdp_data->channel<<1) | (sdp_data->flags & BTSDP_LOCAL_SERVICE_FLAG_MASK); - dlci_state = se_tree_lookup32(dlci_table, token); + dlci_state = (dlci_state_t *)se_tree_lookup32(dlci_table, token); if (!dlci_state) { - dlci_state = se_alloc0(sizeof(dlci_state_t)); + dlci_state = se_new0(dlci_state_t); se_tree_insert32(dlci_table, token, dlci_state); } dlci_state->service = sdp_data->service; diff --git a/epan/dissectors/packet-btsdp.c b/epan/dissectors/packet-btsdp.c index 940af70cb0..fdfcd4c6bd 100644 --- a/epan/dissectors/packet-btsdp.c +++ b/epan/dissectors/packet-btsdp.c @@ -488,7 +488,7 @@ dissect_sdp_type(proto_tree *t, tvbuff_t *tvb, int offset, char **attr_val) guint8 type; guint8 size_index; - str = ep_alloc(MAX_SDP_LEN+1); + str = (char *)ep_alloc(MAX_SDP_LEN+1); *attr_val = str; str[0] = 0; @@ -649,7 +649,7 @@ dissect_sdp_service_attribute(proto_tree *tree, tvbuff_t *tvb, int offset, packe guint32 service, service_val; btsdp_data_t *service_item; - service_item = se_tree_lookup32(service_table, token); + service_item = (btsdp_data_t *)se_tree_lookup32(service_table, token); if (service_item != NULL) { switch (id) { @@ -686,7 +686,7 @@ dissect_sdp_service_attribute(proto_tree *tree, tvbuff_t *tvb, int offset, packe guint8 *psm_guint8; get_sdp_data_element(tvb, offset+ 3, id, &type, &psm, &service, &service_val); - psm_guint8 = psm; + psm_guint8 = (guint8 *)psm; if ((type == 1) && (*psm_guint8 & 0x1)) { service_item->channel = *psm_guint8; @@ -700,7 +700,7 @@ dissect_sdp_service_attribute(proto_tree *tree, tvbuff_t *tvb, int offset, packe if (service_item->service != 0 && service_item->channel != 0) { btl2cap_data_t *l2cap_data; - l2cap_data = pinfo->private_data; + l2cap_data = (btl2cap_data_t *)pinfo->private_data; service_item->flags |= token >>15; /* set flag when local service */ service_item->interface_id = l2cap_data->interface_id; @@ -798,10 +798,10 @@ dissect_sdp_service_search_attribute_request(proto_tree *t, tvbuff_t *tvb, int o while (bytes_to_go > 0) { btsdp_data_t *service_item; if (!pinfo->fd->flags.visited) { - service_item = se_tree_lookup32(service_table, token); + service_item = (btsdp_data_t *)se_tree_lookup32(service_table, token); if (service_item == NULL) { - service_item = se_alloc0(sizeof(btsdp_data_t)); + service_item = se_new0(btsdp_data_t); se_tree_insert32(service_table, token, service_item); } service_item->channel = 0; @@ -889,10 +889,10 @@ dissect_sdp_service_search_request(proto_tree *t, tvbuff_t *tvb, int offset, pac guint8 type; void *val = NULL; - service_item = se_tree_lookup32(service_table, token); + service_item = (btsdp_data_t *)se_tree_lookup32(service_table, token); if (service_item == NULL) { - service_item = se_alloc0(sizeof(btsdp_data_t)); + service_item = se_new0(btsdp_data_t); se_tree_insert32(service_table, token, service_item); } diff --git a/epan/dissectors/packet-fmp.c b/epan/dissectors/packet-fmp.c index e45c804f23..bb0b98469a 100644 --- a/epan/dissectors/packet-fmp.c +++ b/epan/dissectors/packet-fmp.c @@ -107,7 +107,7 @@ dissect_fmp_genString(tvbuff_t *tvb, int offset, proto_tree *tree) { encoding mode; - mode = tvb_get_ntohl(tvb, offset); + mode = (encoding)tvb_get_ntohl(tvb, offset); switch (mode) { case FMP_ASCII: @@ -144,7 +144,7 @@ get_fileHandleSrc_size(tvbuff_t *tvb, int offset) int length; nativeProtocol np; - np = tvb_get_ntohl(tvb, offset); + np = (nativeProtocol)tvb_get_ntohl(tvb, offset); switch (np) { case FMP_PATH: @@ -187,7 +187,7 @@ dissect_fmp_fileHandleSrc(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, length = get_fileHandleSrc_size(tvb, offset); - np = tvb_get_ntohl(tvb, offset); + np = (nativeProtocol)tvb_get_ntohl(tvb, offset); fileHandleItem = proto_tree_add_text(tree, tvb, offset, length, "Source File Handle"); @@ -596,7 +596,7 @@ dissect_fmp_status(tvbuff_t *tvb, int offset, proto_tree *tree, int *rval) { fmpStat status; - status = tvb_get_ntohl(tvb, offset); + status = (fmpStat)tvb_get_ntohl(tvb, offset); switch (status) { case FMP_OK: @@ -668,7 +668,7 @@ dissect_fmp_devSerial(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, if (tree) { queryCmd qc; - qc = tvb_get_ntohl(tvb, offset); + qc = (queryCmd)tvb_get_ntohl(tvb, offset); switch (qc) { case FMP_SCSI_INQUIRY: @@ -709,7 +709,7 @@ dissect_fmp_VolumeDescription(tvbuff_t *tvb, int offset, proto_tree * tree) fmpVolumeType volumeType; fmpDiskIdentifierType diskIdentifierType; - volumeType = tvb_get_ntohl(tvb, offset); + volumeType = (fmpVolumeType)tvb_get_ntohl(tvb, offset); switch (volumeType) { case FMP_VOLUME_DISK: @@ -720,7 +720,7 @@ dissect_fmp_VolumeDescription(tvbuff_t *tvb, int offset, proto_tree * tree) offset += 4; offset = dissect_rpc_uint32(tvb, Hietree, hf_fmp_volID, offset); offset += 8; /* blockIndex64 */ - diskIdentifierType = tvb_get_ntohl(tvb, offset); + diskIdentifierType = (fmpDiskIdentifierType)tvb_get_ntohl(tvb, offset); switch (diskIdentifierType) { @@ -1025,7 +1025,7 @@ dissect_fmp_cerrInfo(tvbuff_t *tvb, int offset, proto_tree *tree) int rval; clientErrorNum errorNum; - errorNum = tvb_get_ntohl(tvb, offset); + errorNum = (clientErrorNum)tvb_get_ntohl(tvb, offset); switch (errorNum) { case FMP_CE_GENERIC: diff --git a/epan/dissectors/packet-iax2.c b/epan/dissectors/packet-iax2.c index 18b3cb239f..67b4a85d05 100644 --- a/epan/dissectors/packet-iax2.c +++ b/epan/dissectors/packet-iax2.c @@ -594,11 +594,11 @@ static guint iax_circuit_lookup(const address *address_p, key.port = port; key.callno = callno; - circuit_id_p = g_hash_table_lookup(iax_circuit_hashtab, &key); + circuit_id_p = (guint32 *)g_hash_table_lookup(iax_circuit_hashtab, &key); if (! circuit_id_p) { iax_circuit_key *new_key; - new_key = se_alloc(sizeof(iax_circuit_key)); + new_key = se_new(iax_circuit_key); new_key->addr.type = address_p->type; new_key->addr.len = MIN(address_p->len, MAX_ADDRESS); new_key->addr.data = new_key->address_data; @@ -607,7 +607,7 @@ static guint iax_circuit_lookup(const address *address_p, new_key->port = port; new_key->callno = callno; - circuit_id_p = se_alloc(sizeof(iax_circuit_key)); + circuit_id_p = (guint32 *)se_new(iax_circuit_key); *circuit_id_p = ++circuitcount; g_hash_table_insert(iax_circuit_hashtab, new_key, circuit_id_p); @@ -947,8 +947,8 @@ static iax_call_data *iax_new_call( packet_info *pinfo, circuit_id = iax_circuit_lookup(&pinfo->src, pinfo->ptype, pinfo->srcport, scallno); - call = se_alloc(sizeof(iax_call_data)); - call -> dataformat = 0; + call = se_new(iax_call_data); + call -> dataformat = AST_DATAFORMAT_NULL; call -> src_codec = 0; call -> dst_codec = 0; call -> n_forward_circuit_ids = 0; @@ -981,7 +981,7 @@ typedef struct iax_packet_data { static iax_packet_data *iax_new_packet_data(iax_call_data *call, gboolean reversed) { - iax_packet_data *p = se_alloc(sizeof(iax_packet_data)); + iax_packet_data *p = se_new(iax_packet_data); p->first_time = TRUE; p->call_data = call; p->codec = 0; @@ -1430,7 +1430,7 @@ static guint32 dissect_ies(tvbuff_t *tvb, packet_info *pinfo, guint32 offset, ie_finfo->rep->representation); else { guint8 *ie_val = NULL; - ie_val = ep_alloc(ITEM_LABEL_LENGTH); + ie_val = (guint8 *)ep_alloc(ITEM_LABEL_LENGTH); proto_item_fill_label(ie_finfo, ie_val); proto_item_set_text(ti, "Information Element: %s", ie_val); @@ -1471,7 +1471,7 @@ static guint32 dissect_iax2_command(tvbuff_t *tvb, guint32 offset, ie_data.peer_address.type = AT_NONE; ie_data.peer_address.len = 0; ie_data.peer_address.data = address_data; - ie_data.peer_ptype = 0; + ie_data.peer_ptype = PT_NONE; ie_data.peer_port = 0; ie_data.peer_callno = 0; ie_data.dataformat = (guint32)-1; @@ -1493,7 +1493,7 @@ static guint32 dissect_iax2_command(tvbuff_t *tvb, guint32 offset, /* if this is a data call, set up a subdissector for the circuit */ if (iax_call && ie_data.dataformat != (guint32)-1 && iax_call -> subdissector == NULL) { iax_call -> subdissector = dissector_get_uint_handle(iax2_dataformat_dissector_table, ie_data.dataformat); - iax_call -> dataformat = ie_data.dataformat; + iax_call -> dataformat = (iax_dataformat_t)ie_data.dataformat; } /* if this is a transfer request, record it in the call data */ @@ -1652,7 +1652,7 @@ dissect_fullpacket(tvbuff_t *tvb, guint32 offset, case AST_FRAME_IAX: offset=dissect_iax2_command(tvb, offset+9, pinfo, packet_type_tree, iax_packet); iax2_info->messageName = val_to_str_ext(csub, &iax_iax_subclasses_ext, "unknown (0x%02x)"); - iax2_info->callState = csub; + iax2_info->callState = (voip_call_state)csub; break; case AST_FRAME_DTMF_BEGIN: @@ -1960,7 +1960,7 @@ typedef struct _call_list { static call_list *call_list_append(call_list *list, guint16 scallno) { - call_list *node = ep_alloc0(sizeof(call_list)); + call_list *node = ep_new0(call_list); node->scallno = scallno; diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c index 26059a57dd..b3d8644153 100644 --- a/epan/dissectors/packet-icmpv6.c +++ b/epan/dissectors/packet-icmpv6.c @@ -1133,9 +1133,9 @@ static icmp_transaction_t *transaction_start(packet_info *pinfo, proto_tree *tre /* Handle the conversation tracking */ conversation = _find_or_create_conversation(pinfo); - icmpv6_info = conversation_get_proto_data(conversation, proto_icmpv6); + icmpv6_info = (icmpv6_conv_info_t *)conversation_get_proto_data(conversation, proto_icmpv6); if (icmpv6_info == NULL) { - icmpv6_info = se_alloc(sizeof(icmpv6_conv_info_t)); + icmpv6_info = se_new(icmpv6_conv_info_t); icmpv6_info->unmatched_pdus = se_tree_create_non_persistent( EMEM_TREE_TYPE_RED_BLACK, "icmpv6_unmatched_pdus"); icmpv6_info->matched_pdus = se_tree_create_non_persistent( @@ -1153,7 +1153,7 @@ static icmp_transaction_t *transaction_start(packet_info *pinfo, proto_tree *tre icmpv6_key[1].length = 0; icmpv6_key[1].key = NULL; - icmpv6_trans = se_alloc(sizeof(icmp_transaction_t)); + icmpv6_trans = se_new(icmp_transaction_t); icmpv6_trans->rqst_frame = PINFO_FD_NUM(pinfo); icmpv6_trans->resp_frame = 0; icmpv6_trans->rqst_time = pinfo->fd->abs_ts; @@ -1170,7 +1170,7 @@ static icmp_transaction_t *transaction_start(packet_info *pinfo, proto_tree *tre icmpv6_key[2].length = 0; icmpv6_key[2].key = NULL; - icmpv6_trans = se_tree_lookup32_array(icmpv6_info->matched_pdus, icmpv6_key); + icmpv6_trans = (icmp_transaction_t *)se_tree_lookup32_array(icmpv6_info->matched_pdus, icmpv6_key); } if (icmpv6_trans == NULL) @@ -1206,7 +1206,7 @@ static icmp_transaction_t *transaction_end(packet_info *pinfo, proto_tree *tree, if (conversation == NULL) return NULL; - icmpv6_info = conversation_get_proto_data(conversation, proto_icmpv6); + icmpv6_info = (icmpv6_conv_info_t *)conversation_get_proto_data(conversation, proto_icmpv6); if (icmpv6_info == NULL) return NULL; @@ -1218,7 +1218,7 @@ static icmp_transaction_t *transaction_end(packet_info *pinfo, proto_tree *tree, icmpv6_key[1].length = 0; icmpv6_key[1].key = NULL; - icmpv6_trans = se_tree_lookup32_array(icmpv6_info->unmatched_pdus, icmpv6_key); + icmpv6_trans = (icmp_transaction_t *)se_tree_lookup32_array(icmpv6_info->unmatched_pdus, icmpv6_key); if (icmpv6_trans == NULL) return NULL; @@ -1255,7 +1255,7 @@ static icmp_transaction_t *transaction_end(packet_info *pinfo, proto_tree *tree, icmpv6_key[2].length = 0; icmpv6_key[2].key = NULL; - icmpv6_trans = se_tree_lookup32_array(icmpv6_info->matched_pdus, icmpv6_key); + icmpv6_trans = (icmp_transaction_t *)se_tree_lookup32_array(icmpv6_info->matched_pdus, icmpv6_key); if (icmpv6_trans == NULL) return NULL; } @@ -3259,9 +3259,9 @@ dissect_icmpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ truncated, so we can checksum it. */ /* 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; phdr[0] = g_htonl(reported_length); diff --git a/epan/dissectors/packet-imf.c b/epan/dissectors/packet-imf.c index 38b669c4a4..5ec1187f20 100644 --- a/epan/dissectors/packet-imf.c +++ b/epan/dissectors/packet-imf.c @@ -279,7 +279,7 @@ static GHashTable *custom_field_table = NULL; static void header_fields_update_cb(void *r, const char **err) { - header_field_t *rec = r; + header_field_t *rec = (header_field_t *)r; char c; if (rec->header_name == NULL) { @@ -308,8 +308,8 @@ header_fields_update_cb(void *r, const char **err) static void * header_fields_copy_cb(void *n, const void *o, size_t siz _U_) { - header_field_t *new_rec = n; - const header_field_t *old_rec = o; + header_field_t *new_rec = (header_field_t *)n; + const header_field_t *old_rec = (const header_field_t *)o; new_rec->header_name = g_strdup(old_rec->header_name); new_rec->description = g_strdup(old_rec->description); @@ -322,7 +322,7 @@ header_fields_copy_cb(void *n, const void *o, size_t siz _U_) static void header_fields_free_cb(void *r) { - header_field_t *rec = r; + header_field_t *rec = (header_field_t *)r; g_free(rec->header_name); g_free(rec->description); @@ -877,10 +877,10 @@ header_fields_initialize_cb (void) if (num_header_fields) { custom_field_table = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, free_imf_field); - hf = g_malloc0 (sizeof (hf_register_info) * num_header_fields); + hf = (hf_register_info *)g_malloc0 (sizeof (hf_register_info) * num_header_fields); for (i = 0; i < num_header_fields; i++) { - hf_id = g_malloc (sizeof (gint)); + hf_id = (gint *)g_malloc (sizeof (gint)); *hf_id = -1; header_name = g_strdup (header_fields[i].header_name); @@ -894,7 +894,7 @@ header_fields_initialize_cb (void) hf[i].hfinfo.same_name_prev = NULL; hf[i].hfinfo.same_name_next = NULL; - imffield = g_malloc (sizeof (struct imf_field)); + imffield = (struct imf_field *)g_malloc (sizeof (struct imf_field)); imffield->hf_id = hf_id; imffield->name = ascii_strdown_inplace (g_strdup (header_name)); switch (header_fields[i].header_format) { @@ -1214,7 +1214,7 @@ proto_register_imf(void) sizeof(header_field_t), "imf_header_fields", TRUE, - (void*) &header_fields, + (void**) &header_fields, &num_header_fields, /* specifies named fields, so affects dissection and the set of named fields */ diff --git a/epan/dissectors/packet-infiniband.c b/epan/dissectors/packet-infiniband.c index 4409ed5bc4..5e957185e2 100644 --- a/epan/dissectors/packet-infiniband.c +++ b/epan/dissectors/packet-infiniband.c @@ -1798,8 +1798,8 @@ skip_lrh: break; case IP_NON_IBA: /* Raw IPv6 Packet */ - g_snprintf(dst_addr, ADDR_MAX_LEN, "IPv6 over IB Packet"); - SET_ADDRESS(&pinfo->dst, AT_STRINGZ, (int)strlen(dst_addr)+1, dst_addr); + g_snprintf((gchar *)dst_addr, ADDR_MAX_LEN, "IPv6 over IB Packet"); + SET_ADDRESS(&pinfo->dst, AT_STRINGZ, (int)strlen((char *)dst_addr)+1, dst_addr); parse_IPvSix(all_headers_tree, tvb, &offset, pinfo); break; @@ -2970,8 +2970,8 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t * proto_tree *CM_header_tree; tvbuff_t *next_tvb; - local_gid = ep_alloc(GID_SIZE); - remote_gid = ep_alloc(GID_SIZE); + local_gid = (guint8 *)ep_alloc(GID_SIZE); + remote_gid = (guint8 *)ep_alloc(GID_SIZE); if (!parse_MAD_Common(parentTree, tvb, offset, &MadData)) { @@ -3062,10 +3062,10 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t * connection_context *connection; conversation_infiniband_data *proto_data; conversation_t *conv; - guint64 *hash_key = g_malloc(sizeof(guint64)); + guint64 *hash_key = (guint64 *)g_malloc(sizeof(guint64)); /* create a new connection context and store it in the hash table */ - connection = g_malloc(sizeof(connection_context)); + connection = (connection_context *)g_malloc(sizeof(connection_context)); memcpy(&(connection->req_gid), local_gid, GID_SIZE); memcpy(&(connection->resp_gid), remote_gid, GID_SIZE); connection->req_lid = local_lid; @@ -3083,7 +3083,7 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t * /* Now we create a conversation for the CM exchange. This uses both sides of the conversation since CM packets also include the source QPN */ - proto_data = se_alloc(sizeof(conversation_infiniband_data)); + proto_data = se_new(conversation_infiniband_data); proto_data->service_id = connection->service_id; conv = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, @@ -3131,7 +3131,7 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t * guint64 hash_key; hash_key = MadData.transactionID; ADD_ADDRESS_TO_HASH(hash_key, &pinfo->dst); - connection = g_hash_table_lookup(CM_context_table, &hash_key); + connection = (connection_context *)g_hash_table_lookup(CM_context_table, &hash_key); /* if an appropriate connection was not found there's something wrong, but nothing we can do about it here - so just skip saving the context */ @@ -3144,7 +3144,7 @@ static void parse_COM_MGT(proto_tree *parentTree, packet_info *pinfo, tvbuff_t * connection->resp_qp = remote_qpn; - proto_data = se_alloc(sizeof(conversation_infiniband_data)); + proto_data = se_new(conversation_infiniband_data); proto_data->service_id = connection->service_id; /* RC traffic never(?) includes a field indicating the source QPN, so @@ -5040,8 +5040,8 @@ skip_lrh: break; case IP_NON_IBA: /* Raw IPv6 Packet */ - g_snprintf(dst_addr, ADDR_MAX_LEN, "IPv6 over IB Packet"); - SET_ADDRESS(&pinfo->dst, AT_STRINGZ, (int)strlen(dst_addr)+1, dst_addr); + g_snprintf((gchar *)dst_addr, ADDR_MAX_LEN, "IPv6 over IB Packet"); + SET_ADDRESS(&pinfo->dst, AT_STRINGZ, (int)strlen((char *)dst_addr)+1, dst_addr); break; case RAW: break; diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c index 8e6579cfd7..fab4211295 100644 --- a/epan/dissectors/packet-ip.c +++ b/epan/dissectors/packet-ip.c @@ -906,14 +906,14 @@ dissect_ipopt_cipso(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset, guint byte_spot = 0; unsigned char bitmask; char *cat_str; - char *cat_str_tmp = wmem_alloc(wmem_packet_scope(), USHRT_MAX_STRLEN); + char *cat_str_tmp = (char *)wmem_alloc(wmem_packet_scope(), USHRT_MAX_STRLEN); size_t cat_str_len; const guint8 *val_ptr = tvb_get_ptr(tvb, offset, taglen - 4); /* this is just a guess regarding string size, but we grow it below * if needed */ cat_str_len = 256; - cat_str = wmem_alloc0(wmem_packet_scope(), cat_str_len); + cat_str = (char *)wmem_alloc0(wmem_packet_scope(), cat_str_len); /* we checked the length above so the highest category value * possible here is 240 */ @@ -929,7 +929,7 @@ dissect_ipopt_cipso(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset, while (cat_str_len < (strlen(cat_str) + 2 + USHRT_MAX_STRLEN)) cat_str_len += cat_str_len; - cat_str_new = wmem_alloc(wmem_packet_scope(), cat_str_len); + cat_str_new = (char *)wmem_alloc(wmem_packet_scope(), cat_str_len); g_strlcpy(cat_str_new, cat_str, cat_str_len); cat_str_new[cat_str_len - 1] = '\0'; cat_str = cat_str_new; @@ -975,8 +975,8 @@ dissect_ipopt_cipso(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset, if (taglen > 4) { int offset_max_cat = offset + taglen - 4; - char *cat_str = wmem_alloc0(wmem_packet_scope(), USHRT_MAX_STRLEN * 15); - char *cat_str_tmp = wmem_alloc(wmem_packet_scope(), USHRT_MAX_STRLEN); + char *cat_str = (char *)wmem_alloc0(wmem_packet_scope(), USHRT_MAX_STRLEN * 15); + char *cat_str_tmp = (char *)wmem_alloc(wmem_packet_scope(), USHRT_MAX_STRLEN); while ((offset + 2) <= offset_max_cat) { g_snprintf(cat_str_tmp, USHRT_MAX_STRLEN, "%u", @@ -1014,8 +1014,8 @@ dissect_ipopt_cipso(const ip_tcp_opt *optp, tvbuff_t *tvb, int offset, if (taglen > 4) { guint16 cat_low, cat_high; int offset_max_cat = offset + taglen - 4; - char *cat_str = wmem_alloc0(wmem_packet_scope(), USHRT_MAX_STRLEN * 16); - char *cat_str_tmp = wmem_alloc(wmem_packet_scope(), USHRT_MAX_STRLEN * 2); + char *cat_str = (char *)wmem_alloc0(wmem_packet_scope(), USHRT_MAX_STRLEN * 16); + char *cat_str_tmp = (char *)wmem_alloc(wmem_packet_scope(), USHRT_MAX_STRLEN * 2); while ((offset + 2) <= offset_max_cat) { cat_high = tvb_get_ntohs(tvb, offset); @@ -1946,7 +1946,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) guint16 ttl; tree = parent_tree; - iph = wmem_alloc(wmem_packet_scope(), sizeof(ws_ip)); + iph = (ws_ip *)wmem_alloc(wmem_packet_scope(), sizeof(ws_ip)); col_set_str(pinfo->cinfo, COL_PROTOCOL, "IPv4"); col_clear(pinfo->cinfo, COL_INFO); @@ -2207,7 +2207,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) src_host = get_hostname(addr); if (ip_summary_in_tree) { proto_item_append_text(ti, ", Src: %s (%s)", src_host, - ip_to_str(iph->ip_src.data)); + ip_to_str((guint8 *)iph->ip_src.data)); } proto_tree_add_ipv4(ip_tree, hf_ip_src, tvb, offset + 12, 4, addr); item = proto_tree_add_ipv4(ip_tree, hf_ip_addr, tvb, offset + 12, 4, addr); @@ -2277,7 +2277,7 @@ dissect_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) cur_rt = tvb_get_ipv4(tvb, offset + 16); if (ip_summary_in_tree) { proto_item_append_text(ti, ", Dst: %s (%s)", dst_host, - ip_to_str(iph->ip_dst.data)); + ip_to_str((guint8 *)iph->ip_dst.data)); if (dst_off) proto_item_append_text(ti, ", Via: %s (%s)", get_hostname(cur_rt), ip_to_str((gchar *)&cur_rt)); diff --git a/epan/dissectors/packet-ipmi.c b/epan/dissectors/packet-ipmi.c index 7cd9c0d2af..0da71f0c1a 100644 --- a/epan/dissectors/packet-ipmi.c +++ b/epan/dissectors/packet-ipmi.c @@ -297,7 +297,7 @@ struct ipmi_header * ipmi_sendmsg_getheaders(struct ipmi_header *base, void *arg, guint i) { static struct ipmi_header hdr; - struct ipmi_header *wrapper = arg; + struct ipmi_header *wrapper = (struct ipmi_header *)arg; /* The problem stems from the fact that the original IPMI specification (before errata came) did not specify the response @@ -348,9 +348,9 @@ maybe_insert_reqresp(ipmi_dissect_format_t *dfmt, struct ipmi_header *hdr) cnv = find_or_create_conversation(current_pinfo); - kt = conversation_get_proto_data(cnv, proto_ipmi); + kt = (struct ipmi_keytree *)conversation_get_proto_data(cnv, proto_ipmi); if (!kt) { - kt = se_alloc(sizeof(struct ipmi_keytree)); + kt = se_new(struct ipmi_keytree); kt->heads = se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "ipmi_key_heads"); conversation_add_proto_data(cnv, proto_ipmi, kt); @@ -363,9 +363,9 @@ maybe_insert_reqresp(ipmi_dissect_format_t *dfmt, struct ipmi_header *hdr) hdr->trg_sa, hdr->trg_lun, hdr->src_sa, hdr->src_lun, hdr->seq, hdr->netfn, hdr->cmd); key = makekey(hdr); - kh = se_tree_lookup32(kt->heads, key); + kh = (struct ipmi_keyhead *)se_tree_lookup32(kt->heads, key); if (!kh) { - kh = se_alloc0(sizeof(struct ipmi_keyhead)); + kh = se_new0(struct ipmi_keyhead); se_tree_insert32(kt->heads, key, kh); } if ((rr = key_lookup_reqresp(kh, hdr, current_pinfo->fd)) != NULL) { @@ -394,9 +394,9 @@ maybe_insert_reqresp(ipmi_dissect_format_t *dfmt, struct ipmi_header *hdr) /* Not found; allocate new structures */ if (!current_saved_data) { /* One 'ipmi_saved_data' for all 'ipmi_req_resp' allocated */ - current_saved_data = se_alloc0(sizeof(struct ipmi_saved_data)); + current_saved_data = se_new0(struct ipmi_saved_data); } - rr = se_alloc0(sizeof(struct ipmi_reqresp)); + rr = se_new0(struct ipmi_reqresp); rr->whichresponse = dfmt->whichresponse; rr->netfn = hdr->netfn & 0x3e; rr->cmd = hdr->cmd; @@ -443,7 +443,7 @@ add_reqresp_info(ipmi_dissect_format_t *dfmt, struct ipmi_header *hdr, proto_tre current_pinfo->srcport, current_pinfo->destport, 0)) == NULL) { goto fallback; } - if ((kt = conversation_get_proto_data(cnv, proto_ipmi)) == NULL) { + if ((kt = (struct ipmi_keytree *)conversation_get_proto_data(cnv, proto_ipmi)) == NULL) { goto fallback; } @@ -453,7 +453,7 @@ add_reqresp_info(ipmi_dissect_format_t *dfmt, struct ipmi_header *hdr, proto_tre hdr->trg_sa, hdr->trg_lun, hdr->src_sa, hdr->src_lun, hdr->seq, hdr->netfn, hdr->cmd); key = makekey(hdr); - if ((kh = se_tree_lookup32(kt->heads, key)) != NULL && + if ((kh = (struct ipmi_keyhead *)se_tree_lookup32(kt->heads, key)) != NULL && (rr = key_lookup_reqresp(kh, hdr, current_pinfo->fd)) != NULL) { debug_printf("Found [ <%d,%d,%d> (%02x,%1x <-> %02x,%1x : %02x) %02x %02x ]\n", rr->frames[0].num, rr->frames[1].num, rr->frames[2].num, @@ -736,7 +736,7 @@ ipmi_add_typelen(proto_tree *tree, const char *desc, tvbuff_t *tvb, len = typelen & msk; ptr->get_len(&clen, &blen, tvb, offs + 1, len, is_fru); - str = ep_alloc(clen + 1); + str = (char *)ep_alloc(clen + 1); ptr->parse(str, tvb, offs + 1, clen); str[clen] = '\0'; @@ -828,7 +828,7 @@ ipmi_register_netfn_cmdtab(guint32 netfn, guint oem_selector, return; } - inh = g_malloc(sizeof(struct ipmi_netfn_handler)); + inh = (struct ipmi_netfn_handler *)g_malloc(sizeof(struct ipmi_netfn_handler)); inh->desc = desc; inh->oem_selector = oem_selector; inh->sig = sig; diff --git a/epan/dissectors/packet-kerberos.c b/epan/dissectors/packet-kerberos.c index 89aee3bc5f..90000c23d9 100644 --- a/epan/dissectors/packet-kerberos.c +++ b/epan/dissectors/packet-kerberos.c @@ -447,14 +447,14 @@ add_encryption_key(packet_info *pinfo, int keytype, int keylength, const char *k } printf("added key in %u keytype:%d len:%d\n",pinfo->fd->num, keytype, keylength); - new_key=g_malloc(sizeof(enc_key_t)); + new_key=(enc_key_t *)g_malloc(sizeof(enc_key_t)); g_snprintf(new_key->key_origin, KRB_MAX_ORIG_LEN, "%s learnt from frame %u",origin,pinfo->fd->num); new_key->next=enc_key_list; enc_key_list=new_key; new_key->keytype=keytype; new_key->keylength=keylength; /*XXX this needs to be freed later */ - new_key->keyvalue=g_memdup(keyvalue, keylength); + new_key->keyvalue=(char *)g_memdup(keyvalue, keylength); } #endif /* HAVE_HEIMDAL_KERBEROS || HAVE_MIT_KERBEROS */ @@ -503,7 +503,7 @@ printf("read keytab file %s\n", filename); } do{ - new_key=g_malloc(sizeof(enc_key_t)); + new_key=(enc_key_t *)g_malloc(sizeof(enc_key_t)); new_key->next=enc_key_list; ret = krb5_kt_next_entry(krb5_ctx, keytab, &key, &cursor); if(ret==0){ @@ -524,7 +524,7 @@ printf("read keytab file %s\n", filename); /*printf("added key for principal :%s\n", new_key->key_origin);*/ new_key->keytype=key.key.enctype; new_key->keylength=key.key.length; - new_key->keyvalue=g_memdup(key.key.contents, key.key.length); + new_key->keyvalue=(char *)g_memdup(key.key.contents, key.key.length); enc_key_list=new_key; } }while(ret==0); @@ -562,7 +562,7 @@ decrypt_krb5_data(proto_tree *tree, packet_info *pinfo, } read_keytab_file_from_preferences(); - data.data = g_malloc(length); + data.data = (char *)g_malloc(length); data.length = length; for(ek=enc_key_list;ek;ek=ek->next){ @@ -1800,7 +1800,7 @@ static int dissect_krb5_addr_type(proto_tree *tree, tvbuff_t *tvb, int offset, a #define ADDRESS_STR_BUFSIZ 256 static int dissect_krb5_address(proto_tree *tree, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_) { - gint8 class; + gint8 appclass; gboolean pc; gint32 tag; guint32 len; @@ -1808,10 +1808,10 @@ static int dissect_krb5_address(proto_tree *tree, tvbuff_t *tvb, int offset, asn proto_item *it=NULL; /* read header and len for the octet string */ - offset=dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &class, &pc, &tag); + offset=dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &appclass, &pc, &tag); offset=dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, NULL); - address_str=ep_alloc(ADDRESS_STR_BUFSIZ); + address_str=(char *)ep_alloc(ADDRESS_STR_BUFSIZ); address_str[0]='\0'; switch(addr_type){ case KRB5_ADDR_IPv4: diff --git a/epan/dissectors/packet-l2tp.c b/epan/dissectors/packet-l2tp.c index aeb5c64cd0..efea07b255 100644 --- a/epan/dissectors/packet-l2tp.c +++ b/epan/dissectors/packet-l2tp.c @@ -840,14 +840,14 @@ static void store_cma_nonce(l2tpv3_tunnel_t *tunnel, switch (msg_type) { case MESSAGE_TYPE_SCCRQ: if (!tunnel->lcce1_nonce) { - tunnel->lcce1_nonce = se_alloc(length); + tunnel->lcce1_nonce = (guint8 *)se_alloc(length); tunnel->lcce1_nonce_len = length; nonce = tunnel->lcce1_nonce; } break; case MESSAGE_TYPE_SCCRP: if (!tunnel->lcce2_nonce) { - tunnel->lcce2_nonce = se_alloc(length); + tunnel->lcce2_nonce = (guint8 *)se_alloc(length); tunnel->lcce2_nonce_len = length; nonce = tunnel->lcce2_nonce; } @@ -893,7 +893,7 @@ static l2tpv3_session_t *find_session(l2tpv3_tunnel_t *tunnel, iterator = tunnel->sessions; while (iterator) { - session = iterator->data; + session = (l2tpv3_session_t *)iterator->data; if ((session->lcce1.id == lcce1_id) || (session->lcce2.id == lcce2_id)) { @@ -915,7 +915,7 @@ static void init_session(l2tpv3_session_t *session) static l2tpv3_session_t *alloc_session(void) { - l2tpv3_session_t *session = ep_alloc0(sizeof(l2tpv3_session_t)); + l2tpv3_session_t *session = ep_new0(l2tpv3_session_t); init_session(session); return session; @@ -1117,7 +1117,7 @@ static void update_session(l2tpv3_tunnel_t *tunnel, l2tpv3_session_t *session) existing = find_session(tunnel, session->lcce1.id, session->lcce2.id); if (!existing) { - existing = se_alloc0(sizeof(l2tpv3_session_t)); + existing = se_new0(l2tpv3_session_t); init_session(existing); } @@ -2390,7 +2390,7 @@ process_l2tpv3_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int process_control_avps(tvb, pinfo, l2tp_tree, idx, length+baseIdx, tunnel); if (tunnel == &tmp_tunnel && l2tp_conv->tunnel == NULL) { - l2tp_conv->tunnel = se_alloc0(sizeof(l2tpv3_tunnel_t)); + l2tp_conv->tunnel = se_new0(l2tpv3_tunnel_t); memcpy(l2tp_conv->tunnel, &tmp_tunnel, sizeof(l2tpv3_tunnel_t)); } } @@ -2462,7 +2462,7 @@ dissect_l2tp_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data case 3: l2tp_conv = (l2tpv3_conversation_t *)conversation_get_proto_data(conv, proto_l2tp); if (!l2tp_conv) { - l2tp_conv = se_alloc0(sizeof(l2tpv3_conversation_t)); + l2tp_conv = se_new0(l2tpv3_conversation_t); l2tp_conv->pt = PT_UDP; conversation_add_proto_data(conv, proto_l2tp, (void *)l2tp_conv); } @@ -2650,7 +2650,7 @@ dissect_l2tp_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) l2tp_conv = (l2tpv3_conversation_t *)conversation_get_proto_data(conv, proto_l2tp); if (!l2tp_conv) { - l2tp_conv = se_alloc0(sizeof(l2tpv3_conversation_t)); + l2tp_conv = se_new0(l2tpv3_conversation_t); l2tp_conv->pt = PT_NONE; conversation_add_proto_data(conv, proto_l2tp, (void *)l2tp_conv); } diff --git a/epan/dissectors/packet-ldss.c b/epan/dissectors/packet-ldss.c index 23ddadc7eb..90db41e304 100644 --- a/epan/dissectors/packet-ldss.c +++ b/epan/dissectors/packet-ldss.c @@ -222,7 +222,7 @@ prepare_ldss_transfer_conv(ldss_broadcast_t *broadcast) conversation_t *transfer_conv; ldss_transfer_info_t *transfer_info; - transfer_info = se_alloc0(sizeof(ldss_transfer_info_t)); + transfer_info = se_new0(ldss_transfer_info_t); transfer_info->broadcast = broadcast; /* Preparation for later push/pull dissection */ @@ -287,7 +287,7 @@ dissect_ldss_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) digest_type = tvb_get_guint8 (tvb, 2); compression = tvb_get_guint8 (tvb, 3); cookie = tvb_get_ntohl (tvb, 4); - digest = tvb_memdup (tvb, 8, DIGEST_LEN); + digest = (guint8 *)tvb_memdup (tvb, 8, DIGEST_LEN); size = tvb_get_ntoh64 (tvb, 40); offset = tvb_get_ntoh64 (tvb, 48); targetTime = tvb_get_ntohl (tvb, 56); @@ -412,7 +412,7 @@ dissect_ldss_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ldss_broadcast_t *data; /* Populate data from the broadcast */ - data = se_alloc0(sizeof(ldss_broadcast_t)); + data = se_new0(ldss_broadcast_t); data->num = pinfo->fd->num; data->ts = pinfo->fd->abs_ts; data->message_id = messageID; @@ -422,11 +422,11 @@ dissect_ldss_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) data->offset = offset; data->compression = compression; - data->file = se_alloc0(sizeof(ldss_file_t)); + data->file = se_new0(ldss_file_t); data->file->digest = digest; data->file->digest_type = digest_type; - data->broadcaster = se_alloc0(sizeof(ldss_broadcaster_t)); + data->broadcaster = se_new0(ldss_broadcaster_t); COPY_ADDRESS(&data->broadcaster->addr, &pinfo->src); data->broadcaster->port = port; @@ -469,8 +469,8 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * earlier broadcast dissection (see prepate_ldss_transfer_conv) */ transfer_conv = find_conversation (pinfo->fd->num, &pinfo->src, &pinfo->dst, PT_TCP, pinfo->srcport, pinfo->destport, 0); - transfer_info = conversation_get_proto_data(transfer_conv, proto_ldss); - transfer_tcpinfo = pinfo->private_data; + transfer_info = (ldss_transfer_info_t *)conversation_get_proto_data(transfer_conv, proto_ldss); + transfer_tcpinfo = (struct tcpinfo *)pinfo->private_data; /* For a pull, the first packet in the TCP connection is the file request. * First packet is identified by relative seq/ack numbers of 1. @@ -495,8 +495,8 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) highest_num_seen < pinfo->fd->num) { already_dissected = FALSE; - transfer_info->req = se_alloc0(sizeof(ldss_file_request_t)); - transfer_info->req->file = se_alloc0(sizeof(ldss_file_t)); + transfer_info->req = se_new0(ldss_file_request_t); + transfer_info->req->file = se_new0(ldss_file_t); highest_num_seen = pinfo->fd->num; } @@ -523,7 +523,7 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) FALSE); /* Include new-line in line */ - line = tvb_memdup(tvb, offset, linelen+1); /* XXX - memory leak? */ + line = (guint8 *)tvb_memdup(tvb, offset, linelen+1); /* XXX - memory leak? */ if (tree) { ti = proto_tree_add_text(ldss_tree, tvb, offset, linelen, @@ -609,7 +609,7 @@ dissect_ldss_transfer (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(digest_bytes->len >= DIGEST_LEN) digest_bytes->len = (DIGEST_LEN-1); /* Ensure the digest is zero-padded */ - transfer_info->file->digest = se_alloc0(DIGEST_LEN); + transfer_info->file->digest = (guint8 *)se_alloc0(DIGEST_LEN); memcpy(transfer_info->file->digest, digest_bytes->data, digest_bytes->len); g_byte_array_free(digest_bytes, TRUE); diff --git a/epan/dissectors/packet-mysql.c b/epan/dissectors/packet-mysql.c index fb52d75360..391e6b5740 100644 --- a/epan/dissectors/packet-mysql.c +++ b/epan/dissectors/packet-mysql.c @@ -703,9 +703,9 @@ dissect_mysql_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) conversation= find_or_create_conversation(pinfo); /* get associated state information, create if necessary */ - conn_data= conversation_get_proto_data(conversation, proto_mysql); + conn_data= (mysql_conn_data_t *)conversation_get_proto_data(conversation, proto_mysql); if (!conn_data) { - conn_data= se_alloc(sizeof(mysql_conn_data_t)); + conn_data= se_new(mysql_conn_data_t); conn_data->srv_caps= 0; conn_data->clnt_caps= 0; conn_data->clnt_caps_ext= 0; @@ -718,13 +718,13 @@ dissect_mysql_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) conversation_add_proto_data(conversation, proto_mysql, conn_data); } - mysql_frame_data_p = p_get_proto_data(pinfo->fd, proto_mysql); + mysql_frame_data_p = (struct mysql_frame_data *)p_get_proto_data(pinfo->fd, proto_mysql); if (!mysql_frame_data_p) { /* We haven't seen this frame before. Store the state of the * conversation now so if/when we dissect the frame again * we'll start with the same state. */ - mysql_frame_data_p = se_alloc(sizeof(struct mysql_frame_data)); + mysql_frame_data_p = se_new(struct mysql_frame_data); mysql_frame_data_p->state = conn_data->state; p_add_proto_data(pinfo->fd, proto_mysql, mysql_frame_data_p); @@ -1323,7 +1323,7 @@ mysql_dissect_request(tvbuff_t *tvb,packet_info *pinfo, int offset, stmt_id = tvb_get_letohl(tvb, offset); offset += 4; - stmt_data = se_tree_lookup32(conn_data->stmts, stmt_id); + stmt_data = (my_stmt_data_t *)se_tree_lookup32(conn_data->stmts, stmt_id); if (stmt_data != NULL) { guint16 data_param = tvb_get_letohs(tvb, offset); if (stmt_data->nparam > data_param) { @@ -1358,7 +1358,7 @@ mysql_dissect_request(tvbuff_t *tvb,packet_info *pinfo, int offset, proto_tree_add_item(req_tree, hf_mysql_exec_iter, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - stmt_data = se_tree_lookup32(conn_data->stmts, stmt_id); + stmt_data = (my_stmt_data_t *)se_tree_lookup32(conn_data->stmts, stmt_id); if (stmt_data != NULL) { if (stmt_data->nparam != 0) { guint8 stmt_bound; @@ -1848,10 +1848,10 @@ mysql_dissect_response_prepare(tvbuff_t *tvb, int offset, proto_tree *tree, mysq offset += 2; proto_tree_add_item(tree, hf_mysql_num_params, tvb, offset, 2, ENC_LITTLE_ENDIAN); conn_data->stmt_num_params = tvb_get_letohs(tvb, offset); - stmt_data = se_alloc(sizeof(struct my_stmt_data)); + stmt_data = se_new(struct my_stmt_data); stmt_data->nparam = conn_data->stmt_num_params; flagsize = (int)(sizeof(guint8) * stmt_data->nparam); - stmt_data->param_flags = se_alloc(flagsize); + stmt_data->param_flags = (guint8 *)se_alloc(flagsize); memset(stmt_data->param_flags, 0, flagsize); se_tree_insert32(conn_data->stmts, stmt_id, stmt_data); offset += 2; diff --git a/epan/dissectors/packet-nbd.c b/epan/dissectors/packet-nbd.c index 4872cd508d..3ca16d287a 100644 --- a/epan/dissectors/packet-nbd.c +++ b/epan/dissectors/packet-nbd.c @@ -117,7 +117,7 @@ get_nbd_tcp_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset) /* * Do we have a state structure for this conv */ - nbd_info = conversation_get_proto_data(conversation, proto_nbd); + nbd_info = (nbd_conv_info_t *)conversation_get_proto_data(conversation, proto_nbd); if (!nbd_info) { /* No, so just return the rest of the current packet */ return tvb_length(tvb); @@ -131,7 +131,7 @@ get_nbd_tcp_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset) hkey[0].length=2; hkey[0].key=handle; hkey[1].length=0; - nbd_trans=se_tree_lookup32_array(nbd_info->unacked_pdus, hkey); + nbd_trans=(nbd_transaction_t *)se_tree_lookup32_array(nbd_info->unacked_pdus, hkey); if(!nbd_trans){ /* No, so just return the rest of the current packet */ return tvb_length(tvb); @@ -148,7 +148,7 @@ get_nbd_tcp_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset) hkey[1].length=2; hkey[1].key=handle; hkey[2].length=0; - nbd_trans=se_tree_lookup32_array(nbd_info->acked_pdus, hkey); + nbd_trans=(nbd_transaction_t *)se_tree_lookup32_array(nbd_info->acked_pdus, hkey); if(!nbd_trans){ /* No, so just return the rest of the current packet */ return tvb_length(tvb); @@ -213,12 +213,12 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) /* * Do we already have a state structure for this conv */ - nbd_info = conversation_get_proto_data(conversation, proto_nbd); + nbd_info = (nbd_conv_info_t *)conversation_get_proto_data(conversation, proto_nbd); if (!nbd_info) { /* No. Attach that information to the conversation, and add * it to the list of information structures. */ - nbd_info = se_alloc(sizeof(nbd_conv_info_t)); + nbd_info = se_new(nbd_conv_info_t); nbd_info->unacked_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "nbd_unacked_pdus"); nbd_info->acked_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "nbd_acked_pdus"); @@ -227,7 +227,7 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) if(!pinfo->fd->flags.visited){ if(magic==NBD_REQUEST_MAGIC){ /* This is a request */ - nbd_trans=se_alloc(sizeof(nbd_transaction_t)); + nbd_trans=se_new(nbd_transaction_t); nbd_trans->req_frame=pinfo->fd->num; nbd_trans->rep_frame=0; nbd_trans->req_time=pinfo->fd->abs_ts; @@ -244,7 +244,7 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) hkey[0].key=handle; hkey[1].length=0; - nbd_trans=se_tree_lookup32_array(nbd_info->unacked_pdus, hkey); + nbd_trans=(nbd_transaction_t *)se_tree_lookup32_array(nbd_info->unacked_pdus, hkey); if(nbd_trans){ nbd_trans->rep_frame=pinfo->fd->num; @@ -270,7 +270,7 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) hkey[1].key=handle; hkey[2].length=0; - nbd_trans=se_tree_lookup32_array(nbd_info->acked_pdus, hkey); + nbd_trans=(nbd_transaction_t *)se_tree_lookup32_array(nbd_info->acked_pdus, hkey); } /* The bloody handles are reused !!! eventhough they are 64 bits. * So we must verify we got the "correct" one @@ -284,7 +284,7 @@ dissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) if(!nbd_trans){ /* create a "fake" nbd_trans structure */ - nbd_trans=ep_alloc(sizeof(nbd_transaction_t)); + nbd_trans=ep_new(nbd_transaction_t); nbd_trans->req_frame=0; nbd_trans->rep_frame=0; nbd_trans->req_time=pinfo->fd->abs_ts; diff --git a/epan/dissectors/packet-ppcap.c b/epan/dissectors/packet-ppcap.c index 172a4ce078..53c5192add 100644 --- a/epan/dissectors/packet-ppcap.c +++ b/epan/dissectors/packet-ppcap.c @@ -239,9 +239,9 @@ dissect_ppcap_source_address(tvbuff_t *tvb, packet_info *pinfo, proto_tree * ppc offset += 1; proto_tree_add_item(ppcap_tree1, hf_ppcap_spc, tvb, offset, 3, ENC_BIG_ENDIAN); /*src_addr1 = (guint32 )tvb_get_ntoh24(tvb, offset);*/ - mtp3_addr_opc = ep_alloc0(sizeof(mtp3_addr_pc_t)); + mtp3_addr_opc = ep_new0(mtp3_addr_pc_t); mtp3_addr_opc->pc = (guint32 )tvb_get_ntoh24(tvb, offset); - mtp3_addr_opc->type = 1; /* ITU_STANDARD */ + mtp3_addr_opc->type = ITU_STANDARD; mtp3_addr_opc->ni = 0; /*SET_ADDRESS(&pinfo->net_src, AT_SS7PC, sizeof(mtp3_addr_pc_t), (guint8 *) mtp3_addr_opc);*/ SET_ADDRESS(&pinfo->src, AT_SS7PC, sizeof(mtp3_addr_pc_t), (guint8 *) mtp3_addr_opc); @@ -256,9 +256,9 @@ dissect_ppcap_source_address(tvbuff_t *tvb, packet_info *pinfo, proto_tree * ppc proto_tree_add_item(ppcap_tree1, hf_ppcap_opc, tvb, offset, msg_len, ENC_BIG_ENDIAN); /*src_addr1 = (guint32 )tvb_get_ntoh24(tvb, offset);*/ - mtp3_addr_opc = ep_alloc0(sizeof(mtp3_addr_pc_t)); + mtp3_addr_opc = ep_new0(mtp3_addr_pc_t); mtp3_addr_opc->pc = tvb_get_ntohl(tvb, offset); - mtp3_addr_opc->type = 1; /* ITU_STANDARD */ + mtp3_addr_opc->type = ITU_STANDARD; mtp3_addr_opc->ni = 0; SET_ADDRESS(&pinfo->src, AT_SS7PC, sizeof(mtp3_addr_pc_t), (guint8 *) mtp3_addr_opc); } @@ -328,9 +328,9 @@ dissect_ppcap_destination_address(tvbuff_t *tvb, packet_info * pinfo, proto_tree proto_tree_add_item(ppcap_tree1, hf_ppcap_spc1, tvb, offset, 3, ENC_BIG_ENDIAN); /*dst_addr1 = (guint32 )tvb_get_ntoh24(tvb, offset);*/ - mtp3_addr_dpc = ep_alloc0(sizeof(mtp3_addr_pc_t)); + mtp3_addr_dpc = ep_new0(mtp3_addr_pc_t); mtp3_addr_dpc->pc = (guint32)tvb_get_ntoh24(tvb, offset); - mtp3_addr_dpc->type = 1; /* ITU_STANDARD */ + mtp3_addr_dpc->type = ITU_STANDARD; mtp3_addr_dpc->ni = 0; SET_ADDRESS(&pinfo->dst, AT_SS7PC, sizeof(mtp3_addr_pc_t), (guint8 *) mtp3_addr_dpc); @@ -346,9 +346,9 @@ dissect_ppcap_destination_address(tvbuff_t *tvb, packet_info * pinfo, proto_tree proto_tree_add_item(ppcap_tree1, hf_ppcap_dpc, tvb, offset, 4, ENC_BIG_ENDIAN); /*dst_addr1 = (guint32 )tvb_get_ntoh24(tvb, offset);*/ - mtp3_addr_dpc = ep_alloc0(sizeof(mtp3_addr_pc_t)); + mtp3_addr_dpc = ep_new0(mtp3_addr_pc_t); mtp3_addr_dpc->pc = tvb_get_ntohl(tvb, offset); - mtp3_addr_dpc->type = 1; /* ITU_STANDARD */ + mtp3_addr_dpc->type = ITU_STANDARD; mtp3_addr_dpc->ni = 0; SET_ADDRESS(&pinfo->dst, AT_SS7PC, sizeof(mtp3_addr_pc_t), (guint8 *) mtp3_addr_dpc); } diff --git a/epan/dissectors/packet-pw-cesopsn.c b/epan/dissectors/packet-pw-cesopsn.c index a2fc1d692f..c5207df07d 100644 --- a/epan/dissectors/packet-pw-cesopsn.c +++ b/epan/dissectors/packet-pw-cesopsn.c @@ -86,7 +86,7 @@ void dissect_pw_cesopsn( tvbuff_t * tvb_original gint packet_size; gint payload_size; gint padding_size; - pwc_packet_properties_t properties; + int properties; packet_size = tvb_reported_length_remaining(tvb_original, 0); diff --git a/epan/dissectors/packet-pw-satop.c b/epan/dissectors/packet-pw-satop.c index 849e30c2c2..0e2fa67940 100644 --- a/epan/dissectors/packet-pw-satop.c +++ b/epan/dissectors/packet-pw-satop.c @@ -72,7 +72,7 @@ void dissect_pw_satop(tvbuff_t * tvb_original gint packet_size; gint payload_size; gint padding_size; - pwc_packet_properties_t properties; + int properties; enum { PAY_NO_IDEA = 0 diff --git a/epan/dissectors/packet-smb-common.c b/epan/dissectors/packet-smb-common.c index c45f0ac0fb..b937a53ea8 100644 --- a/epan/dissectors/packet-smb-common.c +++ b/epan/dissectors/packet-smb-common.c @@ -100,7 +100,7 @@ int display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_i * Allocate a buffer for the string; "len" is the length in * bytes, not the length in characters. */ - str = ep_alloc(len/2); + str = (char *)ep_alloc(len/2); /* * XXX - this assumes the string is just ISO 8859-1; we need @@ -163,7 +163,7 @@ unicode_to_str(tvbuff_t *tvb, int offset, int *us_lenp, gboolean exactlen, int us_len; gboolean overflow = FALSE; - cur=ep_alloc(MAX_UNICODE_STR_LEN+3+1); + cur=(gchar *)ep_alloc(MAX_UNICODE_STR_LEN+3+1); p = cur; len = MAX_UNICODE_STR_LEN; us_len = 0; @@ -265,7 +265,7 @@ get_unicode_or_ascii_string(tvbuff_t *tvb, int *offsetp, /* * The string we return must be null-terminated. */ - cur=ep_alloc(MAX_UNICODE_STR_LEN+3+1); + cur=(gchar *)ep_alloc(MAX_UNICODE_STR_LEN+3+1); copylen = *len; if (copylen < 0) { diff --git a/epan/dissectors/packet-smb-mailslot.c b/epan/dissectors/packet-smb-mailslot.c index f7b62b3a0a..dada1e9846 100644 --- a/epan/dissectors/packet-smb-mailslot.c +++ b/epan/dissectors/packet-smb-mailslot.c @@ -107,9 +107,9 @@ dissect_mailslot_smb(tvbuff_t *mshdr_tvb, tvbuff_t *setup_tvb, col_clear(pinfo->cinfo, COL_INFO); - smb_info = pinfo->private_data; + smb_info = (smb_info_t *)pinfo->private_data; if (smb_info->sip != NULL && smb_info->sip->extra_info_type == SMB_EI_TRI) - tri = smb_info->sip->extra_info; + tri = (smb_transact_info_t *)smb_info->sip->extra_info; else tri = NULL; diff --git a/epan/dissectors/packet-smb-pipe.c b/epan/dissectors/packet-smb-pipe.c index f6225666be..5509bf97ea 100644 --- a/epan/dissectors/packet-smb-pipe.c +++ b/epan/dissectors/packet-smb-pipe.c @@ -465,12 +465,12 @@ static int add_detail_level(tvbuff_t *tvb, int offset, int count _U_, packet_info *pinfo, proto_tree *tree, int convert _U_, int hf_index) { - struct smb_info *smb_info = pinfo->private_data; + struct smb_info *smb_info = (struct smb_info *)pinfo->private_data; smb_transact_info_t *trp = NULL; guint16 level; if (smb_info->sip->extra_info_type == SMB_EI_TRI) - trp = smb_info->sip->extra_info; + trp = (smb_transact_info_t *)smb_info->sip->extra_info; level = tvb_get_letohs(tvb, offset); if (!pinfo->fd->flags.visited) @@ -2507,7 +2507,7 @@ dissect_response_data(tvbuff_t *tvb, packet_info *pinfo, int convert, guint i, j; guint16 aux_count; - trp = smb_info->sip->extra_info; + trp = (smb_transact_info_t *)smb_info->sip->extra_info; /* * Find the item table for the matching request's detail level. @@ -2643,7 +2643,7 @@ static gboolean dissect_pipe_lanman(tvbuff_t *pd_tvb, tvbuff_t *p_tvb, tvbuff_t *d_tvb, packet_info *pinfo, proto_tree *parent_tree) { - smb_info_t *smb_info = pinfo->private_data; + smb_info_t *smb_info = (smb_info_t *)pinfo->private_data; smb_transact_info_t *trp = NULL; int offset = 0/*, start_offset*/; guint16 cmd; @@ -2662,7 +2662,7 @@ dissect_pipe_lanman(tvbuff_t *pd_tvb, tvbuff_t *p_tvb, tvbuff_t *d_tvb, proto_tree *data_tree; if (smb_info->sip->extra_info_type == SMB_EI_TRI) - trp = smb_info->sip->extra_info; + trp = (smb_transact_info_t *)smb_info->sip->extra_info; if (!proto_is_protocol_enabled(find_protocol_by_id(proto_smb_lanman))) return FALSE; @@ -3529,7 +3529,7 @@ dissect_pipe_smb(tvbuff_t *sp_tvb, tvbuff_t *s_tvb, tvbuff_t *pd_tvb, return FALSE; pinfo->current_proto = "SMB Pipe"; - smb_info = pinfo->private_data; + smb_info = (smb_info_t *)pinfo->private_data; /* * Set the columns. @@ -3541,7 +3541,7 @@ dissect_pipe_smb(tvbuff_t *sp_tvb, tvbuff_t *s_tvb, tvbuff_t *pd_tvb, } if (smb_info->sip != NULL && smb_info->sip->extra_info_type == SMB_EI_TRI) - tri = smb_info->sip->extra_info; + tri = (smb_transact_info_t *)smb_info->sip->extra_info; else tri = NULL; diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c index 2971f33c66..041ed824fd 100644 --- a/epan/dissectors/packet-smb.c +++ b/epan/dissectors/packet-smb.c @@ -934,17 +934,17 @@ const gchar *tree_ip_str(packet_info *pinfo, guint16 cmd) { if ( cmd==SMB_COM_READ_ANDX || cmd==SMB_COM_READ || cmd==SMB2_COM_READ) { - buf=(gchar *)ip_to_str(pinfo->src.data); + buf=(gchar *)ip_to_str((const guint8 *)pinfo->src.data); } else { - buf=(gchar *)ip_to_str(pinfo->dst.data); + buf=(gchar *)ip_to_str((const guint8 *)pinfo->dst.data); } } else { if ( cmd==SMB_COM_READ_ANDX || cmd==SMB_COM_READ || cmd==SMB2_COM_READ) { - buf=(gchar *)ip6_to_str(pinfo->src.data); + buf=(gchar *)ip6_to_str((const struct e_in6_addr *)pinfo->src.data); } else { - buf=(gchar *)ip6_to_str(pinfo->dst.data); + buf=(gchar *)ip6_to_str((const struct e_in6_addr *)pinfo->dst.data); } } @@ -968,13 +968,13 @@ feed_eo_smb(guint16 cmd, guint16 fid, tvbuff_t * tvb,packet_info *pinfo,guint16 /* Create a new tvb to point to the payload data */ data_tvb = tvb_new_subset(tvb, dataoffset, datalen, datalen); /* Create the eo_info to pass to the listener */ - eo_info = ep_alloc(sizeof(smb_eo_t)); + eo_info = ep_new(smb_eo_t); /* Try to get fid_info and tid_info */ if (fid_info == NULL) { GSL_iterator = si->ct->GSL_fid_info; while (GSL_iterator) { - suspect_fid_info = GSL_iterator->data; + suspect_fid_info = (smb_fid_info_t *)GSL_iterator->data; if (suspect_fid_info->opened_in > pinfo->fd->num) break; if ((suspect_fid_info->tid == si->tid) && (suspect_fid_info->fid == fid)) fid_info = suspect_fid_info; @@ -983,7 +983,7 @@ feed_eo_smb(guint16 cmd, guint16 fid, tvbuff_t * tvb,packet_info *pinfo,guint16 } - tid_info = se_tree_lookup32(si->ct->tid_tree, si->tid); + tid_info = (smb_tid_info_t *)se_tree_lookup32(si->ct->tid_tree, si->tid); /* Construct the eo_info structure */ eo_info->smbversion=1; @@ -3305,7 +3305,7 @@ dissect_open_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i * dissect_smb_fid() called from the response. */ if ((!pinfo->fd->flags.visited) && si->sip && fn) { - fsi = se_alloc(sizeof(smb_fid_saved_info_t)); + fsi = se_new(smb_fid_saved_info_t); fsi->filename = se_strdup(fn); fsi->create_flags = 0; fsi->access_mask = 0; @@ -3929,7 +3929,7 @@ dissect_create_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, * dissect_smb_fid() called from the response. */ if ((!pinfo->fd->flags.visited) && si->sip && fn) { - fsi = se_alloc(sizeof(smb_fid_saved_info_t)); + fsi = se_new(smb_fid_saved_info_t); fsi->filename = se_strdup(fn); fsi->create_flags = 0; fsi->access_mask = 0; @@ -4327,7 +4327,7 @@ dissect_read_file_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i /* save the offset/len for this transaction */ if (si->sip && !pinfo->fd->flags.visited) { - rwi = se_alloc(sizeof(rw_info_t)); + rwi = se_new(rw_info_t); rwi->offset = ofs; rwi->len = cnt; rwi->fid = fid; @@ -4468,7 +4468,7 @@ dissect_read_file_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, } if (si->sip && (si->sip->extra_info_type == SMB_EI_RWINFO)) { - rwi = si->sip->extra_info; + rwi = (rw_info_t *)si->sip->extra_info; } if (rwi) { proto_item *it; diff --git a/epan/dissectors/packet-vnc.c b/epan/dissectors/packet-vnc.c index 8aa90122af..2da117a05c 100644 --- a/epan/dissectors/packet-vnc.c +++ b/epan/dissectors/packet-vnc.c @@ -632,9 +632,9 @@ dissect_vnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Retrieve information from conversation, or add it if it isn't * there yet */ - per_conversation_info = conversation_get_proto_data(conversation, proto_vnc); + per_conversation_info = (vnc_conversation_t *)conversation_get_proto_data(conversation, proto_vnc); if(!per_conversation_info) { - per_conversation_info = se_alloc(sizeof(vnc_conversation_t)); + per_conversation_info = se_new(vnc_conversation_t); per_conversation_info->vnc_next_state = VNC_SESSION_STATE_SERVER_VERSION; per_conversation_info->security_type_selected = VNC_SECURITY_TYPE_INVALID; @@ -799,10 +799,10 @@ vnc_startup_messages(tvbuff_t *tvb, packet_info *pinfo, gint offset, gint num_auth_types; proto_item* auth_item; - per_packet_info = p_get_proto_data(pinfo->fd, proto_vnc); + per_packet_info = (vnc_packet_t *)p_get_proto_data(pinfo->fd, proto_vnc); if(!per_packet_info) { - per_packet_info = se_alloc(sizeof(vnc_packet_t)); + per_packet_info = se_new(vnc_packet_t); per_packet_info->state = per_conversation_info->vnc_next_state; per_packet_info->preferred_encoding = -1; @@ -1456,7 +1456,7 @@ vnc_client_set_encodings(tvbuff_t *tvb, packet_info *pinfo, gint *offset, guint counter; vnc_packet_t *per_packet_info; - per_packet_info = p_get_proto_data(pinfo->fd, proto_vnc); + per_packet_info = (vnc_packet_t *)p_get_proto_data(pinfo->fd, proto_vnc); /* Our calling function should have set the packet's proto data already */ DISSECTOR_ASSERT(per_packet_info != NULL); @@ -2181,7 +2181,7 @@ process_tight_rect_filter_palette(tvbuff_t *tvb, packet_info *pinfo, gint *offse /* See TightVNC's vnc_unixsrc/vncviewer/tight.c:InitFilterPaletteBPP() */ - per_packet_info = p_get_proto_data(pinfo->fd, proto_vnc); + per_packet_info = (vnc_packet_t *)p_get_proto_data(pinfo->fd, proto_vnc); /* Our calling function should have set the packet's proto data already */ DISSECTOR_ASSERT(per_packet_info != NULL); @@ -2222,7 +2222,7 @@ vnc_tight_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset, gint bit_offset; gint bytes_needed = -1; - per_packet_info = p_get_proto_data(pinfo->fd, proto_vnc); + per_packet_info = (vnc_packet_t *)p_get_proto_data(pinfo->fd, proto_vnc); /* Our calling function should have set the packet's proto data already */ DISSECTOR_ASSERT(per_packet_info != NULL); @@ -2512,7 +2512,7 @@ vnc_set_bytes_per_pixel(const packet_info *pinfo, const guint8 bytes_per_pixel) { vnc_packet_t *per_packet_info; - per_packet_info = p_get_proto_data(pinfo->fd, proto_vnc); + per_packet_info = (vnc_packet_t *)p_get_proto_data(pinfo->fd, proto_vnc); /* Our calling function should have set the packet's proto data already */ DISSECTOR_ASSERT(per_packet_info != NULL); @@ -2525,7 +2525,7 @@ vnc_set_depth(const packet_info *pinfo, const guint8 depth) { vnc_packet_t *per_packet_info; - per_packet_info = p_get_proto_data(pinfo->fd, proto_vnc); + per_packet_info = (vnc_packet_t *)p_get_proto_data(pinfo->fd, proto_vnc); /* Our calling function should have set the packet's proto data already */ DISSECTOR_ASSERT(per_packet_info != NULL); @@ -2538,7 +2538,7 @@ vnc_get_bytes_per_pixel(const packet_info *pinfo) { vnc_packet_t *per_packet_info; - per_packet_info = p_get_proto_data(pinfo->fd, proto_vnc); + per_packet_info = (vnc_packet_t *)p_get_proto_data(pinfo->fd, proto_vnc); /* Our calling function should have set the packet's proto data already */ DISSECTOR_ASSERT(per_packet_info != NULL); diff --git a/epan/strutil.c b/epan/strutil.c index 36211a3bf9..85b270eb27 100644 --- a/epan/strutil.c +++ b/epan/strutil.c @@ -53,7 +53,7 @@ find_line_end(const guchar *data, const guchar *dataend, const guchar **eol) { const guchar *lineend; - lineend = memchr(data, '\n', dataend - data); + lineend = (guchar *)memchr(data, '\n', dataend - data); if (lineend == NULL) { /* * No LF - line is probably continued in next TCP segment. @@ -163,7 +163,7 @@ format_text(const guchar *string, size_t len) * Allocate the buffer if it's not already allocated. */ if (fmtbuf[idx] == NULL) { - fmtbuf[idx] = g_malloc(INITIAL_FMTBUF_SIZE); + fmtbuf[idx] = (gchar *)g_malloc(INITIAL_FMTBUF_SIZE); fmtbuf_len[idx] = INITIAL_FMTBUF_SIZE; } column = 0; @@ -181,7 +181,7 @@ format_text(const guchar *string, size_t len) * for one more character plus a terminating '\0'. */ fmtbuf_len[idx] = fmtbuf_len[idx] * 2; - fmtbuf[idx] = g_realloc(fmtbuf[idx], fmtbuf_len[idx]); + fmtbuf[idx] = (gchar *)g_realloc(fmtbuf[idx], fmtbuf_len[idx]); } c = *string++; @@ -269,7 +269,7 @@ format_text_wsp(const guchar *string, size_t len) * Allocate the buffer if it's not already allocated. */ if (fmtbuf[idx] == NULL) { - fmtbuf[idx] = g_malloc(INITIAL_FMTBUF_SIZE); + fmtbuf[idx] = (gchar *)g_malloc(INITIAL_FMTBUF_SIZE); fmtbuf_len[idx] = INITIAL_FMTBUF_SIZE; } column = 0; @@ -287,7 +287,7 @@ format_text_wsp(const guchar *string, size_t len) * for one more character plus a terminating '\0'. */ fmtbuf_len[idx] = fmtbuf_len[idx] * 2; - fmtbuf[idx] = g_realloc(fmtbuf[idx], fmtbuf_len[idx]); + fmtbuf[idx] = (gchar *)g_realloc(fmtbuf[idx], fmtbuf_len[idx]); } c = *string++; @@ -551,7 +551,7 @@ format_uri(const GByteArray *bytes, const gchar *reserved_chars) * Allocate the buffer if it's not already allocated. */ if (fmtbuf[idx] == NULL) { - fmtbuf[idx] = g_malloc(INITIAL_FMTBUF_SIZE); + fmtbuf[idx] = (gchar *)g_malloc(INITIAL_FMTBUF_SIZE); fmtbuf_len[idx] = INITIAL_FMTBUF_SIZE; } for (column = 0; column < bytes->len; column++) { @@ -568,7 +568,7 @@ format_uri(const GByteArray *bytes, const gchar *reserved_chars) * for one more character plus a terminating '\0'. */ fmtbuf_len[idx] = fmtbuf_len[idx] * 2; - fmtbuf[idx] = g_realloc(fmtbuf[idx], fmtbuf_len[idx]); + fmtbuf[idx] = (gchar *)g_realloc(fmtbuf[idx], fmtbuf_len[idx]); } c = bytes->data[column]; @@ -818,7 +818,7 @@ convert_string_to_hex(const char *string, size_t *nbytes) * OK, it's valid, and it generates "n_bytes" bytes; generate the * raw byte array. */ - bytes = g_malloc(n_bytes); + bytes = (guint8 *)g_malloc(n_bytes); p = &string[0]; q = &bytes[0]; for (;;) { @@ -1019,7 +1019,7 @@ ws_strdup_escape_char (const gchar *str, const gchar chr) p = str; /* Worst case: A string that is full of 'chr' */ - q = new_str = g_malloc (strlen(str) * 2 + 1); + q = new_str = (gchar *)g_malloc (strlen(str) * 2 + 1); while(*p != 0) { if(*p == chr) @@ -1047,7 +1047,7 @@ ws_strdup_unescape_char (const gchar *str, const char chr) p = str; /* Worst case: A string that contains no 'chr' */ - q = new_str = g_malloc (strlen(str) + 1); + q = new_str = (gchar *)g_malloc (strlen(str) + 1); while(*p != 0) { *q++ = *p; diff --git a/epan/to_str.c b/epan/to_str.c index 09f87d422a..b760c8c2c5 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -173,7 +173,7 @@ bytestring_to_str(const guint8 *ad, const guint32 len, const char punct) { else buflen=len*2 + 1; - buf=ep_alloc(buflen); + buf=(gchar *)ep_alloc(buflen); if (punct) bytes_to_hexstr_punct(buf, ad, len, punct); @@ -196,7 +196,7 @@ bytes_to_str(const guint8 *bd, int bd_len) { if (!bd) REPORT_DISSECTOR_BUG("Null pointer passed to bytes_to_str()"); - cur=ep_alloc(MAX_BYTE_STR_LEN+3+1); + cur=(gchar *)ep_alloc(MAX_BYTE_STR_LEN+3+1); if (bd_len <= 0) { cur[0] = '\0'; return cur; } if (bd_len > MAX_BYTE_STR_LEN/2) { /* bd_len > 24 */ @@ -225,7 +225,7 @@ bytes_to_str_punct(const guint8 *bd, int bd_len, gchar punct) { if (!punct) return bytes_to_str(bd, bd_len); - cur=ep_alloc(MAX_BYTE_STR_LEN+3+1); + cur=(gchar *)ep_alloc(MAX_BYTE_STR_LEN+3+1); if (bd_len <= 0) { cur[0] = '\0'; return cur; } if (bd_len > MAX_BYTE_STR_LEN/3) { /* bd_len > 16 */ @@ -325,7 +325,7 @@ gchar * guint32_to_str(const guint32 u) { int str_len = 16; /* guint32_to_str_buf_len(u)+1; */ - gchar *bp = ep_alloc(str_len); + gchar *bp = (gchar *)ep_alloc(str_len); guint32_to_str_buf(u, bp, str_len); return bp; @@ -877,7 +877,7 @@ rel_time_to_secs_str(const nstime_t *rel_time) { gchar *buf; - buf=ep_alloc(REL_TIME_SECS_LEN); + buf=(gchar *)ep_alloc(REL_TIME_SECS_LEN); display_signed_time(buf, REL_TIME_SECS_LEN, (gint32) rel_time->secs, rel_time->nsecs, TO_STR_TIME_RES_T_NSECS); @@ -902,7 +902,7 @@ decode_bits_in_field(const guint bit_offset, const gint no_of_bits, const guint6 mask = mask << (no_of_bits-1); /* Prepare the string, 256 pos for the bits and zero termination, + 64 for the spaces */ - str=ep_alloc0(256+64); + str=(char *)ep_alloc0(256+64); for(bit=0;bit<((int)(bit_offset&0x07));bit++){ if(bit&&(!(bit%4))){ str[str_p] = ' '; @@ -1000,7 +1000,7 @@ decode_boolean_bitfield(const guint32 val, const guint32 mask, const int width, char *buf; char *p; - buf=ep_alloc(1025); /* is this a bit overkill? */ + buf=(char *)ep_alloc(1025); /* is this a bit overkill? */ p = decode_bitfield_value(buf, val, mask, width); if (val & mask) strcpy(p, truedesc); @@ -1019,7 +1019,7 @@ decode_numeric_bitfield(const guint32 val, const guint32 mask, const int width, char *p; int shift = 0; - buf=ep_alloc(1025); /* isnt this a bit overkill? */ + buf=(char *)ep_alloc(1025); /* isnt this a bit overkill? */ /* Compute the number of bits we have to shift the bitfield right to extract its value. */ while ((mask & (1<