From 0df5a9390d41149dfc87440d72e7669ba96748ec Mon Sep 17 00:00:00 2001 From: Bill Meier Date: Wed, 20 Mar 2013 01:18:10 +0000 Subject: From beroset: remove C++ incompatibilities https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416 attachment #10397 svn path=/trunk/; revision=48438 --- plugins/asn1/asn1.c | 8 ++++---- plugins/irda/packet-irda.c | 8 ++++---- plugins/irda/packet-sir.c | 2 +- plugins/stats_tree/pinfo_stats_tree.c | 8 ++++---- plugins/wimax/mac_hd_generic_decoder.c | 16 ++++++++-------- plugins/wimax/mac_hd_type1_decoder.c | 4 ++-- plugins/wimax/mac_hd_type2_decoder.c | 4 ++-- 7 files changed, 25 insertions(+), 25 deletions(-) (limited to 'plugins') diff --git a/plugins/asn1/asn1.c b/plugins/asn1/asn1.c index 39d9e0d660..5e2080ed91 100644 --- a/plugins/asn1/asn1.c +++ b/plugins/asn1/asn1.c @@ -679,7 +679,7 @@ asn1_bits_decode ( ASN1_SCK *asn1, int enc_len, guchar **bits, */ if (enc_len != 0) { tvb_ensure_bytes_exist(asn1->tvb, asn1->offset, enc_len); - *bits = g_malloc (enc_len); + *bits = (guchar *)g_malloc (enc_len); } else { /* * If the length is 0, we allocate a 1-byte buffer, as @@ -687,7 +687,7 @@ asn1_bits_decode ( ASN1_SCK *asn1, int enc_len, guchar **bits, * and our caller expects us to return a pointer to a * buffer. */ - *bits = g_malloc (1); + *bits = (guchar *)g_malloc (1); } ptr = *bits; @@ -737,7 +737,7 @@ asn1_string_value_decode ( ASN1_SCK *asn1, int enc_len, guchar **octets) */ if (enc_len != 0) tvb_ensure_bytes_exist(asn1->tvb, asn1->offset, enc_len); - *octets = g_malloc (enc_len+1); + *octets = (guchar *)g_malloc (enc_len+1); eoc = asn1->offset + enc_len; ptr = *octets; @@ -904,7 +904,7 @@ asn1_oid_value_decode ( ASN1_SCK *asn1, int enc_len, subid_t **oid, guint *len) eoc = asn1->offset + enc_len; size = enc_len + 1; - *oid = g_malloc(size * sizeof(gulong)); + *oid = (guint32 *)g_malloc(size * sizeof(gulong)); optr = *oid; ret = asn1_subid_decode (asn1, &subid); diff --git a/plugins/irda/packet-irda.c b/plugins/irda/packet-irda.c index d89c64bce8..4c1e325be7 100644 --- a/plugins/irda/packet-irda.c +++ b/plugins/irda/packet-irda.c @@ -550,7 +550,7 @@ static void dissect_iap_request(tvbuff_t* tvb, packet_info* pinfo, proto_tree* r } if (iap_conv->pnext == NULL) { - iap_conv->pnext = se_alloc(sizeof(iap_conversation_t)); + iap_conv->pnext = se_new(iap_conversation_t); iap_conv = iap_conv->pnext; break; } @@ -560,7 +560,7 @@ static void dissect_iap_request(tvbuff_t* tvb, packet_info* pinfo, proto_tree* r else { conv = conversation_new(pinfo->fd->num, &srcaddr, &destaddr, PT_NONE, pinfo->srcport, pinfo->destport, 0); - iap_conv = se_alloc(sizeof(iap_conversation_t)); + iap_conv = se_new(iap_conversation_t); conversation_add_proto_data(conv, proto_iap, (void*)iap_conv); } @@ -1224,7 +1224,7 @@ void add_lmp_conversation(packet_info* pinfo, guint8 dlsap, gboolean ttp, dissec if (lmp_conv->pnext == NULL) { - lmp_conv->pnext = se_alloc(sizeof(lmp_conversation_t)); + lmp_conv->pnext = se_new(lmp_conversation_t); lmp_conv = lmp_conv->pnext; break; } @@ -1234,7 +1234,7 @@ void add_lmp_conversation(packet_info* pinfo, guint8 dlsap, gboolean ttp, dissec else { conv = conversation_new(pinfo->fd->num, &destaddr, &srcaddr, PT_NONE, dlsap, 0, NO_PORT_B); - lmp_conv = se_alloc(sizeof(lmp_conversation_t)); + lmp_conv = se_new(lmp_conversation_t); conversation_add_proto_data(conv, proto_irlmp, (void*)lmp_conv); } diff --git a/plugins/irda/packet-sir.c b/plugins/irda/packet-sir.c index 359ea32635..da9856bf6d 100644 --- a/plugins/irda/packet-sir.c +++ b/plugins/irda/packet-sir.c @@ -71,7 +71,7 @@ unescape_data(tvbuff_t *tvb, packet_info *pinfo) } else { guint length = tvb_length(tvb); guint offset; - guint8 *data = g_malloc(length); + guint8 *data = (guint8 *)g_malloc(length); guint8 *dst = data; tvbuff_t *next_tvb; diff --git a/plugins/stats_tree/pinfo_stats_tree.c b/plugins/stats_tree/pinfo_stats_tree.c index e4ada8e9ac..3646f61181 100644 --- a/plugins/stats_tree/pinfo_stats_tree.c +++ b/plugins/stats_tree/pinfo_stats_tree.c @@ -75,8 +75,8 @@ static uat_t * plen_uat = NULL; static guint num_plen_uat = 0; static void* uat_plen_record_copy_cb(void* n, const void* o, size_t siz _U_) { - const uat_plen_record_t *r = o; - uat_plen_record_t *rn = n; + const uat_plen_record_t *r = (const uat_plen_record_t *)o; + uat_plen_record_t *rn = (uat_plen_record_t *)n; if (r->packet_range) rn->packet_range = range_copy(r->packet_range); @@ -150,7 +150,7 @@ static const gchar* st_str_plen = "Packet Lengths"; static void plen_stats_tree_init(stats_tree* st) { guint i; - char **str_range_array = ep_alloc(num_plen_uat*sizeof(char*)); + char **str_range_array = (char **)ep_alloc(num_plen_uat*sizeof(char*)); /* Convert the ranges to strings for the stats tree API */ for (i = 0; i < num_plen_uat; i++) { @@ -217,7 +217,7 @@ void register_pinfo_stat_trees(void) { sizeof(uat_plen_record_t), /* record size */ "packet_lengths", /* filename */ TRUE, /* from_profile */ - (void*) &uat_plen_records, /* data_ptr */ + (void**) &uat_plen_records, /* data_ptr */ &num_plen_uat, /* numitems_ptr */ 0, /* not a dissector, so affects neither dissection nor fields */ NULL, /* help */ diff --git a/plugins/wimax/mac_hd_generic_decoder.c b/plugins/wimax/mac_hd_generic_decoder.c index c869c91417..9c812df956 100644 --- a/plugins/wimax/mac_hd_generic_decoder.c +++ b/plugins/wimax/mac_hd_generic_decoder.c @@ -265,7 +265,7 @@ static const value_string fast_fb_types[] = /* Extended sub-headers */ /* DL sub-header types */ -enum +typedef enum { SDU_SN, DL_SLEEP_CONTROL, @@ -273,7 +273,7 @@ FEEDBACK_REQ, SN_REQ, PDU_SN_SHORT_DL, PDU_SN_LONG_DL -} DL_EXT_SUBHEADER; +} DL_EXT_SUBHEADER_e; static const value_string dl_ext_sub_header_type[] = { @@ -324,14 +324,14 @@ static const value_string uiuc_values[] = }; /* UL sub-header types */ -enum +typedef enum { MIMO_MODE_FEEDBACK, UL_TX_POWER_REPORT, MINI_FEEDBACK, PDU_SN_SHORT_UL, PDU_SN_LONG_UL -} UL_EXT_SUBHEADER; +} UL_EXT_SUBHEADER_e; static const value_string ul_ext_sub_header_type[] = { @@ -503,7 +503,7 @@ static gint hf_mac_header_generic_fast_fb_subhd_fb_type = -1; #define GRANT_MGMT_SUBHEADER_EXT_FLI_MASK 0x0010 /*0x0800*/ #define GRANT_MGMT_SUBHEADER_EXT_FL_MASK 0x000F /*0xF000*/ -enum +typedef enum { SCHEDULE_SERVICE_TYPE_RSVD, SCHEDULE_SERVICE_TYPE_UNDEFINED, @@ -512,7 +512,7 @@ enum SCHEDULE_SERVICE_TYPE_RTPS, SCHEDULE_SERVICE_TYPE_EXT_RTPS, SCHEDULE_SERVICE_TYPE_UGS -} SCHEDULE_SERVICE_TYPE; +} SCHEDULE_SERVICE_TYPE_e; static gint hf_mac_header_generic_grant_mgmt_ugs_tree = -1; static gint hf_mac_header_generic_grant_mgmt_subhd_ugs_si = -1; @@ -1029,8 +1029,8 @@ void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto while (pinfo->fd->num > cid_adj_array_size) { cid_adj_array_size += 1024; - cid_adj_array = g_realloc(cid_adj_array, (int)sizeof(guint) * cid_adj_array_size); - frag_num_array = g_realloc(frag_num_array, (int)sizeof(guint8) * cid_adj_array_size); + cid_adj_array = (guint *)g_realloc(cid_adj_array, (int)sizeof(guint) * cid_adj_array_size); + frag_num_array = (guint8 *)g_realloc(frag_num_array, (int)sizeof(guint8) * cid_adj_array_size); /* Clear the added memory */ memset(&cid_adj_array[cid_adj_array_size - 1024], 0, (int)sizeof(guint) * 1024); } diff --git a/plugins/wimax/mac_hd_type1_decoder.c b/plugins/wimax/mac_hd_type1_decoder.c index c4fcb4b007..5dbe41a950 100644 --- a/plugins/wimax/mac_hd_type1_decoder.c +++ b/plugins/wimax/mac_hd_type1_decoder.c @@ -51,7 +51,7 @@ static gint hf_mac_header_type_1_value_bytes = -1; #define WIMAX_MAC_HEADER_SIZE 6 /* WiMax MAC Header Type I Sub Types */ -enum +typedef enum { BR_INCREMENTAL, /* 0 */ BR_AGGREGATE, /* 1 */ @@ -62,7 +62,7 @@ enum SN_REPORT, /* 6 */ CQICH_ALLOCATION_REQUEST, /* 7 */ TYPE_I_SUBTYPE_MAX -} TYPE_I_SUBTYPE; +} TYPE_I_SUBTYPE_e; static const char *type1_subtype_abbrv[TYPE_I_SUBTYPE_MAX] = { diff --git a/plugins/wimax/mac_hd_type2_decoder.c b/plugins/wimax/mac_hd_type2_decoder.c index 63307fcc9a..818d061fb9 100644 --- a/plugins/wimax/mac_hd_type2_decoder.c +++ b/plugins/wimax/mac_hd_type2_decoder.c @@ -51,7 +51,7 @@ static gint hf_mac_header_type_2_value_bytes = -1; #define WIMAX_MAC_HEADER_SIZE 6 /* WiMax MAC Header Type II Feedback Types */ -enum +typedef enum { CQI_MIMO_FB, /* 0 */ DL_AVG_CINR, /* 1 */ @@ -68,7 +68,7 @@ enum CINR_FB, /* 12 */ CL_MIMO_FB, /* 13 */ TYPE_II_FB_TYPE_MAX -} TYPE_II_FB_TYPE; +} TYPE_II_FB_TYPE_e; static const char *type2_fb_type_abbrv[TYPE_II_FB_TYPE_MAX] = { -- cgit v1.2.1