From beroset:

remove C++ incompatibilities 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416

svn path=/trunk/; revision=48384
This commit is contained in:
Anders Broman 2013-03-18 05:18:32 +00:00
parent b7617b32eb
commit d1f89f81d8
3 changed files with 39 additions and 39 deletions

View File

@ -97,7 +97,7 @@ fill_fp_info(fp_info *p_fp_info, guchar *extra_info, guint32 length)
return;
/* Store division type */
p_fp_info->division = radio_mode;
p_fp_info->division = (enum division_type)radio_mode;
/* Format used by K15, later fields are shifted by 8 bytes. */
if (pntohs(extra_info+2) == 5)
@ -235,7 +235,7 @@ dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree)
break;
}
handles = se_tree_lookup32(port_handles, pinfo->pseudo_header->k12.input);
handles = (dissector_handle_t *)se_tree_lookup32(port_handles, pinfo->pseudo_header->k12.input);
if (! handles ) {
for (i=0 ; i < nk12_handles; i++) {
@ -276,9 +276,9 @@ dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree)
for (i = 0; handles[i] && handles[i+1]; ++i) {
if (handles[i] == sscop_handle) {
sscop_payload_info *p_sscop_info = p_get_proto_data(pinfo->fd, proto_sscop);
sscop_payload_info *p_sscop_info = (sscop_payload_info *)p_get_proto_data(pinfo->fd, proto_sscop);
if (!p_sscop_info) {
p_sscop_info = se_alloc0(sizeof(sscop_payload_info));
p_sscop_info = se_new0(sscop_payload_info);
p_add_proto_data(pinfo->fd, proto_sscop, p_sscop_info);
p_sscop_info->subdissector = handles[i+1];
}
@ -290,9 +290,9 @@ dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree)
/* Setup information required by certain protocols */
if (sub_handle == fp_handle) {
fp_info *p_fp_info = p_get_proto_data(pinfo->fd, proto_fp);
fp_info *p_fp_info = (fp_info *)p_get_proto_data(pinfo->fd, proto_fp);
if (!p_fp_info) {
p_fp_info = se_alloc0(sizeof(fp_info));
p_fp_info = se_new0(fp_info);
p_add_proto_data(pinfo->fd, proto_fp, p_fp_info);
fill_fp_info(p_fp_info,
@ -307,7 +307,7 @@ dissect_k12(tvbuff_t* tvb,packet_info* pinfo,proto_tree* tree)
static void
k12_update_cb(void* r, const char** err)
{
k12_handles_t* h = r;
k12_handles_t* h = (k12_handles_t *)r;
gchar** protos;
guint num_protos, i;
@ -317,7 +317,7 @@ k12_update_cb(void* r, const char** err)
g_strstrip(protos[num_protos]);
g_free(h->handles);
h->handles = g_malloc0(sizeof(dissector_handle_t)*(num_protos < 2 ? 2 : num_protos));
h->handles = (dissector_handle_t *)g_malloc0(sizeof(dissector_handle_t)*(num_protos < 2 ? 2 : num_protos));
for (i = 0; i < num_protos; i++) {
if ( ! (h->handles[i] = find_dissector(protos[i])) ) {
@ -333,8 +333,8 @@ k12_update_cb(void* r, const char** err)
static void*
k12_copy_cb(void* dest, const void* orig, size_t len _U_)
{
k12_handles_t* d = dest;
const k12_handles_t* o = orig;
k12_handles_t* d = (k12_handles_t *)dest;
const k12_handles_t* o = (const k12_handles_t *)orig;
gchar** protos = ep_strsplit(d->protos,":",0);
guint num_protos;
@ -343,7 +343,7 @@ k12_copy_cb(void* dest, const void* orig, size_t len _U_)
d->match = g_strdup(o->match);
d->protos = g_strdup(o->protos);
d->handles = g_memdup(o->handles,(guint)(sizeof(dissector_handle_t)*(num_protos+1)));
d->handles = (dissector_handle_t *)g_memdup(o->handles,(guint)(sizeof(dissector_handle_t)*(num_protos+1)));
return dest;
}
@ -351,7 +351,7 @@ k12_copy_cb(void* dest, const void* orig, size_t len _U_)
static void
k12_free_cb(void* r)
{
k12_handles_t* h = r;
k12_handles_t* h = (k12_handles_t *)r;
g_free(h->match);
g_free(h->protos);
@ -453,7 +453,7 @@ proto_register_k12(void)
sizeof(k12_handles_t),
"k12_protos", /* filename */
TRUE, /* from_profile */
(void*) &k12_handles, /* data_ptr */
(void**) &k12_handles, /* data_ptr */
&nk12_handles, /* numitems_ptr */
UAT_AFFECTS_DISSECTION, /* affects dissection of packets, but not set of named fields */
"ChK12ProtocolsSection", /* help */

View File

@ -1744,12 +1744,12 @@ ncp_hash_insert(conversation_t *conversation, guint8 nw_sequence,
/* Now remember the request, so we can find it if we later
a reply to it. */
request_key = se_alloc(sizeof(ncp_req_hash_key));
request_key = se_new(ncp_req_hash_key);
request_key->conversation = conversation;
/* Make sequence number unique */
request_key->nw_sequence_long = (0x10000 + ((pkt_num/255)<<16)) | nw_sequence;
request_value = se_alloc(sizeof(ncp_req_hash_value));
request_value = se_new(ncp_req_hash_value);
request_value->ncp_rec = ncp_rec;
request_value->req_cond_results = NULL;
request_value->req_nds_flags = 0;
@ -1771,10 +1771,10 @@ ncp_eid_hash_insert(guint32 nw_eid)
/* Now remember the request, so we can find it if we later
a reply to it. */
request_eid_key = se_alloc(sizeof(ncp_req_eid_hash_key));
request_eid_key = se_new(ncp_req_eid_hash_key);
request_eid_key->nw_eid = nw_eid;
request_eid_value = se_alloc(sizeof(ncp_req_eid_hash_value));
request_eid_value = se_new(ncp_req_eid_hash_value);
g_strlcpy(request_eid_value->object_name, " ", 256);
g_hash_table_insert(ncp_req_eid_hash, request_eid_key, request_eid_value);
@ -1799,14 +1799,14 @@ ncp_hash_lookup(conversation_t *conversation, guint8 nw_sequence, guint32 pkt_nu
* Loop through all the previous sequence numbers in the hash to see
* if the original request packet can be found.
*/
temp_value = g_hash_table_lookup(ncp_req_hash, &request_key);
temp_value = (ncp_req_hash_value *)g_hash_table_lookup(ncp_req_hash, &request_key);
while(!temp_value)
{
request_key.nw_sequence_long = request_key.nw_sequence_long-0x10000;
if((request_key.nw_sequence_long & 0xffff0000) == 0){
break;
}
temp_value = g_hash_table_lookup(ncp_req_hash, &request_key);
temp_value = (ncp_req_hash_value *)g_hash_table_lookup(ncp_req_hash, &request_key);
}
return temp_value;
@ -1820,7 +1820,7 @@ ncp_eid_hash_lookup(conversation_t *conversation _U_, guint32 nw_eid)
request_eid_key.nw_eid = nw_eid;
return g_hash_table_lookup(ncp_req_eid_hash, &request_eid_key);
return (ncp_req_eid_hash_value *)g_hash_table_lookup(ncp_req_eid_hash, &request_eid_key);
}
/* Does NCP func require a subfunction code? */
@ -1909,7 +1909,7 @@ get_finfo_length(field_info *finfo)
static char *
get_finfo_value_string(field_info *finfo)
{
return fvalue_get(&finfo->value);
return (char *)fvalue_get(&finfo->value);
}
#if 0
static char *
@ -2442,7 +2442,7 @@ get_string(tvbuff_t* tvb, guint offset, guint str_length)
return "";
}
dest_buf = ep_alloc(max_length + 1);
dest_buf = (char *)ep_alloc(max_length + 1);
dest_buf[0] = '\0';
for ( i = 0; i < (gint)str_length; i++ )
@ -7156,7 +7156,7 @@ nds_defrag(tvbuff_t *tvb, packet_info *pinfo, guint32 nw_connection, guint8 sequ
}
}
else {
request_value = p_get_proto_data(pinfo->fd, proto_ncp);
request_value = (ncp_req_hash_value *)p_get_proto_data(pinfo->fd, proto_ncp);
if (!request_value) {
dissect_ncp_reply(tvb, pinfo, nw_connection, sequence, type, tree, ncp_tap);
return;
@ -7676,7 +7676,7 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
gboolean *results;
dfilter_t *dfilter;
results = se_alloc0(sizeof(gboolean)*NUM_REQ_CONDS);
results = (gboolean *)se_alloc0(sizeof(gboolean)*NUM_REQ_CONDS);
needed = ncp_rec->req_cond_indexes;
while (*needed != -1) {
@ -7723,7 +7723,7 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
col_set_str(pinfo->cinfo, COL_INFO, "C ");
finfo = g_ptr_array_index(parray, 0);
finfo = (field_info *)g_ptr_array_index(parray, 0);
info_type = get_info_type((const gchar*) ncp_rec->req_info_str->first_string);
@ -7761,7 +7761,7 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo,
if (len > 1) {
for (i = 1; i < len; i++) {
non_uni_string[0]='\0';
finfo = g_ptr_array_index(parray, i);
finfo = (field_info *)g_ptr_array_index(parray, i);
info_type = get_info_type((const gchar*) ncp_rec->req_info_str->repeat_string);
if (info_type != 0) { /* Is this a string or not? */

View File

@ -318,7 +318,7 @@ static p_mul_seq_val *lookup_seq_val (guint32 message_id, guint16 seq_no,
address *addr)
{
p_mul_seq_val *pkg_data;
p_mul_id_key *p_mul_key = se_alloc (sizeof (p_mul_id_key));
p_mul_id_key *p_mul_key = se_new(p_mul_id_key);
p_mul_key->id = message_id;
p_mul_key->seq = seq_no;
@ -346,7 +346,7 @@ static void copy_hashtable_data (gpointer key, p_mul_ack_data *ack_data1, GHashT
{
p_mul_ack_data *ack_data2;
ack_data2 = se_alloc (sizeof (p_mul_ack_data));
ack_data2 = se_new(p_mul_ack_data);
ack_data2->ack_id = ack_data1->ack_id;
ack_data2->ack_resend_count = ack_data1->ack_resend_count;
@ -374,7 +374,7 @@ static p_mul_seq_val *register_p_mul_id (packet_info *pinfo, address *addr, guin
nstime_set_zero(&addr_time);
nstime_set_zero(&prev_time);
p_mul_key = se_alloc (sizeof (p_mul_id_key));
p_mul_key = se_new(p_mul_id_key);
if (!pinfo->fd->flags.visited &&
(pdu_type == Address_PDU || pdu_type == Data_PDU || pdu_type == Discard_Message_PDU))
@ -424,7 +424,7 @@ static p_mul_seq_val *register_p_mul_id (packet_info *pinfo, address *addr, guin
}
}
pkg_list = p_get_proto_data (pinfo->fd, proto_p_mul);
pkg_list = (GHashTable *)p_get_proto_data(pinfo->fd, proto_p_mul);
if (!pkg_list) {
/* Never saved list for this packet, create a new */
pkg_list = g_hash_table_new (NULL, NULL);
@ -444,10 +444,10 @@ static p_mul_seq_val *register_p_mul_id (packet_info *pinfo, address *addr, guin
if (pdu_type == Ack_PDU) {
/* Only save this data if positive ack */
if (no_missing == 0) {
ack_data = g_hash_table_lookup (p_mul_data->ack_data, GUINT_TO_POINTER(dstIP));
ack_data = (p_mul_ack_data *)g_hash_table_lookup (p_mul_data->ack_data, GUINT_TO_POINTER(dstIP));
if (!ack_data) {
/* Only save reference to first ACK */
ack_data = se_alloc0 (sizeof (p_mul_ack_data));
ack_data = se_new0(p_mul_ack_data);
ack_data->ack_id = pinfo->fd->num;
g_hash_table_insert (p_mul_data->ack_data, GUINT_TO_POINTER(dstIP), ack_data);
} else {
@ -470,9 +470,9 @@ static p_mul_seq_val *register_p_mul_id (packet_info *pinfo, address *addr, guin
} else {
/* New message */
if (pdu_type == Ack_PDU) {
p_mul_data = se_alloc0 (sizeof (p_mul_seq_val));
p_mul_data = se_new0(p_mul_seq_val);
} else {
p_mul_data = g_malloc0 (sizeof (p_mul_seq_val));
p_mul_data = (p_mul_seq_val *)g_malloc0(sizeof (p_mul_seq_val));
}
p_mul_data->msg_type = pdu_type;
if (pdu_type == Address_PDU || pdu_type == Ack_PDU) {
@ -481,7 +481,7 @@ static p_mul_seq_val *register_p_mul_id (packet_info *pinfo, address *addr, guin
if (pdu_type == Ack_PDU) {
/* No matching message for this ack */
ack_data = se_alloc0 (sizeof (p_mul_ack_data));
ack_data = se_new0(p_mul_ack_data);
ack_data->ack_id = pinfo->fd->num;
g_hash_table_insert (p_mul_data->ack_data, GUINT_TO_POINTER(dstIP), ack_data);
} else {
@ -501,7 +501,7 @@ static p_mul_seq_val *register_p_mul_id (packet_info *pinfo, address *addr, guin
}
/* Copy the current package data to the frame */
pkg_data = se_alloc (sizeof (p_mul_seq_val));
pkg_data = se_new(p_mul_seq_val);
*pkg_data = *p_mul_data;
if (p_mul_data->ack_data) {
/* Copy the hash table for ack data */
@ -511,7 +511,7 @@ static p_mul_seq_val *register_p_mul_id (packet_info *pinfo, address *addr, guin
g_hash_table_insert (pkg_list, GUINT_TO_POINTER(message_id), pkg_data);
} else {
/* Fetch last values from data saved in packet */
pkg_data = g_hash_table_lookup (pkg_list, GUINT_TO_POINTER(message_id));
pkg_data = (p_mul_seq_val *)g_hash_table_lookup (pkg_list, GUINT_TO_POINTER(message_id));
}
DISSECTOR_ASSERT (pkg_data);
@ -570,7 +570,7 @@ static void add_ack_analysis (tvbuff_t *tvb, packet_info *pinfo, proto_tree *p_m
} else {
memcpy((guint8 *)&dstIp, dst->data, 4);
if (pkg_data->ack_data) {
ack_data = g_hash_table_lookup (pkg_data->ack_data, GUINT_TO_POINTER(dstIp));
ack_data = (p_mul_ack_data *)g_hash_table_lookup (pkg_data->ack_data, GUINT_TO_POINTER(dstIp));
}
/* Add reference to Ack_PDU */
@ -609,7 +609,7 @@ static void add_ack_analysis (tvbuff_t *tvb, packet_info *pinfo, proto_tree *p_m
return;
}
if (pkg_data->ack_data) {
ack_data = g_hash_table_lookup (pkg_data->ack_data, GUINT_TO_POINTER(dstIp));
ack_data = (p_mul_ack_data *)g_hash_table_lookup (pkg_data->ack_data, GUINT_TO_POINTER(dstIp));
}
/* Add reference to Address_PDU */