aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2013-03-16 08:12:29 +0000
committerAnders Broman <anders.broman@ericsson.com>2013-03-16 08:12:29 +0000
commit27744ecc2d9925491e5ef8cc97e41d551efc6a2e (patch)
tree6aba5a4a5dc7c11be8982099065f85f32665f968
parent1931018a58a1ce88969cc95fac47810b8b70c1ed (diff)
From beroset:
remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 svn path=/trunk/; revision=48337
-rw-r--r--epan/dissectors/packet-btl2cap.c36
-rw-r--r--epan/dissectors/packet-ntlmssp.c40
-rw-r--r--epan/dissectors/packet-rlc-lte.c38
-rw-r--r--epan/dissectors/packet-tcp.c43
-rw-r--r--epan/stats_tree.c38
-rw-r--r--epan/wslua/init_wslua.c9
-rwxr-xr-xepan/wslua/make-taps.pl6
-rw-r--r--epan/wslua/wslua_dumper.c16
-rw-r--r--epan/wslua/wslua_field.c28
-rw-r--r--epan/wslua/wslua_gui.c28
-rw-r--r--epan/wslua/wslua_listener.c10
-rw-r--r--epan/wslua/wslua_pinfo.c30
-rw-r--r--epan/wslua/wslua_tree.c12
-rw-r--r--epan/wslua/wslua_tvb.c36
-rw-r--r--epan/wslua/wslua_util.c8
15 files changed, 190 insertions, 188 deletions
diff --git a/epan/dissectors/packet-btl2cap.c b/epan/dissectors/packet-btl2cap.c
index d79cdb0201..e1d1f4306b 100644
--- a/epan/dissectors/packet-btl2cap.c
+++ b/epan/dissectors/packet-btl2cap.c
@@ -462,7 +462,7 @@ dissect_connrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
key[5].length = 0;
key[5].key = NULL;
- psm_service = se_tree_lookup32_array_le(psm_to_service_table, key);
+ psm_service = (psm_service_t *)se_tree_lookup32_array_le(psm_to_service_table, key);
if (psm_service && psm_service->interface_id == interface_id &&
psm_service->adapter_id == adapter_id &&
psm_service->chandle == chandle &&
@@ -494,7 +494,7 @@ dissect_connrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *t
k_cid = scid | ((pinfo->p2p_dir == P2P_DIR_RECV) ? 0x80000000 : 0x00000000);
k_frame_number = pinfo->fd->num;
- psm_data = se_alloc(sizeof(psm_data_t));
+ psm_data = se_new(psm_data_t);
psm_data->scid = (scid | ((pinfo->p2p_dir == P2P_DIR_RECV) ? 0x80000000 : 0x00000000));
psm_data->dcid = 0;
psm_data->psm = psm;
@@ -740,7 +740,7 @@ dissect_configrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
key[5].length = 0;
key[5].key = NULL;
- psm_data = se_tree_lookup32_array_le(cid_to_psm_table, key);
+ psm_data = (psm_data_t *)se_tree_lookup32_array_le(cid_to_psm_table, key);
if (psm_data && psm_data->interface_id == interface_id &&
psm_data->adapter_id == adapter_id &&
psm_data->chandle == chandle &&
@@ -928,7 +928,7 @@ dissect_configresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree
key[5].length = 0;
key[5].key = NULL;
- psm_data = se_tree_lookup32_array_le(cid_to_psm_table, key);
+ psm_data = (psm_data_t *)se_tree_lookup32_array_le(cid_to_psm_table, key);
if (psm_data && psm_data->interface_id == interface_id &&
psm_data->adapter_id == adapter_id &&
psm_data->chandle == chandle &&
@@ -1012,7 +1012,7 @@ dissect_connresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *
key[5].length = 0;
key[5].key = NULL;
- psm_data = se_tree_lookup32_array_le(cid_to_psm_table, key);
+ psm_data = (psm_data_t *)se_tree_lookup32_array_le(cid_to_psm_table, key);
if (psm_data && psm_data->interface_id == interface_id &&
psm_data->adapter_id == adapter_id &&
psm_data->chandle == chandle &&
@@ -1203,7 +1203,7 @@ dissect_disconnrequestresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, pr
key[5].length = 0;
key[5].key = NULL;
- psm_data = se_tree_lookup32_array_le(cid_to_psm_table, key);
+ psm_data = (psm_data_t *)se_tree_lookup32_array_le(cid_to_psm_table, key);
if (psm_data && psm_data->interface_id == interface_id &&
psm_data->adapter_id == adapter_id &&
psm_data->chandle == chandle &&
@@ -1231,7 +1231,7 @@ dissect_disconnrequestresponse(tvbuff_t *tvb, int offset, packet_info *pinfo, pr
key[5].length = 0;
key[5].key = NULL;
- psm_data = se_tree_lookup32_array_le(cid_to_psm_table, key);
+ psm_data = (psm_data_t *)se_tree_lookup32_array_le(cid_to_psm_table, key);
if (psm_data && psm_data->interface_id == interface_id &&
psm_data->adapter_id == adapter_id &&
psm_data->chandle == chandle &&
@@ -1296,7 +1296,7 @@ dissect_b_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
key[5].length = 0;
key[5].key = NULL;
- psm_service = se_tree_lookup32_array_le(psm_to_service_table, key);
+ psm_service = (psm_service_t *)se_tree_lookup32_array_le(psm_to_service_table, key);
if (psm_service && psm_service->interface_id == interface_id &&
psm_service->adapter_id == adapter_id &&
psm_service->chandle == chandle &&
@@ -1403,16 +1403,16 @@ dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
}
if (!pinfo->fd->flags.visited) {
- mfp = se_alloc(sizeof(sdu_reassembly_t));
+ mfp = se_new(sdu_reassembly_t);
mfp->first_frame = pinfo->fd->num;
mfp->last_frame = 0;
mfp->tot_len = sdulen;
- mfp->reassembled = se_alloc(sdulen);
+ mfp->reassembled = (guint8 *)se_alloc(sdulen);
tvb_memcpy(tvb, mfp->reassembled, offset, sdulen);
mfp->cur_off = sdulen;
se_tree_insert32(config_data->start_fragments, pinfo->fd->num, mfp);
} else {
- mfp = se_tree_lookup32(config_data->start_fragments, pinfo->fd->num);
+ mfp = (sdu_reassembly_t *)se_tree_lookup32(config_data->start_fragments, pinfo->fd->num);
}
if (mfp != NULL && mfp->last_frame) {
proto_item *item;
@@ -1429,7 +1429,7 @@ dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
length -= 4; /*Control, FCS*/
}
if (segment == 0x02 || segment == 0x03) {
- mfp = se_tree_lookup32_le(config_data->start_fragments, pinfo->fd->num);
+ mfp = (sdu_reassembly_t *)se_tree_lookup32_le(config_data->start_fragments, pinfo->fd->num);
if (!pinfo->fd->flags.visited) {
if (mfp != NULL && !mfp->last_frame && (mfp->tot_len>=mfp->cur_off + length)) {
tvb_memcpy(tvb, mfp->reassembled + mfp->cur_off, offset, length);
@@ -1497,7 +1497,7 @@ dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
key[5].length = 0;
key[5].key = NULL;
- psm_service = se_tree_lookup32_array_le(psm_to_service_table, key);
+ psm_service = (psm_service_t *)se_tree_lookup32_array_le(psm_to_service_table, key);
if (psm_service && psm_service->interface_id == interface_id &&
psm_service->adapter_id == adapter_id &&
psm_service->chandle == chandle &&
@@ -1633,7 +1633,7 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 2;
acl_data = (bthci_acl_data_t *)pinfo->private_data;
- l2cap_data = ep_alloc(sizeof(btl2cap_data_t));
+ l2cap_data = ep_new(btl2cap_data_t);
l2cap_data->interface_id = (acl_data) ? acl_data->interface_id : HCI_INTERFACE_AMP;
l2cap_data->adapter_id = (acl_data) ? acl_data->adapter_id : HCI_ADAPTER_DEFAULT;
@@ -1809,7 +1809,7 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
key[5].length = 0;
key[5].key = NULL;
- psm_service = se_tree_lookup32_array_le(psm_to_service_table, key);
+ psm_service = (psm_service_t *)se_tree_lookup32_array_le(psm_to_service_table, key);
if (!(psm_service && psm_service->interface_id == interface_id &&
psm_service->adapter_id == adapter_id &&
psm_service->chandle == chandle &&
@@ -1893,7 +1893,7 @@ dissect_btl2cap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
key[5].length = 0;
key[5].key = NULL;
- psm_data = se_tree_lookup32_array_le(cid_to_psm_table, key);
+ psm_data = (psm_data_t *)se_tree_lookup32_array_le(cid_to_psm_table, key);
if (psm_data && psm_data->interface_id == interface_id &&
psm_data->adapter_id == adapter_id &&
psm_data->chandle == chandle &&
@@ -1985,12 +1985,12 @@ btl2cap_sdp_tap_packet(void *arg _U_, packet_info *pinfo _U_, epan_dissect_t *ed
key[5].key = NULL;
- psm_service = se_tree_lookup32_array_le(psm_to_service_table, key);
+ psm_service = (psm_service_t *)se_tree_lookup32_array_le(psm_to_service_table, key);
if (!(psm_service && psm_service->interface_id == interface_id &&
psm_service->adapter_id == adapter_id &&
psm_service->chandle == chandle &&
psm_service->psm == psm)) {
- psm_service = se_alloc0(sizeof(psm_service_t));
+ psm_service = se_new0(psm_service_t);
psm_service->interface_id = interface_id;
psm_service->adapter_id = adapter_id;
psm_service->chandle = chandle;
diff --git a/epan/dissectors/packet-ntlmssp.c b/epan/dissectors/packet-ntlmssp.c
index 180d0554e3..953edc2568 100644
--- a/epan/dissectors/packet-ntlmssp.c
+++ b/epan/dissectors/packet-ntlmssp.c
@@ -491,7 +491,7 @@ get_md4pass_list(md4_pass** p_pass_list, const char* nt_password)
return 0;
}
i = 0;
- *p_pass_list = ep_alloc(nb_pass*sizeof(md4_pass));
+ *p_pass_list = (md4_pass *)ep_alloc(nb_pass*sizeof(md4_pass));
pass_list = *p_pass_list;
if (memcmp(nt_password_hash, gbl_zeros, NTLMSSP_KEY_LEN) != 0) {
@@ -1515,13 +1515,13 @@ dissect_ntlmssp_challenge (tvbuff_t *tvb, packet_info *pinfo, int offset,
tvb_memcpy(tvb, tmp, offset, 8); /* challenge */
/* We can face more than one NTLM exchange over the same couple of IP and ports ...*/
- conv_ntlmssp_info = conversation_get_proto_data(conversation, proto_ntlmssp);
+ conv_ntlmssp_info = (ntlmssp_info *)conversation_get_proto_data(conversation, proto_ntlmssp);
/* XXX: The following code is (re)executed every time a particular frame is dissected
* (in whatever order). Thus it seems to me that "multiple exchanges" might not be
* handled well depending on the order that frames are visited after the initial dissection.
*/
if (!conv_ntlmssp_info || memcmp(tmp, conv_ntlmssp_info->server_challenge, 8) != 0) {
- conv_ntlmssp_info = se_alloc(sizeof(ntlmssp_info));
+ conv_ntlmssp_info = se_new(ntlmssp_info);
/* Insert the flags into the conversation */
conv_ntlmssp_info->flags = negotiate_flags;
/* Insert the RC4 state information into the conversation */
@@ -1642,7 +1642,7 @@ dissect_ntlmssp_auth (tvbuff_t *tvb, packet_info *pinfo, int offset,
* - has the AUTHENTICATE message in a second TCP connection;
* (The authentication aparently succeeded).
*/
- conv_ntlmssp_info = p_get_proto_data(pinfo->fd, proto_ntlmssp);
+ conv_ntlmssp_info = (ntlmssp_info *)p_get_proto_data(pinfo->fd, proto_ntlmssp);
if (conv_ntlmssp_info == NULL) {
/*
* There isn't any. Is there any from this conversation? If so,
@@ -1653,9 +1653,9 @@ dissect_ntlmssp_auth (tvbuff_t *tvb, packet_info *pinfo, int offset,
/* so we'll have a place to store flags. */
/* This is a bit brute-force but looks like it will be OK. */
conversation = find_or_create_conversation(pinfo);
- conv_ntlmssp_info = conversation_get_proto_data(conversation, proto_ntlmssp);
+ conv_ntlmssp_info = (ntlmssp_info *)conversation_get_proto_data(conversation, proto_ntlmssp);
if (conv_ntlmssp_info == NULL) {
- conv_ntlmssp_info = se_alloc0(sizeof(ntlmssp_info));
+ conv_ntlmssp_info = se_new0(ntlmssp_info);
conversation_add_proto_data(conversation, proto_ntlmssp, conv_ntlmssp_info);
}
/* XXX: The *conv_ntlmssp_info struct attached to the frame is the
@@ -1849,7 +1849,7 @@ get_sign_key(packet_info *pinfo, int cryptpeer)
}
else {
/* We have a conversation, check for encryption state */
- conv_ntlmssp_info = conversation_get_proto_data(conversation,
+ conv_ntlmssp_info = (ntlmssp_info *)conversation_get_proto_data(conversation,
proto_ntlmssp);
if (conv_ntlmssp_info == NULL) {
/* No encryption state tied to the conversation. Therefore, we
@@ -1889,7 +1889,7 @@ get_encrypted_state(packet_info *pinfo, int cryptpeer)
}
else {
/* We have a conversation, check for encryption state */
- conv_ntlmssp_info = conversation_get_proto_data(conversation,
+ conv_ntlmssp_info = (ntlmssp_info *)conversation_get_proto_data(conversation,
proto_ntlmssp);
if (conv_ntlmssp_info == NULL) {
/* No encryption state tied to the conversation. Therefore, we
@@ -2010,10 +2010,10 @@ decrypt_data_payload(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
ntlmssp_packet_info *stored_packet_ntlmssp_info = NULL;
/* Check to see if we already have state for this packet */
- packet_ntlmssp_info = p_get_proto_data(pinfo->fd, proto_ntlmssp);
+ packet_ntlmssp_info = (ntlmssp_packet_info *)p_get_proto_data(pinfo->fd, proto_ntlmssp);
if (packet_ntlmssp_info == NULL) {
/* We don't have any packet state, so create one */
- packet_ntlmssp_info = se_alloc0(sizeof(ntlmssp_packet_info));
+ packet_ntlmssp_info = se_new0(ntlmssp_packet_info);
p_add_proto_data(pinfo->fd, proto_ntlmssp, packet_ntlmssp_info);
}
if (!packet_ntlmssp_info->payload_decrypted) {
@@ -2029,7 +2029,7 @@ decrypt_data_payload(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
return ;
}
- conv_ntlmssp_info = conversation_get_proto_data(conversation,
+ conv_ntlmssp_info = (ntlmssp_info *)conversation_get_proto_data(conversation,
proto_ntlmssp);
if (conv_ntlmssp_info == NULL) {
/* There is no NTLMSSP state tied to the conversation */
@@ -2041,7 +2041,7 @@ decrypt_data_payload(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
return;
}
if (key != NULL) {
- stored_packet_ntlmssp_info = g_hash_table_lookup(hash_packet, key);
+ stored_packet_ntlmssp_info = (ntlmssp_packet_info *)g_hash_table_lookup(hash_packet, key);
}
if (stored_packet_ntlmssp_info != NULL && stored_packet_ntlmssp_info->payload_decrypted == TRUE) {
/* Mat TBD (stderr, "Found a already decrypted packet\n");*/
@@ -2072,7 +2072,7 @@ decrypt_data_payload(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
/* Store the decrypted contents in the packet state struct
(of course at this point, they aren't decrypted yet) */
- packet_ntlmssp_info->decrypted_payload = tvb_memdup(tvb, offset,
+ packet_ntlmssp_info->decrypted_payload = (guint8 *)tvb_memdup(tvb, offset,
encrypted_block_length);
packet_ntlmssp_info->payload_len = encrypted_block_length;
decrypted_payloads = g_slist_prepend(decrypted_payloads,
@@ -2092,7 +2092,7 @@ decrypt_data_payload(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
in case of KEY_EXCH we have independent key so this is not needed*/
if (!(NTLMSSP_NEGOTIATE_KEY_EXCH & conv_ntlmssp_info->flags)) {
guint8 *peer_block;
- peer_block = ep_memdup(packet_ntlmssp_info->decrypted_payload, encrypted_block_length);
+ peer_block = (guint8 *)ep_memdup(packet_ntlmssp_info->decrypted_payload, encrypted_block_length);
crypt_rc4(rc4_state_peer, peer_block, encrypted_block_length);
}
@@ -2119,7 +2119,7 @@ dissect_ntlmssp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ntlmssp_header_t *ntlmssph;
void *pd_save;
- ntlmssph = ep_alloc(sizeof(ntlmssp_header_t));
+ ntlmssph = ep_new(ntlmssp_header_t);
ntlmssph->type = 0;
ntlmssph->domain_name = NULL;
ntlmssph->acct_name = NULL;
@@ -2234,7 +2234,7 @@ decrypt_verifier(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
int sequence = 0;
ntlmssp_packet_info *stored_packet_ntlmssp_info = NULL;
- packet_ntlmssp_info = p_get_proto_data(pinfo->fd, proto_ntlmssp);
+ packet_ntlmssp_info = (ntlmssp_packet_info *)p_get_proto_data(pinfo->fd, proto_ntlmssp);
if (packet_ntlmssp_info == NULL) {
/* We don't have data for this packet */
return;
@@ -2246,7 +2246,7 @@ decrypt_verifier(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
/* There is no conversation, thus no encryption state */
return;
}
- conv_ntlmssp_info = conversation_get_proto_data(conversation,
+ conv_ntlmssp_info = (ntlmssp_info *)conversation_get_proto_data(conversation,
proto_ntlmssp);
if (conv_ntlmssp_info == NULL) {
/* There is no NTLMSSP state tied to the conversation */
@@ -2254,7 +2254,7 @@ decrypt_verifier(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
}
if (key != NULL) {
- stored_packet_ntlmssp_info = g_hash_table_lookup(hash_packet, key);
+ stored_packet_ntlmssp_info = (ntlmssp_packet_info *)g_hash_table_lookup(hash_packet, key);
}
if (stored_packet_ntlmssp_info != NULL && stored_packet_ntlmssp_info->verifier_decrypted == TRUE) {
/* Mat TBD fprintf(stderr, "Found a already decrypted packet\n");*/
@@ -2303,7 +2303,7 @@ decrypt_verifier(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
* Some analysis need to be done ...
*/
if (sign_key != NULL) {
- check_buf = ep_alloc(packet_ntlmssp_info->payload_len+4);
+ check_buf = (guint8 *)ep_alloc(packet_ntlmssp_info->payload_len+4);
tvb_memcpy(tvb, &sequence, offset+8, 4);
memcpy(check_buf, &sequence, 4);
memcpy(check_buf+4, packet_ntlmssp_info->decrypted_payload, packet_ntlmssp_info->payload_len);
@@ -2328,7 +2328,7 @@ decrypt_verifier(tvbuff_t *tvb, int offset, guint32 encrypted_block_length,
This is not needed when we just have EXTENDED SECURITY because the signature is not crypted
and it's also not needed when we have key exchange because server and client have independent keys */
if (!(NTLMSSP_NEGOTIATE_KEY_EXCH & conv_ntlmssp_info->flags) && !(NTLMSSP_NEGOTIATE_EXTENDED_SECURITY & conv_ntlmssp_info->flags)) {
- peer_block = ep_memdup(packet_ntlmssp_info->verifier, encrypted_block_length);
+ peer_block = (guint8 *)ep_memdup(packet_ntlmssp_info->verifier, encrypted_block_length);
crypt_rc4(rc4_state_peer, peer_block, encrypted_block_length);
}
diff --git a/epan/dissectors/packet-rlc-lte.c b/epan/dissectors/packet-rlc-lte.c
index c3c506c2e3..172fc36f7c 100644
--- a/epan/dissectors/packet-rlc-lte.c
+++ b/epan/dissectors/packet-rlc-lte.c
@@ -425,7 +425,7 @@ static GHashTable *reassembly_report_hash = NULL;
/* Create a new struct for reassembly */
static void reassembly_reset(channel_sequence_analysis_status *status)
{
- status->reassembly_info = se_alloc0(sizeof(rlc_channel_reassembly_info));
+ status->reassembly_info = se_new0(rlc_channel_reassembly_info);
}
/* Hide previous one */
@@ -449,7 +449,7 @@ static void reassembly_add_segment(channel_sequence_analysis_status *status,
return;
}
- segment_data = se_alloc(length);
+ segment_data = (guint8 *)se_alloc(length);
/* TODO: is there a better way to do this? */
memcpy(segment_data, tvb_get_ptr(tvb, offset, length), length);
@@ -488,7 +488,7 @@ static tvbuff_t* reassembly_get_reassembled_tvb(rlc_channel_reassembly_info *rea
for (n=0; n < reassembly_info->number_of_segments; n++) {
combined_length += reassembly_info->segments[n].length;
}
- combined_data = ep_alloc(combined_length);
+ combined_data = (guint8 *)ep_alloc(combined_length);
/* Copy data into contiguous buffer */
for (n=0; n < reassembly_info->number_of_segments; n++) {
@@ -763,9 +763,9 @@ static void show_PDU_in_tree(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb
}
/* Reuse or allocate struct */
- p_pdcp_lte_info = p_get_proto_data(pinfo->fd, proto_pdcp_lte);
+ p_pdcp_lte_info = (pdcp_lte_info *)p_get_proto_data(pinfo->fd, proto_pdcp_lte);
if (p_pdcp_lte_info == NULL) {
- p_pdcp_lte_info = se_alloc0(sizeof(struct pdcp_lte_info));
+ p_pdcp_lte_info = se_new0(pdcp_lte_info);
/* Store info in packet */
p_add_proto_data(pinfo->fd, proto_pdcp_lte, p_pdcp_lte_info);
}
@@ -874,8 +874,8 @@ static void show_PDU_in_tree(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb
/* Equal keys */
static gint rlc_channel_equal(gconstpointer v, gconstpointer v2)
{
- const channel_hash_key* val1 = v;
- const channel_hash_key* val2 = v2;
+ const channel_hash_key* val1 = (const channel_hash_key *)v;
+ const channel_hash_key* val2 = (const channel_hash_key *)v2;
/* All fields must match */
/* N.B. Currently fits into one word, so could return (*v == *v2)
@@ -889,7 +889,7 @@ static gint rlc_channel_equal(gconstpointer v, gconstpointer v2)
/* Compute a hash value for a given key. */
static guint rlc_channel_hash_func(gconstpointer v)
{
- const channel_hash_key* val1 = v;
+ const channel_hash_key* val1 = (const channel_hash_key *)v;
/* TODO: check/reduce multipliers */
return ((val1->ueId * 1024) + (val1->channelType*64) + (val1->channelId*2) + val1->direction);
@@ -1363,8 +1363,8 @@ static sequence_analysis_state checkChannelSequenceInfo(packet_info *pinfo, tvbu
createdChannel = TRUE;
/* Allocate a new value and duplicate key contents */
- p_channel_status = se_alloc0(sizeof(channel_sequence_analysis_status));
- p_channel_key = se_memdup(&channel_key, sizeof(channel_hash_key));
+ p_channel_status = se_new0(channel_sequence_analysis_status);
+ p_channel_key = (channel_hash_key *)se_memdup(&channel_key, sizeof(channel_hash_key));
/* Set mode */
p_channel_status->rlcMode = p_rlc_lte_info->rlcMode;
@@ -1374,7 +1374,7 @@ static sequence_analysis_state checkChannelSequenceInfo(packet_info *pinfo, tvbu
}
/* Create space for frame state_report */
- p_report_in_frame = se_alloc0(sizeof(sequence_analysis_report));
+ p_report_in_frame = se_new0(sequence_analysis_report);
/* Deal with according to channel mode */
@@ -1762,8 +1762,8 @@ static void checkChannelRepeatedNACKInfo(packet_info *pinfo,
if (p_channel_status == NULL) {
/* Allocate a new key and value */
- p_channel_key = se_alloc(sizeof(channel_hash_key));
- p_channel_status = se_alloc0(sizeof(channel_repeated_nack_status));
+ p_channel_key = se_new(channel_hash_key);
+ p_channel_status = se_new0(channel_repeated_nack_status);
/* Copy key contents */
memcpy(p_channel_key, &channel_key, sizeof(channel_hash_key));
@@ -1795,7 +1795,7 @@ static void checkChannelRepeatedNACKInfo(packet_info *pinfo,
if (noOfNACKsRepeated >= 1) {
/* Create space for frame state_report */
- p_report_in_frame = se_alloc(sizeof(channel_repeated_nack_report));
+ p_report_in_frame = se_new(channel_repeated_nack_report);
/* Copy in found duplicates */
for (n=0; n < MIN(tap_info->noOfNACKs, MAX_NACKs); n++) {
@@ -1873,7 +1873,7 @@ static void checkChannelACKWindow(guint16 ack_sn,
if (((1024 + p_channel_status->previousSequenceNumber+1 - ack_sn) % 1024) > 512) {
/* Set result */
- p_report_in_frame = se_alloc0(sizeof(sequence_analysis_report));
+ p_report_in_frame = se_new0(sequence_analysis_report);
p_report_in_frame->state = ACK_Out_of_Window;
p_report_in_frame->previousFrameNum = p_channel_status->previousFrameNum;
p_report_in_frame->sequenceExpected = p_channel_status->previousSequenceNumber;
@@ -2619,10 +2619,10 @@ static gboolean dissect_rlc_lte_heur(tvbuff_t *tvb, packet_info *pinfo,
/* If redissecting, use previous info struct (if available) */
- p_rlc_lte_info = p_get_proto_data(pinfo->fd, proto_rlc_lte);
+ p_rlc_lte_info = (rlc_lte_info *)p_get_proto_data(pinfo->fd, proto_rlc_lte);
if (p_rlc_lte_info == NULL) {
/* Allocate new info struct for this frame */
- p_rlc_lte_info = se_alloc0(sizeof(struct rlc_lte_info));
+ p_rlc_lte_info = se_new0(struct rlc_lte_info);
infoAlreadySet = FALSE;
}
else {
@@ -2712,7 +2712,7 @@ static void dissect_rlc_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
struct rlc_lte_info *p_rlc_lte_info = NULL;
/* Allocate and Zero tap struct */
- rlc_lte_tap_info *tap_info = ep_alloc0(sizeof(rlc_lte_tap_info));
+ rlc_lte_tap_info *tap_info = ep_new0(rlc_lte_tap_info);
/* Set protocol name */
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RLC-LTE");
@@ -2723,7 +2723,7 @@ static void dissect_rlc_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Look for packet info! */
- p_rlc_lte_info = p_get_proto_data(pinfo->fd, proto_rlc_lte);
+ p_rlc_lte_info = (rlc_lte_info *)p_get_proto_data(pinfo->fd, proto_rlc_lte);
/* Can't dissect anything without it... */
if (p_rlc_lte_info == NULL) {
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index 73fd2f4ef0..3b1ccd8ff6 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -469,7 +469,7 @@ init_tcp_conversation_data(packet_info *pinfo)
struct tcp_analysis *tcpd;
/* Initialize the tcp protocol data structure to add to the tcp conversation */
- tcpd=se_alloc0(sizeof(struct tcp_analysis));
+ tcpd=se_new0(struct tcp_analysis);
tcpd->flow1.win_scale=-1;
tcpd->flow1.window = G_MAXUINT32;
tcpd->flow1.multisegment_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "tcp_multisegment_pdus");
@@ -508,7 +508,7 @@ get_tcp_conversation_data(conversation_t *conv, packet_info *pinfo)
conv = find_or_create_conversation(pinfo);
/* Get the data for this conversation */
- tcpd=conversation_get_proto_data(conv, proto_tcp);
+ tcpd=(struct tcp_analysis *)conversation_get_proto_data(conv, proto_tcp);
/* If the conversation was just created or it matched a
* conversation with template options, tcpd will not
@@ -555,7 +555,7 @@ add_tcp_process_info(guint32 frame_num, address *local_addr, address *remote_add
return;
}
- tcpd = conversation_get_proto_data(conv, proto_tcp);
+ tcpd = (struct tcp_analysis *)conversation_get_proto_data(conv, proto_tcp);
if (!tcpd) {
return;
}
@@ -582,7 +582,7 @@ tcp_calculate_timestamps(packet_info *pinfo, struct tcp_analysis *tcpd,
struct tcp_per_packet_data_t *tcppd)
{
if( !tcppd ) {
- tcppd = se_alloc(sizeof(struct tcp_per_packet_data_t));
+ tcppd = se_new(struct tcp_per_packet_data_t);
p_add_proto_data(pinfo->fd, proto_tcp, tcppd);
}
@@ -615,7 +615,7 @@ tcp_print_timestamps(packet_info *pinfo, tvbuff_t *tvb, proto_tree *parent_tree,
PROTO_ITEM_SET_GENERATED(item);
if( !tcppd )
- tcppd = p_get_proto_data(pinfo->fd, proto_tcp);
+ tcppd = (struct tcp_per_packet_data_t *)p_get_proto_data(pinfo->fd, proto_tcp);
if( tcppd ) {
item = proto_tree_add_time(tree, hf_tcp_ts_delta, tvb, 0, 0,
@@ -645,7 +645,7 @@ scan_for_next_pdu(tvbuff_t *tvb, proto_tree *tcp_tree, packet_info *pinfo, int o
struct tcp_multisegment_pdu *msp=NULL;
if(!pinfo->fd->flags.visited) {
- msp=se_tree_lookup32_le(multisegment_pdus, seq-1);
+ msp=(struct tcp_multisegment_pdu *)se_tree_lookup32_le(multisegment_pdus, seq-1);
if(msp) {
/* If this is a continuation of a PDU started in a
* previous segment we need to update the last_frame
@@ -680,7 +680,7 @@ scan_for_next_pdu(tvbuff_t *tvb, proto_tree *tcp_tree, packet_info *pinfo, int o
* this segment we also verify that the found PDU does span
* beyond the end of this segment.
*/
- msp=se_tree_lookup32_le(multisegment_pdus, nxtseq-1);
+ msp=(struct tcp_multisegment_pdu *)se_tree_lookup32_le(multisegment_pdus, nxtseq-1);
if(msp) {
if(pinfo->fd->num==msp->first_frame) {
proto_item *item;
@@ -699,7 +699,7 @@ scan_for_next_pdu(tvbuff_t *tvb, proto_tree *tcp_tree, packet_info *pinfo, int o
/* Second we check if this segment is part of a PDU started
* prior to the segment (seq-1)
*/
- msp=se_tree_lookup32_le(multisegment_pdus, seq-1);
+ msp=(struct tcp_multisegment_pdu *)se_tree_lookup32_le(multisegment_pdus, seq-1);
if(msp) {
/* If this segment is completely within a previous PDU
* then we just skip this packet
@@ -727,7 +727,7 @@ pdu_store_sequencenumber_of_next_pdu(packet_info *pinfo, guint32 seq, guint32 nx
{
struct tcp_multisegment_pdu *msp;
- msp=se_alloc(sizeof(struct tcp_multisegment_pdu));
+ msp=se_new(struct tcp_multisegment_pdu);
msp->nxtpdu=nxtpdu;
msp->seq=seq;
msp->first_frame=pinfo->fd->num;
@@ -792,9 +792,9 @@ tcp_analyze_get_acked_struct(guint32 frame, guint32 seq, guint32 ack, gboolean c
return;
}
- tcpd->ta = se_tree_lookup32_array(tcpd->acked_table, key);
+ tcpd->ta = (struct tcp_acked *)se_tree_lookup32_array(tcpd->acked_table, key);
if((!tcpd->ta) && createflag) {
- tcpd->ta = se_alloc0(sizeof(struct tcp_acked));
+ tcpd->ta = se_new0(struct tcp_acked);
se_tree_insert32_array(tcpd->acked_table, key, (void *)tcpd->ta);
}
}
@@ -1692,7 +1692,7 @@ desegment_tcp(tvbuff_t *tvb, packet_info *pinfo, int offset,
proto_tree *tree, proto_tree *tcp_tree,
struct tcp_analysis *tcpd)
{
- struct tcpinfo *tcpinfo = pinfo->private_data;
+ struct tcpinfo *tcpinfo = (struct tcpinfo *)pinfo->private_data;
fragment_data *ipfd_head;
int last_fragment_len;
gboolean must_desegment;
@@ -1733,7 +1733,7 @@ again:
/* Have we seen this PDU before (and is it the start of a multi-
* segment PDU)?
*/
- if ((msp = se_tree_lookup32(tcpd->fwd->multisegment_pdus, seq))) {
+ if ((msp = (struct tcp_multisegment_pdu *)se_tree_lookup32(tcpd->fwd->multisegment_pdus, seq))) {
const char* str;
/* Yes. This could be because we've dissected this frame before
@@ -1762,7 +1762,7 @@ again:
}
/* Else, find the most previous PDU starting before this sequence number */
- msp = se_tree_lookup32_le(tcpd->fwd->multisegment_pdus, seq-1);
+ msp = (struct tcp_multisegment_pdu *)se_tree_lookup32_le(tcpd->fwd->multisegment_pdus, seq-1);
}
if (msp && msp->seq <= seq && msp->nxtpdu > seq) {
@@ -2240,7 +2240,8 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/*
* Display the PDU length as a field
*/
- item=proto_tree_add_uint(pinfo->tcp_tree, hf_tcp_pdu_size,
+ item=proto_tree_add_uint((proto_tree *)pinfo->tcp_tree,
+ hf_tcp_pdu_size,
tvb, offset, plen, plen);
PROTO_ITEM_SET_GENERATED(item);
#if 0
@@ -4110,7 +4111,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_item *item;
proto_tree *checksum_tree;
- tcph=ep_alloc(sizeof(struct tcpheader));
+ tcph=ep_new(struct tcpheader);
SET_ADDRESS(&tcph->ip_src, pinfo->src.type, pinfo->src.len, pinfo->src.data);
SET_ADDRESS(&tcph->ip_dst, pinfo->dst.type, pinfo->dst.len, pinfo->dst.data);
@@ -4216,7 +4217,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Do we need to calculate timestamps relative to the tcp-stream? */
if (tcp_calculate_ts) {
- tcppd = p_get_proto_data(pinfo->fd, proto_tcp);
+ tcppd = (struct tcp_per_packet_data_t *)p_get_proto_data(pinfo->fd, proto_tcp);
/*
* Calculate the timestamps relative to this conversation (but only on the
@@ -4494,9 +4495,9 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* We haven't turned checksum checking off; 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;
switch (pinfo->src.type) {
@@ -4667,7 +4668,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
optlen = tcph->th_hlen - TCPH_MIN_LEN; /* length of options, in bytes */
tvb_ensure_bytes_exist(tvb, offset + 20, optlen);
if (tcp_tree != NULL) {
- guint8 *p_options = ep_tvb_memdup(tvb, offset + 20, optlen);
+ guint8 *p_options = (guint8 *)ep_tvb_memdup(tvb, offset + 20, optlen);
tf = proto_tree_add_bytes_format(tcp_tree, hf_tcp_options, tvb, offset + 20,
optlen, p_options, "Options: (%u bytes)", optlen);
field_tree = proto_item_add_subtree(tf, ett_tcp_options);
@@ -4749,7 +4750,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
struct tcp_multisegment_pdu *msp;
/* find the most previous PDU starting before this sequence number */
- msp=se_tree_lookup32_le(tcpd->fwd->multisegment_pdus, tcph->th_seq-1);
+ msp=(struct tcp_multisegment_pdu *)se_tree_lookup32_le(tcpd->fwd->multisegment_pdus, tcph->th_seq-1);
if(msp) {
fragment_data *ipfd_head;
diff --git a/epan/stats_tree.c b/epan/stats_tree.c
index 7936b88013..487ac14e54 100644
--- a/epan/stats_tree.c
+++ b/epan/stats_tree.c
@@ -222,7 +222,7 @@ reset_stat_node(stat_node *node)
extern void
stats_tree_reset(void *p)
{
- stats_tree *st = p;
+ stats_tree *st = (stats_tree *)p;
st->start = -1.0;
st->elapsed = 0.0;
@@ -237,7 +237,7 @@ stats_tree_reset(void *p)
extern void
stats_tree_reinit(void *p)
{
- stats_tree *st = p;
+ stats_tree *st = (stats_tree *)p;
stat_node *child;
stat_node *next;
@@ -263,7 +263,7 @@ stats_tree_register_with_group(const char *tapname, const char *abbr, const char
stat_tree_cleanup_cb cleanup, register_stat_group_t stat_group)
{
- stats_tree_cfg *cfg = g_malloc( sizeof(stats_tree_cfg) );
+ stats_tree_cfg *cfg = (stats_tree_cfg *)g_malloc( sizeof(stats_tree_cfg) );
/* at the very least the abbrev and the packet function should be given */
g_assert( tapname && abbr && packet );
@@ -328,7 +328,7 @@ stats_tree_register_plugin(const char *tapname, const char *abbr, const char *na
extern stats_tree*
stats_tree_new(stats_tree_cfg *cfg, tree_pres *pr, const char *filter)
{
- stats_tree *st = g_malloc(sizeof(stats_tree));
+ stats_tree *st = (stats_tree *)g_malloc(sizeof(stats_tree));
st->cfg = cfg;
st->pr = pr;
@@ -358,7 +358,7 @@ stats_tree_new(stats_tree_cfg *cfg, tree_pres *pr, const char *filter)
extern int
stats_tree_packet(void *p, packet_info *pinfo, epan_dissect_t *edt, const void *pri)
{
- stats_tree *st = p;
+ stats_tree *st = (stats_tree *)p;
double now = nstime_to_msec(&pinfo->fd->rel_ts);
if (st->start < 0.0) st->start = now;
@@ -374,7 +374,7 @@ stats_tree_packet(void *p, packet_info *pinfo, epan_dissect_t *edt, const void *
extern stats_tree_cfg*
stats_tree_get_cfg_by_abbr(char *abbr)
{
- return g_hash_table_lookup(registry,abbr);
+ return (stats_tree_cfg *)g_hash_table_lookup(registry,abbr);
}
extern GList*
@@ -397,8 +397,8 @@ struct _stats_tree_pres_cbs {
static void
setup_tree_presentation(gpointer k _U_, gpointer v, gpointer p)
{
- stats_tree_cfg *cfg = v;
- struct _stats_tree_pres_cbs *d = p;
+ stats_tree_cfg *cfg = (stats_tree_cfg *)v;
+ struct _stats_tree_pres_cbs *d = (struct _stats_tree_pres_cbs *)p;
cfg->in_use = FALSE;
cfg->setup_node_pr = d->setup_node_pr;
@@ -454,7 +454,7 @@ new_stat_node(stats_tree *st, const gchar *name, int parent_id,
gboolean with_hash, gboolean as_parent_node)
{
- stat_node *node = g_malloc (sizeof(stat_node));
+ stat_node *node = (stat_node *)g_malloc (sizeof(stat_node));
stat_node *last_chld = NULL;
node->counter = 0;
@@ -479,7 +479,7 @@ new_stat_node(stats_tree *st, const gchar *name, int parent_id,
}
if (parent_id >= 0 && parent_id < (int) st->parents->len ) {
- node->parent = g_ptr_array_index(st->parents,parent_id);
+ node->parent = (stat_node *)g_ptr_array_index(st->parents,parent_id);
} else {
/* ??? should we set the parent to be root ??? */
g_assert_not_reached();
@@ -549,12 +549,12 @@ stats_tree_manip_node(manip_node_mode mode, stats_tree *st, const char *name,
g_assert( parent_id >= 0 && parent_id < (int) st->parents->len );
- parent = g_ptr_array_index(st->parents,parent_id);
+ parent = (stat_node *)g_ptr_array_index(st->parents,parent_id);
if( parent->hash ) {
- node = g_hash_table_lookup(parent->hash,name);
+ node = (stat_node *)g_hash_table_lookup(parent->hash,name);
} else {
- node = g_hash_table_lookup(st->names,name);
+ node = (stat_node *)g_hash_table_lookup(st->names,name);
}
if ( node == NULL )
@@ -628,7 +628,7 @@ get_range(char *rngstr)
return NULL;
}
- rng = g_malloc(sizeof(range_pair_t));
+ rng = (range_pair_t *)g_malloc(sizeof(range_pair_t));
/* string == "X-?" */
if (*(split[0]) != '\0') {
@@ -689,7 +689,7 @@ stats_tree_create_range_node_string(stats_tree *st, const gchar *name,
extern int
stats_tree_parent_id_by_name(stats_tree *st, const gchar *parent_name)
{
- stat_node *node = g_hash_table_lookup(st->names,parent_name);
+ stat_node *node = (stat_node *)g_hash_table_lookup(st->names,parent_name);
if (node)
return node->id;
@@ -730,15 +730,15 @@ stats_tree_tick_range(stats_tree *st, const gchar *name, int parent_id,
gint floor, ceil;
if (parent_id >= 0 && parent_id < (int) st->parents->len) {
- parent = g_ptr_array_index(st->parents,parent_id);
+ parent = (stat_node *)g_ptr_array_index(st->parents,parent_id);
} else {
g_assert_not_reached();
}
if( parent->hash ) {
- node = g_hash_table_lookup(parent->hash,name);
+ node = (stat_node *)g_hash_table_lookup(parent->hash,name);
} else {
- node = g_hash_table_lookup(st->names,name);
+ node = (stat_node *)g_hash_table_lookup(st->names,name);
}
if ( node == NULL )
@@ -787,7 +787,7 @@ extern int
stats_tree_tick_pivot(stats_tree *st, int pivot_id, const gchar *pivot_value)
{
- stat_node *parent = g_ptr_array_index(st->parents,pivot_id);
+ stat_node *parent = (stat_node *)g_ptr_array_index(st->parents,pivot_id);
parent->counter++;
stats_tree_manip_node( MN_INCREASE, st, pivot_value, pivot_id, FALSE, 1);
diff --git a/epan/wslua/init_wslua.c b/epan/wslua/init_wslua.c
index 046104c472..286d91bfe5 100644
--- a/epan/wslua/init_wslua.c
+++ b/epan/wslua/init_wslua.c
@@ -68,7 +68,7 @@ int dissect_lua(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data
lua_pinfo = pinfo;
lua_tvb = tvb;
- lua_tree = g_malloc(sizeof(struct _wslua_treeitem));
+ lua_tree = (struct _wslua_treeitem *)g_malloc(sizeof(struct _wslua_treeitem));
lua_tree->tree = tree;
lua_tree->item = proto_tree_add_text(tree,tvb,0,0,"lua fake item");
lua_tree->expired = FALSE;
@@ -332,12 +332,13 @@ int wslua_init(register_cb cb, gpointer client_data) {
(*cb)(RA_LUA_PLUGINS, NULL, client_data);
/* set up the logger */
- g_log_set_handler(LOG_DOMAIN_LUA, G_LOG_LEVEL_CRITICAL|
+ g_log_set_handler(LOG_DOMAIN_LUA, (GLogLevelFlags)(G_LOG_LEVEL_CRITICAL|
G_LOG_LEVEL_WARNING|
G_LOG_LEVEL_MESSAGE|
G_LOG_LEVEL_INFO|
- G_LOG_LEVEL_DEBUG,
- ops ? ops->logger : basic_logger, NULL);
+ G_LOG_LEVEL_DEBUG),
+ ops ? ops->logger : basic_logger,
+ NULL);
if (!L) {
L = luaL_newstate();
diff --git a/epan/wslua/make-taps.pl b/epan/wslua/make-taps.pl
index bac63f3cce..81e5f40004 100755
--- a/epan/wslua/make-taps.pl
+++ b/epan/wslua/make-taps.pl
@@ -41,8 +41,8 @@ my %types = %{{
'gint16' => 'lua_pushnumber(L,(lua_Number)v->%s);',
'gint32' => 'lua_pushnumber(L,(lua_Number)v->%s);',
'gboolean' => 'lua_pushboolean(L,(int)v->%s);',
- 'address' => '{ Address a = g_malloc(sizeof(address)); COPY_ADDRESS(a, &(v->%s)); pushAddress(L,a); }',
- 'address*' => '{ Address a = g_malloc(sizeof(address)); COPY_ADDRESS(a, v->%s); pushAddress(L,a); }',
+ 'address' => '{ Address a = (Address)g_malloc(sizeof(address)); COPY_ADDRESS(a, &(v->%s)); pushAddress(L,a); }',
+ 'address*' => '{ Address a = (Address)g_malloc(sizeof(address)); COPY_ADDRESS(a, v->%s); pushAddress(L,a); }',
'int' => 'lua_pushnumber(L,(lua_Number)v->%s);',
'nstime_t' => '{lua_Number t = (lua_Number) v->%s.secs; t += v->%s.nsecs * 1e-9; lua_pushnumber(L,t); }',
'nstime_t*' => '{lua_Number t = (lua_Number) v->%s->secs; t += v->%s->nsecs * 1e-9; lua_pushnumber(L,t); }',
@@ -124,7 +124,7 @@ sub dotap {
$elems{$k} = $v;
}
- my $code = "static void wslua_${tname}_to_table(lua_State* L, const void* p) { $sname* v _U_; v = (void*)p; lua_newtable(L);\n";
+ my $code = "static void wslua_${tname}_to_table(lua_State* L, const void* p) { $sname* v _U_; v = ($sname*)p; lua_newtable(L);\n";
my $doc = "Tap: $tname\n";
for my $n (sort keys %elems) {
diff --git a/epan/wslua/wslua_dumper.c b/epan/wslua/wslua_dumper.c
index 51fdab099c..0690d44421 100644
--- a/epan/wslua/wslua_dumper.c
+++ b/epan/wslua/wslua_dumper.c
@@ -64,7 +64,7 @@ WSLUA_CONSTRUCTOR PseudoHeader_none(lua_State* L) {
Creates a "no" pseudoheader.
*/
- PseudoHeader ph = g_malloc(sizeof(struct lua_pseudo_header));
+ PseudoHeader ph = (PseudoHeader)g_malloc(sizeof(struct lua_pseudo_header));
ph->type = PHDR_NONE;
ph->wph = NULL;
@@ -81,9 +81,9 @@ WSLUA_CONSTRUCTOR PseudoHeader_eth(lua_State* L) {
#define WSLUA_OPTARG_PseudoHeader_eth_FCSLEN 1 /* The fcs length */
- PseudoHeader ph = g_malloc(sizeof(struct lua_pseudo_header));
+ PseudoHeader ph = (PseudoHeader)g_malloc(sizeof(struct lua_pseudo_header));
ph->type = PHDR_ETH;
- ph->wph = g_malloc(sizeof(union wtap_pseudo_header));
+ ph->wph = (union wtap_pseudo_header *)g_malloc(sizeof(union wtap_pseudo_header));
ph->wph->eth.fcs_len = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_eth_FCSLEN,-1);
pushPseudoHeader(L,ph);
@@ -103,9 +103,9 @@ WSLUA_CONSTRUCTOR PseudoHeader_atm(lua_State* L) {
#define WSLUA_OPTARG_PseudoHeader_atm_AAL5U2U 6 /* AAL5 User to User indicator */
#define WSLUA_OPTARG_PseudoHeader_atm_AAL5LEN 7 /* AAL5 Len */
- PseudoHeader ph = g_malloc(sizeof(struct lua_pseudo_header));
+ PseudoHeader ph = (PseudoHeader)g_malloc(sizeof(struct lua_pseudo_header));
ph->type = PHDR_ATM;
- ph->wph = g_malloc(sizeof(union wtap_pseudo_header));
+ ph->wph = (union wtap_pseudo_header *)g_malloc(sizeof(union wtap_pseudo_header));
ph->wph->atm.aal = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_atm_AAL,5);
ph->wph->atm.vpi = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_atm_VPI,1);
ph->wph->atm.vci = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_atm_VCI,1);
@@ -124,9 +124,9 @@ WSLUA_CONSTRUCTOR PseudoHeader_mtp2(lua_State* L) {
#define WSLUA_OPTARG_PseudoHeader_mtp2_SENT 1 /* True if the packet is sent, False if received. */
#define WSLUA_OPTARG_PseudoHeader_mtp2_ANNEXA 2 /* True if annex A is used */
#define WSLUA_OPTARG_PseudoHeader_mtp2_LINKNUM 3 /* Link Number */
- PseudoHeader ph = g_malloc(sizeof(struct lua_pseudo_header));
+ PseudoHeader ph = (PseudoHeader)g_malloc(sizeof(struct lua_pseudo_header));
ph->type = PHDR_MTP2;
- ph->wph = g_malloc(sizeof(union wtap_pseudo_header));
+ ph->wph = (union wtap_pseudo_header *)g_malloc(sizeof(union wtap_pseudo_header));
ph->wph->mtp2.sent = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_mtp2_SENT,0);
ph->wph->mtp2.annex_a_used = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_mtp2_ANNEXA,0);
ph->wph->mtp2.link_number = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_mtp2_LINKNUM,0);
@@ -392,7 +392,7 @@ WSLUA_METHOD Dumper_dump_current(lua_State* L) {
if (lua_pinfo->fd->opt_comment)
pkthdr.opt_comment = ep_strdup(lua_pinfo->fd->opt_comment);
- data = ep_tvb_memdup(tvb,0,pkthdr.caplen);
+ data = (const guchar *)ep_tvb_memdup(tvb,0,pkthdr.caplen);
if (! wtap_dump(d, &pkthdr, data, &err)) {
luaL_error(L,"error while dumping: %s",
diff --git a/epan/wslua/wslua_field.c b/epan/wslua/wslua_field.c
index 5c323874ad..98397f76c6 100644
--- a/epan/wslua/wslua_field.c
+++ b/epan/wslua/wslua_field.c
@@ -86,19 +86,19 @@ WSLUA_METAMETHOD FieldInfo__call(lua_State* L) {
lua_pushnumber(L,(lua_Number)fvalue_get_floating(&(fi->value)));
return 1;
case FT_INT64: {
- Int64 num = g_malloc(sizeof(gint64));
+ Int64 num = (Int64)g_malloc(sizeof(gint64));
*num = fvalue_get_integer64(&(fi->value));
pushInt64(L,num);
return 1;
}
case FT_UINT64: {
- UInt64 num = g_malloc(sizeof(guint64));
+ UInt64 num = (UInt64)g_malloc(sizeof(guint64));
*num = fvalue_get_integer64(&(fi->value));
pushUInt64(L,num);
return 1;
}
case FT_ETHER: {
- Address eth = g_malloc(sizeof(address));
+ Address eth = (Address)g_malloc(sizeof(address));
eth->type = AT_ETHER;
eth->len = fi->length;
eth->data = tvb_memdup(fi->ds_tvb,fi->start,fi->length);
@@ -106,7 +106,7 @@ WSLUA_METAMETHOD FieldInfo__call(lua_State* L) {
return 1;
}
case FT_IPv4:{
- Address ipv4 = g_malloc(sizeof(address));
+ Address ipv4 = (Address)g_malloc(sizeof(address));
ipv4->type = AT_IPv4;
ipv4->len = fi->length;
ipv4->data = tvb_memdup(fi->ds_tvb,fi->start,fi->length);
@@ -114,7 +114,7 @@ WSLUA_METAMETHOD FieldInfo__call(lua_State* L) {
return 1;
}
case FT_IPv6: {
- Address ipv6 = g_malloc(sizeof(address));
+ Address ipv6 = (Address)g_malloc(sizeof(address));
ipv6->type = AT_IPv6;
ipv6->len = fi->length;
ipv6->data = tvb_memdup(fi->ds_tvb,fi->start,fi->length);
@@ -122,7 +122,7 @@ WSLUA_METAMETHOD FieldInfo__call(lua_State* L) {
return 1;
}
case FT_IPXNET:{
- Address ipx = g_malloc(sizeof(address));
+ Address ipx = (Address)g_malloc(sizeof(address));
ipx->type = AT_IPX;
ipx->len = fi->length;
ipx->data = tvb_memdup(fi->ds_tvb,fi->start,fi->length);
@@ -131,7 +131,7 @@ WSLUA_METAMETHOD FieldInfo__call(lua_State* L) {
}
case FT_ABSOLUTE_TIME:
case FT_RELATIVE_TIME: {
- NSTime nstime = g_malloc(sizeof(nstime_t));
+ NSTime nstime = (NSTime)g_malloc(sizeof(nstime_t));
*nstime = *(NSTime)fvalue_get(&(fi->value));
pushNSTime(L,nstime);
return 1;
@@ -152,7 +152,7 @@ WSLUA_METAMETHOD FieldInfo__call(lua_State* L) {
case FT_PROTOCOL:
case FT_OID: {
ByteArray ba = g_byte_array_new();
- g_byte_array_append(ba, ep_tvb_memdup(fi->ds_tvb,fi->start,fi->length),fi->length);
+ g_byte_array_append(ba, (const guint8 *)ep_tvb_memdup(fi->ds_tvb,fi->start,fi->length),fi->length);
pushByteArray(L,ba);
return 1;
}
@@ -221,8 +221,8 @@ static int FieldInfo_display(lua_State* L) {
static int FieldInfo_get_range(lua_State* L) {
/* The TvbRange covering this field */
FieldInfo fi = checkFieldInfo(L,1);
- TvbRange r = ep_alloc(sizeof(struct _wslua_tvbrange));
- r->tvb = ep_alloc(sizeof(struct _wslua_tvb));
+ TvbRange r = ep_new(struct _wslua_tvbrange);
+ r->tvb = ep_new(struct _wslua_tvb);
r->tvb->ws_tvb = fi->ds_tvb;
r->offset = fi->start;
@@ -374,7 +374,7 @@ WSLUA_FUNCTION wslua_all_field_infos(lua_State* L) {
if (found) {
for (i=0; i<found->len; i++) {
- pushFieldInfo(L,g_ptr_array_index(found,i));
+ pushFieldInfo(L,(FieldInfo)g_ptr_array_index(found,i));
items_found++;
}
@@ -422,7 +422,7 @@ void lua_prime_all_fields(proto_tree* tree _U_) {
static gboolean fake_tap = FALSE;
for(i=0; i < wanted_fields->len; i++) {
- Field f = g_ptr_array_index(wanted_fields,i);
+ Field f = (Field)g_ptr_array_index(wanted_fields,i);
gchar* name = *((gchar**)f);
*f = proto_registrar_get_byname(name);
@@ -478,7 +478,7 @@ WSLUA_CONSTRUCTOR Field_new(lua_State *L) {
if (!wanted_fields)
WSLUA_ERROR(Field_get,"A Field extractor must be defined before Taps or Dissectors get called");
- f = g_malloc(sizeof(void*));
+ f = (Field)g_malloc(sizeof(void*));
*f = (header_field_info*)g_strdup(name); /* cheating */
g_ptr_array_add(wanted_fields,f);
@@ -507,7 +507,7 @@ WSLUA_METAMETHOD Field__call (lua_State* L) {
guint i;
if (found) {
for (i=0; i<found->len; i++) {
- pushFieldInfo(L,g_ptr_array_index(found,i));
+ pushFieldInfo(L,(FieldInfo)g_ptr_array_index(found,i));
items_found++;
}
}
diff --git a/epan/wslua/wslua_gui.c b/epan/wslua/wslua_gui.c
index 73925859a4..fb9bb6b64d 100644
--- a/epan/wslua/wslua_gui.c
+++ b/epan/wslua/wslua_gui.c
@@ -49,7 +49,7 @@ WSLUA_FUNCTION wslua_gui_enabled(lua_State* L) { /* Checks whether the GUI facil
}
static void lua_menu_callback(gpointer data) {
- struct _lua_menu_data* md = data;
+ struct _lua_menu_data* md = (struct _lua_menu_data *)data;
lua_State* L = md->L;
lua_settop(L,0);
@@ -89,7 +89,7 @@ WSLUA_FUNCTION wslua_register_menu(lua_State* L) { /* Register a menu item in o
const gchar* name = luaL_checkstring(L,WSLUA_ARG_register_menu_NAME);
struct _lua_menu_data* md;
gboolean retap = FALSE;
- register_stat_group_t group = (int)luaL_optnumber(L,WSLUA_OPTARG_register_menu_GROUP,REGISTER_STAT_GROUP_GENERIC);
+ register_stat_group_t group = (register_stat_group_t)luaL_optnumber(L,WSLUA_OPTARG_register_menu_GROUP,REGISTER_STAT_GROUP_GENERIC);
if ( group > REGISTER_TOOLS_GROUP_UNSORTED)
WSLUA_OPTARG_ERROR(register_menu,GROUP,"Must be a defined MENU_* (see init.lua)");
@@ -100,7 +100,7 @@ WSLUA_FUNCTION wslua_register_menu(lua_State* L) { /* Register a menu item in o
if (!lua_isfunction(L,WSLUA_ARG_register_menu_ACTION))
WSLUA_ARG_ERROR(register_menu,ACTION,"Must be a function");
- md = g_malloc(sizeof(struct _lua_menu_data));
+ md = (struct _lua_menu_data *)g_malloc(sizeof(struct _lua_menu_data));
md->L = L;
lua_pushvalue(L, 2);
@@ -131,7 +131,7 @@ static int dlg_cb_error_handler(lua_State* L) {
}
static void lua_dialog_cb(gchar** user_input, void* data) {
- struct _dlg_cb_data* dcbd = data;
+ struct _dlg_cb_data* dcbd = (struct _dlg_cb_data *)data;
int i = 0;
gchar* input;
lua_State* L = dcbd->L;
@@ -177,7 +177,7 @@ static int text_win_close_cb_error_handler(lua_State* L) {
}
static void text_win_close_cb(void* data) {
- struct _close_cb_data* cbd = data;
+ struct _close_cb_data* cbd = (struct _close_cb_data *)data;
lua_State* L = cbd->L;
if (cbd->L) { /* close function is set */
@@ -241,7 +241,7 @@ WSLUA_FUNCTION wslua_new_dialog(lua_State* L) { /* Pops up a new dialog */
}
- dcbd = g_malloc(sizeof(struct _dlg_cb_data));
+ dcbd = (struct _dlg_cb_data *)g_malloc(sizeof(struct _dlg_cb_data));
dcbd->L = L;
lua_remove(L,1);
@@ -255,7 +255,7 @@ WSLUA_FUNCTION wslua_new_dialog(lua_State* L) { /* Pops up a new dialog */
top -= 2;
for (i = 1; i <= top; i++) {
- gchar* label = (void*)luaL_checkstring(L,i);
+ gchar* label = (gchar *)luaL_checkstring(L,i);
/* XXX leaks labels on error */
if (! label)
@@ -280,7 +280,7 @@ WSLUA_CLASS_DEFINE(ProgDlg,NOP,NOP); /* Manages a progress bar dialog. */
WSLUA_CONSTRUCTOR ProgDlg_new(lua_State* L) { /* Creates a new TextWindow. */
#define WSLUA_OPTARG_ProgDlg_new_TITLE 2 /* Title of the new window, defaults to "Progress". */
#define WSLUA_OPTARG_ProgDlg_new_TASK 3 /* Current task, defaults to "". */
- ProgDlg pd = g_malloc(sizeof(struct _wslua_progdlg));
+ ProgDlg pd = (ProgDlg)g_malloc(sizeof(struct _wslua_progdlg));
pd->title = g_strdup(luaL_optstring(L,WSLUA_OPTARG_ProgDlg_new_TITLE,"Progress"));
pd->task = g_strdup(luaL_optstring(L,WSLUA_OPTARG_ProgDlg_new_TASK,""));
pd->stopped = FALSE;
@@ -429,11 +429,11 @@ WSLUA_CONSTRUCTOR TextWindow_new(lua_State* L) { /* Creates a new TextWindow. */
}
title = luaL_optstring(L,WSLUA_OPTARG_TextWindow_new_TITLE,"Untitled Window");
- tw = g_malloc(sizeof(struct _wslua_tw));
+ tw = (struct _wslua_tw *)g_malloc(sizeof(struct _wslua_tw));
tw->expired = FALSE;
tw->ws_tw = ops->new_text_window(title);
- default_cbd = g_malloc(sizeof(struct _close_cb_data));
+ default_cbd = (struct _close_cb_data *)g_malloc(sizeof(struct _close_cb_data));
default_cbd->L = NULL;
default_cbd->func_ref = 0;
@@ -464,7 +464,7 @@ WSLUA_METHOD TextWindow_set_atclose(lua_State* L) { /* Set the function that wil
if (! lua_isfunction(L,2))
WSLUA_ARG_ERROR(TextWindow_at_close,ACTION,"Must be a function");
- cbd = g_malloc(sizeof(struct _close_cb_data));
+ cbd = (struct _close_cb_data *)g_malloc(sizeof(struct _close_cb_data));
cbd->L = L;
cbd->func_ref = luaL_ref(L, LUA_REGISTRYINDEX);
@@ -626,7 +626,7 @@ typedef struct _wslua_bt_cb_t {
} wslua_bt_cb_t;
static gboolean wslua_button_callback(funnel_text_window_t* ws_tw, void* data) {
- wslua_bt_cb_t* cbd = data;
+ wslua_bt_cb_t* cbd = (wslua_bt_cb_t *)data;
lua_State* L = cbd->L;
(void) ws_tw; /* ws_tw is unused since we need wslua_tw_ref and it is stored in cbd */
@@ -676,8 +676,8 @@ WSLUA_METHOD TextWindow_add_button(lua_State* L) {
lua_settop(L,3);
if (ops->add_button) {
- fbt = g_malloc(sizeof(funnel_bt_t));
- cbd = g_malloc(sizeof(wslua_bt_cb_t));
+ fbt = (funnel_bt_t *)g_malloc(sizeof(funnel_bt_t));
+ cbd = (wslua_bt_cb_t *)g_malloc(sizeof(wslua_bt_cb_t));
fbt->tw = tw->ws_tw;
fbt->func = wslua_button_callback;
diff --git a/epan/wslua/wslua_listener.c b/epan/wslua/wslua_listener.c
index 5657983153..065c2fec4c 100644
--- a/epan/wslua/wslua_listener.c
+++ b/epan/wslua/wslua_listener.c
@@ -82,7 +82,7 @@ static int tap_packet_cb_error_handler(lua_State* L) {
static int lua_tap_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const void *data) {
- Listener tap = tapdata;
+ Listener tap = (Listener)tapdata;
int retval = 0;
if (tap->packet_ref == LUA_NOREF) return 0;
@@ -103,7 +103,7 @@ static int lua_tap_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt
lua_pinfo = pinfo;
lua_tvb = edt->tvb;
- lua_tree = g_malloc(sizeof(struct _wslua_treeitem));
+ lua_tree = (struct _wslua_treeitem *)g_malloc(sizeof(struct _wslua_treeitem));
lua_tree->tree = edt->tree;
lua_tree->item = NULL;
lua_tree->expired = FALSE;
@@ -139,7 +139,7 @@ static int tap_reset_cb_error_handler(lua_State* L) {
}
static void lua_tap_reset(void *tapdata) {
- Listener tap = tapdata;
+ Listener tap = (Listener)tapdata;
if (tap->init_ref == LUA_NOREF) return;
@@ -162,7 +162,7 @@ static void lua_tap_reset(void *tapdata) {
}
static void lua_tap_draw(void *tapdata) {
- Listener tap = tapdata;
+ Listener tap = (Listener)tapdata;
const gchar* error;
if (tap->draw_ref == LUA_NOREF) return;
@@ -196,7 +196,7 @@ WSLUA_CONSTRUCTOR Listener_new(lua_State* L) {
Listener tap;
GString* error;
- tap = g_malloc(sizeof(struct _wslua_tap));
+ tap = (Listener)g_malloc(sizeof(struct _wslua_tap));
tap->name = g_strdup(tap_type);
tap->filter = filter ? g_strdup(filter) : NULL;
diff --git a/epan/wslua/wslua_pinfo.c b/epan/wslua/wslua_pinfo.c
index 477b26ce63..6bea086517 100644
--- a/epan/wslua/wslua_pinfo.c
+++ b/epan/wslua/wslua_pinfo.c
@@ -57,7 +57,7 @@ CLEAR_OUTSTANDING(PrivateTable,expired, TRUE)
Pinfo* push_Pinfo(lua_State* L, packet_info* ws_pinfo) {
Pinfo pinfo = NULL;
if (ws_pinfo) {
- pinfo = g_malloc(sizeof(struct _wslua_pinfo));
+ pinfo = (Pinfo)g_malloc(sizeof(struct _wslua_pinfo));
pinfo->ws_pinfo = ws_pinfo;
pinfo->expired = FALSE;
g_ptr_array_add(outstanding_Pinfo,pinfo);
@@ -76,7 +76,7 @@ WSLUA_CONSTRUCTOR NSTime_new(lua_State *L) {
/* Creates a new NSTime object */
#define WSLUA_OPTARG_NSTime_new_SECONDS 1 /* Seconds */
#define WSLUA_OPTARG_NSTime_new_NSECONDS 2 /* Nano seconds */
- NSTime nstime = g_malloc(sizeof(nstime_t));
+ NSTime nstime = (NSTime)g_malloc(sizeof(nstime_t));
if (!nstime) return 0;
@@ -100,7 +100,7 @@ WSLUA_METAMETHOD NSTime__tostring(lua_State* L) {
WSLUA_METAMETHOD NSTime__add(lua_State* L) { /* Calculates the sum of two NSTimes */
NSTime time1 = checkNSTime(L,1);
NSTime time2 = checkNSTime(L,2);
- NSTime time3 = g_malloc (sizeof (nstime_t));
+ NSTime time3 = (NSTime)g_malloc (sizeof (nstime_t));
nstime_sum (time3, time1, time2);
pushNSTime (L, time3);
@@ -111,7 +111,7 @@ WSLUA_METAMETHOD NSTime__add(lua_State* L) { /* Calculates the sum of two NSTime
WSLUA_METAMETHOD NSTime__sub(lua_State* L) { /* Calculates the diff of two NSTimes */
NSTime time1 = checkNSTime(L,1);
NSTime time2 = checkNSTime(L,2);
- NSTime time3 = g_malloc (sizeof (nstime_t));
+ NSTime time3 = (NSTime)g_malloc (sizeof (nstime_t));
nstime_delta (time3, time1, time2);
pushNSTime (L, time3);
@@ -121,7 +121,7 @@ WSLUA_METAMETHOD NSTime__sub(lua_State* L) { /* Calculates the diff of two NSTim
WSLUA_METAMETHOD NSTime__unm(lua_State* L) { /* Calculates the negative NSTime */
NSTime time1 = checkNSTime(L,1);
- NSTime time2 = g_malloc (sizeof (nstime_t));
+ NSTime time2 = (NSTime)g_malloc (sizeof (nstime_t));
nstime_set_zero (time2);
nstime_subtract (time2, time1);
@@ -311,8 +311,8 @@ WSLUA_CONSTRUCTOR Address_ip(lua_State* L) {
/* Creates an Address Object representing an IP address. */
#define WSLUA_ARG_Address_ip_HOSTNAME 1 /* The address or name of the IP host. */
- Address addr = g_malloc(sizeof(address));
- guint32* ip_addr = g_malloc(sizeof(guint32));
+ Address addr = (Address)g_malloc(sizeof(address));
+ guint32* ip_addr = (guint32 *)g_malloc(sizeof(guint32));
const gchar* name = luaL_checkstring(L,WSLUA_ARG_Address_ip_HOSTNAME);
if (! get_host_ipaddr(name, (guint32*)ip_addr)) {
@@ -781,7 +781,7 @@ WSLUA_METAMETHOD Columns_index(lua_State *L) {
const char* colname = luaL_checkstring(L,2);
if (!cols) {
- Column c = g_malloc(sizeof(struct _wslua_col_info));
+ Column c = (Column)g_malloc(sizeof(struct _wslua_col_info));
c->cinfo = NULL;
c->col = col_name_to_id(colname);
c->expired = FALSE;
@@ -800,7 +800,7 @@ WSLUA_METAMETHOD Columns_index(lua_State *L) {
for(cn = colnames; cn->name; cn++) {
if( g_str_equal(cn->name,colname) ) {
- Column c = g_malloc(sizeof(struct _wslua_col_info));
+ Column c = (Column)g_malloc(sizeof(struct _wslua_col_info));
c->cinfo = cols->cinfo;
c->col = col_name_to_id(colname);
c->expired = FALSE;
@@ -856,7 +856,7 @@ WSLUA_METAMETHOD PrivateTable__tostring(lua_State* L) {
keys = g_hash_table_get_keys (priv->table);
key = g_list_first (keys);
while (key) {
- key_string = g_string_append (key_string, key->data);
+ key_string = g_string_append (key_string, (const gchar *)key->data);
key = g_list_next (key);
if (key) {
key_string = g_string_append_c (key_string, ',');
@@ -884,7 +884,7 @@ static int PrivateTable__index(lua_State* L) {
return 0;
}
- string = g_hash_table_lookup (priv->table, (gpointer) name);
+ string = (const gchar *)g_hash_table_lookup (priv->table, (gpointer) name);
if (string) {
lua_pushstring(L, string);
@@ -1075,7 +1075,7 @@ static int Pinfo_columns(lua_State *L) {
return 0;
}
- cols = g_malloc(sizeof(struct _wslua_cols));
+ cols = (Columns)g_malloc(sizeof(struct _wslua_cols));
cols->cinfo = pinfo->ws_pinfo->cinfo;
cols->expired = FALSE;
@@ -1108,7 +1108,7 @@ static int Pinfo_private(lua_State *L) {
is_allocated = TRUE;
}
- priv = g_malloc(sizeof(struct _wslua_private_table));
+ priv = (PrivateTable)g_malloc(sizeof(struct _wslua_private_table));
priv->table = pinfo->ws_pinfo->private_table;
priv->is_allocated = is_allocated;
priv->expired = FALSE;
@@ -1239,7 +1239,7 @@ static int Pinfo_hi(lua_State *L) {
return 0;
}
- addr = g_malloc(sizeof(address));
+ addr = (Address)g_malloc(sizeof(address));
if (CMP_ADDRESS(&(pinfo->ws_pinfo->src), &(pinfo->ws_pinfo->dst) ) >= 0) {
COPY_ADDRESS(addr, &(pinfo->ws_pinfo->src));
} else {
@@ -1260,7 +1260,7 @@ static int Pinfo_lo(lua_State *L) {
return 0;
}
- addr = g_malloc(sizeof(address));
+ addr = (Address)g_malloc(sizeof(address));
if (CMP_ADDRESS(&(pinfo->ws_pinfo->src), &(pinfo->ws_pinfo->dst) ) < 0) {
COPY_ADDRESS(addr, &(pinfo->ws_pinfo->src));
} else {
diff --git a/epan/wslua/wslua_tree.c b/epan/wslua/wslua_tree.c
index 565cddc3ba..870c955147 100644
--- a/epan/wslua/wslua_tree.c
+++ b/epan/wslua/wslua_tree.c
@@ -84,8 +84,8 @@ WSLUA_METHOD TreeItem_add_packet_field(lua_State *L) {
tvbr = shiftTvbRange(L,1);
if (!tvbr) {
/* No TvbRange specified */
- tvbr = ep_alloc(sizeof(struct _wslua_tvbrange));
- tvbr->tvb = ep_alloc(sizeof(struct _wslua_tvb));
+ tvbr = ep_new(struct _wslua_tvbrange);
+ tvbr->tvb = ep_new(struct _wslua_tvb);
tvbr->tvb->ws_tvb = lua_tvb;
tvbr->offset = 0;
tvbr->len = 0;
@@ -115,7 +115,7 @@ WSLUA_METHOD TreeItem_add_packet_field(lua_State *L) {
lua_remove(L,1);
}
- tree_item = g_malloc(sizeof(struct _wslua_treeitem));
+ tree_item = (TreeItem)g_malloc(sizeof(struct _wslua_treeitem));
tree_item->item = item;
tree_item->tree = proto_item_add_subtree(item,ett > 0 ? ett : wslua_ett);
tree_item->expired = FALSE;
@@ -158,8 +158,8 @@ static int TreeItem_add_item_any(lua_State *L, gboolean little_endian) {
tvbr = shiftTvbRange(L,1);
if (!tvbr) {
- tvbr = ep_alloc(sizeof(struct _wslua_tvbrange));
- tvbr->tvb = ep_alloc(sizeof(struct _wslua_tvb));
+ tvbr = ep_new(struct _wslua_tvbrange);
+ tvbr->tvb = ep_new(struct _wslua_tvb);
tvbr->tvb->ws_tvb = lua_tvb;
tvbr->offset = 0;
tvbr->len = 0;
@@ -255,7 +255,7 @@ static int TreeItem_add_item_any(lua_State *L, gboolean little_endian) {
lua_remove(L,1);
}
- tree_item = g_malloc(sizeof(struct _wslua_treeitem));
+ tree_item = (TreeItem)g_malloc(sizeof(struct _wslua_treeitem));
tree_item->item = item;
tree_item->tree = proto_item_add_subtree(item,ett > 0 ? ett : wslua_ett);
tree_item->expired = FALSE;
diff --git a/epan/wslua/wslua_tvb.c b/epan/wslua/wslua_tvb.c
index 431b323444..dc8d821ed3 100644
--- a/epan/wslua/wslua_tvb.c
+++ b/epan/wslua/wslua_tvb.c
@@ -151,7 +151,7 @@ WSLUA_METHOD ByteArray_set_size(lua_State* L) {
if (ba->len >= (guint)siz) { /* truncate */
g_byte_array_set_size(ba,siz);
} else { /* fill */
- padding = g_malloc0(sizeof(guint8)*(siz - ba->len));
+ padding = (guint8 *)g_malloc0(sizeof(guint8)*(siz - ba->len));
g_byte_array_append(ba,padding,siz - ba->len);
g_free(padding);
}
@@ -387,7 +387,7 @@ void clear_outstanding_TvbRange(void) {
Tvb* push_Tvb(lua_State* L, tvbuff_t* ws_tvb) {
- Tvb tvb = g_malloc(sizeof(struct _wslua_tvb));
+ Tvb tvb = (Tvb)g_malloc(sizeof(struct _wslua_tvb));
tvb->ws_tvb = ws_tvb;
tvb->expired = FALSE;
tvb->need_free = FALSE;
@@ -415,9 +415,9 @@ WSLUA_CONSTRUCTOR ByteArray_tvb (lua_State *L) {
return 0;
}
- data = g_memdup(ba->data, ba->len);
+ data = (guint8 *)g_memdup(ba->data, ba->len);
- tvb = g_malloc(sizeof(struct _wslua_tvb));
+ tvb = (Tvb)g_malloc(sizeof(struct _wslua_tvb));
tvb->ws_tvb = tvb_new_real_data(data, ba->len,ba->len);
tvb->expired = FALSE;
tvb->need_free = TRUE;
@@ -442,7 +442,7 @@ WSLUA_CONSTRUCTOR TvbRange_tvb (lua_State *L) {
}
if (tvb_offset_exists(tvbr->tvb->ws_tvb, tvbr->offset + tvbr->len -1 )) {
- tvb = g_malloc(sizeof(struct _wslua_tvb));
+ tvb = (Tvb)g_malloc(sizeof(struct _wslua_tvb));
tvb->expired = FALSE;
tvb->need_free = FALSE;
tvb->ws_tvb = tvb_new_subset(tvbr->tvb->ws_tvb,tvbr->offset,tvbr->len, tvbr->len);
@@ -587,8 +587,8 @@ static TvbRange new_TvbRange(lua_State* L, tvbuff_t* ws_tvb, int offset, int len
return NULL;
}
- tvbr = g_malloc(sizeof(struct _wslua_tvbrange));
- tvbr->tvb = g_malloc(sizeof(struct _wslua_tvb));
+ tvbr = (TvbRange)g_malloc(sizeof(struct _wslua_tvbrange));
+ tvbr->tvb = (Tvb)g_malloc(sizeof(struct _wslua_tvb));
tvbr->tvb->ws_tvb = ws_tvb;
tvbr->tvb->expired = FALSE;
tvbr->tvb->need_free = FALSE;
@@ -735,7 +735,7 @@ WSLUA_METHOD TvbRange_uint64(lua_State* L) {
case 6:
case 7:
case 8: {
- UInt64 num = g_malloc(sizeof(guint64));
+ UInt64 num = (UInt64)g_malloc(sizeof(guint64));
*num = tvb_get_ntoh64(tvbr->tvb->ws_tvb,tvbr->offset);
pushUInt64(L,num);
WSLUA_RETURN(1);
@@ -767,7 +767,7 @@ WSLUA_METHOD TvbRange_le_uint64(lua_State* L) {
case 6:
case 7:
case 8: {
- UInt64 num = g_malloc(sizeof(guint64));
+ UInt64 num = (UInt64)g_malloc(sizeof(guint64));
*num = tvb_get_letoh64(tvbr->tvb->ws_tvb,tvbr->offset);
pushUInt64(L,num);
WSLUA_RETURN(1);
@@ -862,7 +862,7 @@ WSLUA_METHOD TvbRange_int64(lua_State* L) {
case 6:
case 7:
case 8: {
- Int64 num = g_malloc(sizeof(gint64));
+ Int64 num = (Int64)g_malloc(sizeof(gint64));
*num = (gint64)tvb_get_ntoh64(tvbr->tvb->ws_tvb,tvbr->offset);
pushInt64(L,num);
WSLUA_RETURN(1);
@@ -894,7 +894,7 @@ WSLUA_METHOD TvbRange_le_int64(lua_State* L) {
case 6:
case 7:
case 8: {
- Int64 num = g_malloc(sizeof(gint64));
+ Int64 num = (Int64)g_malloc(sizeof(gint64));
*num = (gint64)tvb_get_letoh64(tvbr->tvb->ws_tvb,tvbr->offset);
pushInt64(L,num);
WSLUA_RETURN(1);
@@ -966,9 +966,9 @@ WSLUA_METHOD TvbRange_ipv4(lua_State* L) {
if (tvbr->len != 4)
WSLUA_ERROR(TvbRange_ipv4,"The range must be 4 octets long");
- addr = g_malloc(sizeof(address));
+ addr = (address *)g_malloc(sizeof(address));
- ip_addr = g_malloc(sizeof(guint32));
+ ip_addr = (guint32 *)g_malloc(sizeof(guint32));
*ip_addr = tvb_get_ipv4(tvbr->tvb->ws_tvb,tvbr->offset);
SET_ADDRESS(addr, AT_IPv4, 4, ip_addr);
@@ -992,9 +992,9 @@ WSLUA_METHOD TvbRange_le_ipv4(lua_State* L) {
if (tvbr->len != 4)
WSLUA_ERROR(TvbRange_ipv4,"The range must be 4 octets long");
- addr = g_malloc(sizeof(address));
+ addr = (address *)g_malloc(sizeof(address));
- ip_addr = g_malloc(sizeof(guint32));
+ ip_addr = (guint32 *)g_malloc(sizeof(guint32));
*ip_addr = tvb_get_ipv4(tvbr->tvb->ws_tvb,tvbr->offset);
*((guint32 *)ip_addr) = GUINT32_SWAP_LE_BE(*((guint32 *)ip_addr));
@@ -1021,7 +1021,7 @@ WSLUA_METHOD TvbRange_ether(lua_State* L) {
addr = g_new(address,1);
- buff = tvb_memdup(tvbr->tvb->ws_tvb,tvbr->offset,tvbr->len);
+ buff = (guint8 *)tvb_memdup(tvbr->tvb->ws_tvb,tvbr->offset,tvbr->len);
SET_ADDRESS(addr, AT_ETHER, 6, buff);
pushAddress(L,addr);
@@ -1185,7 +1185,7 @@ WSLUA_METHOD TvbRange_bytes(lua_State* L) {
}
ba = g_byte_array_new();
- g_byte_array_append(ba,ep_tvb_memdup(tvbr->tvb->ws_tvb,tvbr->offset,tvbr->len),tvbr->len);
+ g_byte_array_append(ba,(const guint8 *)ep_tvb_memdup(tvbr->tvb->ws_tvb,tvbr->offset,tvbr->len),tvbr->len);
pushByteArray(L,ba);
@@ -1222,7 +1222,7 @@ WSLUA_METHOD TvbRange_bitfield(lua_State* L) {
lua_pushnumber(L,tvb_get_bits32(tvbr->tvb->ws_tvb,tvbr->offset*8 + pos, len, FALSE));
return 1;
} else if (len <= 64) {
- UInt64 num = g_malloc(sizeof(guint64));
+ UInt64 num = (UInt64)g_malloc(sizeof(guint64));
*num = tvb_get_bits64(tvbr->tvb->ws_tvb,tvbr->offset*8 + pos, len, FALSE);
pushUInt64(L,num);
WSLUA_RETURN(1); /* The bitfield value */
diff --git a/epan/wslua/wslua_util.c b/epan/wslua/wslua_util.c
index 21f5af3323..575277b5e7 100644
--- a/epan/wslua/wslua_util.c
+++ b/epan/wslua/wslua_util.c
@@ -292,11 +292,11 @@ WSLUA_CONSTRUCTOR Dir_open(lua_State* L) {
WSLUA_ARG_ERROR(Dir_open,PATHNAME, "must be a directory");
}
- dir = g_malloc(sizeof(struct _wslua_dir));
+ dir = (Dir)g_malloc(sizeof(struct _wslua_dir));
dir->dir = OPENDIR_OP(dirname_clean);
g_free(dirname_clean);
dir->ext = extension ? g_strdup(extension) : NULL;
- dir->dummy = g_malloc(sizeof(GError *));
+ dir->dummy = (GError **)g_malloc(sizeof(GError *));
*(dir->dummy) = NULL;
if (dir->dir == NULL) {
@@ -414,7 +414,7 @@ static int statcmd_init_cb_error_handler(lua_State* L _U_) {
}
static void statcmd_init(const char *optarg, void* userdata) {
- statcmd_t* sc = userdata;
+ statcmd_t* sc = (statcmd_t *)userdata;
lua_State* L = sc->L;
lua_settop(L,0);
@@ -444,7 +444,7 @@ WSLUA_FUNCTION wslua_register_stat_cmd_arg(lua_State* L) {
#define WSLUA_ARG_register_stat_cmd_arg_ARGUMENT 1 /* Argument */
#define WSLUA_OPTARG_register_stat_cmd_arg_ACTION 2 /* Action */
const char* arg = luaL_checkstring(L,WSLUA_ARG_register_stat_cmd_arg_ARGUMENT);
- statcmd_t* sc = g_malloc0(sizeof(statcmd_t)); /* XXX leaked */
+ statcmd_t* sc = (statcmd_t *)g_malloc0(sizeof(statcmd_t)); /* XXX leaked */
sc->L = L;
lua_pushvalue(L, WSLUA_OPTARG_register_stat_cmd_arg_ACTION);