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-ip.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'epan/dissectors/packet-ip.c') 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)); -- cgit v1.2.3