diff options
Diffstat (limited to 'epan/dissectors')
141 files changed, 1334 insertions, 1424 deletions
diff --git a/epan/dissectors/packet-6lowpan.c b/epan/dissectors/packet-6lowpan.c index 00e3fef188..30d7fe6e38 100644 --- a/epan/dissectors/packet-6lowpan.c +++ b/epan/dissectors/packet-6lowpan.c @@ -791,7 +791,7 @@ lowpan_reassemble_ipv6(tvbuff_t *tvb, struct ip6_hdr *ipv6, struct lowpan_nhdr * }; /* Return the reassembed packet. */ - ret = tvb_new_child_real_data(tvb, buffer, length + sizeof(struct ip6_hdr), reported + sizeof(struct ip6_hdr)); + ret = tvb_new_child_real_data(tvb, buffer, length + (int)sizeof(struct ip6_hdr), reported + (int)sizeof(struct ip6_hdr)); tvb_set_free_cb(ret, g_free); return ret; } /* lowpan_reassemble_ipv6 */ @@ -1029,40 +1029,40 @@ dissect_6lowpan_hc1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint dg */ /* Create a tree for the HC1 Header. */ if (tree) { - ti = proto_tree_add_text(tree, tvb, 0, sizeof(guint16), "HC1 Encoding"); + ti = proto_tree_add_text(tree, tvb, 0, (int)sizeof(guint16), "HC1 Encoding"); hc_tree = proto_item_add_subtree(ti, ett_6lowpan_hc1); /* Get and display the pattern. */ proto_tree_add_bits_item(hc_tree, hf_6lowpan_pattern, tvb, 0, LOWPAN_PATTERN_HC1_BITS, ENC_BIG_ENDIAN); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Get and display the HC1 encoding bits. */ hc1_encoding = tvb_get_guint8(tvb, offset); next_header = ((hc1_encoding & LOWPAN_HC1_NEXT) >> 1); if (tree) { - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_source_prefix, tvb, offset, sizeof(guint8), hc1_encoding & LOWPAN_HC1_SOURCE_PREFIX); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_source_ifc, tvb, offset, sizeof(guint8), hc1_encoding & LOWPAN_HC1_SOURCE_IFC); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_dest_prefix, tvb, offset, sizeof(guint8), hc1_encoding & LOWPAN_HC1_DEST_PREFIX); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_dest_ifc, tvb, offset, sizeof(guint8), hc1_encoding & LOWPAN_HC1_DEST_IFC); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_class, tvb, offset, sizeof(guint8), hc1_encoding & LOWPAN_HC1_TRAFFIC_CLASS); - proto_tree_add_uint(hc_tree, hf_6lowpan_hc1_next, tvb, offset, sizeof(guint8), hc1_encoding & LOWPAN_HC1_NEXT); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_more, tvb, offset, sizeof(guint8), hc1_encoding & LOWPAN_HC1_MORE); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_source_prefix, tvb, offset, (int)sizeof(guint8), hc1_encoding & LOWPAN_HC1_SOURCE_PREFIX); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_source_ifc, tvb, offset, (int)sizeof(guint8), hc1_encoding & LOWPAN_HC1_SOURCE_IFC); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_dest_prefix, tvb, offset, (int)sizeof(guint8), hc1_encoding & LOWPAN_HC1_DEST_PREFIX); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_dest_ifc, tvb, offset, (int)sizeof(guint8), hc1_encoding & LOWPAN_HC1_DEST_IFC); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_class, tvb, offset, (int)sizeof(guint8), hc1_encoding & LOWPAN_HC1_TRAFFIC_CLASS); + proto_tree_add_uint(hc_tree, hf_6lowpan_hc1_next, tvb, offset, (int)sizeof(guint8), hc1_encoding & LOWPAN_HC1_NEXT); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_more, tvb, offset, (int)sizeof(guint8), hc1_encoding & LOWPAN_HC1_MORE); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Get and display the HC2 encoding bits, if present. */ if (hc1_encoding & LOWPAN_HC1_MORE) { if (next_header == LOWPAN_HC1_NEXT_UDP) { hc_udp_encoding = tvb_get_guint8(tvb, offset); if (tree) { - ti = proto_tree_add_text(tree, tvb, offset, sizeof(guint8), "HC_UDP Encoding"); + ti = proto_tree_add_text(tree, tvb, offset, (int)sizeof(guint8), "HC_UDP Encoding"); hc_tree = proto_item_add_subtree(ti, ett_6lowpan_hc2_udp); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc2_udp_src, tvb, offset, sizeof(guint8), hc_udp_encoding & LOWPAN_HC2_UDP_SRCPORT); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc2_udp_dst, tvb, offset, sizeof(guint8), hc_udp_encoding & LOWPAN_HC2_UDP_DSTPORT); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc2_udp_len, tvb, offset, sizeof(guint8), hc_udp_encoding & LOWPAN_HC2_UDP_LENGTH); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc2_udp_src, tvb, offset, (int)sizeof(guint8), hc_udp_encoding & LOWPAN_HC2_UDP_SRCPORT); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc2_udp_dst, tvb, offset, (int)sizeof(guint8), hc_udp_encoding & LOWPAN_HC2_UDP_DSTPORT); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc2_udp_len, tvb, offset, (int)sizeof(guint8), hc_udp_encoding & LOWPAN_HC2_UDP_LENGTH); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } else { /* HC1 states there are more bits, but an illegal next header was defined. */ @@ -1264,7 +1264,7 @@ dissect_6lowpan_hc1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint dg else { udp.length = tvb_reported_length(tvb); udp.length -= BITS_TO_BYTE_LEN(0, bit_offset + LOWPAN_UDP_CHECKSUM_BITS); - udp.length += sizeof(struct udp_hdr); + udp.length += (int)sizeof(struct udp_hdr); } udp.length = g_ntohs(udp.length); @@ -1283,7 +1283,7 @@ dissect_6lowpan_hc1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint dg nhdr_list = (struct lowpan_nhdr *)ep_alloc(sizeof(struct lowpan_nhdr) + sizeof(struct udp_hdr) + length); nhdr_list->next = NULL; nhdr_list->proto = IP_PROTO_UDP; - nhdr_list->length = length + sizeof(struct udp_hdr); + nhdr_list->length = length + (int)sizeof(struct udp_hdr); nhdr_list->reported = g_ntohs(udp.length); /* Copy the UDP header into the buffer. */ @@ -1306,7 +1306,7 @@ dissect_6lowpan_hc1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint dg nhdr_list->reported = tvb_reported_length_remaining(tvb, offset); } else { - nhdr_list->reported = dgram_size - sizeof(struct ip6_hdr); + nhdr_list->reported = dgram_size - (int)sizeof(struct ip6_hdr); } tvb_memcpy(tvb, LOWPAN_NHDR_DATA(nhdr_list), offset, nhdr_list->length); } @@ -1377,7 +1377,7 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d /* Create a tree for the IPHC header. */ if (tree) { - ti = proto_tree_add_text(tree, tvb, 0, sizeof(guint16), "IPHC Header"); + ti = proto_tree_add_text(tree, tvb, 0, (int)sizeof(guint16), "IPHC Header"); iphc_tree = proto_item_add_subtree(ti, ett_6lowpan_iphc); /* Display the pattern. */ @@ -1395,20 +1395,20 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d iphc_dst_mode = (iphc_flags & LOWPAN_IPHC_FLAG_DST_MODE) >> LOWPAN_IPHC_FLAG_OFFSET_DST_MODE; if (tree) { const value_string *dam_vs; - proto_tree_add_uint (iphc_tree, hf_6lowpan_iphc_flag_tf, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_FLOW); - proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_nhdr, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_NHDR); - proto_tree_add_uint (iphc_tree, hf_6lowpan_iphc_flag_hlim, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_HLIM); - proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_cid, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_CONTEXT_ID); - proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_sac, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_SRC_COMP); - proto_tree_add_uint(iphc_tree, hf_6lowpan_iphc_flag_sam, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_SRC_MODE); - proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_mcast, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_MCAST_COMP); - proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_dac, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_DST_COMP); + proto_tree_add_uint (iphc_tree, hf_6lowpan_iphc_flag_tf, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_FLOW); + proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_nhdr, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_NHDR); + proto_tree_add_uint (iphc_tree, hf_6lowpan_iphc_flag_hlim, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_HLIM); + proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_cid, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_CONTEXT_ID); + proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_sac, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_SRC_COMP); + proto_tree_add_uint(iphc_tree, hf_6lowpan_iphc_flag_sam, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_SRC_MODE); + proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_mcast, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_MCAST_COMP); + proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_dac, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_DST_COMP); /* Destination address mode changes meanings depending on multicast compression. */ dam_vs = (iphc_flags & LOWPAN_IPHC_FLAG_MCAST_COMP) ? (lowpan_iphc_mcast_modes) : (lowpan_iphc_addr_modes); - ti_dam = proto_tree_add_uint_format_value(iphc_tree, hf_6lowpan_iphc_flag_dam, tvb, offset, sizeof(guint16), + ti_dam = proto_tree_add_uint_format_value(iphc_tree, hf_6lowpan_iphc_flag_dam, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_DST_MODE, "%s (0x%04x)", val_to_str_const(iphc_dst_mode, dam_vs, "Reserved"), iphc_dst_mode); } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); /* Display the context identifier extension, if present. */ if (iphc_flags & LOWPAN_IPHC_FLAG_CONTEXT_ID) { @@ -1416,10 +1416,10 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d iphc_sci = (iphc_ctx & LOWPAN_IPHC_FLAG_SCI) >> LOWPAN_IPHC_FLAG_OFFSET_SCI; iphc_dci = (iphc_ctx & LOWPAN_IPHC_FLAG_DCI) >> LOWPAN_IPHC_FLAG_OFFSET_DCI; if (tree) { - proto_tree_add_uint(iphc_tree, hf_6lowpan_iphc_sci, tvb, offset, sizeof(guint8), iphc_ctx & LOWPAN_IPHC_FLAG_SCI); - proto_tree_add_uint(iphc_tree, hf_6lowpan_iphc_dci, tvb, offset, sizeof(guint8), iphc_ctx & LOWPAN_IPHC_FLAG_DCI); + proto_tree_add_uint(iphc_tree, hf_6lowpan_iphc_sci, tvb, offset, (int)sizeof(guint8), iphc_ctx & LOWPAN_IPHC_FLAG_SCI); + proto_tree_add_uint(iphc_tree, hf_6lowpan_iphc_dci, tvb, offset, (int)sizeof(guint8), iphc_ctx & LOWPAN_IPHC_FLAG_DCI); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } /* Use link-local contexts if stateless. */ if (!(iphc_flags & LOWPAN_IPHC_FLAG_SRC_COMP)) { @@ -1455,12 +1455,12 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d if ((tree) && (iphc_traffic != LOWPAN_IPHC_FLOW_COMPRESSED)) { /* Create a tree for the traffic class. */ proto_tree * tf_tree; - ti = proto_tree_add_uint(tree, hf_6lowpan_traffic_class, tvb, offset>>3, sizeof(guint8), ipv6_class); + ti = proto_tree_add_uint(tree, hf_6lowpan_traffic_class, tvb, offset>>3, (int)sizeof(guint8), ipv6_class); tf_tree = proto_item_add_subtree(ti, ett_6lopwan_traffic_class); /* Add the ECN and DSCP fields. */ - proto_tree_add_uint(tf_tree, hf_6lowpan_ecn, tvb, offset>>3, sizeof(guint8), ipv6_class & LOWPAN_IPHC_TRAFFIC_ECN); - proto_tree_add_uint(tf_tree, hf_6lowpan_dscp, tvb, offset>>3, sizeof(guint8), ipv6_class & LOWPAN_IPHC_TRAFFIC_DSCP); + proto_tree_add_uint(tf_tree, hf_6lowpan_ecn, tvb, offset>>3, (int)sizeof(guint8), ipv6_class & LOWPAN_IPHC_TRAFFIC_ECN); + proto_tree_add_uint(tf_tree, hf_6lowpan_dscp, tvb, offset>>3, (int)sizeof(guint8), ipv6_class & LOWPAN_IPHC_TRAFFIC_DSCP); } /* Parse and display the traffic label. */ @@ -1490,10 +1490,10 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d if (!(iphc_flags & LOWPAN_IPHC_FLAG_NHDR)) { ipv6.ip6_nxt = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_uint_format(tree, hf_6lowpan_next_header, tvb, offset, sizeof(guint8), ipv6.ip6_nxt, + proto_tree_add_uint_format(tree, hf_6lowpan_next_header, tvb, offset, (int)sizeof(guint8), ipv6.ip6_nxt, "Next header: %s (0x%02x)", ipprotostr(ipv6.ip6_nxt), ipv6.ip6_nxt); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } /* Get the hop limit field, if present. */ @@ -1509,9 +1509,9 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d else { ipv6.ip6_hlim = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_uint(tree, hf_6lowpan_hop_limit, tvb, offset, sizeof(guint8), ipv6.ip6_hlim); + proto_tree_add_uint(tree, hf_6lowpan_hop_limit, tvb, offset, (int)sizeof(guint8), ipv6.ip6_hlim); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } /*===================================================== @@ -1531,17 +1531,17 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d /* Full Address inline. */ else if (iphc_src_mode == LOWPAN_IPHC_ADDR_FULL_INLINE) { if (!(iphc_flags & LOWPAN_IPHC_FLAG_SRC_COMP)) sctx = &lowpan_context_default; - length = sizeof(ipv6.ip6_src); + length = (int)sizeof(ipv6.ip6_src); tvb_memcpy(tvb, &ipv6.ip6_src, offset, length); } /* 64-bits inline. */ else if (iphc_src_mode == LOWPAN_IPHC_ADDR_64BIT_INLINE) { - length = sizeof(guint64); + length = (int)sizeof(guint64); tvb_memcpy(tvb, &ipv6.ip6_src.bytes[sizeof(ipv6.ip6_src) - length], offset, length); } /* 16-bits inline. */ else if (iphc_src_mode == LOWPAN_IPHC_ADDR_16BIT_INLINE) { - length = sizeof(guint16); + length = (int)sizeof(guint16); /* Format becomes ff:fe00:xxxx */ ipv6.ip6_src.bytes[11] = 0xff; ipv6.ip6_src.bytes[12] = 0xfe; @@ -1583,7 +1583,7 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d /* Stateless multicast compression. */ if ((iphc_flags & LOWPAN_IPHC_FLAG_MCAST_COMP) && !(iphc_flags & LOWPAN_IPHC_FLAG_DST_COMP)) { if (iphc_dst_mode == LOWPAN_IPHC_ADDR_FULL_INLINE) { - length = sizeof(ipv6.ip6_dst); + length = (int)sizeof(ipv6.ip6_dst); tvb_memcpy(tvb, &ipv6.ip6_dst.bytes[sizeof(ipv6.ip6_dst) - length], offset, length); } else if (iphc_dst_mode == LOWPAN_IPHC_MCAST_48BIT) { @@ -1657,17 +1657,17 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d /* Full Address inline. */ else if (iphc_dst_mode == LOWPAN_IPHC_ADDR_FULL_INLINE) { dctx = &lowpan_context_default; - length = sizeof(ipv6.ip6_dst); + length = (int)sizeof(ipv6.ip6_dst); tvb_memcpy(tvb, &ipv6.ip6_dst, offset, length); } /* 64-bits inline. */ else if (iphc_dst_mode == LOWPAN_IPHC_ADDR_64BIT_INLINE) { - length = sizeof(guint64); + length = (int)sizeof(guint64); tvb_memcpy(tvb, &ipv6.ip6_dst.bytes[sizeof(ipv6.ip6_dst) - length], offset, length); } /* 16-bits inline. */ else if (iphc_dst_mode == LOWPAN_IPHC_ADDR_16BIT_INLINE) { - length = sizeof(guint16); + length = (int)sizeof(guint16); /* Format becomes ff:fe00:xxxx */ ipv6.ip6_dst.bytes[11] = 0xff; ipv6.ip6_dst.bytes[12] = 0xfe; @@ -1710,7 +1710,7 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d ipv6.ip6_nxt = lowpan_parse_nhc_proto(tvb, offset); /* Parse the 6LoWPAN NHC fields. */ - nhdr_list = dissect_6lowpan_iphc_nhc(tvb, pinfo, tree, offset, dgram_size - sizeof(struct ip6_hdr), siid, diid); + nhdr_list = dissect_6lowpan_iphc_nhc(tvb, pinfo, tree, offset, dgram_size - (int)sizeof(struct ip6_hdr), siid, diid); } /* Create an extension header for the remaining payload. */ else { @@ -1723,7 +1723,7 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d nhdr_list->reported = tvb_reported_length_remaining(tvb, offset); } else { - nhdr_list->reported = dgram_size - sizeof(struct ip6_hdr); + nhdr_list->reported = dgram_size - (int)sizeof(struct ip6_hdr); } tvb_memcpy(tvb, LOWPAN_NHDR_DATA(nhdr_list), offset, nhdr_list->length); } @@ -1776,7 +1776,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Create a tree for the IPv6 extension header. */ if (tree) { - ti = proto_tree_add_text(tree, tvb, offset, sizeof(guint16), "IPv6 extension header"); + ti = proto_tree_add_text(tree, tvb, offset, (int)sizeof(guint16), "IPv6 extension header"); nhc_tree = proto_item_add_subtree(ti, ett_6lowpan_nhc_ext); /* Display the NHC-UDP pattern. */ proto_tree_add_bits_item(nhc_tree, hf_6lowpan_nhc_pattern, tvb, offset<<3, LOWPAN_NHC_PATTERN_EXT_BITS, ENC_BIG_ENDIAN); @@ -1785,13 +1785,13 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Get and display the extension header compression flags. */ ext_flags = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_uint(nhc_tree, hf_6lowpan_nhc_ext_eid, tvb, offset, sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_EID); - proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_ext_nh, tvb, offset, sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_NHDR); + proto_tree_add_uint(nhc_tree, hf_6lowpan_nhc_ext_eid, tvb, offset, (int)sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_EID); + proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_ext_nh, tvb, offset, (int)sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_NHDR); if (ext_flags & LOWPAN_NHC_EXT_NHDR) { /* TODO: Flag a warning, the NH bit MUST be 0 when EID==0x7 (IP-in-IP). */ } } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Decode the remainder of the packet using IPHC encoding. */ iphc_tvb = dissect_6lowpan_iphc(tvb_new_subset_remaining(tvb, offset), pinfo, tree, dgram_size, siid, diid); @@ -1821,7 +1821,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Create a tree for the IPv6 extension header. */ if (tree) { - ti = proto_tree_add_text(tree, tvb, offset, sizeof(guint16), "IPv6 extension header"); + ti = proto_tree_add_text(tree, tvb, offset, (int)sizeof(guint16), "IPv6 extension header"); nhc_tree = proto_item_add_subtree(ti, ett_6lowpan_nhc_ext); /* Display the NHC-UDP pattern. */ proto_tree_add_bits_item(nhc_tree, hf_6lowpan_nhc_pattern, tvb, offset<<3, LOWPAN_NHC_PATTERN_EXT_BITS, ENC_BIG_ENDIAN); @@ -1830,31 +1830,31 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Get and display the extension header compression flags. */ ext_flags = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_uint(nhc_tree, hf_6lowpan_nhc_ext_eid, tvb, offset, sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_EID); - proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_ext_nh, tvb, offset, sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_NHDR); + proto_tree_add_uint(nhc_tree, hf_6lowpan_nhc_ext_eid, tvb, offset, (int)sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_EID); + proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_ext_nh, tvb, offset, (int)sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_NHDR); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Get and display the next header field, if present. */ if (!(ext_flags & LOWPAN_NHC_EXT_NHDR)) { ipv6_ext.ip6e_nxt = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_uint_format(nhc_tree, hf_6lowpan_nhc_ext_next, tvb, offset, sizeof(guint8), ipv6_ext.ip6e_nxt, + proto_tree_add_uint_format(nhc_tree, hf_6lowpan_nhc_ext_next, tvb, offset, (int)sizeof(guint8), ipv6_ext.ip6e_nxt, "Next header: %s (0x%02x)", ipprotostr(ipv6_ext.ip6e_nxt), ipv6_ext.ip6e_nxt); - proto_item_set_end(ti, tvb, offset+sizeof(guint8)); + proto_item_set_end(ti, tvb, offset+(int)sizeof(guint8)); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } /* Get and display the extension header length. */ ext_len = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_uint(nhc_tree, hf_6lowpan_nhc_ext_length, tvb, offset, sizeof(guint8), ext_len); + proto_tree_add_uint(nhc_tree, hf_6lowpan_nhc_ext_length, tvb, offset, (int)sizeof(guint8), ext_len); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Compute the length of the extension header padded to an 8-byte alignment. */ - length = sizeof(struct ip6_ext) + ext_len; + length = (int)sizeof(struct ip6_ext) + ext_len; length = (length + 7) & ~0x7; /* Create the next header structure for the IPv6 extension header. */ @@ -1881,7 +1881,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, nhc_tree); /* Copy the remainder, and truncate the real buffer length. */ - nhdr->length = tvb_length_remaining(tvb, offset) + sizeof(struct ip6_ext); + nhdr->length = tvb_length_remaining(tvb, offset) + (int)sizeof(struct ip6_ext); tvb_memcpy(tvb, LOWPAN_NHDR_DATA(nhdr) + sizeof(struct ip6_ext), offset, tvb_length_remaining(tvb, offset)); /* There is nothing more we can do. */ @@ -1900,7 +1900,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi * There are more LOWPAN_NHC structures to parse. Call ourself again * recursively to parse them and build the linked list. */ - nhdr->next = dissect_6lowpan_iphc_nhc(tvb, pinfo, tree, offset, dgram_size - ext_len - sizeof(struct ip6_ext), siid, diid); + nhdr->next = dissect_6lowpan_iphc_nhc(tvb, pinfo, tree, offset, dgram_size - ext_len - (int)sizeof(struct ip6_ext), siid, diid); } else { /* Create another next header structure for the remaining payload. */ @@ -1913,7 +1913,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi nhdr->next->reported = tvb_reported_length_remaining(tvb, offset); } else { - nhdr->next->reported = dgram_size - ext_len - sizeof(struct ip6_ext); + nhdr->next->reported = dgram_size - ext_len - (int)sizeof(struct ip6_ext); } tvb_memcpy(tvb, LOWPAN_NHDR_DATA(nhdr->next), offset, nhdr->next->length); } @@ -1933,7 +1933,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Create a tree for the UDP header. */ if (tree) { - ti = proto_tree_add_text(tree, tvb, 0, sizeof(guint8), "UDP header compression"); + ti = proto_tree_add_text(tree, tvb, 0, (int)sizeof(guint8), "UDP header compression"); nhc_tree = proto_item_add_subtree(ti, ett_6lowpan_nhc_udp); /* Display the NHC-UDP pattern. */ proto_tree_add_bits_item(nhc_tree, hf_6lowpan_nhc_pattern, tvb, offset<<3, LOWPAN_NHC_PATTERN_UDP_BITS, ENC_BIG_ENDIAN); @@ -1942,11 +1942,11 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Get and display the UDP header compression options */ udp_flags = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_udp_checksum, tvb, offset, sizeof(guint8), udp_flags & LOWPAN_NHC_UDP_CHECKSUM); - proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_udp_src, tvb, offset, sizeof(guint8), udp_flags & LOWPAN_NHC_UDP_SRCPORT); - proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_udp_dst, tvb, offset, sizeof(guint8), udp_flags & LOWPAN_NHC_UDP_DSTPORT); + proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_udp_checksum, tvb, offset, (int)sizeof(guint8), udp_flags & LOWPAN_NHC_UDP_CHECKSUM); + proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_udp_src, tvb, offset, (int)sizeof(guint8), udp_flags & LOWPAN_NHC_UDP_SRCPORT); + proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_udp_dst, tvb, offset, (int)sizeof(guint8), udp_flags & LOWPAN_NHC_UDP_DSTPORT); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Get and display the ports. */ switch (udp_flags & (LOWPAN_NHC_UDP_SRCPORT | LOWPAN_NHC_UDP_DSTPORT)) { @@ -1991,9 +1991,9 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Parse the checksum. */ udp.checksum = tvb_get_ntohs(tvb, offset); if (tree) { - proto_tree_add_uint(tree, hf_6lowpan_udp_checksum, tvb, offset, sizeof(guint16), udp.checksum); + proto_tree_add_uint(tree, hf_6lowpan_udp_checksum, tvb, offset, (int)sizeof(guint16), udp.checksum); } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); udp.checksum = g_ntohs(udp.checksum); } else { @@ -2003,7 +2003,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Compute the datagram length. */ if (dgram_size < 0) { length = tvb_reported_length_remaining(tvb, offset); - udp.length = g_htons(length + sizeof(struct udp_hdr)); + udp.length = g_htons(length + (int)sizeof(struct udp_hdr)); } else { udp.length = g_htons(dgram_size); @@ -2040,7 +2040,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Fill in the pseudo-header. */ memcpy(&cksum_phdr.src, pinfo->src.data, sizeof(struct e_in6_addr)); memcpy(&cksum_phdr.dst, pinfo->dst.data, sizeof(struct e_in6_addr)); - cksum_phdr.length = g_htonl(length + sizeof(struct udp_hdr)); + cksum_phdr.length = g_htonl(length + (int)sizeof(struct udp_hdr)); memset(cksum_phdr.zero, 0, sizeof(cksum_phdr.zero)); cksum_phdr.proto = IP_PROTO_UDP; @@ -2061,7 +2061,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi nhdr = (struct lowpan_nhdr *)ep_alloc(sizeof(struct lowpan_nhdr) + sizeof(struct udp_hdr) + length); nhdr->next = NULL; nhdr->proto = IP_PROTO_UDP; - nhdr->length = length + sizeof(struct udp_hdr); + nhdr->length = length + (int)sizeof(struct udp_hdr); nhdr->reported = g_ntohs(udp.length); /* Copy the UDP header and payload into the buffer. */ @@ -2098,15 +2098,15 @@ dissect_6lowpan_bc0(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) /* Create a tree for the broadcast header. */ if (tree) { - ti = proto_tree_add_text(tree, tvb, 0, sizeof(guint16), "Broadcast Header"); + ti = proto_tree_add_text(tree, tvb, 0, (int)sizeof(guint16), "Broadcast Header"); bcast_tree = proto_item_add_subtree(ti, ett_6lowpan_bcast); /* Get and display the pattern. */ proto_tree_add_bits_item(bcast_tree, hf_6lowpan_pattern, tvb, 0, LOWPAN_PATTERN_BC0_BITS, ENC_BIG_ENDIAN); /* Get and display the sequence number. */ - seqnum = tvb_get_guint8(tvb, sizeof(guint8)); - proto_tree_add_uint(bcast_tree, hf_6lowpan_bcast_seqnum, tvb, sizeof(guint8), sizeof(guint8), seqnum); + seqnum = tvb_get_guint8(tvb, (int)sizeof(guint8)); + proto_tree_add_uint(bcast_tree, hf_6lowpan_bcast_seqnum, tvb, (int)sizeof(guint8), (int)sizeof(guint8), seqnum); } /* Return the remaining buffer. */ @@ -2150,45 +2150,45 @@ dissect_6lowpan_mesh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree * flag_tree; /* Create the mesh header subtree. */ - flag_item = proto_tree_add_text(mesh_tree, tvb, offset, sizeof(guint8), "Flags"); + flag_item = proto_tree_add_text(mesh_tree, tvb, offset, (int)sizeof(guint8), "Flags"); flag_tree = proto_item_add_subtree(flag_item, ett_6lowpan_mesh); /* Add the mesh header fields. */ proto_tree_add_bits_item(flag_tree, hf_6lowpan_pattern, tvb, offset * 8, LOWPAN_PATTERN_MESH_BITS, ENC_BIG_ENDIAN); - proto_tree_add_boolean(flag_tree, hf_6lowpan_mesh_v, tvb, offset, sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_V); - proto_tree_add_boolean(flag_tree, hf_6lowpan_mesh_f, tvb, offset, sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_F); + proto_tree_add_boolean(flag_tree, hf_6lowpan_mesh_v, tvb, offset, (int)sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_V); + proto_tree_add_boolean(flag_tree, hf_6lowpan_mesh_f, tvb, offset, (int)sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_F); if ((mesh_header & LOWPAN_MESH_HEADER_HOPS)==15) { guint8 HopsLeft; - proto_tree_add_uint(flag_tree, hf_6lowpan_mesh_hops, tvb, offset, sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_HOPS); - offset += sizeof(guint8); + proto_tree_add_uint(flag_tree, hf_6lowpan_mesh_hops, tvb, offset, (int)sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_HOPS); + offset += (int)sizeof(guint8); HopsLeft=tvb_get_guint8(tvb, offset); - proto_tree_add_uint(mesh_tree, hf_6lowpan_mesh_hops8, tvb, offset, sizeof(guint8), HopsLeft); + proto_tree_add_uint(mesh_tree, hf_6lowpan_mesh_hops8, tvb, offset, (int)sizeof(guint8), HopsLeft); } else - proto_tree_add_uint(flag_tree, hf_6lowpan_mesh_hops, tvb, offset, sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_HOPS); + proto_tree_add_uint(flag_tree, hf_6lowpan_mesh_hops, tvb, offset, (int)sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_HOPS); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Get and display the originator address. */ if (!(mesh_header & LOWPAN_MESH_HEADER_V)) { guint64 addr64 = tvb_get_ntoh64(tvb, offset); if (tree) { - proto_tree_add_uint64(mesh_tree, hf_6lowpan_mesh_orig64, tvb, offset, sizeof(guint64), addr64); + proto_tree_add_uint64(mesh_tree, hf_6lowpan_mesh_orig64, tvb, offset, (int)sizeof(guint64), addr64); } - src_ifcid = tvb_get_ptr(tvb, offset, sizeof(guint64)); - offset += sizeof(guint64); + src_ifcid = tvb_get_ptr(tvb, offset, (int)sizeof(guint64)); + offset += (int)sizeof(guint64); } else { guint16 addr16 = tvb_get_ntohs(tvb, offset); guint8 * ifcid; if (tree) { - proto_tree_add_uint(mesh_tree, hf_6lowpan_mesh_orig16, tvb, offset, sizeof(guint16), addr16); + proto_tree_add_uint(mesh_tree, hf_6lowpan_mesh_orig16, tvb, offset, (int)sizeof(guint16), addr16); } ifcid = (guint8 *)wmem_alloc(pinfo->pool, sizeof(guint64)); lowpan_addr16_to_ifcid(addr16, ifcid); src_ifcid = ifcid; - offset += sizeof(guint16); + offset += (int)sizeof(guint16); } SET_ADDRESS(&pinfo->src, AT_EUI64, sizeof(guint64), src_ifcid); SET_ADDRESS(&pinfo->net_src, AT_EUI64, sizeof(guint64), src_ifcid); @@ -2197,21 +2197,21 @@ dissect_6lowpan_mesh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!(mesh_header & LOWPAN_MESH_HEADER_F)) { guint64 addr64 = tvb_get_ntoh64(tvb, offset); if (tree) { - proto_tree_add_uint64(mesh_tree, hf_6lowpan_mesh_dest64, tvb, offset, sizeof(guint64), addr64); + proto_tree_add_uint64(mesh_tree, hf_6lowpan_mesh_dest64, tvb, offset, (int)sizeof(guint64), addr64); } - dst_ifcid = tvb_get_ptr(tvb, offset, sizeof(guint64)); - offset += sizeof(guint64); + dst_ifcid = tvb_get_ptr(tvb, offset, (int)sizeof(guint64)); + offset += (int)sizeof(guint64); } else { guint16 addr16 = tvb_get_ntohs(tvb, offset); guint8 * ifcid; if (tree) { - proto_tree_add_uint(mesh_tree, hf_6lowpan_mesh_dest16, tvb, offset, sizeof(guint16), addr16); + proto_tree_add_uint(mesh_tree, hf_6lowpan_mesh_dest16, tvb, offset, (int)sizeof(guint16), addr16); } - ifcid = (guint8 *)wmem_alloc(pinfo->pool, sizeof(guint64)); + ifcid = (guint8 *)wmem_alloc(pinfo->pool, (int)sizeof(guint64)); lowpan_addr16_to_ifcid(addr16, ifcid); dst_ifcid = ifcid; - offset += sizeof(guint16); + offset += (int)sizeof(guint16); } SET_ADDRESS(&pinfo->dst, AT_EUI64, sizeof(guint64), dst_ifcid); SET_ADDRESS(&pinfo->net_dst, AT_EUI64, sizeof(guint64), dst_ifcid); @@ -2270,16 +2270,16 @@ dissect_6lowpan_frag_first(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dgram_size = tvb_get_bits16(tvb, (offset * 8) + LOWPAN_PATTERN_FRAG_BITS, LOWPAN_FRAG_DGRAM_SIZE_BITS, ENC_BIG_ENDIAN); if (tree) { proto_tree_add_bits_item(frag_tree, hf_6lowpan_pattern, tvb, offset * 8, LOWPAN_PATTERN_FRAG_BITS, ENC_BIG_ENDIAN); - length_item = proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_size, tvb, offset, sizeof(guint16), dgram_size); + length_item = proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_size, tvb, offset, (int)sizeof(guint16), dgram_size); } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); /* Get and display the datagram tag. */ dgram_tag = tvb_get_ntohs(tvb, offset); if (tree) { - proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_tag, tvb, offset, sizeof(guint16), dgram_tag); + proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_tag, tvb, offset, (int)sizeof(guint16), dgram_tag); } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); /* Adjust the fragmentation header length. */ if (tree) { @@ -2390,23 +2390,23 @@ dissect_6lowpan_frag_middle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dgram_size = tvb_get_bits16(tvb, (offset * 8) + LOWPAN_PATTERN_FRAG_BITS, LOWPAN_FRAG_DGRAM_SIZE_BITS, ENC_BIG_ENDIAN); if (tree) { proto_tree_add_bits_item(frag_tree, hf_6lowpan_pattern, tvb, offset * 8, LOWPAN_PATTERN_FRAG_BITS, ENC_BIG_ENDIAN); - proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_size, tvb, offset, sizeof(guint16), dgram_size); + proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_size, tvb, offset, (int)sizeof(guint16), dgram_size); } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); /* Get and display the datagram tag. */ dgram_tag = tvb_get_ntohs(tvb, offset); if (tree) { - proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_tag, tvb, offset, sizeof(guint16), dgram_tag); + proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_tag, tvb, offset, (int)sizeof(guint16), dgram_tag); } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); /* Get and display the datagram offset. */ dgram_offset = tvb_get_guint8(tvb, offset) * 8; if (tree) { - proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_offset, tvb, offset, sizeof(guint8), dgram_offset); + proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_offset, tvb, offset, (int)sizeof(guint8), dgram_offset); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Adjust the fragmentation header length. */ frag_size = tvb_reported_length_remaining(tvb, offset); @@ -2465,7 +2465,7 @@ dissect_6lowpan_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } /* Create a tvbuff subset for the remaining data. */ - data_tvb = tvb_new_subset_remaining(tvb, sizeof(guint8)); + data_tvb = tvb_new_subset_remaining(tvb, (int)sizeof(guint8)); call_dissector(data_handle, data_tvb, pinfo, proto_tree_get_root(tree)); } /* dissect_6lowpan_unknown */ diff --git a/epan/dissectors/packet-aarp.c b/epan/dissectors/packet-aarp.c index a4f9c511f2..bf67abc996 100644 --- a/epan/dissectors/packet-aarp.c +++ b/epan/dissectors/packet-aarp.c @@ -111,7 +111,7 @@ tvb_atalkid_to_str(tvbuff_t *tvb, gint offset) return cur; } -static gchar * +static const gchar * tvb_aarphrdaddr_to_str(tvbuff_t *tvb, gint offset, int ad_len, guint16 type) { if (AARP_HW_IS_ETHER(type, ad_len)) { @@ -151,7 +151,7 @@ dissect_aarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *ti; const gchar *op_str; int sha_offset, spa_offset, tha_offset, tpa_offset; - gchar *sha_str, *spa_str, /* *tha_str, */ *tpa_str; + const gchar *sha_str, *spa_str, /* *tha_str, */ *tpa_str; col_set_str(pinfo->cinfo, COL_PROTOCOL, "AARP"); col_clear(pinfo->cinfo, COL_INFO); diff --git a/epan/dissectors/packet-actrace.c b/epan/dissectors/packet-actrace.c index e14976308f..a4af536afd 100644 --- a/epan/dissectors/packet-actrace.c +++ b/epan/dissectors/packet-actrace.c @@ -498,7 +498,7 @@ static void dissect_actrace_cas(tvbuff_t *tvb, packet_info *pinfo, proto_tree *a /* Declare variables */ gint32 value, function, trunk, bchannel, source, event, curr_state, next_state; gint32 par0, par1, par2; - gchar *frame_label = NULL; + const gchar *frame_label = NULL; int direction = 0; int offset = 0; diff --git a/epan/dissectors/packet-actrace.h b/epan/dissectors/packet-actrace.h index 48db97d5d3..b87275f2f4 100644 --- a/epan/dissectors/packet-actrace.h +++ b/epan/dissectors/packet-actrace.h @@ -31,6 +31,6 @@ typedef struct _actrace_info_t int direction; /* direction BLADE_TO_PSTN=0 PSTN_TO_BLADE=1 */ int trunk; gint32 cas_bchannel; - gchar *cas_frame_label; + const gchar *cas_frame_label; } actrace_info_t; diff --git a/epan/dissectors/packet-adwin.c b/epan/dissectors/packet-adwin.c index 29dd0b7aac..abfbaf1aca 100644 --- a/epan/dissectors/packet-adwin.c +++ b/epan/dissectors/packet-adwin.c @@ -868,7 +868,7 @@ dissect_UDPR2(tvbuff_t *tvb, packet_info *pinfo, for (i = 0; i < 250; i++) { proto_item *item; - guint32 offset = 8 + i * sizeof(guint32); + guint32 offset = 8 + i * (int)sizeof(guint32); gint32 value = tvb_get_letohl(tvb, offset); void * fvalue = &value; proto_tree_add_text(adwin_debug_tree, tvb, offset, 4, @@ -907,7 +907,7 @@ dissect_UDPR3(tvbuff_t *tvb, packet_info *pinfo, for (i = 0; i < 350; i++) { proto_item *item; - guint32 offset = 8 + i * sizeof(guint32); + guint32 offset = 8 + i * (int)sizeof(guint32); gint32 value = tvb_get_letohl(tvb, offset); void * fvalue = &value; proto_tree_add_text(adwin_debug_tree, tvb, offset, 4, @@ -959,7 +959,7 @@ dissect_UDPR4(tvbuff_t *tvb, packet_info *pinfo, for (i = 0; i < 350; i++) { proto_item *item; - guint32 offset = 8 + i * sizeof(guint32); + guint32 offset = 8 + i * (int)sizeof(guint32); gint32 value = tvb_get_letohl(tvb, offset); void * fvalue = &value; switch (data_type) { @@ -1018,7 +1018,7 @@ dissect_GDSHP(tvbuff_t *tvb, packet_info *pinfo, for (i = 0; i < 336; i++) { proto_item *item; - guint32 offset = 12 + i * sizeof(guint32); + guint32 offset = 12 + i * (int)sizeof(guint32); gint32 value = tvb_get_letohl(tvb, offset); void * fvalue = &value; proto_tree_add_text(adwin_debug_tree, tvb, offset, 4, diff --git a/epan/dissectors/packet-bacapp.c b/epan/dissectors/packet-bacapp.c index 6a9c7e2fed..4978faca0e 100644 --- a/epan/dissectors/packet-bacapp.c +++ b/epan/dissectors/packet-bacapp.c @@ -4658,7 +4658,7 @@ register_bacapp_stat_trees(void) /* 'data' must be ep_ allocated */ static gint -updateBacnetInfoValue(gint whichval, gchar *data) +updateBacnetInfoValue(gint whichval, const gchar *data) { if (whichval == BACINFO_SERVICE) { bacinfo.service_type = data; diff --git a/epan/dissectors/packet-bacapp.h b/epan/dissectors/packet-bacapp.h index 8d48065d1f..3cac1acb5d 100644 --- a/epan/dissectors/packet-bacapp.h +++ b/epan/dissectors/packet-bacapp.h @@ -33,10 +33,10 @@ /* Used for BACnet statistics */ typedef struct _bacapp_info_value_t { - gchar *service_type; - gchar *invoke_id; - gchar *instance_ident; - gchar *object_ident; + const gchar *service_type; + const gchar *invoke_id; + const gchar *instance_ident; + const gchar *object_ident; } bacapp_info_value_t; #endif /* __PACKET_BACNET_H__ */ diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c index 5b5544abc2..d29b76e0ff 100644 --- a/epan/dissectors/packet-bootp.c +++ b/epan/dissectors/packet-bootp.c @@ -3974,7 +3974,7 @@ dissect_packetcable_mta_cap(proto_tree *v_tree, tvbuff_t *tvb, int voff, int len if (raw_val == PKT_MDC_PROV_FLOWS) { for (i = 0 ; i < 3; i++) { if (flow_val & pkt_mdc_supp_flow_vals[i].value) { - decode_bitfield_value(bit_fld, flow_val, pkt_mdc_supp_flow_vals[i].value, 16); + decode_bitfield_value(bit_fld, (guint32)flow_val, pkt_mdc_supp_flow_vals[i].value, 16); proto_tree_add_text(subtree, tvb, off + 4, 4, "%s%s", bit_fld, pkt_mdc_supp_flow_vals[i].strptr); } diff --git a/epan/dissectors/packet-bpdu.c b/epan/dissectors/packet-bpdu.c index 90ff515a0f..dc4140669a 100644 --- a/epan/dissectors/packet-bpdu.c +++ b/epan/dissectors/packet-bpdu.c @@ -228,11 +228,11 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 flags; guint16 root_identifier_bridge_priority; guint16 root_identifier_system_id_extension = 0; - gchar *root_identifier_mac_str; + const gchar *root_identifier_mac_str; guint32 root_path_cost; guint16 bridge_identifier_bridge_priority; guint16 bridge_identifier_system_id_extension = 0; - gchar *bridge_identifier_mac_str; + const gchar *bridge_identifier_mac_str; guint16 port_identifier; double message_age; double max_age; @@ -245,12 +245,12 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 config_format_selector; guint16 cist_bridge_identifier_bridge_priority; guint16 cist_bridge_identifier_system_id_extension = 0; - gchar *cist_bridge_identifier_mac_str; + const gchar *cist_bridge_identifier_mac_str; guint16 msti_mstid; guint32 msti_regional_root_mstid, msti_regional_root_priority; - gchar *msti_regional_root_mac_str; + const gchar *msti_regional_root_mac_str; guint16 msti_bridge_identifier_priority, msti_port_identifier_priority; - gchar *msti_bridge_identifier_mac_str; + const gchar *msti_bridge_identifier_mac_str; int total_msti_length, offset, msti, msti_format; int msti_length_remaining; guint8 agree_num = 0, dagree_num = 0; diff --git a/epan/dissectors/packet-bt-dht.c b/epan/dissectors/packet-bt-dht.c index 504164a504..b129fcc3a6 100644 --- a/epan/dissectors/packet-bt-dht.c +++ b/epan/dissectors/packet-bt-dht.c @@ -159,7 +159,7 @@ dissect_bencoded_int(tvbuff_t *tvb, packet_info _U_*pinfo, proto_tree *tree, gui } /* pre definition of dissect_bencoded_dict(), which is needed by dissect_bencoded_list() */ -static int dissect_bencoded_dict(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, char *label ); +static int dissect_bencoded_dict(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, const char *label ); /* dissect a bencoded list from tvb, start at offset. it's like "lXXXe", "X" is any bencoded thing */ static int @@ -285,7 +285,7 @@ dissect_bt_dht_values(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint } static int -dissect_bt_dht_nodes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, char **result, char *label ) +dissect_bt_dht_nodes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, char **result, const char *label ) { proto_item *ti; proto_tree *sub_tree; @@ -428,7 +428,7 @@ dissect_bencoded_dict_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* dict = d...e */ static int -dissect_bencoded_dict(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, char *label ) +dissect_bencoded_dict(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, const char *label ) { proto_item *ti; proto_tree *sub_tree; diff --git a/epan/dissectors/packet-btsap.c b/epan/dissectors/packet-btsap.c index 848707b019..6a20549806 100644 --- a/epan/dissectors/packet-btsap.c +++ b/epan/dissectors/packet-btsap.c @@ -565,26 +565,26 @@ dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (parameters_check < required_parameters) { - gchar *error_message = "There is no required parameters"; - pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message, NULL); + static const gchar error_message[] = "There are no required parameters"; + pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message); PROTO_ITEM_SET_GENERATED(pitem); - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message, NULL); + expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message); } else if (parameters_check > required_parameters) { - gchar *error_message = "Invalid parameters"; - pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message, NULL); + static const gchar error_message[] = "Invalid parameters"; + pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message); PROTO_ITEM_SET_GENERATED(pitem); - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message, NULL); + expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message); } if (number_of_parameters < required_parameters) { - gchar *error_message = "Too few parameters"; - pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message, NULL); + static const gchar error_message[] = "Too few parameters"; + pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message); PROTO_ITEM_SET_GENERATED(pitem); - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message, NULL); + expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message); } else if (number_of_parameters > required_parameters) { - gchar *error_message = "Too many parameters"; - pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message, NULL); + static const gchar error_message[] = "Too many parameters"; + pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message); PROTO_ITEM_SET_GENERATED(pitem); - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message, NULL); + expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message); } if (tvb_length(tvb) > offset) { diff --git a/epan/dissectors/packet-collectd.c b/epan/dissectors/packet-collectd.c index f95f4bd732..f1cee8f5e3 100644 --- a/epan/dissectors/packet-collectd.c +++ b/epan/dissectors/packet-collectd.c @@ -88,7 +88,7 @@ struct string_counter_s; typedef struct string_counter_s string_counter_t; struct string_counter_s { - gchar *string; + const gchar *string; gint count; string_counter_t *next; }; diff --git a/epan/dissectors/packet-cops.c b/epan/dissectors/packet-cops.c index 4eeac3f4b7..0d41b09444 100644 --- a/epan/dissectors/packet-cops.c +++ b/epan/dissectors/packet-cops.c @@ -1058,7 +1058,7 @@ static int dissect_cops_object(tvbuff_t *tvb, packet_info *pinfo, guint8 op_code /* Pad to 32bit boundary */ if (object_len % sizeof (guint32)) - object_len += (sizeof (guint32) - object_len % sizeof (guint32)); + object_len += ((int)sizeof (guint32) - object_len % (int)sizeof (guint32)); return object_len; } @@ -1116,7 +1116,7 @@ static void dissect_cops_pr_objects(tvbuff_t *tvb, packet_info *pinfo, guint32 o /* Pad to 32bit boundary */ if (object_len % sizeof (guint32)) - object_len += (sizeof (guint32) - object_len % sizeof (guint32)); + object_len += ((int)sizeof (guint32) - object_len % (int)sizeof (guint32)); pr_len -= object_len - COPS_OBJECT_HDR_SIZE; offset += object_len - COPS_OBJECT_HDR_SIZE; @@ -1163,7 +1163,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32 offset += 4; } else if (c_type == 2) { /* IPv6 */ tvb_get_ipv6(tvb, offset, &ipv6addr); - ifindex = tvb_get_ntohl(tvb, offset + sizeof ipv6addr); + ifindex = tvb_get_ntohl(tvb, offset + (int)sizeof ipv6addr); ti = proto_tree_add_text(tree, tvb, offset, 20, "Contents: IPv6 address %s, ifIndex: %u", ip6_to_str(&ipv6addr), ifindex); itf_tree = proto_item_add_subtree(ti, ett_cops_itf); @@ -1304,7 +1304,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32 offset += 4; } else if (c_type == 2) { /* IPv6 */ tvb_get_ipv6(tvb, offset, &ipv6addr); - tcp_port = tvb_get_ntohs(tvb, offset + sizeof ipv6addr + 2); + tcp_port = tvb_get_ntohs(tvb, offset + (int)sizeof ipv6addr + 2); ti = proto_tree_add_text(tree, tvb, offset, 20, "Contents: IPv6 address %s, TCP Port Number: %u", ip6_to_str(&ipv6addr), tcp_port); pdp_tree = proto_item_add_subtree(ti, ett_cops_pdp); diff --git a/epan/dissectors/packet-csm-encaps.c b/epan/dissectors/packet-csm-encaps.c index baefcd38b2..38c7dee399 100644 --- a/epan/dissectors/packet-csm-encaps.c +++ b/epan/dissectors/packet-csm-encaps.c @@ -155,7 +155,7 @@ static gint ett_csm_encaps_control = -1; /* returns the command name */ -static gchar * +static const gchar * csm_fc(guint16 fc, guint16 ct) { if (fc == 0x0000) { @@ -196,7 +196,7 @@ dissect_csm_encaps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint control, type, sequence, length; guint i; gboolean show_error_param= FALSE; - gchar *str_function_name; + const gchar *str_function_name; function_code = tvb_get_letohs(tvb, 10); diff --git a/epan/dissectors/packet-csn1.h b/epan/dissectors/packet-csn1.h index c7acea4ce0..fd32a868e9 100644 --- a/epan/dissectors/packet-csn1.h +++ b/epan/dissectors/packet-csn1.h @@ -179,9 +179,9 @@ typedef struct gint16 i; union { - void* ptr; + const void* ptr; guint32 value; - crumb_spec_t const *crumb_spec; + const crumb_spec_t const *crumb_spec; } descr; size_t offset; gboolean may_be_null; diff --git a/epan/dissectors/packet-data.c b/epan/dissectors/packet-data.c index 9a32c269f6..6e9370a6ea 100644 --- a/epan/dissectors/packet-data.c +++ b/epan/dissectors/packet-data.c @@ -81,7 +81,7 @@ dissect_data(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree) const guint8 *cp; md5_state_t md_ctx; md5_byte_t digest[16]; - gchar *digest_string; + const gchar *digest_string; cp = tvb_get_ptr(tvb, 0, bytes); diff --git a/epan/dissectors/packet-dbus.c b/epan/dissectors/packet-dbus.c index a7cb69d2e6..36c7f04002 100644 --- a/epan/dissectors/packet-dbus.c +++ b/epan/dissectors/packet-dbus.c @@ -111,7 +111,7 @@ typedef struct { guint32 body_len; guint32 fields_len; - char *body_sig; + const char *body_sig; } dbus_info_t; typedef union { diff --git a/epan/dissectors/packet-dcc.c b/epan/dissectors/packet-dcc.c index 7f8532d75f..a13b14fcb3 100644 --- a/epan/dissectors/packet-dcc.c +++ b/epan/dissectors/packet-dcc.c @@ -78,8 +78,8 @@ static gint ett_dcc_trace = -1; /* Utility macros */ #define D_SIGNATURE() \ proto_tree_add_item(dcc_optree, hf_dcc_signature, tvb, \ - offset, sizeof(DCC_SIGNATURE), ENC_NA); \ - offset += sizeof(DCC_SIGNATURE); + offset, (int)sizeof(DCC_SIGNATURE), ENC_NA); \ + offset += (int)sizeof(DCC_SIGNATURE); #define D_LABEL(label,len) \ proto_tree_add_text(dcc_optree, tvb, offset, len, label); \ @@ -100,12 +100,9 @@ static gint ett_dcc_trace = -1; #define D_TARGET() \ - hidden_item = proto_tree_add_item(dcc_tree, hf_dcc_target, tvb, \ - offset, sizeof(DCC_TGTS), ENC_BIG_ENDIAN); \ - PROTO_ITEM_SET_HIDDEN(hidden_item); \ - proto_tree_add_text(dcc_optree, tvb, offset, sizeof(DCC_TGTS), "%s", \ - val_to_str(tvb_get_ntohl(tvb,offset), dcc_target_vals, "Targets (%u)")); \ - offset += sizeof(DCC_TGTS); \ + proto_tree_add_item(dcc_tree, hf_dcc_target, tvb, \ + offset, (int)sizeof(DCC_TGTS), ENC_BIG_ENDIAN); \ + offset += (int)sizeof(DCC_TGTS); #define D_DATE() { \ nstime_t ts; \ @@ -118,7 +115,7 @@ static gint ett_dcc_trace = -1; #define D_CHECKSUM() { \ proto_tree *cktree, *ckti; \ - ckti = proto_tree_add_text(dcc_optree, tvb, offset, sizeof(DCC_CK), \ + ckti = proto_tree_add_text(dcc_optree, tvb, offset, (int)sizeof(DCC_CK), \ "Checksum - %s", val_to_str(tvb_get_guint8(tvb,offset), \ dcc_cktype_vals, \ "Unknown Type: %u")); \ @@ -128,8 +125,8 @@ static gint ett_dcc_trace = -1; proto_tree_add_item(cktree, hf_dcc_ck_len, tvb, offset, 1, ENC_BIG_ENDIAN); \ offset += 1; \ proto_tree_add_item(cktree, hf_dcc_ck_sum, tvb, offset, \ - sizeof(DCC_SUM), ENC_NA); \ - offset += sizeof(DCC_SUM); \ + (int)sizeof(DCC_SUM), ENC_NA); \ + offset += (int)sizeof(DCC_SUM); \ } @@ -206,7 +203,6 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { proto_tree *dcc_tree, *dcc_optree, *dcc_opnumtree, *ti; proto_tree *dcc_tracetree; - proto_item *hidden_item; int offset = 0; int client_is_le = 0; int op = 0; @@ -304,7 +300,7 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) case DCC_OP_REPORT: D_TARGET(); for (i=0; i<=DCC_QUERY_MAX && - tvb_bytes_exist(tvb, offset+sizeof(DCC_SIGNATURE),1); i++) + tvb_bytes_exist(tvb, offset+(int)sizeof(DCC_SIGNATURE),1); i++) { D_CHECKSUM(); } @@ -313,7 +309,7 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) case DCC_OP_QUERY_RESP: for (i=0; i<=DCC_QUERY_MAX && - tvb_bytes_exist(tvb, offset+sizeof(DCC_SIGNATURE),1); i++) + tvb_bytes_exist(tvb, offset+(int)sizeof(DCC_SIGNATURE),1); i++) { D_TARGET(); } @@ -324,17 +320,17 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) if ( is_response ) { int left_local = tvb_length_remaining(tvb, offset) - - sizeof(DCC_SIGNATURE); + (int)sizeof(DCC_SIGNATURE); if ( left_local == sizeof(DCC_ADMN_RESP_CLIENTS) ) { D_LABEL("Addr", 16); - D_LABEL("Id", sizeof(DCC_CLNT_ID)); + D_LABEL("Id", (int)sizeof(DCC_CLNT_ID)); D_LABEL("Last Used", 4); D_LABEL("Requests", 4); } else { - D_TEXT("Response Text", sizeof(DCC_SIGNATURE)); + D_TEXT("Response Text", (int)sizeof(DCC_SIGNATURE)); } D_SIGNATURE(); } @@ -397,8 +393,8 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) offset += 2; proto_tree_add_item(dcc_optree, hf_dcc_brand, tvb, - offset, sizeof(DCC_BRAND), ENC_ASCII|ENC_NA); - offset += sizeof(DCC_BRAND); + offset, (int)sizeof(DCC_BRAND), ENC_ASCII|ENC_NA); + offset += (int)sizeof(DCC_BRAND); D_SIGNATURE(); break; @@ -478,7 +474,7 @@ proto_register_dcc(void) { &hf_dcc_target, { "Target", "dcc.target", FT_UINT32, BASE_HEX, - NULL, 0, NULL, HFILL }}, + VALS(dcc_target_vals), 0, NULL, HFILL }}, { &hf_dcc_date, { "Date", "dcc.date", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, diff --git a/epan/dissectors/packet-dccp.c b/epan/dissectors/packet-dccp.c index 380e4e713c..5939054ed3 100644 --- a/epan/dissectors/packet-dccp.c +++ b/epan/dissectors/packet-dccp.c @@ -624,7 +624,7 @@ dccp_csum_coverage(const e_dccphdr *dccph, guint len) if (dccph->cscov == 0) return len; - cov = (dccph->data_offset + dccph->cscov - 1) * sizeof (guint32); + cov = (dccph->data_offset + dccph->cscov - 1) * (guint)sizeof (guint32); return (cov > len) ? len : cov; } diff --git a/epan/dissectors/packet-dcerpc-netlogon.c b/epan/dissectors/packet-dcerpc-netlogon.c index ef7031f878..7b394309a7 100644 --- a/epan/dissectors/packet-dcerpc-netlogon.c +++ b/epan/dissectors/packet-dcerpc-netlogon.c @@ -6849,7 +6849,7 @@ static guint32 get_keytab_as_list(md4_pass **p_pass_list,const char* ntlm_pass _ if (ntlm_pass[0] != '\0' && ( strlen(ntlm_pass) < 129 )) { nb_pass++; debugprintf("Password: %s\n",ntlm_pass); - password_len = strlen(ntlm_pass); + password_len = (int)strlen(ntlm_pass); str_to_unicode(ntlm_pass,ntlm_pass_unicode); crypt_md4(ntlm_pass_hash.md4,ntlm_pass_unicode,password_len*2); printnbyte(ntlm_pass_hash.md4,16,"Hash of the NT pass: ","\n"); diff --git a/epan/dissectors/packet-dcerpc-nt.c b/epan/dissectors/packet-dcerpc-nt.c index c64ff1a49a..f0da4686e9 100644 --- a/epan/dissectors/packet-dcerpc-nt.c +++ b/epan/dissectors/packet-dcerpc-nt.c @@ -1143,7 +1143,7 @@ PIDL_dissect_policy_hnd(tvbuff_t *tvb, gint offset, packet_info *pinfo, && !pinfo->fd->flags.visited && !di->conformant_run){ char *pol_string=NULL; - char *pol_name=NULL; + const char *pol_name=NULL; dcerpc_call_value *dcv; dcv = (dcerpc_call_value *)di->call_data; diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index b58c2a9a10..2931ae65a8 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -4348,7 +4348,7 @@ dissect_dcerpc_cn(tvbuff_t *tvb, int offset, packet_info *pinfo, hdr.flags = tvb_get_guint8(tvb, offset++); tvb_memcpy(tvb, (guint8 *)hdr.drep, offset, sizeof (hdr.drep)); - offset += sizeof (hdr.drep); + offset += (int)sizeof (hdr.drep); hdr.frag_len = dcerpc_tvb_get_ntohs(tvb, offset, hdr.drep); offset += 2; @@ -4441,7 +4441,7 @@ dissect_dcerpc_cn(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree_add_uint(drep_tree, hf_dcerpc_drep_byteorder, tvb, offset, 1, hdr.drep[0] >> 4); proto_tree_add_uint(drep_tree, hf_dcerpc_drep_character, tvb, offset, 1, hdr.drep[0] & 0x0f); proto_tree_add_uint(drep_tree, hf_dcerpc_drep_fp, tvb, offset+1, 1, hdr.drep[1]); - offset += sizeof (hdr.drep); + offset += (int)sizeof (hdr.drep); proto_tree_add_uint(dcerpc_tree, hf_dcerpc_cn_frag_len, tvb, offset, 2, hdr.frag_len); offset += 2; @@ -5201,7 +5201,7 @@ dissect_dcerpc_dg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat col_add_str(pinfo->cinfo, COL_INFO, pckt_vals[hdr.ptype].strptr); tvb_memcpy(tvb, (guint8 *)hdr.drep, offset, sizeof (hdr.drep)); - offset += sizeof (hdr.drep); + offset += (int)sizeof (hdr.drep); hdr.serial_hi = tvb_get_guint8(tvb, offset++); dcerpc_tvb_get_uuid(tvb, offset, hdr.drep, &hdr.obj_id); offset += 16; @@ -5306,7 +5306,7 @@ dissect_dcerpc_dg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat val_to_str_const(hdr.drep[1], drep_fp_vals, "Unknown")); } } - offset += sizeof (hdr.drep); + offset += (int)sizeof (hdr.drep); if (tree) proto_tree_add_uint(dcerpc_tree, hf_dcerpc_dg_serial_hi, tvb, offset, 1, hdr.serial_hi); diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c index 3825726a2c..fc71cfa2cf 100644 --- a/epan/dissectors/packet-dcm.c +++ b/epan/dissectors/packet-dcm.c @@ -3712,7 +3712,7 @@ static guint32 dissect_dcm_pdv_header (tvbuff_t *tvb, packet_info *pinfo, p static guint32 dissect_dcm_pdv_fragmented (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_state_assoc_t *assoc, guint32 offset, guint32 pdv_len, gchar **pdv_description); static guint32 dissect_dcm_pdv_body (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_state_pdv_t *pdv, guint32 offset, guint32 pdv_body_len, gchar **pdv_description); -static guint32 dissect_dcm_tag (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_state_pdv_t *pdv, guint32 offset, guint32 endpos, gboolean is_first_tag, gchar **tag_description, gboolean *end_of_seq_or_item); +static guint32 dissect_dcm_tag (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_state_pdv_t *pdv, guint32 offset, guint32 endpos, gboolean is_first_tag, const gchar **tag_description, gboolean *end_of_seq_or_item); static guint32 dissect_dcm_tag_open (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_state_pdv_t *pdv, guint32 offset, guint32 endpos, gboolean *is_first_tag); static guint32 dissect_dcm_tag_value (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_state_pdv_t *pdv, guint32 offset, guint16 grp, guint16 elm, guint32 vl, guint32 vl_max, const gchar* vr, gchar **tag_value); @@ -4229,7 +4229,7 @@ dcm_export_create_tag_str(guint8 *buffer, guint32 bufflen, guint32 offset, static guint8* -dcm_export_create_header(guint32 *dcm_header_len, gchar *sop_class_uid, gchar *sop_instance_uid, gchar *xfer_uid) +dcm_export_create_header(guint32 *dcm_header_len, const gchar *sop_class_uid, gchar *sop_instance_uid, gchar *xfer_uid) { guint8 *dcm_header=NULL; guint32 offset=0; @@ -4317,7 +4317,7 @@ dcm_export_create_object(packet_info *pinfo, dcm_state_assoc_t *assoc, dcm_state gchar *filename; const gchar *hostname; - gchar *sop_class_uid; + const gchar *sop_class_uid; gchar *sop_instance_uid; /* Calculate total PDV length, i.e. all packets until last PDV without continuation */ @@ -4440,7 +4440,7 @@ dissect_dcm_assoc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu guint16 assoc_ver; - gchar *buf_desc = NULL; + const gchar *buf_desc = NULL; const char *reject_result_desc = ""; const char *reject_source_desc = ""; const char *reject_reason_desc = ""; @@ -4453,8 +4453,6 @@ dissect_dcm_assoc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu guint8 abort_source; guint8 abort_reason; - buf_desc = (gchar *)ep_alloc0(MAX_BUF_LEN); /* Valid for this packet */ - assoc_header_pitem = proto_tree_add_text(tree, tvb, offset, pdu_len-6, "Association Header"); assoc_header_ptree = proto_item_add_subtree(assoc_header_pitem, ett_assoc_header); @@ -4479,7 +4477,7 @@ dissect_dcm_assoc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu offset += 32; /* 32 reserved bytes */ - g_snprintf(buf_desc, MAX_BUF_LEN, "A-ASSOCIATE request %s --> %s", + buf_desc = ep_strdup_printf("A-ASSOCIATE request %s --> %s", g_strstrip(assoc->ae_calling), g_strstrip(assoc->ae_called)); offset = dissect_dcm_assoc_detail(tvb, pinfo, assoc_header_ptree, assoc, @@ -4506,7 +4504,7 @@ dissect_dcm_assoc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu offset += 32; /* 32 reserved bytes */ - g_snprintf(buf_desc, MAX_BUF_LEN, "A-ASSOCIATE accept %s <-- %s", + buf_desc = ep_strdup_printf("A-ASSOCIATE accept %s <-- %s", g_strstrip(assoc->ae_calling_resp), g_strstrip(assoc->ae_called_resp)); offset = dissect_dcm_assoc_detail(tvb, pinfo, assoc_header_ptree, assoc, @@ -4565,7 +4563,7 @@ dissect_dcm_assoc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu offset += 3; /* Provider aborted */ - g_snprintf(buf_desc, MAX_BUF_LEN,"A-ASSOCIATE reject %s <-- %s (%s)", + buf_desc = ep_strdup_printf("A-ASSOCIATE reject %s <-- %s (%s)", g_strstrip(assoc->ae_calling), g_strstrip(assoc->ae_called), reject_reason_desc); expert_add_info_format(pinfo, assoc_header_pitem, @@ -4623,12 +4621,12 @@ dissect_dcm_assoc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu if (abort_source == 0) { /* User aborted */ - g_snprintf(buf_desc, MAX_BUF_LEN,"ABORT %s --> %s", + buf_desc = ep_strdup_printf("ABORT %s --> %s", g_strstrip(assoc->ae_calling), g_strstrip(assoc->ae_called)); } else { /* Provider aborted, slightly more information */ - g_snprintf(buf_desc, MAX_BUF_LEN,"ABORT %s <-- %s (%s)", + buf_desc = ep_strdup_printf("ABORT %s <-- %s (%s)", g_strstrip(assoc->ae_calling), g_strstrip(assoc->ae_called), abort_reason_desc); } @@ -5625,7 +5623,7 @@ dcm_tag_summary(guint16 grp, guint16 elm, guint32 vl, const gchar *tag_desc, con static guint32 dissect_dcm_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_state_pdv_t *pdv, guint32 offset, guint32 endpos, - gboolean is_first_tag, gchar **tag_description, + gboolean is_first_tag, const gchar **tag_description, gboolean *end_of_seq_or_item) { /* Decode one tag. If it is a sequence or item start create a subtree. @@ -5921,7 +5919,7 @@ dissect_dcm_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean local_end_of_seq_or_item = FALSE; gboolean is_first_desc = TRUE; - gchar *item_description = NULL; /* Will be allocated as ep_ memory in dissect_dcm_tag() */ + const gchar *item_description = NULL; /* Will be allocated as ep_ memory in dissect_dcm_tag() */ if (vl == 0xFFFFFFFF) { /* Undefined length */ @@ -6113,7 +6111,7 @@ dissect_dcm_pdv_body(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { /* Handle one PDV inside a data PDU */ - gchar *tag_value = NULL; + const gchar *tag_value = NULL; gboolean dummy = FALSE; guint32 endpos = 0; diff --git a/epan/dissectors/packet-disp.c b/epan/dissectors/packet-disp.c index 2d6c2ae9d8..fcb2445f9c 100644 --- a/epan/dissectors/packet-disp.c +++ b/epan/dissectors/packet-disp.c @@ -1509,7 +1509,7 @@ dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_item *item=NULL; proto_tree *tree=NULL; int (*disp_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; - char *disp_op_name; + const char *disp_op_name; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); diff --git a/epan/dissectors/packet-dmp.c b/epan/dissectors/packet-dmp.c index 959e3a8430..f04c39dc20 100644 --- a/epan/dissectors/packet-dmp.c +++ b/epan/dissectors/packet-dmp.c @@ -1674,7 +1674,7 @@ static gchar *dissect_7bit_string (tvbuff_t *tvb, gint offset, gint length) return (gchar *) decoded; } -static gchar *dissect_thales_mts_id (tvbuff_t *tvb, gint offset, gint length) +static const gchar *dissect_thales_mts_id (tvbuff_t *tvb, gint offset, gint length) { /* Thales XOmail uses this format: "MTA-NAME/000000000000" */ if (length >= 7 && length <= 22) { @@ -1687,7 +1687,7 @@ static gchar *dissect_thales_mts_id (tvbuff_t *tvb, gint offset, gint length) return ILLEGAL_FORMAT; } -static gchar *dissect_thales_ipm_id (tvbuff_t *tvb, gint offset, gint length, gint modifier) +static const gchar *dissect_thales_ipm_id (tvbuff_t *tvb, gint offset, gint length, gint modifier) { /* Thales XOmail uses this format: "<prefix>0000 YYMMDDhhmmssZ" */ if (length >= 6 && length <= 20 && modifier >= 0 && modifier <= 2) { @@ -1842,12 +1842,12 @@ static gint dissect_dmp_sic (tvbuff_t *tvb, packet_info *pinfo, } else if ((key & 0xF0) == 0xB0) { /* bit 7-4: 1011 */ length = 7; bytes = 6; - value = ((guint64)tvb_get_ntohs (tvb, offset) & 0x0FFF) << 32 | + value = ((guint64)(tvb_get_ntohs (tvb, offset) & 0x0FFF)) << 32 | tvb_get_ntohl (tvb, offset + 2); } else if ((key & 0xF0) == 0x90) { /* bit 7-4: 1001 */ length = 8; bytes = 7; - value = ((guint64)(tvb_get_ntohl (tvb, offset)>>8) & 0x0FFF)<<32 | + value = ((guint64)((tvb_get_ntohl (tvb, offset)>>8) & 0x0FFF))<<32 | tvb_get_ntohl (tvb, offset + 3); } else { /* bit 7-4: 0xxx or 1000 */ length = 5; @@ -2692,7 +2692,7 @@ static gint dissect_mts_identifier (tvbuff_t *tvb, packet_info *pinfo _U_, proto gint offset, gboolean subject) { proto_item *hidden_item; - gchar *mts_id; + const gchar *mts_id; if (dmp.msg_id_type == X400_MSG_ID || dmp_nat_decode == NAT_DECODE_DMP) { mts_id = dissect_7bit_string (tvb, offset, dmp.mts_id_length); @@ -2725,7 +2725,7 @@ static gint dissect_ipm_identifier (tvbuff_t *tvb, packet_info *pinfo _U_, proto { proto_tree *field_tree; proto_item *tf, *hidden_item; - gchar *ipm_id; + const gchar *ipm_id; gint length, modifier, ipm_id_length; length = tvb_get_guint8 (tvb, offset); @@ -3491,7 +3491,8 @@ static gint dissect_dmp_notification (tvbuff_t *tvb, packet_info *pinfo _U_, /* Ref chapter 6.2.1.2.8 SecurityCategories */ static gint dissect_dmp_security_category (tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree, gchar **label_string, + proto_tree *tree, + const gchar **label_string, gint offset, guint8 ext) { proto_tree *field_tree = NULL; @@ -3602,7 +3603,7 @@ static gint dissect_dmp_content (tvbuff_t *tvb, packet_info *pinfo, proto_tree *field_tree = NULL; proto_item *en = NULL, *ei = NULL, *tf = NULL; proto_item *hidden_item; - gchar *label_string = ep_strdup (""); + const char *label_string = ep_strdup (""); const gchar *class_name = NULL; guint8 message, dmp_sec_pol, dmp_sec_class, dmp_nation = 0, exp_time, dtg; gint32 secs = 0; diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c index 105e3f77c3..aa5a29f740 100644 --- a/epan/dissectors/packet-dnp.c +++ b/epan/dissectors/packet-dnp.c @@ -1487,7 +1487,7 @@ dnp3_al_get_timestamp(nstime_t *timestamp, tvbuff_t *tvb, int data_pos) time_ms = (guint64)hi * 0x10000 + lo; timestamp->secs = (long)(time_ms / 1000); - timestamp->nsecs = (long)(time_ms % 1000) * 1000000; + timestamp->nsecs = (int)(time_ms % 1000) * 1000000; } /*****************************************************************/ diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index 3c1d0dc134..8c462694ab 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -625,7 +625,7 @@ dns_type_name (guint type) return val_to_str(type, dns_types, "Unknown (%u)"); } -static char * +static const char * dns_type_description (guint type) { static const char *type_names[] = { diff --git a/epan/dissectors/packet-dop.c b/epan/dissectors/packet-dop.c index 8c32d65d1f..d6a4155585 100644 --- a/epan/dissectors/packet-dop.c +++ b/epan/dissectors/packet-dop.c @@ -68,7 +68,7 @@ static int proto_dop = -1; static struct SESSION_DATA_STRUCTURE* session = NULL; static const char *binding_type = NULL; /* binding_type */ -static int call_dop_oid_callback(char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char *col_info); +static int call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *col_info); /*--- Included file: packet-dop-hf.c ---*/ @@ -2045,7 +2045,7 @@ static void dissect_ACIItem_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto #line 84 "../../asn1/dop/packet-dop-template.c" static int -call_dop_oid_callback(char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char *col_info) +call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *col_info) { char* binding_param; @@ -2082,7 +2082,7 @@ dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_item *item=NULL; proto_tree *tree=NULL; int (*dop_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; - char *dop_op_name; + const char *dop_op_name; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); diff --git a/epan/dissectors/packet-dsp.c b/epan/dissectors/packet-dsp.c index d4ab3c2ba0..bffa753d20 100644 --- a/epan/dissectors/packet-dsp.c +++ b/epan/dissectors/packet-dsp.c @@ -1798,7 +1798,7 @@ dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_item *item=NULL; proto_tree *tree=NULL; int (*dsp_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; - char *dsp_op_name; + const char *dsp_op_name; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); diff --git a/epan/dissectors/packet-e164.h b/epan/dissectors/packet-e164.h index 43cf956b9c..941be27615 100644 --- a/epan/dissectors/packet-e164.h +++ b/epan/dissectors/packet-e164.h @@ -40,7 +40,7 @@ typedef enum { typedef struct { e164_number_type_t e164_number_type; guint nature_of_address; - char *E164_number_str; /* E164 number string */ + const char *E164_number_str; /* E164 number string */ guint E164_number_length; /* Length of the E164_number string */ } e164_info_t; diff --git a/epan/dissectors/packet-erf.c b/epan/dissectors/packet-erf.c index cc25c4f1de..3a8b937ba4 100644 --- a/epan/dissectors/packet-erf.c +++ b/epan/dissectors/packet-erf.c @@ -724,7 +724,7 @@ channelised_fill_vc_id_string(emem_strbuf_t* out_string, sdh_g707_format_t* in_f int i; gboolean is_printed = FALSE; - static char* g_vc_size_strings[] = { + static const char* g_vc_size_strings[] = { "unknown", /*0x0*/ "VC3", /*0x1*/ "VC4", /*0x2*/ diff --git a/epan/dissectors/packet-fip.c b/epan/dissectors/packet-fip.c index 59618d2959..19ab34536c 100644 --- a/epan/dissectors/packet-fip.c +++ b/epan/dissectors/packet-fip.c @@ -342,7 +342,7 @@ dissect_fip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint val; tvbuff_t *desc_tvb; const char *info; - char *text; + const char *text; col_set_str(pinfo->cinfo, COL_PROTOCOL, "FIP"); col_clear(pinfo->cinfo, COL_INFO); diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c index 14f3c3e607..277d0b86ad 100644 --- a/epan/dissectors/packet-frame.c +++ b/epan/dissectors/packet-frame.c @@ -380,7 +380,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) const guint8 *cp; md5_state_t md_ctx; md5_byte_t digest[16]; - gchar *digest_string; + const gchar *digest_string; cp = tvb_get_ptr(tvb, 0, cap_len); diff --git a/epan/dissectors/packet-ftp.c b/epan/dissectors/packet-ftp.c index cebf76ee2f..bf7bc072a4 100644 --- a/epan/dissectors/packet-ftp.c +++ b/epan/dissectors/packet-ftp.c @@ -641,7 +641,7 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * of a multi-line reply. */ tvb_get_nstringz0(tvb, 0, sizeof(code_str), code_str); - code = strtoul(code_str, NULL, 10); + code = (guint32)strtoul(code_str, NULL, 10); proto_tree_add_uint(reqresp_tree, hf_ftp_response_code, tvb, 0, 3, code); diff --git a/epan/dissectors/packet-gadu-gadu.c b/epan/dissectors/packet-gadu-gadu.c index a0d96f3e32..3499b6493e 100644 --- a/epan/dissectors/packet-gadu-gadu.c +++ b/epan/dissectors/packet-gadu-gadu.c @@ -506,7 +506,7 @@ dissect_gadu_gadu_uint32_string_utf8(tvbuff_t *tvb, int hfindex, proto_tree *tre { const int org_offset = offset; - char *str; + const char *str; guint32 len; len = tvb_get_letohl(tvb, offset); diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c index f65fee381d..536797c2cb 100644 --- a/epan/dissectors/packet-giop.c +++ b/epan/dissectors/packet-giop.c @@ -315,11 +315,12 @@ static void decode_IIOP_IOR_profile(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, - guint32 boundary, gboolean new_endianness, gchar *repobuf, + guint32 boundary, gboolean new_endianness, + const gchar *repobuf, gboolean store_flag); static void decode_TaggedProfile(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, - guint32 boundary, gboolean stream_is_big_endian, gchar *repobuf); + guint32 boundary, gboolean stream_is_big_endian, const gchar *repobuf); static void decode_IOR(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, guint32 boundary, gboolean stream_is_big_endian ); @@ -990,7 +991,7 @@ typedef enum collection_data collection_data_t; struct giop_object_key { - guint8 *objkey; /* ptr to object key */ + const guint8 *objkey; /* ptr to object key */ guint32 objkey_len; /* length */ }; @@ -1017,7 +1018,7 @@ static const char *giop_ior_file = "IOR.txt"; * Insert FN,reqid,operation and sub handle in list. DOES not check for duplicates yet. */ -static GList *insert_in_comp_req_list(GList *list, guint32 fn, guint32 reqid, gchar * op, giop_sub_handle_t *sh ) { +static GList *insert_in_comp_req_list(GList *list, guint32 fn, guint32 reqid, const gchar * op, giop_sub_handle_t *sh ) { comp_req_list_entry_t * entry; entry = se_alloc(sizeof(comp_req_list_entry_t)); @@ -1351,7 +1352,7 @@ static guint32 giop_hash_objkey_hash(gconstpointer v) { * Blindly Inserts even if it does exist, See TODO at top for reason. */ -static void insert_in_objkey_hash(GHashTable *hash, gchar *obj, guint32 len, gchar *repoid, ior_src_t src) { +static void insert_in_objkey_hash(GHashTable *hash, const gchar *obj, guint32 len, const gchar *repoid, ior_src_t src) { struct giop_object_key objkey_key, *new_objkey_key; struct giop_object_val *objkey_val = NULL; @@ -1642,7 +1643,7 @@ void register_giop_user(giop_sub_dissector_t *sub, const gchar *name, int sub_pr * */ -static gchar * get_repoid_from_objkey(GHashTable *hash, guint8 *obj, guint32 len) { +static gchar * get_repoid_from_objkey(GHashTable *hash, const guint8 *obj, guint32 len) { struct giop_object_key objkey_key; struct giop_object_val *objkey_val = NULL; @@ -1930,7 +1931,7 @@ static void giop_dump_collection(collection_data_t collection_type) { */ static gboolean try_heuristic_giop_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 *offset, - MessageHeader *header, gchar *operation ) { + MessageHeader *header, const gchar *operation ) { int i,len; gboolean res = FALSE; /* result of calling a heuristic sub dissector */ @@ -1991,7 +1992,7 @@ static gboolean try_heuristic_giop_dissector(tvbuff_t *tvb, packet_info *pinfo, */ static gboolean try_explicit_giop_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, - MessageHeader *header, gchar *operation, gchar *repoid ) { + MessageHeader *header, const gchar *operation, gchar *repoid ) { giop_sub_handle_t *subdiss = NULL; /* handle */ gboolean res = FALSE; @@ -2063,7 +2064,7 @@ static gboolean try_explicit_giop_dissector(tvbuff_t *tvb, packet_info *pinfo, p * the initial sequence. */ -gchar * make_printable_string (gchar *in, guint32 len) { +gchar * make_printable_string (const gchar *in, guint32 len) { guint32 i = 0; gchar *print_string = NULL; @@ -2154,7 +2155,7 @@ static void dissect_data_for_typecode(tvbuff_t *tvb, packet_info *pinfo, proto_t gdouble my_double; /* double */ gfloat my_float; /* float */ - gchar *buf = NULL; /* ptr to string buffer */ + const gchar *buf = NULL; /* ptr to string buffer */ /* Grab the data according to data type */ @@ -2290,7 +2291,7 @@ static void dissect_typecode_string_param(tvbuff_t *tvb, proto_tree *tree, gint gboolean new_stream_is_big_endian, guint32 new_boundary, int hf_id ) { guint32 u_octet4; /* unsigned int32 */ - gchar *buf; /* ptr to string buffer */ + const gchar *buf; /* ptr to string buffer */ /* get string */ u_octet4 = get_CDR_string(tvb,&buf,offset,new_stream_is_big_endian,new_boundary); @@ -2353,7 +2354,7 @@ static void dissect_tk_struct_params(tvbuff_t *tvb, packet_info *pinfo, proto_tr count = get_CDR_ulong(tvb,offset,new_stream_is_big_endian,new_boundary); if (tree) { proto_tree_add_uint(tree,hf_giop_typecode_count,tvb, - *offset-sizeof(count),4,count); + *offset-(int)sizeof(count),4,count); } /* get all tuples */ @@ -2570,7 +2571,7 @@ static void dissect_tk_except_params(tvbuff_t *tvb, packet_info *pinfo, proto_tr count = get_CDR_ulong(tvb,offset,new_stream_is_big_endian,new_boundary); if (tree) { proto_tree_add_uint(tree,hf_giop_typecode_count,tvb, - *offset-sizeof(count),4,count); + *offset-(int)sizeof(count),4,count); } /* get all tuples */ @@ -2637,7 +2638,7 @@ static void dissect_tk_value_params(tvbuff_t *tvb, packet_info *pinfo, proto_tre s_octet2 = get_CDR_short(tvb,offset,stream_is_big_endian,boundary); if (tree) { proto_tree_add_int(tree,hf_giop_typecode_Visibility,tvb, - *offset-sizeof(s_octet2),2,s_octet2); + *offset-(int)sizeof(s_octet2),2,s_octet2); } } @@ -2752,7 +2753,7 @@ guint32 get_CDR_encap_info(tvbuff_t *tvb, proto_tree *tree, gint *offset, /* Get sequence length of parameter list */ seqlen = get_CDR_ulong(tvb,offset,old_stream_is_big_endian,old_boundary); proto_tree_add_uint(tree,hf_giop_sequence_length,tvb, - *offset-sizeof(seqlen),4,seqlen); + *offset-(int)sizeof(seqlen),4,seqlen); /* * seqlen == 0, implies no endianness and no data @@ -3205,7 +3206,8 @@ guint8 get_CDR_octet(tvbuff_t *tvb, int *offset) { * This function also increments offset by len. */ -void get_CDR_octet_seq(tvbuff_t *tvb, gchar **seq, int *offset, guint32 len) { +void get_CDR_octet_seq(tvbuff_t *tvb, const gchar **seq, int *offset, guint32 len) { + guint8 *seq_buf; /* * Make sure that the entire sequence of octets is in the buffer before @@ -3221,8 +3223,9 @@ void get_CDR_octet_seq(tvbuff_t *tvb, gchar **seq, int *offset, guint32 len) { * do what we do now, and null-terminate the string (which also means * we don't need to zero out the entire allocation, just the last byte)? */ - *seq = ep_alloc_array0(gchar, len + 1); - tvb_memcpy( tvb, *seq, *offset, len); + seq_buf = ep_alloc_array0(gchar, len + 1); + tvb_memcpy( tvb, seq_buf, *offset, len); + *seq = seq_buf; *offset += len; } @@ -3260,7 +3263,7 @@ giop_add_CDR_string(proto_tree *tree, tvbuff_t *tvb, int *offset, gboolean stream_is_big_endian, int boundary, int hf) { guint32 u_octet4; - gchar *seq = NULL; + const gchar *seq = NULL; u_octet4 = get_CDR_string(tvb, &seq, offset, stream_is_big_endian, boundary); proto_tree_add_string(tree, hf, tvb, *offset-u_octet4, u_octet4, (u_octet4 > 0) ? seq : ""); @@ -3286,7 +3289,7 @@ giop_add_CDR_string(proto_tree *tree, tvbuff_t *tvb, int *offset, */ -guint32 get_CDR_string(tvbuff_t *tvb, gchar **seq, int *offset, gboolean stream_is_big_endian, +guint32 get_CDR_string(tvbuff_t *tvb, const gchar **seq, int *offset, gboolean stream_is_big_endian, int boundary ) { guint32 slength; @@ -3387,7 +3390,7 @@ guint32 get_CDR_typeCode(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, u_octet4 = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary); /* get maximum length */ if (tree) { proto_tree_add_uint(tree,hf_giop_typecode_max_length,tvb, - *offset-sizeof(u_octet4),4,u_octet4); + *offset-(int)sizeof(u_octet4),4,u_octet4); } break; @@ -3415,7 +3418,7 @@ guint32 get_CDR_typeCode(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, u_octet4 = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary); /* get maximum length */ if (tree) { proto_tree_add_uint(tree,hf_giop_typecode_max_length,tvb, - *offset-sizeof(u_octet4),4,u_octet4); + *offset-(int)sizeof(u_octet4),4,u_octet4); } break; @@ -3423,13 +3426,13 @@ guint32 get_CDR_typeCode(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, u_octet2 = get_CDR_ushort(tvb,offset,stream_is_big_endian,boundary); /* get digits */ if (tree) { proto_tree_add_uint(tree,hf_giop_typecode_digits,tvb, - *offset-sizeof(u_octet2),2,u_octet2); + *offset-(int)sizeof(u_octet2),2,u_octet2); } s_octet2 = get_CDR_short(tvb,offset,stream_is_big_endian,boundary); /* get scale */ if (tree) { proto_tree_add_int(tree,hf_giop_typecode_scale,tvb, - *offset-sizeof(s_octet2),2,s_octet2); + *offset-(int)sizeof(s_octet2),2,s_octet2); } break; @@ -3559,10 +3562,10 @@ guint16 get_CDR_ushort(tvbuff_t *tvb, int *offset, gboolean stream_is_big_endian * Wchar is not supported for GIOP 1.0. */ -gint get_CDR_wchar(tvbuff_t *tvb, gchar **seq, int *offset, MessageHeader * header) { +gint get_CDR_wchar(tvbuff_t *tvb, const gchar **seq, int *offset, MessageHeader * header) { gint slength; - gchar *raw_wstring; + const gchar *raw_wstring; /* CORBA chapter 15: * - prior to GIOP 1.2 wchar limited to two octet fixed length. @@ -3614,12 +3617,12 @@ gint get_CDR_wchar(tvbuff_t *tvb, gchar **seq, int *offset, MessageHeader * head */ -guint32 get_CDR_wstring(tvbuff_t *tvb, gchar **seq, int *offset, gboolean stream_is_big_endian, +guint32 get_CDR_wstring(tvbuff_t *tvb, const gchar **seq, int *offset, gboolean stream_is_big_endian, int boundary, MessageHeader * header) { guint32 slength; gint reported_length; - gchar *raw_wstring; + const gchar *raw_wstring; /* CORBA chapter 15: * - prior to GIOP 1.2 wstring limited to two octet fixed length. @@ -3689,10 +3692,10 @@ guint32 get_CDR_wstring(tvbuff_t *tvb, gchar **seq, int *offset, gboolean stream static void dissect_target_address(tvbuff_t * tvb, packet_info *pinfo, int *offset, proto_tree * tree, gboolean stream_is_big_endian, guint32 *object_key_len, - gchar **object_key_val) + const gchar **object_key_val) { guint16 discriminant; - gchar *object_key = NULL; + const gchar *object_key = NULL; guint32 len = 0; guint32 u_octet4; proto_item* ti; @@ -3796,7 +3799,7 @@ static void decode_UnknownServiceContext(tvbuff_t *tvb, packet_info *pinfo, prot gboolean stream_is_be, guint32 boundary) { guint32 context_data_len; - gchar *context_data; + const gchar *context_data; proto_item *ti; /* get sequence length, and NO encapsulation */ @@ -3874,7 +3877,7 @@ static void decode_ServiceContextList(tvbuff_t *tvb, packet_info *pinfo, proto_t /* Get sequence length (number of elements) */ seqlen = get_CDR_ulong(tvb,offset,stream_is_be,boundary); proto_tree_add_uint(tree,hf_giop_sequence_length,tvb, - *offset-sizeof(seqlen),4,seqlen); + *offset-(int)sizeof(seqlen),4,seqlen); /* return if zero length sequence */ @@ -4263,13 +4266,13 @@ dissect_giop_request_1_1 (tvbuff_t * tvb, packet_info * pinfo, guint32 len = 0; guint32 objkey_len = 0; /* object key length */ - gchar *objkey = NULL; /* object key sequence */ + const gchar *objkey = NULL; /* object key sequence */ gboolean exres = FALSE; /* result of trying explicit dissectors */ - gchar *operation; - gchar *requesting_principal; + const gchar *operation; + const gchar *requesting_principal; guint8 response_expected; - gchar *reserved; + const gchar *reserved; gchar miop[4]; proto_tree *request_tree; proto_item *tf; @@ -4399,7 +4402,7 @@ dissect_giop_request_1_1 (tvbuff_t * tvb, packet_info * pinfo, } if (!exres && !strcmp(giop_op_is_a, operation) && request_tree) { - gchar *type_id; + const gchar *type_id; len = get_CDR_string(tvb, &type_id, &offset, stream_is_big_endian, 0); proto_tree_add_uint (request_tree, hf_giop_type_id_len, tvb, offset - 4 - len, 4, len); proto_tree_add_string(request_tree, hf_giop_type_id, tvb, offset - len, len, type_id); @@ -4433,14 +4436,14 @@ dissect_giop_request_1_2 (tvbuff_t * tvb, packet_info * pinfo, guint32 offset = 0; guint32 request_id; guint32 len = 0; - gchar *reserved; - gchar *operation = NULL; + const gchar *reserved; + const gchar *operation = NULL; proto_tree *request_tree; proto_item *tf; gboolean exres = FALSE; /* result of trying explicit dissectors */ guint32 objkey_len = 0; /* object key length */ - gchar *objkey = NULL; /* object key sequence */ + const gchar *objkey = NULL; /* object key sequence */ gchar *repoid = NULL; /* from object key lookup in objkey hash */ tf = proto_tree_add_text (tree, tvb, offset, -1, "General Inter-ORB Protocol Request"); @@ -4517,7 +4520,7 @@ dissect_giop_request_1_2 (tvbuff_t * tvb, packet_info * pinfo, } if (!exres && !strcmp(giop_op_is_a, operation) && request_tree) { - gchar *type_id; + const gchar *type_id; len = get_CDR_string(tvb, &type_id, &offset, stream_is_big_endian, 0); proto_tree_add_uint (request_tree, hf_giop_type_id_len, tvb, offset - 4 - len, 4, len); proto_tree_add_string(request_tree, hf_giop_type_id, tvb, offset - len, len, type_id); @@ -5454,7 +5457,7 @@ static void decode_IOR(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int proto_tree *tree = NULL; /* IOR tree */ proto_item *tf; - gchar *repobuf; /* for repository ID */ + const gchar *repobuf; /* for repository ID */ guint32 i; @@ -5466,7 +5469,7 @@ static void decode_IOR(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int u_octet4 = get_CDR_string(tvb,&repobuf,offset,stream_is_big_endian,boundary); proto_tree_add_uint(tree,hf_giop_string_length,tvb, - *offset-u_octet4-sizeof(u_octet4),4,u_octet4); + *offset-u_octet4-(int)sizeof(u_octet4),4,u_octet4); if (u_octet4 > 0) { proto_tree_add_string(tree,hf_giop_type_id,tvb, *offset-u_octet4,u_octet4,repobuf); @@ -5477,7 +5480,7 @@ static void decode_IOR(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int seqlen_p = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary); proto_tree_add_uint(tree,hf_giop_sequence_length,tvb, - *offset-sizeof(seqlen_p),4,seqlen_p); + *offset-(int)sizeof(seqlen_p),4,seqlen_p); /* fetch all TaggedProfiles in this sequence */ for (i=0; i< seqlen_p; i++) { @@ -5486,11 +5489,11 @@ static void decode_IOR(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int } static void decode_TaggedProfile(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, - guint32 boundary, gboolean stream_is_big_endian, gchar *repobuf) { + guint32 boundary, gboolean stream_is_big_endian, const gchar *repobuf) { guint32 seqlen_pd; /* sequence length of profile data */ guint32 pidtag; /* profile ID TAG */ - gchar *profile_data; /* profile_data pointer */ + const gchar *profile_data; /* profile_data pointer */ guint32 new_boundary; /* for encapsulations encountered */ gboolean new_big_endianness; /* for encapsulations encountered */ proto_item *ti; @@ -5498,7 +5501,7 @@ static void decode_TaggedProfile(tvbuff_t *tvb, packet_info *pinfo, proto_tree * /* Get ProfileId tag */ pidtag = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary); ti = proto_tree_add_uint(tree,hf_giop_profile_id,tvb, - *offset-sizeof(pidtag),4,pidtag); + *offset-(int)sizeof(pidtag),4,pidtag); /* get sequence length, new endianness and boundary for encapsulation */ seqlen_pd = get_CDR_encap_info(tvb, tree, offset, @@ -5551,18 +5554,19 @@ static void decode_TaggedProfile(tvbuff_t *tvb, packet_info *pinfo, proto_tree * static void decode_IIOP_IOR_profile(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, - guint32 boundary, gboolean stream_is_big_endian, gchar *repo_id_buf, + guint32 boundary, gboolean stream_is_big_endian, + const gchar *repo_id_buf, gboolean store_flag) { guint32 i; /* loop index */ guint8 v_major,v_minor; /* IIOP version */ - gchar *buf; + const gchar *buf; guint32 u_octet4; /* u long */ guint16 u_octet2; /* u short */ guint32 seqlen; /* generic sequence length */ guint32 seqlen1; /* generic sequence length */ - gchar *objkey; /* object key pointer */ + const gchar *objkey; /* object key pointer */ proto_item *ti, *ti_minor; @@ -5696,7 +5700,7 @@ static void decode_SystemExceptionReplyBody (tvbuff_t *tvb, proto_tree *tree, gi guint32 minor_code_value; guint32 completion_status; - gchar *buf; /* pointer to string buffer */ + const gchar *buf; /* pointer to string buffer */ length = get_CDR_string(tvb, &buf, offset, stream_is_big_endian, boundary); proto_tree_add_uint(tree, hf_giop_exception_len, tvb, *offset-4, 4, length); diff --git a/epan/dissectors/packet-giop.h b/epan/dissectors/packet-giop.h index 7807ea1eef..1e71d71648 100644 --- a/epan/dissectors/packet-giop.h +++ b/epan/dissectors/packet-giop.h @@ -98,7 +98,7 @@ typedef enum ReplyStatusType { */ typedef gboolean (giop_sub_dissector_t)(tvbuff_t *, packet_info *, proto_tree *, int *, - MessageHeader *, gchar * , gchar *); + MessageHeader *, const gchar * , gchar *); /* * Generic Subdissector handle, wraps user info. @@ -359,7 +359,7 @@ extern guint8 get_CDR_octet(tvbuff_t *tvb, int *offset); * This function also increments offset by len. */ -extern void get_CDR_octet_seq(tvbuff_t *tvb, gchar **seq, int *offset, guint32 len); +extern void get_CDR_octet_seq(tvbuff_t *tvb, const gchar **seq, int *offset, guint32 len); /* Copy a 2 octet sequence from the tvbuff * which represents a signed short value, and convert @@ -396,7 +396,7 @@ extern void giop_add_CDR_string(proto_tree *tree, tvbuff_t *tvb, int *offset, * */ -extern guint32 get_CDR_string(tvbuff_t *tvb, gchar **seq, int *offset, +extern guint32 get_CDR_string(tvbuff_t *tvb, const gchar **seq, int *offset, gboolean stream_is_big_endian, int boundary); @@ -482,7 +482,7 @@ extern guint16 get_CDR_ushort(tvbuff_t *tvb, int *offset, * Wchar is not supported for GIOP 1.0. */ -extern gint get_CDR_wchar(tvbuff_t *tvb, gchar **seq, int *offset, +extern gint get_CDR_wchar(tvbuff_t *tvb, const gchar **seq, int *offset, MessageHeader * header); @@ -505,7 +505,7 @@ extern gint get_CDR_wchar(tvbuff_t *tvb, gchar **seq, int *offset, * Wstring is not supported for GIOP 1.0. */ -extern guint32 get_CDR_wstring(tvbuff_t *tvb, gchar **seq, int *offset, +extern guint32 get_CDR_wstring(tvbuff_t *tvb, const gchar **seq, int *offset, gboolean stream_is_big_endian, int boundary, MessageHeader * header); @@ -540,7 +540,7 @@ extern guint32 get_CDR_encap_info(tvbuff_t *tvb, proto_tree *tree, gint *offset, * the initial sequence. */ -extern gchar * make_printable_string (gchar *in, guint32 len); +extern gchar * make_printable_string (const gchar *in, guint32 len); /* * Enums for TCkind diff --git a/epan/dissectors/packet-gluster_cli.c b/epan/dissectors/packet-gluster_cli.c index 05042950c2..7198668b6d 100644 --- a/epan/dissectors/packet-gluster_cli.c +++ b/epan/dissectors/packet-gluster_cli.c @@ -76,11 +76,9 @@ static int gluster_cli_2_common_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar* errstr= NULL; - offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_string(tvb, tree, hf_gluster_op_errstr, offset, - &errstr); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_gluster_dict, offset); return offset; @@ -90,15 +88,12 @@ static int gluster_cli_2_probe_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar* hostname = NULL; - gchar* errstr = NULL; - offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_uint32(tvb, tree, hf_gluster_port, offset); offset = dissect_rpc_string(tvb, tree, hf_gluster_hostname, offset, - &hostname); + NULL); offset = dissect_rpc_string(tvb, tree, hf_gluster_op_errstr, offset, - &errstr); + NULL); return offset; } @@ -107,10 +102,8 @@ static int gluster_cli_2_probe_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* hostname = NULL; - offset = dissect_rpc_string(tvb, tree, hf_gluster_hostname, offset, - &hostname); + NULL); offset = dissect_rpc_uint32(tvb, tree, hf_gluster_port, offset); return offset; @@ -120,11 +113,9 @@ static int gluster_cli_2_deprobe_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar* hostname = NULL; - offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_string(tvb, tree, hf_gluster_hostname, offset, - &hostname); + NULL); return offset; } @@ -133,10 +124,8 @@ static int gluster_cli_2_deprobe_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* hostname = NULL; - offset = dissect_rpc_string(tvb, tree, hf_gluster_hostname, offset, - &hostname); + NULL); offset = dissect_rpc_uint32(tvb, tree, hf_gluster_port, offset); offset = dissect_rpc_uint32(tvb, tree, hf_gluster_flags, offset); @@ -147,9 +136,7 @@ static int gluster_cli_2_fsm_log_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* name = NULL; - - offset = dissect_rpc_string(tvb, tree, hf_gluster_wd, offset, &name); + offset = dissect_rpc_string(tvb, tree, hf_gluster_wd, offset, NULL); return offset; } @@ -158,10 +145,8 @@ static int gluster_cli_2_getwd_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar* wd = NULL; - offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); - offset = dissect_rpc_string(tvb, tree, hf_gluster_wd, offset, &wd); + offset = dissect_rpc_string(tvb, tree, hf_gluster_wd, offset, NULL); return offset; } @@ -179,10 +164,8 @@ static int gluster_cli_2_mount_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* label = NULL; - offset = dissect_rpc_string(tvb, tree, hf_gluster_label, offset, - &label); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_gluster_dict, offset); return offset; @@ -192,10 +175,8 @@ static int gluster_cli_2_mount_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar* path = NULL; - offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); - offset = dissect_rpc_string(tvb, tree, hf_gluster_path, offset, &path); + offset = dissect_rpc_string(tvb, tree, hf_gluster_path, offset, NULL); return offset; } @@ -204,10 +185,8 @@ static int gluster_cli_2_umount_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* path = NULL; - offset = dissect_rpc_uint32(tvb, tree, hf_gluster_lazy, offset); - offset = dissect_rpc_string(tvb, tree, hf_gluster_path, offset, &path); + offset = dissect_rpc_string(tvb, tree, hf_gluster_path, offset, NULL); return offset; } diff --git a/epan/dissectors/packet-gluster_pmap.c b/epan/dissectors/packet-gluster_pmap.c index d2113bdcca..7d02a6b51f 100644 --- a/epan/dissectors/packet-gluster_pmap.c +++ b/epan/dissectors/packet-gluster_pmap.c @@ -80,9 +80,8 @@ static int gluster_pmap_portbybrick_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *brick = NULL; offset = dissect_rpc_string(tvb, tree, hf_gluster_brick, offset, - &brick); + NULL); return offset; } @@ -96,7 +95,7 @@ gluster_dump_reply_detail(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, { proto_item *detail_item; proto_tree *detail_tree; - gchar *progname = NULL; + const gchar *progname = NULL; detail_item = proto_tree_add_text(tree, tvb, offset, -1, "Available Progam: "); diff --git a/epan/dissectors/packet-glusterd.c b/epan/dissectors/packet-glusterd.c index 6d9a6321a0..2fec7bf25c 100644 --- a/epan/dissectors/packet-glusterd.c +++ b/epan/dissectors/packet-glusterd.c @@ -118,12 +118,10 @@ static int gluster_gd_mgmt_probe_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar *hostname = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset, - &hostname); + NULL); offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset); offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); @@ -134,12 +132,10 @@ static int gluster_gd_mgmt_probe_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *hostname = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset, - &hostname); + NULL); offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset); return offset; @@ -149,12 +145,10 @@ static int gluster_gd_mgmt_friend_add_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar *hostname = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset, - &hostname); + NULL); offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset); @@ -165,12 +159,10 @@ static int gluster_gd_mgmt_friend_add_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *hostname = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset, - &hostname); + NULL); offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_vols, offset); @@ -204,13 +196,11 @@ static int gluster_gd_mgmt_stage_op_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar *errstr = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset, - &errstr); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset); return offset; } @@ -231,14 +221,12 @@ static int gluster_gd_mgmt_commit_op_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar *errstr = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_buf, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset, - &errstr); + NULL); return offset; } @@ -307,14 +295,12 @@ static int glusterd_mgmt_2_stage_op_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar *errstr = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset); offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset, - &errstr); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset); return offset; @@ -336,14 +322,12 @@ static int glusterd_mgmt_2_commit_op_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar *errstr = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_buf, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset, - &errstr); + NULL); return offset; } @@ -366,11 +350,9 @@ static int glusterd_brick_2_common_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar *errstr = NULL; - offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset, - &errstr); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset); return offset; @@ -380,10 +362,8 @@ static int glusterd_brick_2_common_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *name = NULL; - offset = dissect_rpc_string(tvb, tree, hf_glusterd_name, offset, - &name); + NULL); offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset); diff --git a/epan/dissectors/packet-glusterfs.c b/epan/dissectors/packet-glusterfs.c index b1db9d6669..14a19f2b59 100644 --- a/epan/dissectors/packet-glusterfs.c +++ b/epan/dissectors/packet-glusterfs.c @@ -473,7 +473,8 @@ glusterfs_rpc_dissect_statfs(proto_tree *tree, tvbuff_t *tvb, int offset) int gluster_rpc_dissect_dict(proto_tree *tree, tvbuff_t *tvb, int hfindex, int offset) { - gchar *key, *value, *name; + gchar *key, *value; + const gchar *name; gint items, i, len, roundup, value_len, key_len; proto_item *subtree_item; @@ -484,7 +485,7 @@ gluster_rpc_dissect_dict(proto_tree *tree, tvbuff_t *tvb, int hfindex, int offse /* create a subtree for all the items in the dict */ if (hfindex >= 0) { header_field_info *hfinfo = proto_registrar_get_nth(hfindex); - name = (gchar*) hfinfo->name; + name = hfinfo->name; } else name = "<NAMELESS DICT STRUCTURE>"; @@ -608,11 +609,9 @@ static int glusterfs_gfs3_op_unlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* path = NULL; - gchar* bname = NULL; offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); return offset; } @@ -629,10 +628,8 @@ static int glusterfs_gfs3_op_statfs_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *path = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); return offset; } @@ -650,12 +647,10 @@ static int glusterfs_gfs3_op_setxattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *path = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = glusterfs_rpc_dissect_flags(tree, tvb, offset); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); return offset; } @@ -673,10 +668,8 @@ static int glusterfs_gfs3_op_opendir_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *path = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); return offset; } @@ -703,14 +696,11 @@ static int glusterfs_gfs3_op_create_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *path = NULL; - gchar *bname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); offset = glusterfs_rpc_dissect_flags(tree, tvb, offset); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_mode, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -734,14 +724,11 @@ static int glusterfs_gfs3_op_lookup_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *path = NULL; - gchar *bname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); offset = glusterfs_rpc_dissect_flags(tree, tvb, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -753,8 +740,6 @@ glusterfs_gfs3_op_inodelk_call(tvbuff_t *tvb, int offset, { proto_item *flock_item; proto_tree *flock_tree; - gchar* path = NULL; - gchar* volume = NULL; offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_cmd, offset); @@ -764,8 +749,8 @@ glusterfs_gfs3_op_inodelk_call(tvbuff_t *tvb, int offset, flock_tree = proto_item_add_subtree(flock_item, ett_glusterfs_flock); offset = glusterfs_rpc_dissect_gf_flock(flock_tree, tvb, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, &volume); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, NULL); return offset; } @@ -775,7 +760,7 @@ _glusterfs_gfs_op_readdir_entry(tvbuff_t *tvb, int offset, proto_tree *tree, { proto_item *entry_item; proto_tree *entry_tree; - gchar* path = NULL; + const gchar* path = NULL; entry_item = proto_tree_add_text(tree, tvb, offset, -1, "Entry"); entry_tree = proto_item_add_subtree(entry_item, ett_glusterfs_entry); @@ -883,14 +868,12 @@ glusterfs_rpc_dissect_setattr(proto_tree *tree, tvbuff_t *tvb, int offset) static int glusterfs_gfs3_op_setattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *path = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = glusterfs_rpc_dissect_gf_iatt(tree, tvb, hf_glusterfs_iatt, offset); offset = glusterfs_rpc_dissect_setattr(tree, tvb, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); return offset; } @@ -942,13 +925,11 @@ static int glusterfs_gfs3_3_op_mknod_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *bname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); offset = dissect_rpc_uint64(tvb, tree, hf_glusterfs_offset, offset); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_mode, offset); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_umask, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -958,12 +939,10 @@ static int glusterfs_gfs3_3_op_mkdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *bname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_mode, offset); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_umask, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -973,13 +952,11 @@ static int glusterfs_gfs3_3_op_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar* path = NULL; - offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = glusterfs_rpc_dissect_gf_iatt(tree, tvb, hf_glusterfs_iatt, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, - &path); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1016,10 +993,9 @@ glusterfs_gfs3_3_op_unlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { guint xflags; - gchar* bname = NULL; offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); xflags = tvb_get_ntohl(tvb, offset); proto_tree_add_uint_format(tree, hf_glusterfs_xflags, tvb, offset, 4, xflags, "Flags: 0%02o", xflags); offset += 4; @@ -1032,14 +1008,13 @@ static int glusterfs_gfs3_3_op_rmdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* bname = NULL; guint xflags; offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); xflags = tvb_get_ntohl(tvb, offset); proto_tree_add_uint_format(tree, hf_glusterfs_xflags, tvb, offset, 4, xflags, "Flags: 0%02o", xflags); offset += 4; - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1049,14 +1024,11 @@ static int glusterfs_gfs3_3_op_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *bname = NULL; - gchar *linkname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_umask, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_linkname, offset, &linkname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_linkname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1066,14 +1038,10 @@ static int glusterfs_gfs3_3_op_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - - gchar *oldbname = NULL; - gchar *newbname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_oldgfid, offset); offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_newgfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_oldbname, offset, &oldbname); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_newbname, offset, &newbname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_oldbname, offset, NULL); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_newbname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1113,11 +1081,9 @@ static int glusterfs_gfs3_3_op_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *newbname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_oldgfid, offset); offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_newgfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_newbname, offset, &newbname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_newbname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1259,11 +1225,9 @@ static int glusterfs_gfs3_3_op_getxattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* name = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_namelen, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, &name); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1285,9 +1249,8 @@ static int glusterfs_gfs3_3_op_removexattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* name = NULL; offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, &name); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1360,13 +1323,11 @@ static int glusterfs_gfs3_3_op_create_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *bname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); offset = glusterfs_rpc_dissect_flags(tree, tvb, offset); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_mode, offset); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_umask, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1447,12 +1408,10 @@ static int glusterfs_gfs3_3_op_lookup_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *bname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); offset = glusterfs_rpc_dissect_flags(tree, tvb, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1487,13 +1446,11 @@ static int glusterfs_gfs3_3_op_inodelk_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* volume = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_cmd, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_type, offset); offset = glusterfs_rpc_dissect_gf_2_flock(tree, tvb, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, &volume); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1503,8 +1460,6 @@ static int glusterfs_gfs3_3_op_finodelk_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* volume = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = dissect_rpc_uint64(tvb, tree, hf_glusterfs_fd, offset); @@ -1512,7 +1467,7 @@ glusterfs_gfs3_3_op_finodelk_call(tvbuff_t *tvb, int offset, offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_type, offset); offset = glusterfs_rpc_dissect_gf_2_flock(tree, tvb, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, &volume); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1522,14 +1477,12 @@ static int glusterfs_gfs3_3_op_entrylk_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* volume = NULL; - gchar* name = NULL; offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_cmd, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_type, offset); offset = dissect_rpc_uint64(tvb, tree, hf_glusterfs_entrylk_namelen, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, &name); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, &volume); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, NULL); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1539,15 +1492,13 @@ static int glusterfs_gfs3_3_op_fentrylk_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* volume = NULL; - gchar* name = NULL; offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = dissect_rpc_uint64(tvb, tree, hf_glusterfs_fd, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_cmd, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_type, offset); offset = dissect_rpc_uint64(tvb, tree, hf_glusterfs_entrylk_namelen, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, &name); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, &volume); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, NULL); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1593,12 +1544,10 @@ static int glusterfs_gfs3_3_op_fgetxattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* name = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = dissect_rpc_uint64(tvb, tree, hf_glusterfs_fd, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_namelen, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, &name); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; diff --git a/epan/dissectors/packet-glusterfs_hndsk.c b/epan/dissectors/packet-glusterfs_hndsk.c index 4b0cc40040..ad83f1ab70 100644 --- a/epan/dissectors/packet-glusterfs_hndsk.c +++ b/epan/dissectors/packet-glusterfs_hndsk.c @@ -104,10 +104,9 @@ static int gluster_hndsk_2_getspec_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar* spec = NULL; offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_string(tvb, tree, hf_gluster_hndsk_spec, offset, - &spec); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_gluster_hndsk_dict, offset); return offset; @@ -117,14 +116,12 @@ static int gluster_hndsk_2_getspec_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *key = NULL; - if (tree) proto_tree_add_item(tree, hf_gluster_hndsk_flags, tvb, offset, 4, ENC_NA); offset += 4; offset = dissect_rpc_string(tvb, tree, hf_gluster_hndsk_key, offset, - &key); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_gluster_hndsk_dict, offset); return offset; @@ -143,9 +140,8 @@ static int gluster_hndsk_2_set_lk_ver_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* uid = NULL; offset = dissect_rpc_string(tvb, tree, hf_gluster_hndsk_uid, offset, - &uid); + NULL); offset = dissect_rpc_uint32(tvb, tree,hf_gluster_hndsk_lk_ver, offset); return offset; } diff --git a/epan/dissectors/packet-gmrp.c b/epan/dissectors/packet-gmrp.c index fe20aa21ff..2e7d753751 100644 --- a/epan/dissectors/packet-gmrp.c +++ b/epan/dissectors/packet-gmrp.c @@ -69,7 +69,7 @@ static const value_string attribute_type_vals[] = { /* The length of GMRP LeaveAll attribute should be 2 octets (one for length * and the other for event) */ -#define GMRP_LENGTH_LEAVEALL (sizeof(guint8)+sizeof(guint8)) +#define GMRP_LENGTH_LEAVEALL (int)(sizeof(guint8)+sizeof(guint8)) /* The length of GMRP attribute other than LeaveAll should be: * @@ -78,8 +78,8 @@ static const value_string attribute_type_vals[] = { * 3 bytes for Service Requirement (1 for length, 1 for event, 1 for attribute value) * */ -#define GMRP_GROUP_MEMBERSHIP_NON_LEAVEALL (sizeof(guint8)+sizeof(guint8)+(6*sizeof(guint8))) -#define GMRP_SERVICE_REQUIREMENT_NON_LEAVEALL (sizeof(guint8)+sizeof(guint8)+sizeof(guint8)) +#define GMRP_GROUP_MEMBERSHIP_NON_LEAVEALL (int)(sizeof(guint8)+sizeof(guint8)+(6*sizeof(guint8))) +#define GMRP_SERVICE_REQUIREMENT_NON_LEAVEALL (int)(sizeof(guint8)+sizeof(guint8)+sizeof(guint8)) /* Packet offset definitions */ #define GARP_PROTOCOL_ID 0 @@ -128,7 +128,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) protocol_id = tvb_get_ntohs(tvb, GARP_PROTOCOL_ID); proto_tree_add_uint_format(gmrp_tree, hf_gmrp_proto_id, tvb, - GARP_PROTOCOL_ID, sizeof(guint16), + GARP_PROTOCOL_ID, (int)sizeof(guint16), protocol_id, "Protocol Identifier: 0x%04x (%s)", protocol_id, @@ -139,16 +139,16 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Currently only one protocol ID is supported */ if (protocol_id != GARP_DEFAULT_PROTOCOL_ID) { - proto_tree_add_text(gmrp_tree, tvb, GARP_PROTOCOL_ID, sizeof(guint16), + proto_tree_add_text(gmrp_tree, tvb, GARP_PROTOCOL_ID, (int)sizeof(guint16), " (Warning: this version of Wireshark only knows about protocol id = 1)"); call_dissector(data_handle, - tvb_new_subset_remaining(tvb, GARP_PROTOCOL_ID + sizeof(guint16)), + tvb_new_subset_remaining(tvb, GARP_PROTOCOL_ID + (int)sizeof(guint16)), pinfo, tree); return; } - offset += sizeof(guint16); - length -= sizeof(guint16); + offset += (int)sizeof(guint16); + length -= (int)sizeof(guint16); msg_index = 0; @@ -167,7 +167,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* End of GARP PDU */ if (msg_index) { - proto_tree_add_text(gmrp_tree, tvb, offset, sizeof(guint8), + proto_tree_add_text(gmrp_tree, tvb, offset, (int)sizeof(guint8), "End of pdu"); break; } @@ -180,14 +180,14 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); msg_item = proto_tree_add_text(gmrp_tree, tvb, msg_start, -1, "Message %d", msg_index + 1); proto_tree_add_uint(gmrp_tree, hf_gmrp_attribute_type, tvb, - msg_start, sizeof(guint8), octet); + msg_start, (int)sizeof(guint8), octet); /* GMRP supports Group Membership and Service Requirement as attribute types */ if ( (octet != GMRP_ATTRIBUTE_TYPE_GROUP_MEMBERSHIP) && (octet != GMRP_ATTRIBUTE_TYPE_SERVICE_REQUIREMENT) ) @@ -217,10 +217,10 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (attr_index) { proto_tree_add_text(gmrp_tree, tvb, offset, - sizeof(guint8), " End of mark"); + (int)sizeof(guint8), " End of mark"); - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); proto_item_set_len(msg_item, offset - msg_start); break; @@ -237,23 +237,23 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint8 event; - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); attr_item = proto_tree_add_text(gmrp_tree, tvb, attr_start, -1, " Attribute %d", attr_index + 1); proto_tree_add_uint(gmrp_tree, hf_gmrp_attribute_length, - tvb, attr_start, sizeof(guint8), octet); + tvb, attr_start, (int)sizeof(guint8), octet); /* Read in attribute event */ event = tvb_get_guint8(tvb, offset); proto_tree_add_uint(gmrp_tree, hf_gmrp_attribute_event, - tvb, offset, sizeof(guint8), event); + tvb, offset, (int)sizeof(guint8), event); - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); switch (event) { @@ -287,20 +287,20 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* Group Membership */ proto_tree_add_item(gmrp_tree, hf_gmrp_attribute_value_group_membership, - tvb, offset, (6*sizeof(guint8)), ENC_NA); + tvb, offset, (int)(6*sizeof(guint8)), ENC_NA); - offset += 6*sizeof(guint8); - length -= 6*sizeof(guint8); + offset += (int)(6*sizeof(guint8)); + length -= (int)(6*sizeof(guint8)); } else if ( GMRP_ATTRIBUTE_TYPE_SERVICE_REQUIREMENT == attribute_type ) { /* Service Requirement */ proto_tree_add_item(gmrp_tree, hf_gmrp_attribute_value_service_requirement, - tvb, offset, sizeof(guint8), ENC_BIG_ENDIAN); + tvb, offset, (int)sizeof(guint8), ENC_BIG_ENDIAN); - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); } else { diff --git a/epan/dissectors/packet-gsm_a_common.c b/epan/dissectors/packet-gsm_a_common.c index a249231cc0..5af4ce027a 100644 --- a/epan/dissectors/packet-gsm_a_common.c +++ b/epan/dissectors/packet-gsm_a_common.c @@ -40,6 +40,7 @@ #include "packet-bssap.h" #include "packet-sccp.h" #include "packet-gsm_a_common.h" +#include "packet-gmr1_common.h" #include "packet-e212.h" diff --git a/epan/dissectors/packet-gsm_a_common.h b/epan/dissectors/packet-gsm_a_common.h index 6baa1f1b1e..633c7ab731 100644 --- a/epan/dissectors/packet-gsm_a_common.h +++ b/epan/dissectors/packet-gsm_a_common.h @@ -153,7 +153,6 @@ extern int hf_bssgp_elem_id; extern const value_string gmr1_ie_common_strings[]; extern elem_fcn gmr1_ie_common_func[]; extern gint ett_gmr1_ie_common[]; -extern int hf_gmr1_elem_id; extern const value_string gmr1_ie_rr_strings[]; extern elem_fcn gmr1_ie_rr_func[]; diff --git a/epan/dissectors/packet-gsm_abis_oml.c b/epan/dissectors/packet-gsm_abis_oml.c index 2cba113abc..92dd2c81c3 100644 --- a/epan/dissectors/packet-gsm_abis_oml.c +++ b/epan/dissectors/packet-gsm_abis_oml.c @@ -1801,7 +1801,7 @@ dissect_oml_manuf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tvb_memeql(tvb, offset+1, ipaccess_magic, sizeof(ipaccess_magic))) return offset; - offset += sizeof(ipaccess_magic) + 1; + offset += (int)sizeof(ipaccess_magic) + 1; return dissect_oml_fom(tvb, pinfo, tree, offset, top_ti); } diff --git a/epan/dissectors/packet-gvrp.c b/epan/dissectors/packet-gvrp.c index 42e1ef88f8..165744f869 100644 --- a/epan/dissectors/packet-gvrp.c +++ b/epan/dissectors/packet-gvrp.c @@ -60,12 +60,12 @@ static const value_string attribute_type_vals[] = { /* The length of GVRP LeaveAll attribute should be 2 octets (one for length * and the other for event) */ -#define GVRP_LENGTH_LEAVEALL (sizeof(guint8)+sizeof(guint8)) +#define GVRP_LENGTH_LEAVEALL (int)(sizeof(guint8)+sizeof(guint8)) /* The length of GVRP attribute other than LeaveAll should be 4 octets (one * for length, one for event, and the last two for VID value). */ -#define GVRP_LENGTH_NON_LEAVEALL (sizeof(guint8)+sizeof(guint8)+sizeof(guint16)) +#define GVRP_LENGTH_NON_LEAVEALL (int)(sizeof(guint8)+sizeof(guint8)+sizeof(guint16)) /* Packet offset definitions */ #define GARP_PROTOCOL_ID 0 @@ -115,7 +115,7 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) protocol_id = tvb_get_ntohs(tvb, GARP_PROTOCOL_ID); proto_tree_add_uint_format(gvrp_tree, hf_gvrp_proto_id, tvb, - GARP_PROTOCOL_ID, sizeof(guint16), + GARP_PROTOCOL_ID, (int)sizeof(guint16), protocol_id, "Protocol Identifier: 0x%04x (%s)", protocol_id, @@ -126,16 +126,16 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Currently only one protocol ID is supported */ if (protocol_id != GARP_DEFAULT_PROTOCOL_ID) { - proto_tree_add_text(gvrp_tree, tvb, GARP_PROTOCOL_ID, sizeof(guint16), + proto_tree_add_text(gvrp_tree, tvb, GARP_PROTOCOL_ID, (int)sizeof(guint16), " (Warning: this version of Wireshark only knows about protocol id = 1)"); call_dissector(data_handle, - tvb_new_subset(tvb, GARP_PROTOCOL_ID + sizeof(guint16), -1, -1), + tvb_new_subset(tvb, GARP_PROTOCOL_ID + (int)sizeof(guint16), -1, -1), pinfo, tree); return; } - offset += sizeof(guint16); - length -= sizeof(guint16); + offset += (int)sizeof(guint16); + length -= (int)sizeof(guint16); msg_index = 0; @@ -154,7 +154,7 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* End of GARP PDU */ if (msg_index) { - proto_tree_add_text(gvrp_tree, tvb, offset, sizeof(guint8), + proto_tree_add_text(gvrp_tree, tvb, offset, (int)sizeof(guint8), "End of mark"); break; } @@ -166,14 +166,14 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); msg_item = proto_tree_add_text(gvrp_tree, tvb, msg_start, -1, "Message %d", msg_index + 1); proto_tree_add_uint(gvrp_tree, hf_gvrp_attribute_type, tvb, - msg_start, sizeof(guint8), octet); + msg_start, (int)sizeof(guint8), octet); /* GVRP only supports one attribute type. */ if (octet != GVRP_ATTRIBUTE_TYPE) @@ -202,10 +202,10 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (attr_index) { proto_tree_add_text(gvrp_tree, tvb, offset, - sizeof(guint8), " End of mark"); + (int)sizeof(guint8), " End of mark"); - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); proto_item_set_len(msg_item, offset - msg_start); break; @@ -221,23 +221,23 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint8 event; - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); attr_item = proto_tree_add_text(gvrp_tree, tvb, attr_start, -1, " Attribute %d", attr_index + 1); proto_tree_add_uint(gvrp_tree, hf_gvrp_attribute_length, - tvb, attr_start, sizeof(guint8), octet); + tvb, attr_start, (int)sizeof(guint8), octet); /* Read in attribute event */ event = tvb_get_guint8(tvb, offset); proto_tree_add_uint(gvrp_tree, hf_gvrp_attribute_event, - tvb, offset, sizeof(guint8), event); + tvb, offset, (int)sizeof(guint8), event); - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); switch (event) { @@ -266,10 +266,10 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Show attribute value */ proto_tree_add_item(gvrp_tree, hf_gvrp_attribute_value, - tvb, offset, sizeof(guint16), ENC_BIG_ENDIAN); + tvb, offset, (int)sizeof(guint16), ENC_BIG_ENDIAN); - offset += sizeof(guint16); - length -= sizeof(guint16); + offset += (int)sizeof(guint16); + length -= (int)sizeof (guint16); break; default: diff --git a/epan/dissectors/packet-hartip.c b/epan/dissectors/packet-hartip.c index 1aa16f7b25..280e32e14e 100644 --- a/epan/dissectors/packet-hartip.c +++ b/epan/dissectors/packet-hartip.c @@ -390,8 +390,8 @@ dissect_float(proto_tree *tree, int hf, tvbuff_t *tvb, gint offset) } static gint -dissect_string(proto_tree *tree, int hf, char *name, int len, tvbuff_t *tvb, - gint offset) +dissect_string(proto_tree *tree, int hf, const char *name, int len, + tvbuff_t *tvb, gint offset) { proto_item *ti; char *str; @@ -408,8 +408,8 @@ dissect_string(proto_tree *tree, int hf, char *name, int len, tvbuff_t *tvb, } static gint -dissect_packAscii(proto_tree *tree, int hf, char *name, int len, tvbuff_t *tvb, - gint offset) +dissect_packAscii(proto_tree *tree, int hf, const char *name, int len, + tvbuff_t *tvb, gint offset) { gushort usIdx; gushort usGroupCnt; @@ -458,8 +458,8 @@ dissect_packAscii(proto_tree *tree, int hf, char *name, int len, tvbuff_t *tvb, } static gint -dissect_timestamp(proto_tree *tree, int hf, char *name, int len, tvbuff_t *tvb, - gint offset) +dissect_timestamp(proto_tree *tree, int hf, const char *name, int len, + tvbuff_t *tvb, gint offset) { proto_item *ti; guint32 t; diff --git a/epan/dissectors/packet-hclnfsd.c b/epan/dissectors/packet-hclnfsd.c index a626126926..f1a0d537b0 100644 --- a/epan/dissectors/packet-hclnfsd.c +++ b/epan/dissectors/packet-hclnfsd.c @@ -144,18 +144,24 @@ static const value_string names_request_type[] = { { 0, NULL } }; -static void -hclnfsd_decode_obscure(char *ident, int ident_len) +static char * +hclnfsd_decode_obscure(const char *ident, int ident_len) { + char *ident_decoded, *ident_out; int j, x, y; + ident_decoded = ep_alloc(ident_len); + ident_out = ident_decoded; for (x = -1, j = 0; j < ident_len; j++) { y = *ident; x ^= *ident; - *ident++ = x; + *ident_out = x; x = y; + ident++; + ident_out++; } + return ident_decoded; } @@ -163,7 +169,8 @@ static int dissect_hclnfsd_authorize_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { guint32 request_type; - char *ident = NULL; + const char *ident = NULL; + char *ident_decoded; char *username = NULL; char *password = NULL; int ident_len = 0; @@ -204,9 +211,9 @@ dissect_hclnfsd_authorize_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_ proto_item_set_len(ident_item, ident_len); - hclnfsd_decode_obscure(ident, ident_len); + ident_decoded = hclnfsd_decode_obscure(ident, ident_len); - username = ident + 2; + username = ident_decoded + 2; password = username + strlen(username) + 1; proto_tree_add_text(ident_tree, tvb, offset, ident_len, diff --git a/epan/dissectors/packet-hdfs.c b/epan/dissectors/packet-hdfs.c index aaa31526eb..be17fc6af6 100644 --- a/epan/dissectors/packet-hdfs.c +++ b/epan/dissectors/packet-hdfs.c @@ -614,7 +614,7 @@ dissect_hdfs_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!tvb_memeql(tvb, offset, REQUEST_STR, sizeof(REQUEST_STR) - 1)) { proto_tree_add_item(hdfs_tree, hf_hdfs_sequenceno, tvb, offset, sizeof(REQUEST_STR) - 1, ENC_ASCII|ENC_NA); - offset += sizeof(REQUEST_STR) - 1; + offset += (int)sizeof(REQUEST_STR) - 1; proto_tree_add_item(hdfs_tree, hf_hdfs_pdu_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; diff --git a/epan/dissectors/packet-hdfsdata.c b/epan/dissectors/packet-hdfsdata.c index 9bb4101200..21ff553f03 100644 --- a/epan/dissectors/packet-hdfsdata.c +++ b/epan/dissectors/packet-hdfsdata.c @@ -130,9 +130,9 @@ dissect_variable_length_long (tvbuff_t *tvb, proto_tree *hdfsdata_tree, int* off { int byte_count = 1; int idx = 0; - long i = 0; - char first_byte = tvb_get_guint8(tvb, *offset); - long size = 0; + guint i = 0; + gint8 first_byte = tvb_get_guint8(tvb, *offset); + guint size = 0; int len = decode_vint_size(first_byte); if (len == 1) { @@ -147,7 +147,7 @@ dissect_variable_length_long (tvbuff_t *tvb, proto_tree *hdfsdata_tree, int* off i = i << 8; i = i | (b & 0xFF); } - size = ((first_byte < -120 || (first_byte >= -112 && first_byte < 0)) ? (i ^ -1L) : i); + size = ((first_byte < -120 || (first_byte >= -112 && first_byte < 0)) ? (i ^ 0xFFFFFFFF) : i); proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_clientlen, tvb, *offset, byte_count, ENC_BIG_ENDIAN); *offset = (*offset) + byte_count; diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c index 32dad27aa2..7c7379af7c 100644 --- a/epan/dissectors/packet-http.c +++ b/epan/dissectors/packet-http.c @@ -1360,7 +1360,7 @@ basic_request_dissector(tvbuff_t *tvb, proto_tree *tree, int offset, http_conv_t *conv_data) { const guchar *next_token; - gchar *request_uri; + const gchar *request_uri; int tokenlen; /* The first token is the method. */ @@ -1380,7 +1380,7 @@ basic_request_dissector(tvbuff_t *tvb, proto_tree *tree, int offset, tokenlen = get_token_len(line, lineend, &next_token); /* Save the request URI for various later uses */ - request_uri = (gchar *)tvb_get_ephemeral_string(tvb, offset, tokenlen); + request_uri = tvb_get_ephemeral_string(tvb, offset, tokenlen); stat_info->request_uri = ep_strdup(request_uri); conv_data->request_uri = se_strdup(request_uri); @@ -1430,7 +1430,7 @@ basic_response_dissector(tvbuff_t *tvb, proto_tree *tree, int offset, response_code_chars[3] = '\0'; stat_info->response_code = conv_data->response_code = - strtoul(response_code_chars, NULL, 10); + (guint)strtoul(response_code_chars, NULL, 10); proto_tree_add_uint(tree, hf_http_response_code, tvb, offset, 3, stat_info->response_code); @@ -1708,7 +1708,7 @@ chunked_encoding_dissector(tvbuff_t **tvb_ptr, packet_info *pinfo, *c = '\0'; } - chunk_size = strtol((gchar*)chunk_string, NULL, 16); + chunk_size = (guint32)strtol((gchar*)chunk_string, NULL, 16); if (chunk_size > datalen) { /* @@ -1815,7 +1815,7 @@ http_payload_subdissector(tvbuff_t *tvb, proto_tree *tree, PROTO_ITEM_SET_GENERATED(item); item = proto_tree_add_uint(proxy_tree, hf_http_proxy_connect_port, - tvb, 0, 0, strtol(strings[1], NULL, 10) ); + tvb, 0, 0, (guint32)strtol(strings[1], NULL, 10) ); PROTO_ITEM_SET_GENERATED(item); } @@ -2241,7 +2241,7 @@ process_header(tvbuff_t *tvb, int offset, int next_offset, case FT_INT16: case FT_INT24: case FT_INT32: - tmp=strtol(value, NULL, 10); + tmp=(guint32)strtol(value, NULL, 10); hdr_item = proto_tree_add_uint(tree, *headers[hf_index].hf, tvb, offset, len, tmp); break; default: diff --git a/epan/dissectors/packet-http.h b/epan/dissectors/packet-http.h index afb09aaa8f..975cc8e15f 100644 --- a/epan/dissectors/packet-http.h +++ b/epan/dissectors/packet-http.h @@ -34,7 +34,7 @@ typedef struct _http_info_value_t { gchar *request_method; guint response_code; gchar *http_host; - gchar *request_uri; + const gchar *request_uri; } http_info_value_t; /* Used for HTTP Export Object feature */ diff --git a/epan/dissectors/packet-iax2.h b/epan/dissectors/packet-iax2.h index 13ff9e971b..9cfd978d67 100644 --- a/epan/dissectors/packet-iax2.h +++ b/epan/dissectors/packet-iax2.h @@ -249,8 +249,8 @@ typedef struct _iax2_info_t guint payload_len; voip_call_state callState; const gchar *messageName; - gchar *callingParty; - gchar *calledParty; + const gchar *callingParty; + const gchar *calledParty; const guint8 *payload_data; } iax2_info_t; diff --git a/epan/dissectors/packet-icep.c b/epan/dissectors/packet-icep.c index c19bc50e52..5943a1084c 100644 --- a/epan/dissectors/packet-icep.c +++ b/epan/dissectors/packet-icep.c @@ -280,7 +280,6 @@ static void dissect_ice_facet(packet_info *pinfo, proto_tree *tree, proto_item * */ guint32 Size = 0; /* number of elements in the sequence */ - char *s = NULL; (*consumed) = 0; @@ -305,9 +304,8 @@ static void dissect_ice_facet(packet_info *pinfo, proto_tree *tree, proto_item * if ( Size == 0 ) { if (tree) { - s = ep_strdup( "(empty)" ); /* display the 0x00 Size byte when click on a empty ice_string */ - proto_tree_add_string(tree, hf_icep, tvb, offset - 1, 1, s); + proto_tree_add_string(tree, hf_icep, tvb, offset - 1, 1, "(empty)"); } return; } diff --git a/epan/dissectors/packet-icmp.c b/epan/dissectors/packet-icmp.c index 4c1cecdf3a..90c84ad470 100644 --- a/epan/dissectors/packet-icmp.c +++ b/epan/dissectors/packet-icmp.c @@ -1658,9 +1658,9 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { guint32 frame_ts, orig_ts; - frame_ts = ((pinfo->fd->abs_ts.secs * 1000) + + frame_ts = (guint32)(((pinfo->fd->abs_ts.secs * 1000) + (pinfo->fd->abs_ts.nsecs / 1000000)) % - 86400000; + 86400000); orig_ts = get_best_guess_mstimeofday(tvb, 8, frame_ts); diff --git a/epan/dissectors/packet-icq.c b/epan/dissectors/packet-icq.c index 4d39bc80e8..14a9362b3e 100644 --- a/epan/dissectors/packet-icq.c +++ b/epan/dissectors/packet-icq.c @@ -511,10 +511,10 @@ proto_add_icq_attr(proto_tree* tree, /* The tree to add to */ len = tvb_get_letohs(tvb, offset); if (len > tvb_reported_length_remaining(tvb, offset)) return -1; /* length goes past end of packet */ - proto_tree_add_text(tree, tvb, offset, sizeof(guint16) + len, + proto_tree_add_text(tree, tvb, offset, (int)sizeof(guint16) + len, "%s[%u]: %.*s", descr, len, len, - tvb_get_ephemeral_string(tvb, offset + sizeof(guint16), len)); - return len + sizeof(guint16); + tvb_get_ephemeral_string(tvb, offset + (int)sizeof(guint16), len)); + return len + (int)sizeof(guint16); } static void @@ -643,7 +643,7 @@ icqv5_decode_msgType(proto_tree* tree, tvbuff_t *tvb, int offset, int size, "Authorization: (%u) %s",auth_suc, (auth_suc==0)?"Denied":"Allowed"); offset++; - proto_tree_add_text(subtree, tvb, offset, sizeof(guint16), "x1: 0x%04x", + proto_tree_add_text(subtree, tvb, offset, (int)sizeof(guint16), "x1: 0x%04x", tvb_get_letohs(tvb, offset)); break; } @@ -1208,10 +1208,10 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ /* Read the length field */ pktLen = tvb_get_letohs(tvb, offset); - proto_tree_add_text(sstree, tvb, offset, sizeof(guint16), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint16), "Length: %u", pktLen); - offset += sizeof(guint16); + offset += (int)sizeof(guint16); } /* FALLTHRU */ case META_USER_FOUND: @@ -1233,9 +1233,9 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ /* * Read UIN */ - proto_tree_add_text(sstree, tvb, offset, sizeof(guint32), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint32), "UIN: %u", tvb_get_letohl(tvb, offset)); - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); for ( ; *d!=NULL; d++) { len = proto_add_icq_attr(sstree, tvb, offset, *d); @@ -1249,11 +1249,11 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ "authorization: %s", (auth==0x01)?"Necessary":"Who needs it"); offset++; /* Get x2 */ - proto_tree_add_text(sstree, tvb, offset, sizeof(guint16), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint16), "x2: 0x%04x", tvb_get_letohs(tvb, offset)); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); /* Get x3 */ - proto_tree_add_text(sstree, tvb, offset, sizeof(guint32), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint32), "x3: 0x%08x", tvb_get_letohl(tvb, offset)); break; } @@ -1263,9 +1263,9 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ /* Get the about information */ len = tvb_get_letohs(tvb, offset); - offset+=sizeof(guint16); - proto_tree_add_text(sstree, tvb, offset - sizeof(guint16), - sizeof(guint16)+len, "About(%d): %.*s", len, + offset+=(int)sizeof(guint16); + proto_tree_add_text(sstree, tvb, offset - (int)sizeof(guint16), + (int)sizeof(guint16)+len, "About(%d): %.*s", len, len, tvb_get_ephemeral_string(tvb, offset, len)); break; } @@ -1299,9 +1299,9 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ #if 0 /* Get the uin */ uin = tvb_get_letohl(tvb, offset); - proto_tree_add_text(sstree, tvb, offset, sizeof(guint32), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint32), "UIN: %u", uin); - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); #endif /* @@ -1309,10 +1309,10 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ */ while ((*d)!=NULL) { len = tvb_get_letohs(tvb, offset); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); if (len>0) { - proto_tree_add_text(sstree, tvb, offset - sizeof(guint16), - sizeof(guint16)+len, "%s(%d): %.*s", + proto_tree_add_text(sstree, tvb, offset - (int)sizeof(guint16), + (int)sizeof(guint16)+len, "%s(%d): %.*s", *d, len, len - 1, tvb_get_ephemeral_string(tvb, offset, len - 1)); offset+=len; @@ -1321,29 +1321,29 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ } /* Get country code */ country = tvb_get_letohs(tvb, offset); - proto_tree_add_text(sstree, tvb, offset, sizeof(guint16), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint16), "Countrycode: %u", country); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); /* Get the timezone setting */ user_timezone = tvb_get_guint8(tvb, offset); - proto_tree_add_text(sstree, tvb, offset, sizeof(unsigned char), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(unsigned char), "Timezone: %u", user_timezone); offset++; /* Get the authorize setting */ auth = tvb_get_guint8(tvb, offset); - proto_tree_add_text(sstree, tvb, offset, sizeof(unsigned char), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(unsigned char), "Authorization: (%u) %s", auth, (auth==0)?"No":"Yes"); offset++; /* Get the webaware setting */ auth = tvb_get_guint8(tvb, offset); - proto_tree_add_text(sstree, tvb, offset, sizeof(unsigned char), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(unsigned char), "Webaware: (%u) %s", auth, (auth==0)?"No":"Yes"); offset++; /* Get the authorize setting */ auth = tvb_get_guint8(tvb, offset); - proto_tree_add_text(sstree, tvb, offset, sizeof(unsigned char), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(unsigned char), "HideIP: (%u) %s", auth, (auth==0)?"No":"Yes"); break; } @@ -1376,7 +1376,7 @@ icqv5_srv_recv_message(proto_tree* tree, /* Tree to put the data in */ ti = proto_tree_add_text(tree, tvb, offset, 4, "Body"); subtree = proto_item_add_subtree(ti, ett_icq_body); proto_tree_add_item(subtree, hf_icq_uin, tvb, offset + SRV_RECV_MSG_UIN, - sizeof(guint32), ENC_LITTLE_ENDIAN); + (int)sizeof(guint32), ENC_LITTLE_ENDIAN); year = tvb_get_letohs(tvb, offset + SRV_RECV_MSG_YEAR); month = tvb_get_guint8(tvb, offset + SRV_RECV_MSG_MONTH); day = tvb_get_guint8(tvb, offset + SRV_RECV_MSG_DAY); @@ -1384,7 +1384,7 @@ icqv5_srv_recv_message(proto_tree* tree, /* Tree to put the data in */ minute = tvb_get_guint8(tvb, offset + SRV_RECV_MSG_MINUTE); proto_tree_add_text(subtree, tvb, offset + SRV_RECV_MSG_YEAR, - sizeof(guint16) + 4*sizeof(unsigned char), + (int)sizeof(guint16) + 4*(int)sizeof(unsigned char), "Time: %u-%u-%u %02u:%02u", day, month, year, hour, minute); icqv5_decode_msgType(subtree, tvb, offset + SRV_RECV_MSG_MSG_TYPE, @@ -1412,32 +1412,32 @@ icqv5_srv_rand_user(proto_tree* tree, /* Tree to put the data in */ /* guint32 UIN */ uin = tvb_get_letohl(tvb, offset + SRV_RAND_USER_UIN); proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_UIN, - sizeof(guint32), "UIN: %u", uin); + (int)sizeof(guint32), "UIN: %u", uin); /* guint32 IP */ proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_IP, - sizeof(guint32), "IP: %s", tvb_ip_to_str(tvb, offset + SRV_RAND_USER_IP)); + (int)sizeof(guint32), "IP: %s", tvb_ip_to_str(tvb, offset + SRV_RAND_USER_IP)); /* guint16 portNum */ /* XXX - 16 bits, or 32 bits? */ port = tvb_get_letohs(tvb, offset + SRV_RAND_USER_PORT); proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_UIN, - sizeof(guint32), "Port: %u", port); + (int)sizeof(guint32), "Port: %u", port); /* guint32 realIP */ proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_REAL_IP, - sizeof(guint32), "RealIP: %s", tvb_ip_to_str(tvb, offset + SRV_RAND_USER_REAL_IP)); + (int)sizeof(guint32), "RealIP: %s", tvb_ip_to_str(tvb, offset + SRV_RAND_USER_REAL_IP)); /* guint8 Communication Class */ commClass = tvb_get_guint8(tvb, offset + SRV_RAND_USER_CLASS); proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_CLASS, - sizeof(guint8), "Class: %s", + (int)sizeof(guint8), "Class: %s", (commClass!=4)?"User to User":"Through Server"); /* guint32 status */ /* XXX - 16 bits, or 32 bits? */ status = tvb_get_letohs(tvb, offset + SRV_RAND_USER_STATUS); proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_STATUS, - sizeof(guint32), "Status: %s", findStatus(status)); + (int)sizeof(guint32), "Status: %s", findStatus(status)); /* guint16 tcpVersion */ tcpVer = tvb_get_letohs(tvb, offset + SRV_RAND_USER_TCP_VER); proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_TCP_VER, - sizeof(guint16), "TCPVersion: %u", tcpVer); + (int)sizeof(guint16), "TCPVersion: %u", tcpVer); } } diff --git a/epan/dissectors/packet-ieee80211-radiotap.c b/epan/dissectors/packet-ieee80211-radiotap.c index a9e9c5d177..e1f0f465d5 100644 --- a/epan/dissectors/packet-ieee80211-radiotap.c +++ b/epan/dissectors/packet-ieee80211-radiotap.c @@ -278,9 +278,9 @@ static const int ieee80211_vht_bw2rate_index[] = { }; struct mcs_vht_info { - char *modulation; - char *coding_rate; - float rates[4][2]; + const char *modulation; + const char *coding_rate; + float rates[4][2]; }; static const struct mcs_vht_info ieee80211_vhtinfo[MAX_MCS_VHT_INDEX+1] = { @@ -894,8 +894,8 @@ capture_radiotap(const guchar * pd, int offset, int len, packet_counts * ld) } present = pletohl(&hdr->it_present); - offset += sizeof(struct ieee80211_radiotap_header); - it_len -= sizeof(struct ieee80211_radiotap_header); + offset += (int)sizeof(struct ieee80211_radiotap_header); + it_len -= (int)sizeof(struct ieee80211_radiotap_header); /* skip over other present bitmaps */ xpresent = present; diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c index a8fe89bd50..36f8a4a377 100644 --- a/epan/dissectors/packet-ieee802154.c +++ b/epan/dissectors/packet-ieee802154.c @@ -938,7 +938,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g packet->key_source.addr32 = tvb_get_ntohl(tvb, offset); proto_tree_add_uint64(field_tree, hf_ieee802154_aux_sec_key_source, tvb, offset, 4, packet->key_source.addr32); proto_item_set_len(ti, 1 + 4); - offset += sizeof (guint32); + offset += (int)sizeof (guint32); } if (packet->key_id_mode == KEY_ID_MODE_KEY_EXPLICIT_8) { packet->key_source.addr64 = tvb_get_ntoh64(tvb, offset); @@ -993,12 +993,12 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g /* Frame Counter and Key Sequence Counter prepended to the payload of an encrypted frame */ if (IEEE802154_IS_ENCRYPTED(packet->security_level)) { packet->frame_counter = tvb_get_letohl (tvb, offset); - proto_tree_add_uint(ieee802154_tree, hf_ieee802154_sec_frame_counter, tvb, offset, sizeof(guint32), packet->frame_counter); - offset += sizeof(guint32); + proto_tree_add_uint(ieee802154_tree, hf_ieee802154_sec_frame_counter, tvb, offset, (int)sizeof(guint32), packet->frame_counter); + offset += (int)sizeof(guint32); packet->key_sequence_counter = tvb_get_guint8 (tvb, offset); - proto_tree_add_uint(ieee802154_tree, hf_ieee802154_sec_key_sequence_counter, tvb, offset, sizeof(guint8), packet->key_sequence_counter); - offset += sizeof(guint8); + proto_tree_add_uint(ieee802154_tree, hf_ieee802154_sec_key_sequence_counter, tvb, offset, (int)sizeof(guint8), packet->key_sequence_counter); + offset += (int)sizeof(guint8); } } @@ -2152,7 +2152,7 @@ ccm_cbc_mac(const gchar *key _U_, const gchar *iv _U_, const gchar *a _U_, gint else {memcpy(block, a, a_len); memset(block+a_len, 0, sizeof(block)-a_len);} /* Adjust pointers. */ a += sizeof(block); - a_len -= sizeof(block); + a_len -= (int)sizeof(block); /* Execute the CBC-MAC algorithm. */ if (gcry_cipher_encrypt(cipher_hd, mic, 16, block, sizeof(block))) { gcry_cipher_close(cipher_hd); @@ -2167,7 +2167,7 @@ ccm_cbc_mac(const gchar *key _U_, const gchar *iv _U_, const gchar *a _U_, gint else {memcpy(block, m, m_len); memset(block+m_len, 0, sizeof(block)-m_len);} /* Adjust pointers. */ m += sizeof(block); - m_len -= sizeof(block); + m_len -= (int)sizeof(block); /* Execute the CBC-MAC algorithm. */ if (gcry_cipher_encrypt(cipher_hd, mic, 16, block, sizeof(block))) { gcry_cipher_close(cipher_hd); diff --git a/epan/dissectors/packet-ieee802a.c b/epan/dissectors/packet-ieee802a.c index 07b2ae8ef2..117849f4d0 100644 --- a/epan/dissectors/packet-ieee802a.c +++ b/epan/dissectors/packet-ieee802a.c @@ -55,7 +55,7 @@ static GHashTable *oui_info_table = NULL; * Add an entry for a new OUI. */ void -ieee802a_add_oui(guint32 oui, const char *table_name, char *table_ui_name, +ieee802a_add_oui(guint32 oui, const char *table_name, const char *table_ui_name, hf_register_info *hf_item) { oui_info_t *new_info; diff --git a/epan/dissectors/packet-ieee802a.h b/epan/dissectors/packet-ieee802a.h index 46d9242c27..c491bde97c 100644 --- a/epan/dissectors/packet-ieee802a.h +++ b/epan/dissectors/packet-ieee802a.h @@ -27,6 +27,6 @@ /* * Add an entry for a new OUI. */ -void ieee802a_add_oui(guint32, const char *, char *, hf_register_info *); +void ieee802a_add_oui(guint32, const char *, const char *, hf_register_info *); #endif diff --git a/epan/dissectors/packet-imf.c b/epan/dissectors/packet-imf.c index 20f950a151..6f9f44c7cc 100644 --- a/epan/dissectors/packet-imf.c +++ b/epan/dissectors/packet-imf.c @@ -554,7 +554,7 @@ dissect_imf_siolabel(tvbuff_t *tvb, int offset, int length, proto_item *item, pa label_string = ep_strbuf_append(label_string, label); if (tvb_get_guint8(tvb, item_offset + 5) == '*') { /* continuations */ - int num = strtol(tvb_get_ephemeral_string(tvb, item_offset + 6, value_offset - item_offset + 6), NULL, 10); + int num = (int)strtol(tvb_get_ephemeral_string(tvb, item_offset + 6, value_offset - item_offset + 6), NULL, 10); proto_tree_add_string_format(tree, hf_imf_siolabel_label, tvb, value_offset, value_length, label, "Label[%d]: \"%s\"", num, label); } else { diff --git a/epan/dissectors/packet-ipsec.c b/epan/dissectors/packet-ipsec.c index 7e39557e4b..12424c9106 100644 --- a/epan/dissectors/packet-ipsec.c +++ b/epan/dissectors/packet-ipsec.c @@ -884,7 +884,7 @@ dissect_ah_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, col_clear(pinfo->cinfo, COL_INFO); tvb_memcpy(tvb, (guint8 *)&ah, 0, sizeof(ah)); - advance = sizeof(ah) + ((ah.ah_len - 1) << 2); + advance = (int)sizeof(ah) + ((ah.ah_len - 1) << 2); if (check_col(pinfo->cinfo, COL_INFO)) { col_add_fstr(pinfo->cinfo, COL_INFO, "AH (SPI=0x%08x)", @@ -1381,7 +1381,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) crypt_algo_libgcrypt = GCRY_CIPHER_3DES; crypt_mode_libgcrypt = GCRY_CIPHER_MODE_CBC; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1416,7 +1416,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) esp_iv_len = 16; crypt_mode_libgcrypt = GCRY_CIPHER_MODE_CBC; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1464,7 +1464,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) esp_iv_len = 8; crypt_mode_libgcrypt = GCRY_CIPHER_MODE_CBC; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1501,7 +1501,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) esp_iv_len = 8; crypt_algo_libgcrypt = GCRY_CIPHER_DES; crypt_mode_libgcrypt = GCRY_CIPHER_MODE_CBC; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1536,7 +1536,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) esp_iv_len = 8; crypt_mode_libgcrypt = GCRY_CIPHER_MODE_CTR; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1583,7 +1583,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) esp_iv_len = 16; crypt_mode_libgcrypt = GCRY_CIPHER_MODE_CBC; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1629,7 +1629,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) crypt_algo_libgcrypt = GCRY_CIPHER_BLOWFISH; crypt_mode_libgcrypt = GCRY_CIPHER_MODE_CBC; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1655,7 +1655,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default : /* Fix parameters */ esp_iv_len = 0; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1763,7 +1763,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(decrypt_ok && (decrypted_len > esp_iv_len)) { tvb_decrypted = tvb_new_child_real_data(tvb, g_memdup(decrypted_data+sizeof(guint8)*esp_iv_len, - (decrypted_len - esp_iv_len)*sizeof(guint8)), + decrypted_len - esp_iv_len), decrypted_len - esp_iv_len, decrypted_len - esp_iv_len); g_free(decrypted_data); @@ -1871,7 +1871,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(!g_esp_enable_encryption_decode && g_esp_enable_authentication_check && sad_is_present) { call_dissector(data_handle, - tvb_new_subset(tvb, sizeof(struct newesp), len - sizeof(struct newesp) - esp_auth_len, -1), + tvb_new_subset(tvb, (int)sizeof(struct newesp), len - (int)sizeof(struct newesp) - esp_auth_len, -1), pinfo, esp_tree); if(esp_tree) @@ -1899,9 +1899,9 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(dissector_try_uint(ip_dissector_table, encapsulated_protocol, tvb_new_subset(tvb, - sizeof(struct newesp), + (int)sizeof(struct newesp), -1, - len - sizeof(struct newesp) - 14 - esp_pad_len), + len - (int)sizeof(struct newesp) - 14 - esp_pad_len), pinfo, tree)) { diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index 5532863d6c..c21346741a 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -600,20 +600,20 @@ dissect_routing6(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo rthdr_tree = proto_item_add_subtree(ti, ett_ipv6); proto_tree_add_text(rthdr_tree, tvb, - offset + offsetof(struct ip6_rthdr, ip6r_nxt), 1, + offset + (int)offsetof(struct ip6_rthdr, ip6r_nxt), 1, "Next header: %s (%u)", ipprotostr(rt.ip6r_nxt), rt.ip6r_nxt); proto_tree_add_text(rthdr_tree, tvb, - offset + offsetof(struct ip6_rthdr, ip6r_len), 1, + offset + (int)offsetof(struct ip6_rthdr, ip6r_len), 1, "Length: %u (%d bytes)", rt.ip6r_len, len); proto_tree_add_item(rthdr_tree, hf_ipv6_routing_hdr_type, tvb, - offset + offsetof(struct ip6_rthdr, ip6r_type), 1, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_rthdr, ip6r_type), 1, ENC_BIG_ENDIAN); proto_tree_add_item(rthdr_tree, hf_ipv6_routing_hdr_left, tvb, - offset + offsetof(struct ip6_rthdr, ip6r_segleft), 1, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_rthdr, ip6r_segleft), 1, ENC_BIG_ENDIAN); - seg_left = tvb_get_guint8(tvb, offset + offsetof(struct ip6_rthdr, ip6r_segleft)); + seg_left = tvb_get_guint8(tvb, offset + (int)offsetof(struct ip6_rthdr, ip6r_segleft)); if (rt.ip6r_type == IPv6_RT_HEADER_SOURCE_ROUTING && len <= sizeof(buf)) { struct e_in6_addr *a; @@ -627,12 +627,12 @@ dissect_routing6(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo a < (struct e_in6_addr *)(buf + len); a++, n++) { proto_tree_add_item(rthdr_tree, hf_ipv6_routing_hdr_addr, tvb, - offset + offsetof(struct ip6_rthdr0, ip6r0_addr) - + n * sizeof(struct e_in6_addr), - sizeof(struct e_in6_addr), ENC_NA); + offset + (int)(offsetof(struct ip6_rthdr0, ip6r0_addr) + + n * sizeof(struct e_in6_addr)), + (int)sizeof(struct e_in6_addr), ENC_NA); if (seg_left) TVB_SET_ADDRESS(&pinfo->dst, AT_IPv6, tvb, - offset + offsetof(struct ip6_rthdr0, ip6r0_addr) + n * sizeof(struct e_in6_addr), 16); + offset + (int)offsetof(struct ip6_rthdr0, ip6r0_addr) + n * (int)sizeof(struct e_in6_addr), 16); } } if (rt.ip6r_type == IPv6_RT_HEADER_MobileIP) { @@ -820,21 +820,21 @@ dissect_frag6(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, rthdr_tree = proto_item_add_subtree(ti, ett_ipv6); proto_tree_add_item(rthdr_tree, hf_ipv6_frag_nxt, tvb, - offset + offsetof(struct ip6_frag, ip6f_nxt), 1, + offset + (int)offsetof(struct ip6_frag, ip6f_nxt), 1, ENC_BIG_ENDIAN); proto_tree_add_item(rthdr_tree, hf_ipv6_frag_reserved, tvb, - offset + offsetof(struct ip6_frag, ip6f_reserved), 1, + offset + (int)offsetof(struct ip6_frag, ip6f_reserved), 1, ENC_BIG_ENDIAN); proto_tree_add_item(rthdr_tree, hf_ipv6_frag_offset, tvb, - offset + offsetof(struct ip6_frag, ip6f_offlg), 2, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_frag, ip6f_offlg), 2, ENC_BIG_ENDIAN); proto_tree_add_item(rthdr_tree, hf_ipv6_frag_reserved_bits, tvb, - offset + offsetof(struct ip6_frag, ip6f_offlg), 2, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_frag, ip6f_offlg), 2, ENC_BIG_ENDIAN); proto_tree_add_item(rthdr_tree, hf_ipv6_frag_more, tvb, - offset + offsetof(struct ip6_frag, ip6f_offlg), 2, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_frag, ip6f_offlg), 2, ENC_BIG_ENDIAN); proto_tree_add_item(rthdr_tree, hf_ipv6_frag_id, tvb, - offset + offsetof(struct ip6_frag, ip6f_ident), 4, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_frag, ip6f_ident), 4, ENC_BIG_ENDIAN); } return len; } @@ -1580,17 +1580,17 @@ dissect_shim6(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info * pinfo) /* Next Header */ proto_tree_add_uint_format(shim_tree, hf_ipv6_shim6_nxt, tvb, - offset + offsetof(struct ip6_shim, ip6s_nxt), 1, shim.ip6s_nxt, + offset + (int)offsetof(struct ip6_shim, ip6s_nxt), 1, shim.ip6s_nxt, "Next header: %s (%u)", ipprotostr(shim.ip6s_nxt), shim.ip6s_nxt); /* Header Extension Length */ proto_tree_add_uint_format(shim_tree, hf_ipv6_shim6_len, tvb, - offset + offsetof(struct ip6_shim, ip6s_len), 1, shim.ip6s_len, + offset + (int)offsetof(struct ip6_shim, ip6s_len), 1, shim.ip6s_len, "Header Ext Length: %u (%d bytes)", shim.ip6s_len, len); /* P Field */ proto_tree_add_item(shim_tree, hf_ipv6_shim6_p, tvb, - offset + offsetof(struct ip6_shim, ip6s_p), 1, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_shim, ip6s_p), 1, ENC_BIG_ENDIAN); /* skip the first 2 bytes (nxt hdr, hdr ext len, p+7bits) */ p = offset + 3; @@ -1605,7 +1605,7 @@ dissect_shim6(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info * pinfo) /* Payload Extension Header */ proto_tree_add_none_format(shim_tree, hf_ipv6_shim6_ct, tvb, - offset + offsetof(struct ip6_shim, ip6s_p), 6, + offset + (int)offsetof(struct ip6_shim, ip6s_p), 6, "Receiver Context Tag: %02x %02x %02x %02x %02x %02x", shim.ip6s_p & SHIM6_BITMASK_CT, tmp[0], tmp[1], tmp[2], tmp[3], tmp[4]); } @@ -1617,7 +1617,7 @@ dissect_shim6(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info * pinfo) /* Message Type */ proto_tree_add_item(shim_tree, hf_ipv6_shim6_type, tvb, - offset + offsetof(struct ip6_shim, ip6s_p), 1, + offset + (int)offsetof(struct ip6_shim, ip6s_p), 1, ENC_BIG_ENDIAN ); @@ -1687,7 +1687,7 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) plen = g_ntohs(ipv6.ip6_plen); /* Adjust the length of this tvbuff to include only the IPv6 datagram. */ - set_actual_length(tvb, plen + sizeof (struct ip6_hdr)); + set_actual_length(tvb, plen + (guint)sizeof (struct ip6_hdr)); TVB_SET_ADDRESS(&pinfo->net_src, AT_IPv6, tvb, offset + IP6H_SRC, 16); TVB_SET_ADDRESS(&pinfo->src, AT_IPv6, tvb, offset + IP6H_SRC, 16); @@ -1706,47 +1706,47 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* !!! warning: (4-bit) version, (6-bit) DSCP, (1-bit) ECN-ECT, (1-bit) ECN-CE and (20-bit) Flow */ pi = proto_tree_add_item(ipv6_tree, hf_ipv6_version, tvb, - offset + offsetof(struct ip6_hdr, ip6_vfc), 1, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_vfc), 1, ENC_BIG_ENDIAN); pt = proto_item_add_subtree(pi,ett_ipv6_version); pi = proto_tree_add_item(pt, hf_ip_version, tvb, - offset + offsetof(struct ip6_hdr, ip6_vfc), 1, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_vfc), 1, ENC_BIG_ENDIAN); PROTO_ITEM_SET_GENERATED(pi); ipv6_tc = proto_tree_add_item(ipv6_tree, hf_ipv6_class, tvb, - offset + offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); ipv6_tc_tree = proto_item_add_subtree(ipv6_tc, ett_ipv6_traffic_class); proto_tree_add_item(ipv6_tc_tree, hf_ipv6_traffic_class_dscp, tvb, - offset + offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); proto_tree_add_item(ipv6_tc_tree, hf_ipv6_traffic_class_ect, tvb, - offset + offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); proto_tree_add_item(ipv6_tc_tree, hf_ipv6_traffic_class_ce, tvb, - offset + offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); proto_tree_add_item(ipv6_tree, hf_ipv6_flow, tvb, - offset + offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); proto_tree_add_item(ipv6_tree, hf_ipv6_plen, tvb, - offset + offsetof(struct ip6_hdr, ip6_plen), 2, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_plen), 2, ENC_BIG_ENDIAN); proto_tree_add_uint_format(ipv6_tree, hf_ipv6_nxt, tvb, - offset + offsetof(struct ip6_hdr, ip6_nxt), 1, + offset + (int)offsetof(struct ip6_hdr, ip6_nxt), 1, ipv6.ip6_nxt, "Next header: %s (%u)", ipprotostr(ipv6.ip6_nxt), ipv6.ip6_nxt); proto_tree_add_item(ipv6_tree, hf_ipv6_hlim, tvb, - offset + offsetof(struct ip6_hdr, ip6_hlim), 1, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_hlim), 1, ENC_BIG_ENDIAN); /* Yes, there is not TTL in IPv6 Header... but it is the same of Hop Limit...*/ - pinfo->ip_ttl = tvb_get_guint8(tvb, offset + offsetof(struct ip6_hdr, ip6_hlim)); + pinfo->ip_ttl = tvb_get_guint8(tvb, offset + (int)offsetof(struct ip6_hdr, ip6_hlim)); /* Add the different items for the source address */ proto_tree_add_item(ipv6_tree, hf_ipv6_src, tvb, - offset + offsetof(struct ip6_hdr, ip6_src), 16, ENC_NA); + offset + (int)offsetof(struct ip6_hdr, ip6_src), 16, ENC_NA); ti = proto_tree_add_ipv6(ipv6_tree, hf_ipv6_addr, tvb, - offset + offsetof(struct ip6_hdr, ip6_src), + offset + (int)offsetof(struct ip6_hdr, ip6_src), 16, (guint8 *)&ipv6.ip6_src); PROTO_ITEM_SET_HIDDEN(ti); name = get_addr_name(&pinfo->src); @@ -1754,12 +1754,12 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_append_text(ipv6_item, ", Src: %s (%s)", name, ip6_to_str(&ipv6.ip6_src)); } ti = proto_tree_add_string(ipv6_tree, hf_ipv6_src_host, tvb, - offset + offsetof(struct ip6_hdr, ip6_src), + offset + (int)offsetof(struct ip6_hdr, ip6_src), 16, name); PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_HIDDEN(ti); ti = proto_tree_add_string(ipv6_tree, hf_ipv6_host, tvb, - offset + offsetof(struct ip6_hdr, ip6_src), + offset + (int)offsetof(struct ip6_hdr, ip6_src), 16, name); PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_HIDDEN(ti); @@ -1831,9 +1831,9 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Add different items for the destination address */ proto_tree_add_item(ipv6_tree, hf_ipv6_dst, tvb, - offset + offsetof(struct ip6_hdr, ip6_dst), 16, ENC_NA); + offset + (int)offsetof(struct ip6_hdr, ip6_dst), 16, ENC_NA); ti = proto_tree_add_ipv6(ipv6_tree, hf_ipv6_addr, tvb, - offset + offsetof(struct ip6_hdr, ip6_dst), + offset + (int)offsetof(struct ip6_hdr, ip6_dst), 16, (guint8 *)&ipv6.ip6_dst); PROTO_ITEM_SET_HIDDEN(ti); name = get_addr_name(&pinfo->dst); @@ -1841,12 +1841,12 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_append_text(ipv6_item, ", Dst: %s (%s)", name, ip6_to_str(&ipv6.ip6_dst)); } ti = proto_tree_add_string(ipv6_tree, hf_ipv6_dst_host, tvb, - offset + offsetof(struct ip6_hdr, ip6_dst), + offset + (int)offsetof(struct ip6_hdr, ip6_dst), 16, name); PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_HIDDEN(ti); ti = proto_tree_add_string(ipv6_tree, hf_ipv6_host, tvb, - offset + offsetof(struct ip6_hdr, ip6_dst), + offset + (int)offsetof(struct ip6_hdr, ip6_dst), 16, name); PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_HIDDEN(ti); @@ -1925,7 +1925,7 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* start of the new header (could be a extension header) */ nxt = tvb_get_guint8(tvb, offset + 6); - offset += sizeof(struct ip6_hdr); + offset += (int)sizeof(struct ip6_hdr); offlg = 0; ident = 0; @@ -2032,7 +2032,7 @@ again: /* collect packet info */ pinfo->ipproto = nxt; - pinfo->iplen = sizeof(ipv6) + plen + offset; + pinfo->iplen = (int)sizeof(ipv6) + plen + offset; pinfo->iphdrlen = offset; tap_queue_packet(ipv6_tap, pinfo, &ipv6); diff --git a/epan/dissectors/packet-isakmp.c b/epan/dissectors/packet-isakmp.c index 8343e54d3d..28b12c6abc 100644 --- a/epan/dissectors/packet-isakmp.c +++ b/epan/dissectors/packet-isakmp.c @@ -1513,7 +1513,7 @@ static const value_string rohc_attr_type[] = { { 0, NULL }, }; -#define ISAKMP_HDR_SIZE (sizeof(struct isakmp_hdr) + (2 * COOKIE_SIZE)) +#define ISAKMP_HDR_SIZE ((int)sizeof(struct isakmp_hdr) + (2 * COOKIE_SIZE)) #ifdef HAVE_LIBGCRYPT @@ -4804,7 +4804,7 @@ isakmp_hash_func(gconstpointer c) { guint val = 0, keychunk, i; /* XOR our icookie down to the size of a guint */ - for (i = 0; i < COOKIE_SIZE - (COOKIE_SIZE % sizeof(keychunk)); i += sizeof(keychunk)) { + for (i = 0; i < COOKIE_SIZE - (COOKIE_SIZE % (guint)sizeof(keychunk)); i += (guint)sizeof(keychunk)) { memcpy(&keychunk, &i_cookie[i], sizeof(keychunk)); val ^= keychunk; } @@ -4826,11 +4826,11 @@ static guint ikev2_key_hash_func(gconstpointer k) { guint hash = 0, keychunk, i; /* XOR our icookie down to the size of a guint */ - for (i = 0; i < key->spii_len - (key->spii_len % sizeof(keychunk)); i += sizeof(keychunk)) { + for (i = 0; i < key->spii_len - (key->spii_len % (guint)sizeof(keychunk)); i += (guint)sizeof(keychunk)) { memcpy(&keychunk, &key->spii[i], sizeof(keychunk)); hash ^= keychunk; } - for (i = 0; i < key->spir_len - (key->spir_len % sizeof(keychunk)); i += sizeof(keychunk)) { + for (i = 0; i < key->spir_len - (key->spir_len % (guint)sizeof(keychunk)); i += (guint)sizeof(keychunk)) { memcpy(&keychunk, &key->spir[i], sizeof(keychunk)); hash ^= keychunk; } diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c index 027f356301..0932c554c0 100644 --- a/epan/dissectors/packet-jxta.c +++ b/epan/dissectors/packet-jxta.c @@ -421,7 +421,7 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr return 0; } - offset += sizeof(JXTA_UDP_SIG); + offset += (int)sizeof(JXTA_UDP_SIG); jxta_message_framing_tvb = tvb_new_subset_remaining(tvb, offset); processed = dissect_jxta_message_framing(jxta_message_framing_tvb, pinfo, NULL, &content_length, &content_type); @@ -471,8 +471,8 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr gchar *content_type = NULL; tvbuff_t *jxta_message_tvb; - proto_tree_add_item(jxta_udp_tree, hf_jxta_udpsig, tvb, tree_offset, sizeof(JXTA_UDP_SIG), ENC_ASCII|ENC_NA); - tree_offset += sizeof(JXTA_UDP_SIG); + proto_tree_add_item(jxta_udp_tree, hf_jxta_udpsig, tvb, tree_offset, (int)sizeof(JXTA_UDP_SIG), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(JXTA_UDP_SIG); jxta_message_framing_tvb = tvb_new_subset_remaining(tvb, tree_offset); @@ -988,7 +988,7 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro break; } else { headername_len = tvb_get_guint8(tvb, offset); - offset += sizeof(guint8); + offset += (int)sizeof(guint8); headername_offset = offset; available = tvb_reported_length_remaining(tvb, offset); @@ -1009,7 +1009,7 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro break; } else { headervalue_len = tvb_get_ntohs(tvb, offset); - offset += sizeof(guint16); + offset += (int)sizeof(guint16); headervalue_offset = offset; available = tvb_reported_length_remaining(tvb, offset); @@ -1061,35 +1061,35 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro /* * Put header name into the protocol tree */ - proto_tree_add_item(framing_header_tree, hf_jxta_framing_header_name, tvb, tree_offset, sizeof(gint8), ENC_ASCII|ENC_NA); + proto_tree_add_item(framing_header_tree, hf_jxta_framing_header_name, tvb, tree_offset, (int)sizeof(gint8), ENC_ASCII|ENC_NA); /* * Append header name into the header protocol item. It's a nice hint so you don't have to reveal all headers. */ if (headernamelen > 0) { proto_item_append_text(framing_header_tree_item, " \"%s\"", - tvb_format_text(tvb, tree_offset + sizeof(guint8), headernamelen)); + tvb_format_text(tvb, tree_offset + (int)sizeof(guint8), headernamelen)); } - tree_offset += sizeof(guint8) + headernamelen; + tree_offset += (int)sizeof(guint8) + headernamelen; if (headernamelen > 0) { guint16 headervaluelen = tvb_get_ntohs(tvb, tree_offset); if (tree) { proto_tree_add_uint(framing_header_tree, hf_jxta_framing_header_value_length, tvb, tree_offset, - sizeof(guint16), headervaluelen); + (int)sizeof(guint16), headervaluelen); /** TODO bondolo Add specific handling for known header types */ /* * Put header value into protocol tree. */ - proto_tree_add_item(framing_header_tree, hf_jxta_framing_header_value, tvb, tree_offset + sizeof(guint16), + proto_tree_add_item(framing_header_tree, hf_jxta_framing_header_value, tvb, tree_offset + (int)sizeof(guint16), headervaluelen, ENC_NA); } - tree_offset += sizeof(guint16) + headervaluelen; + tree_offset += (int)sizeof(guint16) + headervaluelen; } proto_item_set_end(framing_header_tree_item, tvb, tree_offset); @@ -1150,7 +1150,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree return 0; } - offset += sizeof(JXTA_MSG_SIG); + offset += (int)sizeof(JXTA_MSG_SIG); available = tvb_reported_length_remaining(tvb, offset); if (available < sizeof(guint8)) { @@ -1159,7 +1159,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree } else { message_version = tvb_get_guint8(tvb, offset); - offset += sizeof(guint8); + offset += (int)sizeof(guint8); if ((JXTA_MSG_VERSION_1 != message_version) && (JXTA_MSG_VERSION_2 != message_version)) { /* Sort of a lie, we say that we don't recognize it at all. */ @@ -1174,7 +1174,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree needed = (gint) (sizeof(guint8) - available); break; } else { - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } } @@ -1187,7 +1187,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree guint16 msg_names_count = tvb_get_ntohs(tvb, offset); guint each_name; - offset += sizeof(guint16); + offset += (int)sizeof(guint16); for (each_name = 0; each_name < msg_names_count; each_name++) { guint16 name_len; @@ -1200,13 +1200,13 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree name_len = tvb_get_ntohs(tvb, offset); - available = tvb_reported_length_remaining(tvb, offset + sizeof(name_len)); + available = tvb_reported_length_remaining(tvb, offset + (int)sizeof(name_len)); if (available < name_len) { needed = (gint) (name_len - available); break; } - offset += sizeof(name_len) + name_len; + offset += (int)sizeof(name_len) + name_len; } } @@ -1219,7 +1219,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree guint16 elem_count = tvb_get_ntohs(tvb, offset); guint each_elem; - offset += sizeof(guint16); + offset += (int)sizeof(guint16); /* parse elements */ for (each_elem = 0; each_elem < elem_count; each_elem++) { @@ -1309,8 +1309,8 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree jxta_msg_tree = proto_item_add_subtree(jxta_msg_tree_item, ett_jxta_msg); - proto_tree_add_item(jxta_msg_tree, hf_jxta_message_sig, tvb, tree_offset, sizeof(JXTA_MSG_SIG), ENC_ASCII|ENC_NA); - tree_offset += sizeof(JXTA_MSG_SIG); + proto_tree_add_item(jxta_msg_tree, hf_jxta_message_sig, tvb, tree_offset, (int)sizeof(JXTA_MSG_SIG), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(JXTA_MSG_SIG); tree_item = proto_tree_add_string(jxta_msg_tree, hf_jxta_message_src, tvb, 0, 0, src_addr->str); PROTO_ITEM_SET_GENERATED(tree_item); @@ -1345,21 +1345,21 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree } message_version = tvb_get_guint8(tvb, tree_offset); - proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_version, tvb, tree_offset, sizeof(guint8), message_version); - tree_offset += sizeof(guint8); + proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_version, tvb, tree_offset, (int)sizeof(guint8), message_version); + tree_offset += (int)sizeof(guint8); if( message_version > 0 ) { guint8 flags = tvb_get_guint8(tvb, tree_offset); - proto_item *flags_ti = proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_flags, tvb, tree_offset, sizeof(guint8), flags); + proto_item *flags_ti = proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_flags, tvb, tree_offset, (int)sizeof(guint8), flags); proto_tree *jxta_msg_flags_tree = proto_item_add_subtree(flags_ti, ett_jxta_msg_flags); proto_tree_add_boolean(jxta_msg_flags_tree, hf_jxta_message_flag_utf16be, tvb, tree_offset, 1, flags); proto_tree_add_boolean(jxta_msg_flags_tree, hf_jxta_message_flag_ucs32be, tvb, tree_offset, 1, flags); - tree_offset += sizeof(guint8); + tree_offset += (int)sizeof(guint8); } msg_names_count = tvb_get_ntohs(tvb, tree_offset); - proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_names_count, tvb, tree_offset, sizeof(guint16), msg_names_count); - tree_offset += sizeof(guint16); + proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_names_count, tvb, tree_offset, (int)sizeof(guint16), msg_names_count); + tree_offset += (int)sizeof(guint16); names_table = ep_alloc((msg_names_count + 2) * sizeof(const gchar *)); names_table[0] = ""; @@ -1369,15 +1369,15 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree for (each_name = 0; each_name < msg_names_count; each_name++) { guint16 name_len = tvb_get_ntohs(tvb, tree_offset); - names_table[2 + each_name] = tvb_get_ephemeral_string(tvb, tree_offset + sizeof(name_len), name_len); - proto_tree_add_item(jxta_msg_tree, hf_jxta_message_names_name, tvb, tree_offset, sizeof(name_len), ENC_ASCII|ENC_NA); - tree_offset += sizeof(name_len) + name_len; + names_table[2 + each_name] = tvb_get_ephemeral_string(tvb, tree_offset + (int)sizeof(name_len), name_len); + proto_tree_add_item(jxta_msg_tree, hf_jxta_message_names_name, tvb, tree_offset, (int)sizeof(name_len), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(name_len) + name_len; } /* parse element count */ elem_count = tvb_get_ntohs(tvb, tree_offset); - proto_tree_add_item(jxta_msg_tree, hf_jxta_message_element_count, tvb, tree_offset, sizeof(guint16), ENC_BIG_ENDIAN); - tree_offset += sizeof(guint16); + proto_tree_add_item(jxta_msg_tree, hf_jxta_message_element_count, tvb, tree_offset, (int)sizeof(guint16), ENC_BIG_ENDIAN); + tree_offset += (int)sizeof(guint16); /* FIXME bondolo Element count 0 (Process elements until FIN) should be supported. */ @@ -1442,7 +1442,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p return 0; } - offset += sizeof(JXTA_MSGELEM_SIG); + offset += (int)sizeof(JXTA_MSGELEM_SIG); /* namespace id field */ available = tvb_reported_length_remaining(tvb, offset); @@ -1451,7 +1451,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p break; } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* flags field */ available = tvb_reported_length_remaining(tvb, offset); @@ -1460,7 +1460,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p break; } else { flags = tvb_get_guint8(tvb, offset); - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } /* name field */ @@ -1470,7 +1470,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p break; } else { guint16 name_len = tvb_get_ntohs(tvb, offset); - offset += sizeof(guint16); + offset += (int)sizeof(guint16); available = tvb_reported_length_remaining(tvb, offset); if (available < name_len) { @@ -1492,7 +1492,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p } type_len = tvb_get_ntohs(tvb, offset); - offset += sizeof(guint16); + offset += (int)sizeof(guint16); available = tvb_reported_length_remaining(tvb, offset); if (available < type_len) { @@ -1514,7 +1514,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p } encoding_len = tvb_get_ntohs(tvb, offset); - offset += sizeof(guint16); + offset += (int)sizeof(guint16); available = tvb_reported_length_remaining(tvb, offset); if (available < encoding_len) { @@ -1532,7 +1532,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p break; } else { guint32 content_len = tvb_get_ntohl(tvb, offset); - offset += sizeof(guint32); + offset += (int)sizeof(guint32); available = tvb_reported_length_remaining(tvb, offset); if (available < content_len) { @@ -1588,37 +1588,37 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p gchar *mediatype = NULL; tvbuff_t *element_content_tvb; - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_sig, tvb, tree_offset, sizeof(JXTA_MSGELEM_SIG), ENC_ASCII|ENC_NA); - tree_offset += sizeof(JXTA_MSGELEM_SIG); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_sig, tvb, tree_offset, (int)sizeof(JXTA_MSGELEM_SIG), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(JXTA_MSGELEM_SIG); namespaceID = tvb_get_guint8(tvb, tree_offset); namespace_ti = - proto_tree_add_uint(jxta_elem_tree, hf_jxta_element1_namespaceid, tvb, tree_offset, sizeof(guint8), namespaceID); + proto_tree_add_uint(jxta_elem_tree, hf_jxta_element1_namespaceid, tvb, tree_offset, (int)sizeof(guint8), namespaceID); if (namespaceID < ns_count) { proto_item_append_text(namespace_ti, " (%s)", names_table[namespaceID]); } else { proto_item_append_text(namespace_ti, " * BAD *"); } - tree_offset += sizeof(guint8); + tree_offset += (int)sizeof(guint8); flags = tvb_get_guint8(tvb, tree_offset); - flags_ti = proto_tree_add_uint(jxta_elem_tree, hf_jxta_element_flags, tvb, tree_offset, sizeof(guint8), flags); + flags_ti = proto_tree_add_uint(jxta_elem_tree, hf_jxta_element_flags, tvb, tree_offset, (int)sizeof(guint8), flags); jxta_elem_flags_tree = proto_item_add_subtree(flags_ti, ett_jxta_elem_1_flags); proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element1_flag_hasType, tvb, tree_offset, 1, flags); proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element1_flag_hasEncoding, tvb, tree_offset, 1, flags); proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element1_flag_hasSignature, tvb, tree_offset, 1, flags); - tree_offset += sizeof(guint8); + tree_offset += (int)sizeof(guint8); name_len = tvb_get_ntohs(tvb, tree_offset); - proto_item_append_text(jxta_elem_tree_item, " \"%s\"", tvb_format_text(tvb, tree_offset + sizeof(guint16), name_len)); - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_name, tvb, tree_offset, sizeof(guint16), ENC_ASCII|ENC_NA); - tree_offset += sizeof(guint16) + name_len; + proto_item_append_text(jxta_elem_tree_item, " \"%s\"", tvb_format_text(tvb, tree_offset + (int)sizeof(guint16), name_len)); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_name, tvb, tree_offset, (int)sizeof(guint16), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(guint16) + name_len; /* process type */ if ((flags & JXTAMSG1_ELMFLAG_TYPE) != 0) { guint16 type_len = tvb_get_ntohs(tvb, tree_offset); - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_type, tvb, tree_offset, sizeof(guint16), ENC_ASCII|ENC_NA); - tree_offset += sizeof(guint16); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_type, tvb, tree_offset, (int)sizeof(guint16), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(guint16); mediatype = tvb_get_ephemeral_string(tvb, tree_offset, type_len); @@ -1628,14 +1628,14 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p /* process encoding */ if ((flags & JXTAMSG1_ELMFLAG_ENCODING) != 0) { guint16 encoding_len = tvb_get_ntohs(tvb, tree_offset); - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_encoding, tvb, tree_offset, sizeof(guint16), ENC_ASCII|ENC_NA); - tree_offset += sizeof(guint16) + encoding_len; + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_encoding, tvb, tree_offset, (int)sizeof(guint16), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(guint16) + encoding_len; } /* content */ content_len = tvb_get_ntohl(tvb, tree_offset); - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_content_len, tvb, tree_offset, sizeof(guint32), ENC_BIG_ENDIAN); - tree_offset += sizeof(guint32); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_content_len, tvb, tree_offset, (int)sizeof(guint32), ENC_BIG_ENDIAN); + tree_offset += (int)sizeof(guint32); element_content_tvb = tvb_new_subset(tvb, tree_offset, content_len, content_len); @@ -1690,7 +1690,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p return 0; } - offset += sizeof(JXTA_MSGELEM_SIG); + offset += (int)sizeof(JXTA_MSGELEM_SIG); /* flags field */ available = tvb_reported_length_remaining(tvb, offset); @@ -1699,7 +1699,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } else { flags = tvb_get_guint8(tvb, offset); - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } /* namespace id field */ @@ -1709,7 +1709,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); /* name field */ if ((flags & JXTAMSG2_ELMFLAG_NAME_LITERAL) == 0) { @@ -1719,7 +1719,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); } else { /* literal name field */ available = tvb_reported_length_remaining(tvb, offset); @@ -1728,7 +1728,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } else { guint16 name_len = tvb_get_ntohs(tvb, offset); - offset += sizeof(guint16); + offset += (int)sizeof(guint16); available = tvb_reported_length_remaining(tvb, offset); if (available < name_len) { @@ -1748,7 +1748,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); } /* encoding field */ @@ -1759,7 +1759,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); } @@ -1771,7 +1771,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } else { guint64 content_len = tvb_get_ntoh64(tvb, offset); - offset += sizeof(guint64); + offset += (int)sizeof(guint64); available = tvb_reported_length_remaining(tvb, offset); if (available < content_len) { @@ -1788,7 +1788,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } else { guint64 content_len = tvb_get_ntohl(tvb, offset); - offset += sizeof(guint32); + offset += (int)sizeof(guint32); available = tvb_reported_length_remaining(tvb, offset); if (available < content_len) { @@ -1846,11 +1846,11 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p const gchar *mediatype = NULL; tvbuff_t *element_content_tvb; - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_sig, tvb, tree_offset, sizeof(JXTA_MSGELEM_SIG), ENC_ASCII|ENC_NA); - tree_offset += sizeof(JXTA_MSGELEM_SIG); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_sig, tvb, tree_offset, (int)sizeof(JXTA_MSGELEM_SIG), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(JXTA_MSGELEM_SIG); flags = tvb_get_guint8(tvb, tree_offset); - flags_ti = proto_tree_add_uint(jxta_elem_tree, hf_jxta_element_flags, tvb, tree_offset, sizeof(guint8), flags); + flags_ti = proto_tree_add_uint(jxta_elem_tree, hf_jxta_element_flags, tvb, tree_offset, (int)sizeof(guint8), flags); jxta_elem_flags_tree = proto_item_add_subtree(flags_ti, ett_jxta_elem_2_flags); proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element2_flag_64bitlens, tvb, tree_offset, 1, flags); proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element2_flag_nameLiteral, tvb, tree_offset, 1, flags); @@ -1858,43 +1858,43 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element2_flag_hasSignature, tvb, tree_offset, 1, flags); proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element2_flag_hasEncoding, tvb, tree_offset, 1, flags); proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element2_flag_sigOfEncoded, tvb, tree_offset, 1, flags); - tree_offset += sizeof(guint8); + tree_offset += (int)sizeof(guint8); /* Namespace */ namespaceID = tvb_get_ntohs(tvb, tree_offset); namespace_ti = - proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_namespaceid, tvb, tree_offset, sizeof(guint16), namespaceID); + proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_namespaceid, tvb, tree_offset, (int)sizeof(guint16), namespaceID); if (namespaceID < names_count) { proto_item_append_text(namespace_ti, " (%s)", names_table[namespaceID]); } else { proto_item_append_text(namespace_ti, " * BAD *"); } - tree_offset += sizeof(guint16); + tree_offset += (int)sizeof(guint16); /* Name */ if ((flags & JXTAMSG2_ELMFLAG_NAME_LITERAL) == 0) { nameID = tvb_get_ntohs(tvb, tree_offset); name_ti = - proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_nameid, tvb, tree_offset, sizeof(guint16), nameID); + proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_nameid, tvb, tree_offset, (int)sizeof(guint16), nameID); if (namespaceID < names_count) { proto_item_append_text(name_ti, " (%s)", names_table[nameID]); } else { proto_item_append_text(name_ti, " * BAD *"); } - tree_offset += sizeof(guint16); + tree_offset += (int)sizeof(guint16); } else { /* literal name */ guint16 name_len = tvb_get_ntohs(tvb, tree_offset); - proto_item_append_text(jxta_elem_tree_item, " \"%s\"", tvb_format_text(tvb, tree_offset + sizeof(guint16), name_len)); - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_name, tvb, tree_offset, sizeof(guint16), ENC_ASCII|ENC_NA); - tree_offset += sizeof(guint16) + name_len; + proto_item_append_text(jxta_elem_tree_item, " \"%s\"", tvb_format_text(tvb, tree_offset + (int)sizeof(guint16), name_len)); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_name, tvb, tree_offset, (int)sizeof(guint16), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(guint16) + name_len; } /* process type */ if ((flags & JXTAMSG2_ELMFLAG_TYPE) != 0) { guint16 mimeID = tvb_get_ntohs(tvb, tree_offset); proto_item *mime_ti = - proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_mimeid, tvb, tree_offset, sizeof(guint16), mimeID); + proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_mimeid, tvb, tree_offset, (int)sizeof(guint16), mimeID); if (mimeID < names_count) { proto_item_append_text(mime_ti, " (%s)", names_table[mimeID]); @@ -1903,16 +1903,16 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p proto_item_append_text(mime_ti, " * BAD *"); } - tree_offset += sizeof(guint16); + tree_offset += (int)sizeof(guint16); } else { - mediatype = "application/octect-stream"; + mediatype = "application/octet-stream"; } /* process encoding */ if ((flags & JXTAMSG2_ELMFLAG_ENCODINGS) != 0) { guint16 encodingID = tvb_get_ntohs(tvb, tree_offset); proto_item *encoding_ti = - proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_encodingid, tvb, tree_offset, sizeof(guint16), encodingID); + proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_encodingid, tvb, tree_offset, (int)sizeof(guint16), encodingID); if (encodingID < names_count) { proto_item_append_text(encoding_ti, " (%s)", names_table[encodingID]); @@ -1920,18 +1920,18 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p proto_item_append_text(encoding_ti, " * BAD *"); } - tree_offset += sizeof(guint16); + tree_offset += (int)sizeof(guint16); } if ((flags & JXTAMSG2_ELMFLAG_UINT64_LENS) != 0) { content_len = tvb_get_ntoh64(tvb, tree_offset); - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_content_len64, tvb, tree_offset, sizeof(guint64), ENC_BIG_ENDIAN); - tree_offset += sizeof(guint64); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_content_len64, tvb, tree_offset, (int)sizeof(guint64), ENC_BIG_ENDIAN); + tree_offset += (int)sizeof(guint64); } else { content_len = tvb_get_ntohl(tvb, tree_offset); - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_content_len, tvb, tree_offset, sizeof(guint32), ENC_BIG_ENDIAN); - tree_offset += sizeof(guint32); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_content_len, tvb, tree_offset, (int)sizeof(guint32), ENC_BIG_ENDIAN); + tree_offset += (int)sizeof(guint32); } /* content */ diff --git a/epan/dissectors/packet-k12.c b/epan/dissectors/packet-k12.c index 2d5f3511e7..53065b5849 100644 --- a/epan/dissectors/packet-k12.c +++ b/epan/dissectors/packet-k12.c @@ -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,sizeof(dissector_handle_t)*(num_protos+1)); + d->handles = g_memdup(o->handles,(guint)(sizeof(dissector_handle_t)*(num_protos+1))); return dest; } diff --git a/epan/dissectors/packet-lwapp.c b/epan/dissectors/packet-lwapp.c index f891945932..a4eee2d461 100644 --- a/epan/dissectors/packet-lwapp.c +++ b/epan/dissectors/packet-lwapp.c @@ -451,7 +451,7 @@ dissect_lwapp(tvbuff_t *tvb, packet_info *pinfo, } /* tree */ - next_client = tvb_new_subset_remaining(tvb, (have_destmac?6:0) + sizeof(LWAPP_Header)); + next_client = tvb_new_subset_remaining(tvb, (have_destmac?6:0) + (int)sizeof(LWAPP_Header)); if ((header.flags & LWAPP_FLAGS_T) == 0) { call_dissector(swap_frame_control ? wlan_bsfc_handle : wlan_handle, next_client, pinfo, tree); diff --git a/epan/dissectors/packet-lwres.c b/epan/dissectors/packet-lwres.c index a9c2d00ba9..ae67ba9956 100644 --- a/epan/dissectors/packet-lwres.c +++ b/epan/dissectors/packet-lwres.c @@ -472,7 +472,7 @@ static void dissect_a_records(tvbuff_t* tvb, proto_tree* tree,guint32 nrec,int o if(tree) { a_rec_item = proto_tree_add_text(tree,tvb,offset, - ((sizeof(guint32) + sizeof(guint16)) * nrec),"A records"); + (int)((sizeof(guint32) + sizeof(guint16)) * nrec),"A records"); a_rec_tree = proto_item_add_subtree(a_rec_item, ett_a_rec); } @@ -482,7 +482,7 @@ static void dissect_a_records(tvbuff_t* tvb, proto_tree* tree,guint32 nrec,int o for(i=0; i<nrec; i++) { - curr = offset + ((sizeof(guint32)+sizeof(guint16)) * i); + curr = offset + (int)((sizeof(guint32)+sizeof(guint16)) * i); len = tvb_get_ntohs(tvb,curr); @@ -575,7 +575,7 @@ static void dissect_srv_records(tvbuff_t* tvb, proto_tree* tree,guint32 nrec,int dlen, "DNAME: %s", dname); - curr+=((sizeof(short)*4) + dlen); + curr+=(int)((sizeof(short)*4) + dlen); } @@ -631,7 +631,7 @@ static void dissect_mx_records(tvbuff_t* tvb, proto_tree* tree, guint32 nrec, in dlen, "name: %s", dname); - curr+=((sizeof(short)*2) + dlen); + curr+=(int)((sizeof(short)*2) + dlen); } @@ -675,7 +675,7 @@ static void dissect_ns_records(tvbuff_t* tvb, proto_tree* tree, guint32 nrec, in curr + 2, dlen, "Name: %s", dname); - curr+=(sizeof(short) + dlen); + curr+=(int)(sizeof(short) + dlen); } diff --git a/epan/dissectors/packet-megaco.c b/epan/dissectors/packet-megaco.c index 92d7af7d41..f286f59ab9 100644 --- a/epan/dissectors/packet-megaco.c +++ b/epan/dissectors/packet-megaco.c @@ -644,8 +644,8 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (check_col(pinfo->cinfo, COL_INFO) ) col_add_fstr(pinfo->cinfo, COL_INFO, "%s Reply ", - tvb_format_text(tvb,tvb_offset,len)); - trx_id = strtoul(tvb_format_text(tvb,tvb_offset,len),NULL,10); + tvb_format_text(tvb,tvb_offset,len)); + trx_id = (guint)strtoul(tvb_format_text(tvb,tvb_offset,len),NULL,10); if(tree) my_proto_tree_add_string(message_body_tree, hf_megaco_transid, tvb, @@ -681,8 +681,8 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (check_col(pinfo->cinfo, COL_INFO) ) col_append_fstr(pinfo->cinfo, COL_INFO, "%s Request", - tvb_format_text(tvb,tvb_offset,len)); - trx_id = strtoul(tvb_format_text(tvb,tvb_offset,len),NULL,10); + tvb_format_text(tvb,tvb_offset,len)); + trx_id = (guint)strtoul(tvb_format_text(tvb,tvb_offset,len),NULL,10); if(tree) my_proto_tree_add_string(message_body_tree, hf_megaco_transid, tvb, tvb_offset,len, tvb_format_text(tvb,tvb_offset,len)); @@ -767,7 +767,7 @@ nextcontext: tvb_previous_offset, tokenlen, tvb_format_text(tvb, tvb_previous_offset, tokenlen)); - ctx_id = strtoul(tvb_format_text(tvb, tvb_previous_offset, tokenlen),NULL,10); + ctx_id = (guint)strtoul(tvb_format_text(tvb, tvb_previous_offset, tokenlen),NULL,10); if (check_col(pinfo->cinfo, COL_INFO) ) col_append_fstr(pinfo->cinfo, COL_INFO, " |=%s",tvb_format_text(tvb, tvb_previous_offset,tokenlen)); @@ -3221,7 +3221,7 @@ dissect_megaco_LocalControldescriptor(tvbuff_t *tvb, proto_tree *megaco_mediades tvb_get_nstringz0(tvb,tvb_current_offset,3,code_str); proto_item_append_text(item,"[ %s ]", - val_to_str_ext(strtoul(code_str,NULL,16), &dscp_vals_ext,"Unknown (%u)")); + val_to_str_ext((guint32)strtoul(code_str,NULL,16), &dscp_vals_ext,"Unknown (%u)")); tvb_current_offset = megaco_tvb_skip_wsp(tvb, tvb_offset +1); break; diff --git a/epan/dissectors/packet-mgcp.c b/epan/dissectors/packet-mgcp.c index a629c94ead..198849f2fd 100644 --- a/epan/dissectors/packet-mgcp.c +++ b/epan/dissectors/packet-mgcp.c @@ -1459,7 +1459,7 @@ static void dissect_mgcp_firstline(tvbuff_t *tvb, packet_info *pinfo, proto_tree { transid = tvb_format_text(tvb,tvb_previous_offset,tokenlen); /* XXX - what if this isn't a valid text string? */ - mi->transid = atol(transid); + mi->transid = (guint32)strtoul(transid, NULL, 10); proto_tree_add_string(tree, hf_mgcp_transid, tvb, tvb_previous_offset, tokenlen, transid); } @@ -1915,7 +1915,7 @@ dissect_mgcp_connectionparams(proto_tree *parent_tree, tvbuff_t *tvb, gint offse { if (hf_uint != -1) { - proto_tree_add_uint(tree, hf_uint, tvb, offset, tokenlen, atol(typval[1])); + proto_tree_add_uint(tree, hf_uint, tvb, offset, tokenlen, (guint32)strtoul(typval[1], NULL, 10)); } else if (hf_string != -1) { @@ -2075,7 +2075,7 @@ dissect_mgcp_localconnectionoptions(proto_tree *parent_tree, tvbuff_t *tvb, gint { if (hf_uint != -1) { - proto_tree_add_uint(tree, hf_uint, tvb, offset, tokenlen, atol(typval[1])); + proto_tree_add_uint(tree, hf_uint, tvb, offset, tokenlen, (guint32)strtoul(typval[1], NULL, 10)); } else if (hf_string != -1) { diff --git a/epan/dissectors/packet-mms.c b/epan/dissectors/packet-mms.c index b6a418c0f2..fe409b5b07 100644 --- a/epan/dissectors/packet-mms.c +++ b/epan/dissectors/packet-mms.c @@ -1861,7 +1861,7 @@ dissect_mms_TimeOfDay(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _ /* 86400 seconds in one day */ ts.secs = (days + 5113) * 86400 + milliseconds / 1000; - ts.nsecs = (milliseconds % 1000) * G_GINT64_CONSTANT(1000000U); + ts.nsecs = (milliseconds % 1000) * 1000000U; ptime = abs_time_to_str(&ts, ABSOLUTE_TIME_UTC, TRUE); if(hf_index >= 0) diff --git a/epan/dissectors/packet-mount.c b/epan/dissectors/packet-mount.c index 396abcd522..242be713ef 100644 --- a/epan/dissectors/packet-mount.c +++ b/epan/dissectors/packet-mount.c @@ -159,7 +159,7 @@ static int dissect_mount_dirpath_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - char *mountpoint=NULL; + const char *mountpoint=NULL; if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){ rpc_call_info_value *civ=pinfo->private_data; @@ -217,8 +217,8 @@ dissect_mountlist(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree proto_item* lock_item = NULL; proto_tree* lock_tree = NULL; int old_offset = offset; - char* hostname; - char* directory; + const char* hostname; + const char* directory; if (tree) { lock_item = proto_tree_add_item(tree, hf_mount_mountlist, tvb, @@ -294,7 +294,7 @@ dissect_exportlist(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr int groups_offset; proto_item* groups_item = NULL; proto_item* groups_tree = NULL; - char* directory; + const char* directory; group_name_list[0]=0; group_names_len=0; @@ -583,7 +583,7 @@ dissect_sgi_exportlist(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_ proto_item* exportlist_item = NULL; proto_tree* exportlist_tree = NULL; int old_offset = offset; - char* directory, *options; + const char* directory, *options; if (tree) { exportlist_item = proto_tree_add_item(tree, hf_mount_exportlist, diff --git a/epan/dissectors/packet-mpls-pm.c b/epan/dissectors/packet-mpls-pm.c index 342cd6129e..89570ef9d7 100644 --- a/epan/dissectors/packet-mpls-pm.c +++ b/epan/dissectors/packet-mpls-pm.c @@ -208,7 +208,7 @@ mpls_pm_dissect_counter(tvbuff_t *tvb, proto_tree *pm_tree, * fields represent octet counts. Otherwise Counter 1-4 fields * represent packet counts */ - gchar *unit = bflag ? "octets" : "packets"; + const gchar *unit = bflag ? "octets" : "packets"; if (query) { switch (i) { diff --git a/epan/dissectors/packet-mysql.c b/epan/dissectors/packet-mysql.c index 8f941fa8f5..97f8ca2b26 100644 --- a/epan/dissectors/packet-mysql.c +++ b/epan/dissectors/packet-mysql.c @@ -1850,7 +1850,7 @@ mysql_dissect_response_prepare(tvbuff_t *tvb, int offset, proto_tree *tree, mysq conn_data->stmt_num_params = tvb_get_letohs(tvb, offset); stmt_data = se_alloc(sizeof(struct my_stmt_data)); stmt_data->nparam = conn_data->stmt_num_params; - flagsize = sizeof(guint8) * stmt_data->nparam; + flagsize = (int)(sizeof(guint8) * stmt_data->nparam); stmt_data->param_flags = se_alloc(flagsize); memset(stmt_data->param_flags, 0, flagsize); se_tree_insert32(conn_data->stmts, stmt_id, stmt_data); diff --git a/epan/dissectors/packet-nasdaq-itch.c b/epan/dissectors/packet-nasdaq-itch.c index dbaf9a30c2..5fe9776bfd 100644 --- a/epan/dissectors/packet-nasdaq-itch.c +++ b/epan/dissectors/packet-nasdaq-itch.c @@ -157,7 +157,7 @@ order_ref_number(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree if (nasdaq_itch_tree || col_info) { const char *str_value = tvb_get_ephemeral_string(tvb, offset, 9); - guint32 value = strtoul(str_value, NULL, 10); + guint32 value = (guint32)strtoul(str_value, NULL, 10); proto_tree_add_uint(nasdaq_itch_tree, hf_nasdaq_itch_order_reference, tvb, offset, 9, value); if (col_info) { @@ -177,7 +177,7 @@ time_stamp(tvbuff_t *tvb, proto_tree *nasdaq_itch_tree, int id, int offset, int const char *display = ""; const char *str_value = tvb_get_ephemeral_string(tvb, offset, size); - ms = val = strtoul(str_value, NULL, 10); + ms = val = (guint32)strtoul(str_value, NULL, 10); switch (size) { case 3: display = ep_strdup_printf(" %03u" , val); @@ -203,7 +203,7 @@ number_of_shares(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree if (nasdaq_itch_tree || col_info) { const char *str_value = tvb_get_ephemeral_string(tvb, offset, size); - guint32 value = strtoul(str_value, NULL, 10); + guint32 value = (guint32)strtoul(str_value, NULL, 10); proto_tree_add_uint(nasdaq_itch_tree, id, tvb, offset, size, value); if (col_info) { diff --git a/epan/dissectors/packet-ncp2222.inc b/epan/dissectors/packet-ncp2222.inc index e8055b0210..f25f90852e 100644 --- a/epan/dissectors/packet-ncp2222.inc +++ b/epan/dissectors/packet-ncp2222.inc @@ -191,32 +191,32 @@ static const fragment_items nds_frag_items = { #define IT_ATLAST 24 /* Iteration information flags */ -#define DSI_OUTPUT_FIELDS 0x00000001L -#define DSI_ENTRY_ID 0x00000002L -#define DSI_ENTRY_FLAGS 0x00000004L -#define DSI_SUBORDINATE_COUNT 0x00000008L -#define DSI_MODIFICATION_TIME 0x00000010L -#define DSI_MODIFICATION_TIMESTAMP 0x00000020L -#define DSI_CREATION_TIMESTAMP 0x00000040L -#define DSI_PARTITION_ROOT_ID 0x00000080L -#define DSI_PARENT_ID 0x00000100L -#define DSI_REVISION_COUNT 0x00000200L -#define DSI_REPLICA_TYPE 0x00000400L -#define DSI_BASE_CLASS 0x00000800L -#define DSI_ENTRY_RDN 0x00001000L -#define DSI_ENTRY_DN 0x00002000L -#define DSI_PARTITION_ROOT_DN 0x00004000L -#define DSI_PARENT_DN 0x00008000L -#define DSI_PURGE_TIME 0x00010000L -#define DSI_DEREFERENCED_BASE_CLASS 0x00020000L -#define DSI_REPLICA_NUMBER 0x00040000L -#define DSI_REPLICA_STATE 0x00080000L -#define DSI_FEDERATION_BOUNDARY 0x00100000L -#define DSI_SCHEMA_BOUNDARY 0x00200000L -#define DSI_FEDERATION_BOUNDARY_ID 0x00400000L -#define DSI_SCHEMA_BOUNDARY_ID 0x00800000L -#define DSI_CUR_SUBCOUNT 0x01000000L -#define DSI_LOCAL_ENTRY_FLAGS 0x02000000L +#define DSI_OUTPUT_FIELDS 0x00000001U +#define DSI_ENTRY_ID 0x00000002U +#define DSI_ENTRY_FLAGS 0x00000004U +#define DSI_SUBORDINATE_COUNT 0x00000008U +#define DSI_MODIFICATION_TIME 0x00000010U +#define DSI_MODIFICATION_TIMESTAMP 0x00000020U +#define DSI_CREATION_TIMESTAMP 0x00000040U +#define DSI_PARTITION_ROOT_ID 0x00000080U +#define DSI_PARENT_ID 0x00000100U +#define DSI_REVISION_COUNT 0x00000200U +#define DSI_REPLICA_TYPE 0x00000400U +#define DSI_BASE_CLASS 0x00000800U +#define DSI_ENTRY_RDN 0x00001000U +#define DSI_ENTRY_DN 0x00002000U +#define DSI_PARTITION_ROOT_DN 0x00004000U +#define DSI_PARENT_DN 0x00008000U +#define DSI_PURGE_TIME 0x00010000U +#define DSI_DEREFERENCED_BASE_CLASS 0x00020000 +#define DSI_REPLICA_NUMBER 0x00040000 +#define DSI_REPLICA_STATE 0x00080000 +#define DSI_FEDERATION_BOUNDARY 0x00100000 +#define DSI_SCHEMA_BOUNDARY 0x00200000 +#define DSI_FEDERATION_BOUNDARY_ID 0x00400000 +#define DSI_SCHEMA_BOUNDARY_ID 0x00800000 +#define DSI_CUR_SUBCOUNT 0x01000000 +#define DSI_LOCAL_ENTRY_FLAGS 0x02000000 static const value_string zensearchenum[] = { { 0, "[Root]" }, @@ -2849,7 +2849,7 @@ trap_for_expert_event(proto_tree *ncp_tree, packet_info *pinfo, const ncp_record } expert_add_info_format(pinfo, NULL, PI_REQUEST_CODE, PI_CHAT, "%s: %s, Rights:(%s)", - val_to_str((strtoul(oaction, NULL, 16) & 0xeb), open_create_mode_vals, "Unknown: %d"), + val_to_str((guint32)(strtoul(oaction, NULL, 16) & 0xeb), open_create_mode_vals, "Unknown: %d"), p_filename, val_to_str((atoi(p_rights) & 0x5f), ncp_rights_vals, "Unknown: %d")); } diff --git a/epan/dissectors/packet-ndmp.c b/epan/dissectors/packet-ndmp.c index 27078be65c..7c1061d803 100644 --- a/epan/dissectors/packet-ndmp.c +++ b/epan/dissectors/packet-ndmp.c @@ -2371,7 +2371,7 @@ dissect_file_name(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *par proto_tree* tree = NULL; int old_offset=offset; guint32 type; - char *name; + const char *name; if (parent_tree) { item = proto_tree_add_text(parent_tree, tvb, offset, -1, diff --git a/epan/dissectors/packet-ndps.c b/epan/dissectors/packet-ndps.c index 7975593295..8a10c1f4af 100644 --- a/epan/dissectors/packet-ndps.c +++ b/epan/dissectors/packet-ndps.c @@ -355,7 +355,6 @@ static int hf_spx_ndps_func_delivery = -1; static int hf_spx_ndps_func_broker = -1; static gint ett_ndps = -1; -static dissector_handle_t ndps_data_handle; /* desegmentation of NDPS over TCP */ static gboolean ndps_desegment = TRUE; diff --git a/epan/dissectors/packet-netperfmeter.c b/epan/dissectors/packet-netperfmeter.c index f333292624..36fc3e5464 100644 --- a/epan/dissectors/packet-netperfmeter.c +++ b/epan/dissectors/packet-netperfmeter.c @@ -296,9 +296,9 @@ dissect_npmp_add_flow_message(tvbuff_t *message_tvb, proto_tree *message_tree) if (onoffevents > 0) { onofftree = proto_item_add_subtree(onoffitem, ett_onoffarray); for(i = 0;i < onoffevents;i++) { - onoffvalue = tvb_get_ntohl(message_tvb, offset_addflow_onoffeventarray + (sizeof(guint32) * i)); + onoffvalue = tvb_get_ntohl(message_tvb, offset_addflow_onoffeventarray + (int)(sizeof(guint32) * i)); proto_tree_add_uint_format(onofftree, hf_addflow_onoffeventarray, message_tvb, - offset_addflow_onoffeventarray + (sizeof(guint32) * i), sizeof(guint32), + offset_addflow_onoffeventarray + (int)(sizeof(guint32) * i), (int)sizeof(guint32), onoffvalue, "%1.3f s: set to %s", onoffvalue / 1000.0, (i & 1) ? "OFF" : "ON"); } } diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c index 0f1bb2bcc3..e785811335 100644 --- a/epan/dissectors/packet-nfs.c +++ b/epan/dissectors/packet-nfs.c @@ -1009,7 +1009,7 @@ nfs_name_snoop_init(void) } void -nfs_name_snoop_add_name(int xid, tvbuff_t *tvb, int name_offset, int name_len, int parent_offset, int parent_len, char *name) +nfs_name_snoop_add_name(int xid, tvbuff_t *tvb, int name_offset, int name_len, int parent_offset, int parent_len, const char *name) { nfs_name_snoop_t *nns, *old_nns; const char *ptr=NULL; @@ -2976,7 +2976,7 @@ dissect_sattr(tvbuff_t *tvb, int offset, proto_tree *tree, const char* name) /* RFC 1094, Page 17 */ static int -dissect_filename(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, char **string_ret) +dissect_filename(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, const char **string_ret) { offset = dissect_rpc_string(tvb, tree, hf, offset, string_ret); return offset; @@ -2985,7 +2985,7 @@ dissect_filename(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, char **str /* RFC 1094, Page 17 */ static int -dissect_path(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, char **name) +dissect_path(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, const char **name) { offset = dissect_rpc_string(tvb, tree, hf, offset, name); return offset; @@ -3044,7 +3044,7 @@ dissect_nfs2_getattr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, pr /* RFC 1094, Page 18 */ static int -dissect_diropargs(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char* label, guint32 *hash, char **name) +dissect_diropargs(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char* label, guint32 *hash, const char **name) { proto_item* diropargs_item = NULL; proto_tree* diropargs_tree = NULL; @@ -3089,7 +3089,7 @@ static int dissect_nfs2_rmdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 hash; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name); @@ -3103,7 +3103,7 @@ static int dissect_nfs2_remove_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 hash; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name); @@ -3117,7 +3117,7 @@ static int dissect_nfs2_lookup_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 hash; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name); @@ -3214,7 +3214,7 @@ dissect_nfs2_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, { guint32 status; const char *err; - char *name=NULL; + const char *name=NULL; offset = dissect_stat(tvb, offset, tree, &status); switch (status) { @@ -3330,7 +3330,7 @@ dissect_nfs2_mkdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 hash; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name); offset = dissect_sattr (tvb, offset, tree, "attributes"); @@ -3346,7 +3346,7 @@ dissect_nfs2_create_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 hash; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name); offset = dissect_sattr (tvb, offset, tree, "attributes"); @@ -3364,9 +3364,9 @@ dissect_nfs2_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 from_hash; - char *from_name=NULL; + const char *from_name=NULL; guint32 to_hash; - char *to_name=NULL; + const char *to_name=NULL; offset = dissect_diropargs(tvb, offset, pinfo, tree, "from", &from_hash, &from_name); offset = dissect_diropargs(tvb, offset, pinfo, tree, "to", &to_hash, &to_name); @@ -3385,7 +3385,7 @@ dissect_nfs2_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo, { guint32 from_hash; guint32 to_hash; - char *to_name=NULL; + const char *to_name=NULL; offset = dissect_fhandle(tvb, offset, pinfo, tree, "from", &from_hash); offset = dissect_diropargs(tvb, offset, pinfo, tree, "to", &to_hash, &to_name); @@ -3403,8 +3403,8 @@ dissect_nfs2_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 from_hash; - char *from_name=NULL; - char *to_name=NULL; + const char *from_name=NULL; + const char *to_name=NULL; offset = dissect_diropargs(tvb, offset, pinfo, tree, "from", &from_hash, &from_name); offset = dissect_path(tvb, offset, tree, hf_nfs_symlink_to, &to_name); @@ -3454,7 +3454,7 @@ dissect_readdir_entry(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, int old_offset = offset; guint32 fileid; guint32 cookie; - char *name; + const char *name; if (tree) { entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb, @@ -3642,7 +3642,7 @@ static const value_string nfsv2_proc_vals[] = { /* RFC 1813, Page 15 */ static int -dissect_filename3(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, char **string_ret) +dissect_filename3(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, const char **string_ret) { offset = dissect_rpc_string(tvb, tree, hf, offset, string_ret); return offset; @@ -3651,7 +3651,7 @@ dissect_filename3(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, char **st /* RFC 1813, Page 15 */ static int -dissect_nfspath3(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, char **name) +dissect_nfspath3(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, const char **name) { offset = dissect_rpc_string(tvb, tree, hf, offset, name); return offset; @@ -4545,7 +4545,7 @@ dissect_sattr3(tvbuff_t *tvb, int offset, proto_tree *tree, const char* name) static int dissect_diropargs3(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char* label, guint32 *hash, - char **name) + const char **name) { proto_item* diropargs3_item = NULL; proto_tree* diropargs3_tree = NULL; @@ -4598,7 +4598,7 @@ dissect_nfs3_remove_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 hash = 0; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs3(tvb, offset, pinfo, tree, "object", &hash, &name); @@ -4631,7 +4631,7 @@ dissect_nfs3_rmdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 hash = 0; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs3(tvb, offset, pinfo, tree, "object", &hash, &name); @@ -4782,7 +4782,7 @@ dissect_nfs3_lookup_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { guint32 hash = 0; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "what", &hash, &name); @@ -5086,7 +5086,7 @@ dissect_nfs3_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, { guint32 status; const char *err; - char *name=NULL; + const char *name=NULL; offset = dissect_nfsstat3(tvb, offset, tree, &status); switch (status) { @@ -5303,7 +5303,7 @@ dissect_nfs3_create_call(tvbuff_t *tvb, int offset, packet_info *pinfo, { guint32 mode; guint32 hash = 0; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "where", &hash, &name); offset = dissect_createmode3(tvb, offset, tree, &mode); @@ -5360,7 +5360,7 @@ dissect_nfs3_mkdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { guint32 hash = 0; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where", &hash, &name); offset = dissect_sattr3 (tvb, offset, tree, "attributes"); @@ -5406,8 +5406,8 @@ dissect_nfs3_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { guint32 from_hash = 0; - char *from_name=NULL; - char *to_name=NULL; + const char *from_name=NULL; + const char *to_name=NULL; offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where", &from_hash, &from_name); offset = dissect_sattr3 (tvb, offset, tree, "symlink_attributes"); @@ -5454,7 +5454,7 @@ dissect_nfs3_mknod_call(tvbuff_t *tvb, int offset, packet_info *pinfo, { guint32 type; guint32 hash = 0; - char *name=NULL; + const char *name=NULL; const char *type_str; offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where", &hash, &name); @@ -5564,9 +5564,9 @@ dissect_nfs3_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { guint32 from_hash = 0; - char *from_name=NULL; + const char *from_name=NULL; guint32 to_hash = 0; - char *to_name=NULL; + const char *to_name=NULL; offset = dissect_diropargs3(tvb, offset, pinfo, tree, "from", &from_hash, &from_name); offset = dissect_diropargs3(tvb, offset, pinfo, tree, "to", &to_hash, &to_name); @@ -5614,7 +5614,7 @@ dissect_nfs3_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo, { guint32 from_hash = 0; guint32 to_hash = 0; - char *to_name=NULL; + const char *to_name=NULL; offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "file", &from_hash); offset = dissect_diropargs3(tvb, offset, pinfo, tree, "link", &to_hash, &to_name); @@ -5684,7 +5684,7 @@ dissect_entry3(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_item* entry_item = NULL; proto_tree* entry_tree = NULL; int old_offset = offset; - char *name=NULL; + const char *name=NULL; if (tree) { entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb, @@ -5783,7 +5783,7 @@ dissect_entryplus3(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_item* entry_item = NULL; proto_tree* entry_tree = NULL; int old_offset = offset; - char *name=NULL; + const char *name=NULL; if (tree) { entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb, @@ -6268,7 +6268,7 @@ dissect_nfs_nfsstat4(tvbuff_t *tvb, int offset, static int dissect_nfs_utf8string(tvbuff_t *tvb, int offset, - proto_tree *tree, int hf, char **string_ret) + proto_tree *tree, int hf, const char **string_ret) { /* TODO: this dissector is subject to change; do not remove */ return dissect_rpc_string(tvb, tree, hf, offset, string_ret); @@ -7803,7 +7803,7 @@ static const value_string names_claim_type4[] = { /* XXX - need a better place to populate name than here, maybe? */ static int dissect_nfs_open_claim4(tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *tree, char **name) + proto_tree *tree, const char **name) { guint open_claim_type4; proto_item *fitem = NULL; @@ -7935,8 +7935,8 @@ dissect_nfs_openflag4(tvbuff_t *tvb, int offset, packet_info *pinfo, static int dissect_nfs_clientaddr4(tvbuff_t *tvb, int offset, proto_tree *tree) { - char *universal_ip_address = NULL; - char *protocol = NULL; + const char *universal_ip_address = NULL; + const char *protocol = NULL; guint b1, b2, b3, b4, b5, b6, b7, b8, b9, b10; guint16 port; int addr_offset; @@ -8992,7 +8992,7 @@ dissect_nfs_argop4(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *newftree = NULL; guint32 string_length; int cbprog; - char *name = NULL, *source_name = NULL, *dest_name=NULL; + const char *name = NULL, *source_name = NULL, *dest_name=NULL; const char *opname=NULL; guint32 last_fh_hash=0; guint32 saved_fh_hash=0; @@ -9612,7 +9612,7 @@ static int dissect_nfs4_compound_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { - char *tag=NULL; + const char *tag=NULL; offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, &tag); /* Display the NFSv4 tag. If it is empty, string generator will have returned "<EMPTY>", in which case don't display anything */ @@ -10050,7 +10050,7 @@ dissect_nfs4_compound_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { guint32 status; - char *tag=NULL; + const char *tag=NULL; offset = dissect_nfs_nfsstat4(tvb, offset, tree, &status); offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, &tag); @@ -10493,7 +10493,7 @@ dissect_nfs_cb_argop(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree * static int dissect_nfs_cb_compound_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { - char *tag=NULL; + const char *tag=NULL; offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, &tag); @@ -10592,7 +10592,7 @@ dissect_nfs_cb_compound_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { guint32 status; - char *tag=NULL; + const char *tag=NULL; offset = dissect_nfs_nfsstat4(tvb, offset, tree, &status); offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, &tag); diff --git a/epan/dissectors/packet-nfs.h b/epan/dissectors/packet-nfs.h index 7fdfdfd7dc..b8946ea398 100644 --- a/epan/dissectors/packet-nfs.h +++ b/epan/dissectors/packet-nfs.h @@ -183,7 +183,7 @@ extern int dissect_nfs_fh3(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_ int dissect_nfs_post_op_attr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char* name); -void nfs_name_snoop_add_name(int xid, tvbuff_t *tvb, int name_offset, int name_len, int parent_offset, int parent_len, char *name); +void nfs_name_snoop_add_name(int xid, tvbuff_t *tvb, int name_offset, int name_len, int parent_offset, int parent_len, const char *name); extern gboolean nfs_fhandle_reqrep_matching; diff --git a/epan/dissectors/packet-ntlmssp.c b/epan/dissectors/packet-ntlmssp.c index c9322d0c25..cdfb765b63 100644 --- a/epan/dissectors/packet-ntlmssp.c +++ b/epan/dissectors/packet-ntlmssp.c @@ -482,7 +482,7 @@ get_md4pass_list(md4_pass** p_pass_list, const char* nt_password) if ((nt_password[0] != '\0') && (strlen(nt_password) < 129)) { int password_len; nb_pass++; - password_len = strlen(nt_password); + password_len = (int)strlen(nt_password); str_to_unicode(nt_password, nt_password_unicode); crypt_md4(nt_password_hash, nt_password_unicode, password_len*2); } diff --git a/epan/dissectors/packet-oipf.c b/epan/dissectors/packet-oipf.c index 0369bf422e..176f7e3553 100644 --- a/epan/dissectors/packet-oipf.c +++ b/epan/dissectors/packet-oipf.c @@ -49,7 +49,7 @@ static int hf_oipf_ciplus_data = -1; for the dissector table directly, we have to process it as a string (the string must not be a local variable as glib stores a pointer to it in the hash table) */ -static gchar *sas_app_id_str_oipf = "0x0108113101190000"; +static const gchar sas_app_id_str_oipf[] = "0x0108113101190000"; static const value_string oipf_ciplus_cmd_id[] = { { 0x01, "send_msg" }, diff --git a/epan/dissectors/packet-p1.c b/epan/dissectors/packet-p1.c index 5561f16662..305b5d7085 100644 --- a/epan/dissectors/packet-p1.c +++ b/epan/dissectors/packet-p1.c @@ -8345,7 +8345,7 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_item *item=NULL; proto_tree *tree=NULL; int (*p1_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index _U_) = NULL; - char *p1_op_name; + const char *p1_op_name; int hf_p1_index = -1; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); diff --git a/epan/dissectors/packet-pcnfsd.c b/epan/dissectors/packet-pcnfsd.c index 1fb73533b4..fab3dd0d81 100644 --- a/epan/dissectors/packet-pcnfsd.c +++ b/epan/dissectors/packet-pcnfsd.c @@ -170,12 +170,18 @@ dissect_pcnfsd2_mapid_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, } /* "NFS Illustrated 14.7.13 */ -static void -pcnfsd_decode_obscure(char* data, int len) +static char * +pcnfsd_decode_obscure(const char* data, int len) { - for ( ; len>0 ; len--, data++) { - *data = (*data ^ 0x5b) & 0x7f; + char *decoded_buf; + char *decoded_data; + + decoded_buf = ep_alloc(len); + decoded_data = decoded_buf; + for ( ; len>0 ; len--, data++, decoded_data++) { + *decoded_data = (*data ^ 0x5b) & 0x7f; } + return decoded_buf; } @@ -185,10 +191,11 @@ dissect_pcnfsd2_auth_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { int newoffset; - char *ident = NULL; + const char *ident = NULL; + const char *ident_decoded; proto_item *ident_item = NULL; proto_tree *ident_tree = NULL; - char *password = NULL; + const char *password = NULL; proto_item *password_item = NULL; proto_tree *password_tree = NULL; @@ -210,13 +217,15 @@ dissect_pcnfsd2_auth_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, if (ident) { /* Only attempt to decode the ident if it has been specified */ - if (strcmp(ident, RPC_STRING_EMPTY)) - pcnfsd_decode_obscure(ident, (int)strlen(ident)); + if (strcmp(ident, RPC_STRING_EMPTY) != 0) + ident_decoded = pcnfsd_decode_obscure(ident, (int)strlen(ident)); + else + ident_decoded = ident; if (ident_tree) proto_tree_add_string(ident_tree, hf_pcnfsd_auth_ident_clear, - tvb, offset+4, (gint)strlen(ident), ident); + tvb, offset+4, (gint)strlen(ident_decoded), ident_decoded); } if (ident_item) { proto_item_set_text(ident_item, "Authentication Ident: %s", diff --git a/epan/dissectors/packet-pgm.c b/epan/dissectors/packet-pgm.c index dd01a5c086..9e4b77e976 100644 --- a/epan/dissectors/packet-pgm.c +++ b/epan/dissectors/packet-pgm.c @@ -505,7 +505,7 @@ dissect_pgmopts(ptvcursor_t* cursor, const char *pktname) tvb_memcpy(tvb, (guint8 *)naklist, ptvcursor_current_offset(cursor), optdata_len); firsttime = TRUE; soffset = 0; - naks = (optdata_len/sizeof(guint32)); + naks = (int)(optdata_len/sizeof(guint32)); nakbuf = ep_alloc(8192); j = 0; /* diff --git a/epan/dissectors/packet-pkix1explicit.h b/epan/dissectors/packet-pkix1explicit.h index 1dc24139a4..27b3c569b5 100644 --- a/epan/dissectors/packet-pkix1explicit.h +++ b/epan/dissectors/packet-pkix1explicit.h @@ -35,7 +35,9 @@ int dissect_pkix1explicit_Certificate(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index); int dissect_pkix1explicit_CertificateList(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index); +#if 0 int dissect_pkix1explicit_CertificateSerialNumber(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index); +#endif int dissect_pkix1explicit_Name(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index); int dissect_pkix1explicit_GeneralName(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index); int dissect_pkix1explicit_AlgorithmIdentifier(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx,proto_tree *tree, int hf_index); @@ -63,7 +65,7 @@ int dissect_pkix1explicit_TerminalType(gboolean implicit_tag _U_, tvbuff_t *tvb int dissect_pkix1explicit_TeletexDomainDefinedAttribute(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_); /*--- End of included file: packet-pkix1explicit-exp.h ---*/ -#line 38 "../../asn1/pkix1explicit/packet-pkix1explicit-template.h" +#line 40 "../../asn1/pkix1explicit/packet-pkix1explicit-template.h" #endif /* PACKET_PKIX1EXPLICIT_H */ diff --git a/epan/dissectors/packet-reload-framing.c b/epan/dissectors/packet-reload-framing.c index 2e659dceeb..60c0b3466a 100644 --- a/epan/dissectors/packet-reload-framing.c +++ b/epan/dissectors/packet-reload-framing.c @@ -185,14 +185,14 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if (type==DATA) { transaction_id_key[1].length = 1; transaction_id_key[1].key = &pinfo->srcport; - transaction_id_key[2].length = (pinfo->src.len) / sizeof(guint32); + transaction_id_key[2].length = (pinfo->src.len) / (guint)sizeof(guint32); transaction_id_key[2].key = g_malloc(pinfo->src.len); memcpy(transaction_id_key[2].key, pinfo->src.data, pinfo->src.len); } else { transaction_id_key[1].length = 1; transaction_id_key[1].key = &pinfo->destport; - transaction_id_key[2].length = (pinfo->dst.len) / sizeof(guint32); + transaction_id_key[2].length = (pinfo->dst.len) / (guint)sizeof(guint32); transaction_id_key[2].key = g_malloc(pinfo->dst.len); memcpy(transaction_id_key[2].key, pinfo->dst.data, pinfo->dst.len); } diff --git a/epan/dissectors/packet-reload.c b/epan/dissectors/packet-reload.c index 4ee8469f4c..0296a6c9fb 100644 --- a/epan/dissectors/packet-reload.c +++ b/epan/dissectors/packet-reload.c @@ -687,24 +687,24 @@ typedef struct _Kind { } kind_t; static kind_t predefined_kinds[] = { - {"INVALID" ,DATAKINDID_INVALID, -1}, - {"SIP-REGISTRATION" ,DATAKINDID_SIP_REGISTRATION, DATAMODEL_DICTIONARY}, - {"TURN-SERVICE" ,DATAKINDID_TURNSERVICE, DATAMODEL_SINGLE}, - {"CERTIFICATE_BY_NODE" ,DATAKINDID_CERTIFICATE_BY_NODE, DATAMODEL_ARRAY}, - {"RESERVED_ROUTING_TABLE_SIZE" ,DATAKINDID_RESERVED_ROUTING_TABLE_SIZE, -1}, - {"RESERVED_SOFTWARE_VERSION" ,DATAKINDID_RESERVED_SOFTWARE_VERSION, -1}, - {"RESERVED_MACHINE_UPTIME" ,DATAKINDID_RESERVED_MACHINE_UPTIME, -1}, - {"DATAKINDID_RESERVED_APP_UPTIME" ,DATAKINDID_RESERVED_APP_UPTIME, -1}, - {"RESERVED_MEMORY_FOOTPRINT" ,DATAKINDID_RESERVED_MEMORY_FOOTPRINT, -1}, - {"RESERVED_DATASIZE_STORED" ,DATAKINDID_RESERVED_DATASIZE_STORED, -1}, - {"RESERVED_INSTANCES_STORED" ,DATAKINDID_RESERVED_INSTANCES_STORED, -1}, - {"RESERVED_MESSAGES_SENT_RCVD" ,DATAKINDID_RESERVED_MESSAGES_SENT_RCVD, -1}, - {"RESERVED_EWMA_BYTES_SENT" ,DATAKINDID_RESERVED_EWMA_BYTES_SENT, -1}, - {"RESERVED_EWMA_BYTES_RCVD" ,DATAKINDID_RESERVED_EWMA_BYTES_RCVD, -1}, - {"RESERVED_LAST_CONTACT" ,DATAKINDID_RESERVED_LAST_CONTACT, -1}, - {"RESERVED_RTT" ,DATAKINDID_RESERVED_RTT, -1}, - {"CERTIFICATE_BY_USER" ,DATAKINDID_CERTIFICATE_BY_USER, DATAMODEL_ARRAY}, - {"REDIR" ,DATAKINDID_REDIR, DATAMODEL_DICTIONARY}, + {(gchar *)"INVALID" ,DATAKINDID_INVALID, -1}, + {(gchar *)"SIP-REGISTRATION" ,DATAKINDID_SIP_REGISTRATION, DATAMODEL_DICTIONARY}, + {(gchar *)"TURN-SERVICE" ,DATAKINDID_TURNSERVICE, DATAMODEL_SINGLE}, + {(gchar *)"CERTIFICATE_BY_NODE" ,DATAKINDID_CERTIFICATE_BY_NODE, DATAMODEL_ARRAY}, + {(gchar *)"RESERVED_ROUTING_TABLE_SIZE" ,DATAKINDID_RESERVED_ROUTING_TABLE_SIZE, -1}, + {(gchar *)"RESERVED_SOFTWARE_VERSION" ,DATAKINDID_RESERVED_SOFTWARE_VERSION, -1}, + {(gchar *)"RESERVED_MACHINE_UPTIME" ,DATAKINDID_RESERVED_MACHINE_UPTIME, -1}, + {(gchar *)"DATAKINDID_RESERVED_APP_UPTIME" ,DATAKINDID_RESERVED_APP_UPTIME, -1}, + {(gchar *)"RESERVED_MEMORY_FOOTPRINT" ,DATAKINDID_RESERVED_MEMORY_FOOTPRINT, -1}, + {(gchar *)"RESERVED_DATASIZE_STORED" ,DATAKINDID_RESERVED_DATASIZE_STORED, -1}, + {(gchar *)"RESERVED_INSTANCES_STORED" ,DATAKINDID_RESERVED_INSTANCES_STORED, -1}, + {(gchar *)"RESERVED_MESSAGES_SENT_RCVD" ,DATAKINDID_RESERVED_MESSAGES_SENT_RCVD, -1}, + {(gchar *)"RESERVED_EWMA_BYTES_SENT" ,DATAKINDID_RESERVED_EWMA_BYTES_SENT, -1}, + {(gchar *)"RESERVED_EWMA_BYTES_RCVD" ,DATAKINDID_RESERVED_EWMA_BYTES_RCVD, -1}, + {(gchar *)"RESERVED_LAST_CONTACT" ,DATAKINDID_RESERVED_LAST_CONTACT, -1}, + {(gchar *)"RESERVED_RTT" ,DATAKINDID_RESERVED_RTT, -1}, + {(gchar *)"CERTIFICATE_BY_USER" ,DATAKINDID_CERTIFICATE_BY_USER, DATAMODEL_ARRAY}, + {(gchar *)"REDIR" ,DATAKINDID_REDIR, DATAMODEL_DICTIONARY}, }; diff --git a/epan/dissectors/packet-rpc.c b/epan/dissectors/packet-rpc.c index 26feaa2104..5d58477515 100644 --- a/epan/dissectors/packet-rpc.c +++ b/epan/dissectors/packet-rpc.c @@ -553,7 +553,7 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset, packet_info *pinfo, int hfindex, gboolean fixed_length, guint32 length, - gboolean string_data, char **string_buffer_ret, + gboolean string_data, const char **string_buffer_ret, dissect_function_t *dissect_it) { int data_offset; @@ -576,7 +576,7 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset, /* int string_item_offset; */ char *string_buffer = NULL; - char *string_buffer_print = NULL; + const char *string_buffer_print = NULL; if (fixed_length) { string_length = length; @@ -734,7 +734,7 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset, int dissect_rpc_string(tvbuff_t *tvb, proto_tree *tree, - int hfindex, int offset, char **string_buffer_ret) + int hfindex, int offset, const char **string_buffer_ret) { offset = dissect_rpc_opaque_data(tvb, offset, tree, NULL, hfindex, FALSE, 0, TRUE, string_buffer_ret, NULL); @@ -755,7 +755,7 @@ dissect_rpc_data(tvbuff_t *tvb, proto_tree *tree, int dissect_rpc_bytes(tvbuff_t *tvb, proto_tree *tree, int hfindex, int offset, guint32 length, - gboolean string_data, char **string_buffer_ret) + gboolean string_data, const char **string_buffer_ret) { offset = dissect_rpc_opaque_data(tvb, offset, tree, NULL, hfindex, TRUE, length, string_data, string_buffer_ret, NULL); diff --git a/epan/dissectors/packet-rpc.h b/epan/dissectors/packet-rpc.h index 32d30f56b0..82711f7a94 100644 --- a/epan/dissectors/packet-rpc.h +++ b/epan/dissectors/packet-rpc.h @@ -151,19 +151,19 @@ extern unsigned int rpc_roundup(unsigned int a); extern int dissect_rpc_bool(tvbuff_t *tvb, proto_tree *tree, int hfindex, int offset); extern int dissect_rpc_string(tvbuff_t *tvb, - proto_tree *tree, int hfindex, int offset, char **string_buffer_ret); + proto_tree *tree, int hfindex, int offset, const char **string_buffer_ret); int dissect_rpc_opaque_data(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo, int hfindex, gboolean fixed_length, guint32 length, - gboolean string_data, char **string_buffer_ret, + gboolean string_data, const char **string_buffer_ret, dissect_function_t *dissect_it); extern int dissect_rpc_data(tvbuff_t *tvb, proto_tree *tree, int hfindex, int offset); extern int dissect_rpc_bytes(tvbuff_t *tvb, proto_tree *tree, int hfindex, int offset, guint32 length, - gboolean string_data, char **string_buffer_ret); + gboolean string_data, const char **string_buffer_ret); extern int dissect_rpc_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, dissect_function_t *rpc_list_dissector); extern int dissect_rpc_array(tvbuff_t *tvb, packet_info *pinfo, diff --git a/epan/dissectors/packet-rsvp.c b/epan/dissectors/packet-rsvp.c index c40d888477..00b36951ce 100644 --- a/epan/dissectors/packet-rsvp.c +++ b/epan/dissectors/packet-rsvp.c @@ -3829,9 +3829,9 @@ dissect_glabel_lambda(proto_tree *ti _U_, proto_tree *rsvp_object_tree, tvbuff_t *tvb, int offset) { - float freq = 0.0; + float freq = 0.0f; guint32 wavelength = 0; - float cs_thz = 0.0; + float cs_thz = 0.0f; guint8 grid = ((tvb_get_guint8(tvb, offset) & 0xE0) >> 5); guint8 cs = ((tvb_get_guint8(tvb, offset) & 0x1E) >> 1); diff --git a/epan/dissectors/packet-rtcp.c b/epan/dissectors/packet-rtcp.c index c34f19e6b6..25be5b4b9b 100644 --- a/epan/dissectors/packet-rtcp.c +++ b/epan/dissectors/packet-rtcp.c @@ -587,7 +587,7 @@ static void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static gboolean global_rtcp_show_roundtrip_calculation = FALSE; #define MIN_ROUNDTRIP_TO_REPORT_DEFAULT 10 static guint global_rtcp_show_roundtrip_calculation_minimum = MIN_ROUNDTRIP_TO_REPORT_DEFAULT; -static void remember_outgoing_sr(packet_info *pinfo, long lsr); +static void remember_outgoing_sr(packet_info *pinfo, guint32 lsr); static void calculate_roundtrip_delay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 lsr, guint32 dlsr); static void add_roundtrip_delay_info(tvbuff_t *tvb, packet_info *pinfo, @@ -2542,7 +2542,7 @@ void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Update conversation data to record time that outgoing rr/sr was sent */ -static void remember_outgoing_sr(packet_info *pinfo, long lsr) +static void remember_outgoing_sr(packet_info *pinfo, guint32 lsr) { conversation_t *p_conv; struct _rtcp_conversation_info *p_conv_data; diff --git a/epan/dissectors/packet-rtp-midi.c b/epan/dissectors/packet-rtp-midi.c index e91ce261df..4533b25050 100644 --- a/epan/dissectors/packet-rtp-midi.c +++ b/epan/dissectors/packet-rtp-midi.c @@ -2914,7 +2914,7 @@ decodetime(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int guint8 octet; unsigned int consumed; unsigned int i; - unsigned long deltatime; + unsigned int deltatime; consumed = 0; deltatime = 0; @@ -7115,7 +7115,7 @@ decode_sj_chapter_x( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un guint8 header; guint8 octet; unsigned int consumed = 0; - unsigned long cmdlen = 0; + unsigned int cmdlen = 0; unsigned int i; /* Can we read this chapter's header? */ @@ -7165,8 +7165,8 @@ decode_sj_chapter_x( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un } if ( header & RTP_MIDI_SJ_CHAPTER_X_FLAG_F ) { - unsigned long field = 0; - unsigned long fieldlen = 0; + unsigned int field = 0; + unsigned int fieldlen = 0; /* FIRST is "compressed" using only the necessary amount of octets, like delta-time */ for ( i=0; i < 4; i++ ) { diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c index 9d2a61f561..7f27212bfe 100644 --- a/epan/dissectors/packet-rtps.c +++ b/epan/dissectors/packet-rtps.c @@ -579,17 +579,17 @@ static void rtps_util_add_long(proto_tree *, tvbuff_t *, gint, int, int, gboolean, gboolean, const char *, guint8 *, size_t); static void rtps_util_add_port(proto_tree *, tvbuff_t *, - gint, int, char *, guint8 *, gint); + gint, int, const char *, guint8 *, gint); static void rtps_util_add_boolean(proto_tree *, tvbuff_t *, - gint, char *, guint8 *, size_t); + gint, const char *, guint8 *, size_t); static void rtps_util_add_durability_service_qos(proto_tree *, tvbuff_t *, gint, int, guint8 *, gint); static void rtps_util_add_liveliness_qos(proto_tree *, tvbuff_t *, gint, int, guint8 *, gint); static void rtps_util_add_kind_qos(proto_tree *, tvbuff_t *, - gint, int, char *, const value_string *, guint8 *, size_t); + gint, int, const char *, const value_string *, guint8 *, size_t); static gint rtps_util_add_seq_string(proto_tree *, tvbuff_t *, - gint, int, int, char *, guint8 *, gint); + gint, int, int, const char *, guint8 *, gint); static void rtps_util_add_seq_octets(proto_tree *, tvbuff_t *, gint, int, int, int, guint8 *, gint); static int rtps_util_add_bitmap(proto_tree *, tvbuff_t *, @@ -597,7 +597,7 @@ static int rtps_util_add_bitmap(proto_tree *, tvbuff_t *, static void rtps_util_decode_flags(proto_tree *, tvbuff_t *, gint, guint8, const struct Flag_definition *); static gint rtps_util_add_seq_ulong(proto_tree *, tvbuff_t *, - gint, int, int, int, int, char *); + gint, int, int, int, int, const char *); @@ -1624,7 +1624,7 @@ static void rtps_util_add_port(proto_tree *tree, /* Can be NULL */ tvbuff_t * tvb, gint offset, gboolean little_endian, - char * label, + const char *label, guint8 * buffer, /* Can be NULL */ gint buffer_size) { guint8 tempBuffer[MAX_PORT_SIZE]; @@ -1659,7 +1659,7 @@ static void rtps_util_add_port(proto_tree *tree, /* Can be NULL */ static void rtps_util_add_boolean(proto_tree *tree, /* Can be NULL */ tvbuff_t * tvb, gint offset, - char * label, + const char *label, guint8 * buffer, /* Can be NULL */ size_t buffer_size) { const char *str; @@ -1807,7 +1807,7 @@ static void rtps_util_add_kind_qos(proto_tree *tree, /* Can be NULL */ tvbuff_t * tvb, gint offset, gboolean little_endian, - char * label, + const char *label, const value_string *vals, guint8 * buffer, /* Can be NULL */ size_t buffer_size) { @@ -1841,7 +1841,7 @@ static gint rtps_util_add_seq_string(proto_tree *tree, /* Can NOT be NULL */ gint offset, gboolean little_endian, int param_length, - char * label, + const char *label, guint8 * buffer, /* Can NOT be NULL */ gint buffer_size) { guint32 num_strings; @@ -1906,7 +1906,7 @@ static gint rtps_util_add_seq_ulong(proto_tree *tree, /* Can NOT be NULL */ int param_length, int is_hex, int is_signed, - char * label) { + const char *label) { guint32 num_elem; guint32 i; proto_tree *string_tree; diff --git a/epan/dissectors/packet-rtps2.c b/epan/dissectors/packet-rtps2.c index 354bee833f..a5c6f06d27 100644 --- a/epan/dissectors/packet-rtps2.c +++ b/epan/dissectors/packet-rtps2.c @@ -754,17 +754,17 @@ static guint16 rtps_util_add_short(proto_tree *, tvbuff_t *, gint, int, int, gboolean, gboolean, const char *, guint8 *, gint); static void rtps_util_add_port(proto_tree *, tvbuff_t *, - gint, int, char *, guint8 *, gint); + gint, int, const char *, guint8 *, gint); static void rtps_util_add_boolean(proto_tree *, tvbuff_t *, - gint, char *, guint8 *, size_t); + gint, const char *, guint8 *, size_t); static void rtps_util_add_durability_service_qos(proto_tree *, tvbuff_t *, gint, int, guint8 *, gint); static void rtps_util_add_liveliness_qos(proto_tree *, tvbuff_t *, gint, int, guint8 *, gint); static void rtps_util_add_kind_qos(proto_tree *, tvbuff_t *, - gint, int, char *, const value_string *, guint8 *, size_t); + gint, int, const char *, const value_string *, guint8 *, size_t); static gint rtps_util_add_seq_string(proto_tree *, tvbuff_t *, - gint, int, int, char *, guint8 *, gint); + gint, int, int, const char *, guint8 *, gint); static void rtps_util_add_seq_octets(proto_tree *, tvbuff_t *, gint, int, int, int, guint8 *, gint); static int rtps_util_add_bitmap(proto_tree *, tvbuff_t *, @@ -776,7 +776,7 @@ static void rtps_util_decode_flags(proto_tree *, tvbuff_t *, static void rtps_util_decode_flags_16bit(proto_tree *, tvbuff_t *, gint, guint16, const struct Flag_definition *); static gint rtps_util_add_seq_ulong(proto_tree *, tvbuff_t *, - gint, int, int, int, int, char *); + gint, int, int, int, int, const char *); static void rtps_util_add_extra_flags(proto_tree *, tvbuff_t *, gint, const char *); @@ -1914,7 +1914,7 @@ static void rtps_util_add_port(proto_tree *tree, tvbuff_t * tvb, gint offset, gboolean little_endian, - char * label, + const char *label, guint8 * buffer, /* Can be NULL */ gint buffer_size) { guint8 tempBuffer[MAX_PORT_SIZE]; @@ -1949,7 +1949,7 @@ static void rtps_util_add_port(proto_tree *tree, static void rtps_util_add_boolean(proto_tree *tree, tvbuff_t * tvb, gint offset, - char * label, + const char *label, guint8 * buffer, /* Can be NULL */ size_t buffer_size) { const char *str; @@ -2098,7 +2098,7 @@ static void rtps_util_add_kind_qos(proto_tree *tree, tvbuff_t * tvb, gint offset, gboolean little_endian, - char * label, + const char *label, const value_string *vals, guint8 * buffer, /* Can be NULL */ size_t buffer_size) { @@ -2132,7 +2132,7 @@ static gint rtps_util_add_seq_string(proto_tree *tree, gint offset, gboolean little_endian, int param_length, - char * label, + const char *label, guint8 * buffer, /* Can NOT be NULL */ gint buffer_size) { guint32 num_strings; @@ -2202,7 +2202,7 @@ static gint rtps_util_add_seq_ulong(proto_tree *tree, int param_length, int is_hex, int is_signed, - char * label) { + const char *label) { guint32 num_elem; guint32 i; proto_tree *string_tree; diff --git a/epan/dissectors/packet-rtse.c b/epan/dissectors/packet-rtse.c index f901c256ec..9b5c2065c5 100644 --- a/epan/dissectors/packet-rtse.c +++ b/epan/dissectors/packet-rtse.c @@ -266,7 +266,7 @@ static int dissect_rtse_T_open(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 53 "../../asn1/rtse/rtse.cnf" - char *oid = NULL; + const char *oid = NULL; switch(app_proto) { case 1: /* mts-transfer-protocol-1984 */ @@ -526,7 +526,7 @@ dissect_rtse_RefuseReason(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs static int dissect_rtse_T_userDataRJ(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 9 "../../asn1/rtse/rtse.cnf" - char *oid = NULL; + const char *oid = NULL; switch(app_proto) { case 1: /* mts-transfer-protocol-1984 */ diff --git a/epan/dissectors/packet-rtsp.c b/epan/dissectors/packet-rtsp.c index 0d19104caf..d2e464b08e 100644 --- a/epan/dissectors/packet-rtsp.c +++ b/epan/dissectors/packet-rtsp.c @@ -460,7 +460,7 @@ is_rtsp_request_or_reply(const guchar *line, size_t linelen, rtsp_type_t *type) if (tokenlen >= 3) { memcpy(response_chars, next_token, 3); response_chars[3] = '\0'; - rtsp_stat_info->response_code = strtoul(response_chars, NULL, 10); + rtsp_stat_info->response_code = (guint)strtoul(response_chars, NULL, 10); } } return TRUE; @@ -678,7 +678,7 @@ rtsp_get_content_length(const guchar *line_begin, size_t line_len) up = p; if (up == tmp || (*up != '\0' && !isspace(*up))) return -1; /* not a valid number */ - return content_length; + return (int)content_length; } static const char rtsp_Session[] = "Session:"; @@ -1060,7 +1060,7 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, tvb_format_text(tvb, value_offset, value_len)); - offset = offset + STRLEN_CONST(rtsp_content_type); + offset = offset + (int)STRLEN_CONST(rtsp_content_type); /* Skip wsp */ offset = tvb_skip_wsp(tvb, offset, value_len); semi_colon_offset = tvb_find_guint8(tvb, value_offset, value_len, ';'); diff --git a/epan/dissectors/packet-sap.c b/epan/dissectors/packet-sap.c index ade2b6dc23..ca8f1c7d6b 100644 --- a/epan/dissectors/packet-sap.c +++ b/epan/dissectors/packet-sap.c @@ -135,7 +135,7 @@ dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) is_comp = vers_flags&MCAST_SAP_BIT_C; sap_version = (vers_flags&MCAST_SAP_VERSION_MASK)>>MCAST_SAP_VERSION_SHIFT; - addr_len = (is_ipv6) ? sizeof(struct e_in6_addr) : 4; + addr_len = (is_ipv6) ? (int)sizeof(struct e_in6_addr) : 4; if (check_col(pinfo->cinfo, COL_INFO)) { col_add_fstr(pinfo->cinfo, COL_INFO, "%s (v%u)", @@ -176,7 +176,7 @@ dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int has_pad; guint8 pad_len = 0; - auth_data_len = auth_len * sizeof(guint32); + auth_data_len = (guint32)(auth_len * sizeof(guint32)); sdi = proto_tree_add_item(sap_tree, hf_auth_data, tvb, offset, auth_data_len, ENC_NA); sa_tree = proto_item_add_subtree(sdi, ett_sap_auth); diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c index 8b59b97af7..0f271cdfd1 100644 --- a/epan/dissectors/packet-sdp.c +++ b/epan/dissectors/packet-sdp.c @@ -482,7 +482,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) for (n = 0; n < transport_info.media_count; n++) { if (transport_info.media_port[n] != NULL) { - port = atol(transport_info.media_port[n]); + port = (guint32)strtol(transport_info.media_port[n], NULL, 10); } if (transport_info.media_proto[n] != NULL) { /* Check if media protocol is RTP @@ -1189,9 +1189,9 @@ dissect_sdp_media(tvbuff_t *tvb, proto_item *ti, "RTP/AVP") == 0) { media_format = tvb_get_ephemeral_string(tvb, offset, tokenlen); proto_tree_add_string(sdp_media_tree, hf_media_format, tvb, offset, - tokenlen, val_to_str_ext(atol((char*)media_format), &rtp_payload_type_vals_ext, "%u")); + tokenlen, val_to_str_ext((guint32)strtoul((char*)media_format, NULL, 10), &rtp_payload_type_vals_ext, "%u")); idx = transport_info->media[transport_info->media_count].pt_count; - transport_info->media[transport_info->media_count].pt[idx] = atol((char*)media_format); + transport_info->media[transport_info->media_count].pt[idx] = (gint32)strtol((char*)media_format, NULL, 10); if (idx < (SDP_MAX_RTP_PAYLOAD_TYPES-1)) transport_info->media[transport_info->media_count].pt_count++; } else { @@ -1372,7 +1372,7 @@ decode_sdp_fmtp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset tokenlen = end_offset - offset; format_specific_parameter = tvb_get_ephemeral_string(tvb, offset, tokenlen); item = proto_tree_add_uint(tree, hf_sdp_fmtp_mpeg4_profile_level_id, tvb, offset, tokenlen, - atol((char*)format_specific_parameter)); + (guint32)strtol((char*)format_specific_parameter, NULL, 10)); PROTO_ITEM_SET_GENERATED(item); } else if (strcmp((char*)field_name, "config") == 0) { /* String including "=" */ @@ -1394,14 +1394,14 @@ decode_sdp_fmtp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset tokenlen = end_offset - offset; format_specific_parameter = tvb_get_ephemeral_string(tvb, offset, tokenlen); item = proto_tree_add_uint(tree, hf_sdp_fmtp_h263_profile, tvb, offset, tokenlen, - atol((char*)format_specific_parameter)); + (guint32)strtol((char*)format_specific_parameter, NULL, 10)); PROTO_ITEM_SET_GENERATED(item); } else if (strcmp((char*)field_name, "level") == 0) { offset++; tokenlen = end_offset - offset; format_specific_parameter = tvb_get_ephemeral_string(tvb, offset, tokenlen); item = proto_tree_add_uint(tree, hf_sdp_fmtp_h263_level, tvb, offset, tokenlen, - atol((char*)format_specific_parameter)); + (guint32)strtol((char*)format_specific_parameter, NULL, 10)); PROTO_ITEM_SET_GENERATED(item); } } @@ -1445,7 +1445,7 @@ decode_sdp_fmtp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset tokenlen = end_offset - offset; format_specific_parameter = tvb_get_ephemeral_string(tvb, offset, tokenlen); item = proto_tree_add_uint(tree, hf_sdp_h264_packetization_mode, tvb, offset, tokenlen, - atol((char*)format_specific_parameter)); + (guint32)strtol((char*)format_specific_parameter, NULL, 10)); PROTO_ITEM_SET_GENERATED(item); } else if (strcmp(field_name, "sprop-parameter-sets") == 0) { /* The value of the parameter is the @@ -1622,7 +1622,7 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto } key = se_alloc(sizeof (gint)); - *key = atol((char*)payload_type); + *key = (gint)strtol((char*)payload_type, NULL, 10); transport_info->encoding_name[pt] = (char*)tvb_get_ephemeral_string(tvb, offset, tokenlen); @@ -1665,7 +1665,7 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto } else { /* we create a new key and encoding_name to assign to the other hash tables */ gint *key2; key2 = se_alloc(sizeof (gint)); - *key2 = atol((char*)payload_type); + *key2 = (gint)strtol((char*)payload_type, NULL, 10); g_hash_table_insert(transport_info->media[n].rtp_dyn_payload, key2, encoding_name_and_rate); } diff --git a/epan/dissectors/packet-sflow.c b/epan/dissectors/packet-sflow.c index 94a8fbdd76..6d9b0c9578 100644 --- a/epan/dissectors/packet-sflow.c +++ b/epan/dissectors/packet-sflow.c @@ -1746,7 +1746,7 @@ dissect_sflow_24_flow_sample(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_text(tree, tvb, offset + 24, 4, "Output interface: ifIndex %u", output & 0x7fffffff); } - offset += sizeof (flow_header); + offset += (int)sizeof (flow_header); /* what kind of flow sample is it? */ packet_type = tvb_get_ntohl(tvb, offset); @@ -2421,7 +2421,7 @@ dissect_sflow_24_counters_sample(tvbuff_t *tvb, proto_tree *tree, gint offset, p val_to_str_const(g_ntohl(counters_header.counters_type), sflow_245_counterstype, "Unknown type")); - offset += sizeof (counters_header); + offset += (int)sizeof (counters_header); /* most counters types have the "generic" counters first */ switch (g_ntohl(counters_header.counters_type)) { @@ -2504,19 +2504,19 @@ dissect_sflow_24_counters_sample(tvbuff_t *tvb, proto_tree *tree, gint offset, p switch (g_ntohl(counters_header.counters_type)) { case SFLOW_245_COUNTERS_ETHERNET: tvb_memcpy(tvb, (guint8 *) & ethc, offset, sizeof (ethc)); - offset += sizeof (ethc); + offset += (int)sizeof (ethc); break; case SFLOW_245_COUNTERS_TOKENRING: tvb_memcpy(tvb, (guint8 *) & tokc, offset, sizeof (tokc)); - offset += sizeof (tokc); + offset += (int)sizeof (tokc); break; case SFLOW_245_COUNTERS_VG: tvb_memcpy(tvb, (guint8 *) & vgc, offset, sizeof (vgc)); - offset += sizeof (vgc); + offset += (int)sizeof (vgc); break; case SFLOW_245_COUNTERS_VLAN: tvb_memcpy(tvb, (guint8 *) & vlanc, offset, sizeof (vlanc)); - offset += sizeof (vlanc); + offset += (int)sizeof (vlanc); break; default: diff --git a/epan/dissectors/packet-simulcrypt.c b/epan/dissectors/packet-simulcrypt.c index e45d6096f5..6a368a60bc 100644 --- a/epan/dissectors/packet-simulcrypt.c +++ b/epan/dissectors/packet-simulcrypt.c @@ -51,7 +51,7 @@ typedef struct Tecm_interpretation { int ca_system_id; - char *protocol_name; + const char *protocol_name; dissector_handle_t protocol_handle; guint ecmg_port; } ecm_interpretation; diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index a9069f1116..1619db612f 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -1665,7 +1665,7 @@ dissect_sip_reason_header(tvbuff_t *tvb, proto_tree *tree, gint start_offset, gi length = line_end_offset - current_offset; /* q850_cause_code_vals */ - cause_value = strtoul(tvb_get_ephemeral_string(tvb, current_offset, length), NULL, 10); + cause_value = (guint)strtoul(tvb_get_ephemeral_string(tvb, current_offset, length), NULL, 10); proto_tree_add_text(tree, tvb, current_offset, length, "Cause: %u(0x%x)[%s]", cause_value,cause_value, val_to_str_ext(cause_value, &q850_cause_code_vals_ext, "Unknown (%d)" )); @@ -2679,7 +2679,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr { proto_tree_add_uint(rack_tree, hf_sip_rack_rseq_no, tvb, value_offset, sub_value_offset, - strtoul(value, NULL, 10)); + (guint32)strtoul(value, NULL, 10)); break; } } @@ -2703,7 +2703,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr proto_tree_add_uint(rack_tree, hf_sip_rack_cseq_no, tvb, value_offset+cseq_no_offset, sub_value_offset-cseq_no_offset, - strtoul(value+cseq_no_offset, NULL, 10)); + (guint32)strtoul(value+cseq_no_offset, NULL, 10)); break; } } @@ -2827,7 +2827,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr sip_element_item = proto_tree_add_uint(hdr_tree, hf_header_array[hf_index], tvb, offset, next_offset - offset, - strtoul(value, NULL, 10)); + (guint32)strtoul(value, NULL, 10)); } break; diff --git a/epan/dissectors/packet-smpp.c b/epan/dissectors/packet-smpp.c index 2f8d989f14..922299920e 100644 --- a/epan/dissectors/packet-smpp.c +++ b/epan/dissectors/packet-smpp.c @@ -1240,11 +1240,11 @@ smpp_handle_string(proto_tree *tree, tvbuff_t *tvb, int field, int *offset) } /* NOTE - caller must free the returned string! */ -static char * +static const char * smpp_handle_string_return(proto_tree *tree, tvbuff_t *tvb, int field, int *offset) { gint len; - char *str; + const char *str; len = tvb_strsize(tvb, *offset); if (len > 1) { @@ -1926,8 +1926,8 @@ submit_sm(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset = 0; guint8 flag, udhi; guint8 length; - char *src_str = NULL; - char *dst_str = NULL; + const char *src_str = NULL; + const char *dst_str = NULL; address save_src, save_dst; smpp_handle_string_z(tree, tvb, hf_smpp_service_type, &offset, "(Default)"); diff --git a/epan/dissectors/packet-smtp.c b/epan/dissectors/packet-smtp.c index 125b972ccf..a7e68a2966 100644 --- a/epan/dissectors/packet-smtp.c +++ b/epan/dissectors/packet-smtp.c @@ -550,7 +550,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ guint32 msg_len; - msg_len = strtoul (line+5, NULL, 10); + msg_len = (guint32)strtoul (line+5, NULL, 10); spd_frame_data->pdu_type = SMTP_PDU_CMD; session_state->data_seen = TRUE; diff --git a/epan/dissectors/packet-spice.c b/epan/dissectors/packet-spice.c index 4776a931ac..ac914e5cdb 100644 --- a/epan/dissectors/packet-spice.c +++ b/epan/dissectors/packet-spice.c @@ -1170,7 +1170,7 @@ dissect_RedCursor(tvbuff_t *tvb, proto_tree *tree, guint32 offset) offset += 2; type = dissect_CursorHeader(tvb, RedCursor_tree, offset, &width, &height); - offset += sizeof_CursorHeader; + offset += (int)sizeof_CursorHeader; if (((width == 0) || (height == 0)) || (flags == SPICE_CURSOR_FLAGS_FROM_CACHE)) { @@ -1545,7 +1545,7 @@ dissect_Image(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offse guint32 ImageSize = 0; const guint8 type = dissect_ImageDescriptor(tvb, tree, offset); - offset += sizeof_ImageDescriptor; + offset += (int)sizeof_ImageDescriptor; switch (type) { case IMAGE_TYPE_QUIC: @@ -1643,7 +1643,7 @@ dissect_RectList(tvbuff_t *tvb, proto_tree *tree, guint32 offset) offset += 4; for (i = 0; i < rectlist_size; i++ ) { dissect_SpiceRect(tvb, rectlist_tree, offset, i); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; } } @@ -1719,12 +1719,12 @@ dissect_Mask(tvbuff_t *tvb, proto_tree *tree, guint32 offset) ti = proto_tree_add_text(tree, tvb, offset, sizeof_Mask, "Mask"); Mask_tree = proto_item_add_subtree(ti, ett_Mask); - bitmap = tvb_get_letohl(tvb, offset + sizeof(point32_t) + 1); + bitmap = tvb_get_letohl(tvb, offset + (int)sizeof(point32_t) + 1); if (bitmap != 0) { proto_tree_add_item(Mask_tree, hf_Mask_flag, tvb, offset, 1, ENC_NA); offset += 1; dissect_POINT32(tvb, Mask_tree, offset); - offset += sizeof(point32_t); + offset += (int)sizeof(point32_t); proto_tree_add_item(Mask_tree, hf_Mask_bitmap, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_item_set_len(ti, sizeof_Mask + sizeof_ImageDescriptor); @@ -1734,7 +1734,7 @@ dissect_Mask(tvbuff_t *tvb, proto_tree *tree, guint32 offset) proto_tree_add_text(Mask_tree, tvb, offset, 1, "Mask flag - value irrelevant as bitmap address is 0"); offset += 1; proto_tree_add_text(Mask_tree, tvb, offset, sizeof(point32_t), "Point - value irrelevant as bitmap address is 0"); - offset += sizeof(point32_t); + offset += (int)sizeof(point32_t); proto_tree_add_item(Mask_tree, hf_Mask_bitmap, tvb, offset, 4, ENC_LITTLE_ENDIAN); } return sizeof_Mask; @@ -1798,9 +1798,9 @@ dissect_DisplayBase(tvbuff_t *tvb, proto_tree *tree, guint32 offset) offset += 4; rect = dissect_SpiceRect(tvb, DisplayBase_tree, offset, -1); proto_item_append_text(ti, " - SpiceRect box (%u-%u, %u-%u)",rect.left, rect.top, rect.right, rect.bottom); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; clip_type = dissect_Clip(tvb, DisplayBase_tree, offset); - offset += sizeof_Clip; + offset += (int)sizeof_Clip; if (clip_type == CLIP_TYPE_RECTS) { clip_size = dissect_RectList(tvb, DisplayBase_tree, offset); proto_item_set_len(ti, sizeof_DisplayBase + clip_size); @@ -2080,7 +2080,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo dissect_ID(tvb, tree, offset); offset += 4; dissect_SpiceRect(tvb, tree, offset, -1); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; data_size = dissect_Image(tvb, tree, pinfo, offset); offset += data_size; break; @@ -2093,7 +2093,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo displayBaseLen = dissect_DisplayBase(tvb, tree, offset); offset += displayBaseLen; dissect_POINT32(tvb, tree, offset); - offset += sizeof(point32_t); + offset += (int)sizeof(point32_t); break; case SPICE_DISPLAY_DRAW_WHITENESS: displayBaseLen = dissect_DisplayBase(tvb, tree, offset); @@ -2127,7 +2127,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo offset += 4; /* source area */ dissect_SpiceRect(tvb, tree, offset, -1); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; proto_tree_add_item(tree, hf_tranparent_src_color, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_tranparent_true_color, tvb, offset, 4, ENC_LITTLE_ENDIAN); @@ -2145,7 +2145,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo /* source area */ dissect_SpiceRect(tvb, tree, offset, -1); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; proto_tree_add_item(tree, hf_display_rop_descriptor, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; @@ -2167,7 +2167,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo /* source area */ dissect_SpiceRect(tvb, tree, offset, -1); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; data_size = dissect_Brush(tvb, tree, offset); offset += data_size; @@ -2192,7 +2192,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo offset += 4; r = dissect_SpiceRect(tvb, tree, offset, -1); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; if (!rect_is_empty(r)) { data_size = dissect_Brush(tvb, tree, offset); offset += data_size; @@ -2218,7 +2218,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo proto_tree_add_item(tree, hf_display_stream_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; clip_type = dissect_Clip(tvb, tree, offset); - offset += sizeof_Clip; + offset += (int)sizeof_Clip; if (clip_type == CLIP_TYPE_RECTS) { offset += dissect_RectList(tvb, tree, offset); } @@ -2243,9 +2243,9 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo proto_tree_add_item(tree, hf_display_stream_src_height, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; dissect_SpiceRect(tvb, tree, offset, -1); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; clip_type = dissect_Clip(tvb, tree, offset); - offset += sizeof_Clip; + offset += (int)sizeof_Clip; if (clip_type == CLIP_TYPE_RECTS) { offset += dissect_RectList(tvb, tree, offset); } @@ -2277,7 +2277,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo proto_tree_add_item(tree, hf_display_stream_height, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; dissect_SpiceRect(tvb, tree, offset, -1); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; proto_tree_add_item(tree, hf_display_stream_data_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; break; @@ -2387,7 +2387,7 @@ dissect_spice_cursor_server(tvbuff_t *tvb, proto_tree *tree, const guint16 messa switch (message_type) { case SPICE_CURSOR_INIT: dissect_POINT16(tvb, tree, offset); - offset += sizeof(point16_t); + offset += (int)sizeof(point16_t); proto_tree_add_item(tree, hf_cursor_trail_len, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; proto_tree_add_item(tree, hf_cursor_trail_freq, tvb, offset, 2, ENC_LITTLE_ENDIAN); @@ -2402,14 +2402,14 @@ dissect_spice_cursor_server(tvbuff_t *tvb, proto_tree *tree, const guint16 messa break; case SPICE_CURSOR_SET: dissect_POINT16(tvb, tree, offset); - offset += sizeof(point16_t); + offset += (int)sizeof(point16_t); offset +=1; /*TODO flags */ RedCursorSize = dissect_RedCursor(tvb, tree, offset); offset += RedCursorSize; break; case SPICE_CURSOR_MOVE: dissect_POINT16(tvb, tree, offset); - offset += sizeof(point16_t); + offset += (int)sizeof(point16_t); break; case SPICE_CURSOR_HIDE: proto_tree_add_text(tree, tvb, offset, 0, "CURSOR_HIDE message"); @@ -2698,7 +2698,7 @@ dissect_spice_inputs_client(tvbuff_t *tvb, proto_tree *tree, const guint16 messa ti = proto_tree_add_text(tree, tvb, offset, sizeof(point32_t) + 3, "Client MOUSE_POSITION message"); inputs_tree = proto_item_add_subtree(ti, ett_inputs_client); dissect_POINT32(tvb, inputs_tree, offset); - offset += sizeof(point32_t); + offset += (int)sizeof(point32_t); proto_tree_add_item(inputs_tree, hf_button_state, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; proto_tree_add_item(inputs_tree, hf_mouse_display_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); @@ -2708,7 +2708,7 @@ dissect_spice_inputs_client(tvbuff_t *tvb, proto_tree *tree, const guint16 messa ti = proto_tree_add_text(tree, tvb, offset, sizeof(point32_t) + 4, "Client MOUSE_MOTION message"); inputs_tree = proto_item_add_subtree(ti, ett_inputs_client); dissect_POINT32(tvb, inputs_tree, offset); - offset += sizeof(point32_t); + offset += (int)sizeof(point32_t); proto_tree_add_item(inputs_tree, hf_button_state, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; break; @@ -3094,7 +3094,7 @@ dissect_spice_link_server_pdu(tvbuff_t *tvb, proto_tree *tree, spice_conversatio common_caps_len = tvb_get_letohl(tvb, offset + 4 + SPICE_TICKET_PUBKEY_BYTES); channel_caps_len = tvb_get_letohl(tvb, offset + 8 + SPICE_TICKET_PUBKEY_BYTES); - offset += sizeof_SpiceLinkHeader + SPICE_TICKET_PUBKEY_BYTES; + offset += (int)sizeof_SpiceLinkHeader + SPICE_TICKET_PUBKEY_BYTES; if (common_caps_len > 0) { ti = proto_tree_add_text(tree, tvb, offset, common_caps_len * 4, diff --git a/epan/dissectors/packet-spnego.c b/epan/dissectors/packet-spnego.c index 69719b8c77..91e085715b 100644 --- a/epan/dissectors/packet-spnego.c +++ b/epan/dissectors/packet-spnego.c @@ -899,11 +899,11 @@ arcfour_mic_cksum(guint8 *key_data, int key_length, */ static int gssapi_verify_pad(unsigned char *wrapped_data, int wrapped_length, - size_t datalen, - size_t *padlen) + int datalen, + int *padlen) { unsigned char *pad; - size_t padlength; + int padlength; int i; pad = wrapped_data + wrapped_length - 1; @@ -930,14 +930,14 @@ decrypt_arcfour(packet_info *pinfo, { guint8 Klocaldata[16]; int ret; - size_t datalen; + int datalen; guint8 k6_data[16]; guint32 SND_SEQ[2]; guint8 Confounder[8]; guint8 cksum_data[8]; int cmp; int conf_flag; - size_t padlen = 0; + int padlen = 0; datalen = tvb_length(pinfo->gssapi_encrypted_tvb); diff --git a/epan/dissectors/packet-srvloc.c b/epan/dissectors/packet-srvloc.c index 6b88d5a6ba..640087c91d 100644 --- a/epan/dissectors/packet-srvloc.c +++ b/epan/dissectors/packet-srvloc.c @@ -443,7 +443,7 @@ add_v1_string(proto_tree *tree, int hf, tvbuff_t *tvb, int offset, int length, * * XXX - this is also used with CHARSET_UTF_8. Is that a cut-and-pasteo? */ -static guint8* +static const guint8* unicode_to_bytes(tvbuff_t *tvb, int offset, int length, gboolean endianness) { const guint8 *ascii_text = tvb_get_ephemeral_string(tvb, offset, length); @@ -505,10 +505,10 @@ static void attr_list(proto_tree *tree, int hf, tvbuff_t *tvb, int offset, int length, guint16 encoding) { - char *attr_type; + const char *attr_type; int i, svc, ss, type_len, foffset=offset; guint32 prot; - guint8 *byte_value; + const guint8 *byte_value; proto_item *ti; proto_tree *srvloc_tree; char *tmp; @@ -549,16 +549,15 @@ attr_list(proto_tree *tree, int hf, tvbuff_t *tvb, int offset, int length, attr_type = tvb_get_ephemeral_unicode_string(tvb, offset, type_len*2, ENC_BIG_ENDIAN); proto_tree_add_string(tree, hf, tvb, offset, type_len*2, attr_type); offset += (type_len*2)+2; - /* If this is the attribute svcname */ if (strcmp(attr_type, "svcname-ws")==0) { + /* This is the attribute svcname */ tmp = tvb_get_ephemeral_unicode_string(tvb, offset, length-offset, ENC_BIG_ENDIAN); type_len = (int)strcspn(tmp, ")"); add_v1_string(tree, hf_srvloc_srvrply_svcname, tvb, offset, type_len*2, encoding); offset += (type_len*2)+4; - attr_type[0] = '\0'; - } - /* If this is the attribute svcaddr */ - if (strcmp(attr_type, "svcaddr-ws")==0) { + attr_type = ""; + } else if (strcmp(attr_type, "svcaddr-ws")==0) { + /* This is the attribute svcaddr */ i=1; for (foffset = offset; foffset<length; foffset += 2) { @@ -582,7 +581,7 @@ attr_list(proto_tree *tree, int hf, tvbuff_t *tvb, int offset, int length, else { byte_value = unicode_to_bytes(tvb, foffset, 4, FALSE); /* UDP */ - prot = atol(byte_value); + prot = (guint32)strtoul(byte_value, NULL, 10); proto_tree_add_text(srvloc_tree, tvb, foffset, 4, "Protocol: %s", val_to_str_const(prot, srvloc_prot, "Unknown")); foffset += 4; @@ -591,7 +590,7 @@ attr_list(proto_tree *tree, int hf, tvbuff_t *tvb, int offset, int length, else { byte_value = unicode_to_bytes(tvb, foffset, 8, FALSE); /* IPX */ - prot = atol(byte_value); + prot = (guint32)strtoul(byte_value, NULL, 10); proto_tree_add_text(srvloc_tree, tvb, foffset, 8, "Protocol: %s", val_to_str_const(prot, srvloc_prot, "Unknown")); foffset += 8; @@ -620,10 +619,10 @@ attr_list(proto_tree *tree, int hf, tvbuff_t *tvb, int offset, int length, foffset += 57; } offset = foffset; - attr_type[0] = '\0'; + attr_type = ""; } /* If there are no more supported attributes available then abort dissection */ - if (strcmp(attr_type, "svcaddr-ws")!=0 && strcmp(attr_type, "svcname-ws")!=0 && strcmp(attr_type, "\0")!=0) { + if (strcmp(attr_type, "svcaddr-ws")!=0 && strcmp(attr_type, "svcname-ws")!=0 && strcmp(attr_type, "")!=0) { break; } } @@ -657,7 +656,7 @@ attr_list(proto_tree *tree, int hf, tvbuff_t *tvb, int offset, int length, { /* UDP */ byte_value = unicode_to_bytes(tvb, foffset, 2, FALSE); /* UDP */ - prot = atol(byte_value); + prot = (guint32)strtoul(byte_value, NULL, 10); proto_tree_add_text(srvloc_tree, tvb, foffset, 2, "Protocol: %s", val_to_str_const(prot, srvloc_prot, "Unknown")); foffset += 2; @@ -666,7 +665,7 @@ attr_list(proto_tree *tree, int hf, tvbuff_t *tvb, int offset, int length, else { byte_value = unicode_to_bytes(tvb, foffset, 4, FALSE); /* IPX */ - prot = atol(byte_value); + prot = (guint32)strtoul(byte_value, NULL, 10); proto_tree_add_text(srvloc_tree, tvb, foffset, 4, "Protocol: %s", val_to_str_const(prot, srvloc_prot, "Unknown")); foffset += 4; diff --git a/epan/dissectors/packet-ssl-utils.c b/epan/dissectors/packet-ssl-utils.c index bd078c48d2..ecf9144eb0 100644 --- a/epan/dissectors/packet-ssl-utils.c +++ b/epan/dissectors/packet-ssl-utils.c @@ -1910,7 +1910,7 @@ ssl3_prf(StringInfo* secret, const gchar* usage, return(0); } -static gint prf(SslDecryptSession* ssl,StringInfo* secret,gchar* usage,StringInfo* rnd1,StringInfo* rnd2,StringInfo* out) +static gint prf(SslDecryptSession* ssl,StringInfo* secret,const gchar* usage,StringInfo* rnd1,StringInfo* rnd2,StringInfo* out) { gint ret; if (ssl->version_netorder==SSLV3_VERSION){ @@ -2745,7 +2745,8 @@ ssl_load_key(FILE* fp) */ gnutls_x509_privkey_t priv_key; gnutls_datum_t key; - gint size, ret; + long size; + gint ret; guint bytes; Ssl_private_key_t *private_key = g_malloc0(sizeof(Ssl_private_key_t)); @@ -2770,7 +2771,7 @@ ssl_load_key(FILE* fp) return NULL; } key.data = g_malloc(size); - key.size = size; + key.size = (int)size; bytes = (guint) fread(key.data, 1, key.size, fp); if (bytes < key.size) { ssl_debug_printf("ssl_load_key: can't read from file %d bytes, got %d\n", diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c index 63caf9e15a..dbd259ee76 100644 --- a/epan/dissectors/packet-ssl.c +++ b/epan/dissectors/packet-ssl.c @@ -482,8 +482,6 @@ ssl_association_info_(gpointer key_ _U_, gpointer value_, gpointer s_) return FALSE; } -extern GTree* ssl_associations; - /** * @return an information string on the SSL protocol associations. The string has ephemeral lifetime/scope. */ diff --git a/epan/dissectors/packet-synphasor.c b/epan/dissectors/packet-synphasor.c index 7efbf1c16f..2a405c5d24 100644 --- a/epan/dissectors/packet-synphasor.c +++ b/epan/dissectors/packet-synphasor.c @@ -672,7 +672,7 @@ static gint dissect_header(tvbuff_t *tvb, proto_tree *tree) } /* forward declarations of helper functions for 'dissect_config_frame()' */ -static gint dissect_CHNAM (tvbuff_t *tvb, proto_tree *tree, gint offset, gint cnt, char *prefix); +static gint dissect_CHNAM (tvbuff_t *tvb, proto_tree *tree, gint offset, gint cnt, const char *prefix); static gint dissect_PHUNIT (tvbuff_t *tvb, proto_tree *tree, gint offset, gint cnt); static gint dissect_ANUNIT (tvbuff_t *tvb, proto_tree *tree, gint offset, gint cnt); static gint dissect_DIGUNIT(tvbuff_t *tvb, proto_tree *tree, gint offset, gint cnt); @@ -1171,7 +1171,7 @@ static gint dissect_DIGUNIT(tvbuff_t *tvb, proto_tree *tree, gint offset, gint c } /* used by 'dissect_config_frame()' to dissect the "channel name"-fields */ -static gint dissect_CHNAM(tvbuff_t *tvb, proto_tree *tree, gint offset, gint cnt, char *prefix) +static gint dissect_CHNAM(tvbuff_t *tvb, proto_tree *tree, gint offset, gint cnt, const char *prefix) { proto_item *temp_item = NULL; proto_tree *temp_tree = NULL; diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index 7d835e1e6f..d16c57455f 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -3415,7 +3415,7 @@ dissect_tcpopt_rvbd_probe(const ip_tcp_opt *optp _U_, tvbuff_t *tvb, int offset, if (tvb_memeql(tvb, offset + PROBE_V1_QUERY_LEN, qinfo_hdr, sizeof(qinfo_hdr)) == 0) { not_cfe = tvb_get_guint8(tvb, offset + PROBE_V1_QUERY_LEN + - sizeof(qinfo_hdr)) & RVBD_FLAGS_PROBE_NCFE; + (int)sizeof(qinfo_hdr)) & RVBD_FLAGS_PROBE_NCFE; } col_prepend_fstr(pinfo->cinfo, COL_INFO, "S%s, ", type == PROBE_TRACE ? "#" : diff --git a/epan/dissectors/packet-tds.c b/epan/dissectors/packet-tds.c index 83c1c947cd..130475d9df 100644 --- a/epan/dissectors/packet-tds.c +++ b/epan/dissectors/packet-tds.c @@ -1107,51 +1107,51 @@ dissect_tds7_login(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) td7hdr.total_packet_size = tvb_get_letohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_login_total_size, tvb, offset, sizeof(td7hdr.total_packet_size), td7hdr.total_packet_size); - offset += sizeof(td7hdr.total_packet_size); + offset += (int)sizeof(td7hdr.total_packet_size); td7hdr.tds_version = tvb_get_ntohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_version, tvb, offset, sizeof(td7hdr.tds_version), td7hdr.tds_version); - offset += sizeof(td7hdr.tds_version); + offset += (int)sizeof(td7hdr.tds_version); td7hdr.packet_size = tvb_get_ntohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_packet_size, tvb, offset, sizeof(td7hdr.packet_size), td7hdr.packet_size); - offset += sizeof(td7hdr.packet_size); + offset += (int)sizeof(td7hdr.packet_size); td7hdr.client_version = tvb_get_ntohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_client_version, tvb, offset, sizeof(td7hdr.client_version), td7hdr.client_version); - offset += sizeof(td7hdr.client_version); + offset += (int)sizeof(td7hdr.client_version); td7hdr.client_pid = tvb_get_letohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_client_pid, tvb, offset, sizeof(td7hdr.client_pid), td7hdr.client_pid); - offset += sizeof(td7hdr.client_pid); + offset += (int)sizeof(td7hdr.client_pid); td7hdr.connection_id= tvb_get_letohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_connection_id, tvb, offset, sizeof(td7hdr.connection_id), td7hdr.connection_id); - offset += sizeof(td7hdr.connection_id); + offset += (int)sizeof(td7hdr.connection_id); td7hdr.option_flags1 = tvb_get_guint8(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_option_flags1, tvb, offset, sizeof(td7hdr.option_flags1), td7hdr.option_flags1); - offset += sizeof(td7hdr.option_flags1); + offset += (int)sizeof(td7hdr.option_flags1); td7hdr.option_flags2 = tvb_get_guint8(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_option_flags2, tvb, offset, sizeof(td7hdr.option_flags2), td7hdr.option_flags2); - offset += sizeof(td7hdr.option_flags2); + offset += (int)sizeof(td7hdr.option_flags2); td7hdr.sql_type_flags = tvb_get_guint8(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_sql_type_flags, tvb, offset, sizeof(td7hdr.sql_type_flags), td7hdr.sql_type_flags); - offset += sizeof(td7hdr.sql_type_flags); + offset += (int)sizeof(td7hdr.sql_type_flags); td7hdr.reserved_flags = tvb_get_guint8(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_reserved_flags, tvb, offset, sizeof(td7hdr.reserved_flags), td7hdr.reserved_flags); - offset += sizeof(td7hdr.reserved_flags); + offset += (int)sizeof(td7hdr.reserved_flags); td7hdr.time_zone = tvb_get_ntohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_time_zone, tvb, offset, sizeof(td7hdr.time_zone), td7hdr.time_zone); - offset += sizeof(td7hdr.time_zone); + offset += (int)sizeof(td7hdr.time_zone); td7hdr.collation = tvb_get_ntohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_collation, tvb, offset, sizeof(td7hdr.collation), td7hdr.collation); - offset += sizeof(td7hdr.collation); + offset += (int)sizeof(td7hdr.collation); length_hdr = proto_tree_add_text(login_tree, tvb, offset, 50, "Lengths and offsets"); length_tree = proto_item_add_subtree(length_hdr, ett_tds7_hdr); diff --git a/epan/dissectors/packet-telnet.c b/epan/dissectors/packet-telnet.c index af10ee97ce..d97d527868 100644 --- a/epan/dissectors/packet-telnet.c +++ b/epan/dissectors/packet-telnet.c @@ -1091,7 +1091,6 @@ static void dissect_authentication_subopt(packet_info *pinfo, const char *optname _U_, tvbuff_t *tvb, int offset, int len, proto_tree *tree) { guint8 acmd; - char *name; /* XXX here we should really split it up in a conversation struct keeping track of what method we actually use and not just assume it is always @@ -1116,14 +1115,7 @@ dissect_authentication_subopt(packet_info *pinfo, const char *optname _U_, tvbuf } break; case TN_AC_NAME: - if(len<255){ - name=ep_alloc(256); - tvb_memcpy(tvb, (guint8*)name, offset, len); - name[len]=0; - } else { - name="<...name too long...>"; - } - proto_tree_add_string(tree, hf_telnet_auth_name, tvb, offset, len, name); + proto_tree_add_item(tree, hf_telnet_auth_name, tvb, offset, len, ENC_ASCII); break; } } diff --git a/epan/dissectors/packet-tftp.c b/epan/dissectors/packet-tftp.c index 021e08f2fc..a48e7d6274 100644 --- a/epan/dissectors/packet-tftp.c +++ b/epan/dissectors/packet-tftp.c @@ -148,7 +148,7 @@ tftp_dissect_options(tvbuff_t *tvb, packet_info *pinfo, int offset, /* Special code to handle individual options */ if (!g_ascii_strcasecmp((const char *)optionname, "blksize") && opcode == TFTP_OACK) { - gint blocksize = strtol((const char *)optionvalue, NULL, 10); + gint blocksize = (gint)strtol((const char *)optionvalue, NULL, 10); if (blocksize < 8 || blocksize > 65464) { expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_WARN, "TFTP blocksize out of range"); diff --git a/epan/dissectors/packet-tivoconnect.c b/epan/dissectors/packet-tivoconnect.c index 68b12087b6..fa4348e61f 100644 --- a/epan/dissectors/packet-tivoconnect.c +++ b/epan/dissectors/packet-tivoconnect.c @@ -70,7 +70,7 @@ dissect_tivoconnect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d gchar * string = NULL; gint length = -1; /* value strings */ - gchar * proto_name = NULL; + const gchar * proto_name = NULL; gchar * packet_identity = NULL; gchar * packet_machine = NULL; diff --git a/epan/dissectors/packet-tpncp.c b/epan/dissectors/packet-tpncp.c index 6ed5720e84..23eb9947fa 100644 --- a/epan/dissectors/packet-tpncp.c +++ b/epan/dissectors/packet-tpncp.c @@ -585,7 +585,7 @@ static gint init_tpncp_data_fields_info(tpncp_data_field_info *data_fields_info, if (!was_registered) { /* Register non-standard data should be done only once. */ - hf_allocated = hf_size+array_length(hf_tpncp)-1; + hf_allocated = hf_size+(int)array_length(hf_tpncp)-1; if ((hf = (hf_register_info *)g_realloc(hf, hf_allocated * sizeof(hf_register_info))) == NULL) return (-1); for (idx = 0; idx < array_length(hf_tpncp); idx++) { diff --git a/epan/dissectors/packet-ucp.c b/epan/dissectors/packet-ucp.c index c66c62295a..d38f8cca8c 100644 --- a/epan/dissectors/packet-ucp.c +++ b/epan/dissectors/packet-ucp.c @@ -111,12 +111,12 @@ static int st_ucp_results = -1; static int st_ucp_results_pos = -1; static int st_ucp_results_neg = -1; -static gchar* st_str_ucp = "UCP Messages"; -static gchar* st_str_ops = "Operations"; -static gchar* st_str_res = "Results"; -static gchar* st_str_ucp_res = "UCP Results Acks/Nacks"; -static gchar* st_str_pos = "Positive"; -static gchar* st_str_neg = "Negative"; +static gchar st_str_ucp[] = "UCP Messages"; +static gchar st_str_ops[] = "Operations"; +static gchar st_str_res[] = "Results"; +static gchar st_str_ucp_res[] = "UCP Results Acks/Nacks"; +static gchar st_str_pos[] = "Positive"; +static gchar st_str_neg[] = "Negative"; /* * Data (variable) section @@ -749,7 +749,7 @@ check_ucp(tvbuff_t *tvb, int *endpkt) * \return The date in standard 'time_t' format. */ static time_t -ucp_mktime(char *datestr) +ucp_mktime(const char *datestr) { struct tm r_time; @@ -866,7 +866,7 @@ static guint ucp_handle_int(proto_tree *tree, tvbuff_t *tvb, int field, int *offset) { gint idx, len; - char *strval; + const char *strval; guint intval = 0; idx = tvb_find_guint8(tvb, *offset, -1, '/'); @@ -876,7 +876,7 @@ ucp_handle_int(proto_tree *tree, tvbuff_t *tvb, int field, int *offset) tvb_ensure_bytes_exist(tvb, *offset, len + 1); } else len = idx - *offset; - strval = (gchar*)tvb_get_ephemeral_string(tvb, *offset, len); + strval = tvb_get_ephemeral_string(tvb, *offset, len); if (len > 0) { intval = atoi(strval); proto_tree_add_uint(tree, field, tvb, *offset, len, intval); @@ -891,7 +891,7 @@ static void ucp_handle_time(proto_tree *tree, tvbuff_t *tvb, int field, int *offset) { gint idx, len; - char *strval; + const char *strval; time_t tval; nstime_t tmptime; @@ -902,7 +902,7 @@ ucp_handle_time(proto_tree *tree, tvbuff_t *tvb, int field, int *offset) tvb_ensure_bytes_exist(tvb, *offset, len + 1); } else len = idx - *offset; - strval = (gchar*)tvb_get_ephemeral_string(tvb, *offset, len); + strval = tvb_get_ephemeral_string(tvb, *offset, len); if (len > 0) { tval = ucp_mktime(strval); tmptime.secs = tval; diff --git a/epan/dissectors/packet-umts_mac.c b/epan/dissectors/packet-umts_mac.c index e690a884fb..57133186af 100644 --- a/epan/dissectors/packet-umts_mac.c +++ b/epan/dissectors/packet-umts_mac.c @@ -39,7 +39,6 @@ int proto_umts_mac = -1; extern int proto_fp; extern int proto_rlc; -extern int proto_rrc; /* dissector fields */ static int hf_mac_fach_fdd_tctf = -1; diff --git a/epan/dissectors/packet-umts_mac.h b/epan/dissectors/packet-umts_mac.h index 4ca6c7c52f..78f8f95184 100644 --- a/epan/dissectors/packet-umts_mac.h +++ b/epan/dissectors/packet-umts_mac.h @@ -84,6 +84,6 @@ enum enum_mac_tsn_size { MAC_TSN_6BITS, MAC_TSN_14BITS }; -gint get_mac_tsn_size(); +gint get_mac_tsn_size(void); #endif diff --git a/epan/dissectors/packet-vines.c b/epan/dissectors/packet-vines.c index 4e2123cbe5..bef0fada79 100644 --- a/epan/dissectors/packet-vines.c +++ b/epan/dissectors/packet-vines.c @@ -299,6 +299,11 @@ dissect_vines_frp_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { guint8 vines_frp_ctrl; + if (pinfo->srcport != pinfo->destport) { + /* Require that the source and destination ports be the + * port for Vines FRP. */ + return 0; + } if (!tvb_bytes_exist(tvb, 0, 1)) { /* Too short to check the flags value. */ return 0; @@ -357,8 +362,6 @@ proto_reg_handoff_vines_frp(void) proto_vines_frp); dissector_add_uint("ip.proto", IP_PROTO_VINES, vines_frp_handle); - /* XXX: AFAIK, src and dst port must be the same; should - the dissector check for that? */ vines_frp_new_handle = new_create_dissector_handle(dissect_vines_frp_new, proto_vines_frp); dissector_add_uint("udp.port", UDP_PORT_VINES, vines_frp_new_handle); diff --git a/epan/dissectors/packet-vxi11.c b/epan/dissectors/packet-vxi11.c index a704e85f31..050ef5d3a3 100644 --- a/epan/dissectors/packet-vxi11.c +++ b/epan/dissectors/packet-vxi11.c @@ -319,7 +319,7 @@ dissect_create_link_parms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - char *str; + const char *str; offset = dissect_rpc_uint32(tvb, tree, hf_vxi11_core_client_id, offset); offset = dissect_rpc_bool(tvb, tree, hf_vxi11_core_lock_device, offset); diff --git a/epan/dissectors/packet-wccp.c b/epan/dissectors/packet-wccp.c index f8c877ff95..f88baf3d86 100644 --- a/epan/dissectors/packet-wccp.c +++ b/epan/dissectors/packet-wccp.c @@ -252,7 +252,7 @@ static void dissect_web_cache_list_entry(tvbuff_t *tvb, int offset, int idx, proto_tree *wccp_tree); static guint32 wccp_bucket_info(guint8 bucket_info, proto_tree *bucket_tree, guint32 start, tvbuff_t *tvb, int offset); -static gchar *bucket_name(guint8 bucket); +static const gchar *bucket_name(guint8 bucket); static guint16 dissect_wccp2_header(tvbuff_t *tvb, int offset, proto_tree *wccp_tree); static void dissect_wccp2_info(tvbuff_t *tvb, int offset, guint16 length, @@ -456,10 +456,10 @@ wccp_bucket_info(guint8 bucket_info, proto_tree *bucket_tree, guint32 start, return(start); } -static gchar * +static const gchar * bucket_name(guint8 bucket) { - gchar *cur; + const gchar *cur; if (bucket == 0xff) { cur="Unassigned"; @@ -956,10 +956,10 @@ dissect_wccp2_router_assignment_element(tvbuff_t *tvb, int offset, proto_tree_add_item(tree, hf_router_assignment_element_change_num, tvb, offset+8, 4, ENC_BIG_ENDIAN); } -static gchar * +static const gchar * assignment_bucket_name(guint8 bucket) { - gchar *cur; + const gchar *cur; if (bucket == 0xff) { cur="Unassigned"; diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c index a7a2e7824b..9f5a54e95b 100644 --- a/epan/dissectors/packet-wsp.c +++ b/epan/dissectors/packet-wsp.c @@ -1317,7 +1317,7 @@ parameter_value_q (proto_tree *tree, proto_item *ti, tvbuff_t *tvb, int start); " <Warning: Quoted-string value has been encoded with a trailing quote>" /* WSP well-known header parsing function prototypes; - * will be listed in the function lookup table WellKnownHeaders[] */ + * will be listed in the function lookup table WellKnownHeader[] */ static guint32 wkh_default (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_); static guint32 wkh_accept (proto_tree *tree, tvbuff_t *tvb, @@ -1414,9 +1414,6 @@ static guint32 wkh_authorization (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_); static guint32 wkh_proxy_authorization (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_); -/* Pragma */ -static guint32 wkh_pragma (proto_tree *tree, tvbuff_t *tvb, - guint32 hdr_start, packet_info *pinfo _U_); /* Integer-value */ static guint32 wkh_content_length (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_); diff --git a/epan/dissectors/packet-x11.c b/epan/dissectors/packet-x11.c index ef190a2604..edf9f180f3 100644 --- a/epan/dissectors/packet-x11.c +++ b/epan/dissectors/packet-x11.c @@ -1229,11 +1229,11 @@ static const value_string zero_is_none_vals[] = { \ seqno = VALUE16(tvb, *offsetp); \ proto_tree_add_uint_format(t, hf_x11_reply_##name, tvb, \ - *offsetp, sizeof(seqno), seqno, \ + *offsetp, 2, seqno, \ "sequencenumber: %d (%s)", \ (int)seqno, \ val_to_str(opcode & 0xFF, state->opcode_vals, "<Unknown opcode %d>")); \ - *offsetp += sizeof(seqno); \ + *offsetp += 2; \ } while (0) #define REPLYCONTENTS_COMMON() do { \ @@ -1580,10 +1580,12 @@ static void listOfColorItem(tvbuff_t *tvb, int *offsetp, proto_tree *t, int hf, } } +#if 0 /* XXX: Use of GTree no longer needed; use value_string_ext */ static gint compareGuint32(gconstpointer a, gconstpointer b) { return GPOINTER_TO_INT(b) - GPOINTER_TO_INT(a); } +#endif static void XConvertCase(register int sym, int *lower, int *upper) @@ -1893,7 +1895,7 @@ static void listOfKeycode(tvbuff_t *tvb, int *offsetp, proto_tree *t, int hf, guint byte_order _U_) { proto_item *ti = proto_tree_add_item(t, hf, tvb, *offsetp, - array_length(modifiers) * keycodes_per_modifier, ENC_NA); + (int)array_length(modifiers) * keycodes_per_modifier, ENC_NA); proto_tree *tt = proto_item_add_subtree(ti, ett_x11_list_of_keycode); size_t m; diff --git a/epan/dissectors/packet-xml.c b/epan/dissectors/packet-xml.c index 2ff61f0896..59a34affd5 100644 --- a/epan/dissectors/packet-xml.c +++ b/epan/dissectors/packet-xml.c @@ -53,7 +53,7 @@ struct _attr_reg_data { GArray *hf; - gchar *basename; + const gchar *basename; }; @@ -77,8 +77,8 @@ static tvbparse_wanted_t *want_heur; static GHashTable *xmpli_names; static GHashTable *media_types; -static xml_ns_t xml_ns = {"xml", "/", -1, -1, -1, NULL, NULL, NULL}; -static xml_ns_t unknown_ns = {"unknown", "?", -1, -1, -1, NULL, NULL, NULL}; +static xml_ns_t xml_ns = {(gchar *)"xml", "/", -1, -1, -1, NULL, NULL, NULL}; +static xml_ns_t unknown_ns = {(gchar *)"unknown", "?", -1, -1, -1, NULL, NULL, NULL}; static xml_ns_t *root_ns; static gboolean pref_heuristic_media = FALSE; @@ -184,7 +184,7 @@ dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvbparse_t *tt; static GPtrArray *stack; xml_frame_t *current_frame; - char *colinfo_str; + const char *colinfo_str; if (stack != NULL) g_ptr_array_free(stack, TRUE); @@ -210,8 +210,10 @@ dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) root_ns = &xml_ns; colinfo_str = "/XML"; } else { - colinfo_str = ep_strdup_printf("/%s", root_ns->name); - ascii_strup_inplace(colinfo_str); + char *colinfo_str_buf; + colinfo_str_buf = ep_strdup_printf("/%s", root_ns->name); + ascii_strup_inplace(colinfo_str_buf); + colinfo_str = colinfo_str_buf; } col_append_str(pinfo->cinfo, COL_PROTOCOL, colinfo_str); @@ -769,7 +771,7 @@ static void init_xml_parser(void) } -static xml_ns_t *xml_new_namespace(GHashTable *hash, gchar *name, ...) +static xml_ns_t *xml_new_namespace(GHashTable *hash, const gchar *name, ...) { xml_ns_t *ns = g_malloc(sizeof(xml_ns_t)); va_list ap; @@ -798,7 +800,7 @@ static xml_ns_t *xml_new_namespace(GHashTable *hash, gchar *name, ...) } -static void add_xml_field(GArray *hfs, int *p_id, gchar *name, gchar *fqn) +static void add_xml_field(GArray *hfs, int *p_id, const gchar *name, const gchar *fqn) { hf_register_info hfri; @@ -1064,7 +1066,7 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) g_string_append_printf(errors, "element %s defined more than once\n", element->name); free_elements(NULL, element, NULL); } else { - g_hash_table_insert(elements, element->name, element); + g_hash_table_insert(elements, (gpointer)element->name, element); g_ptr_array_add(element_names, g_strdup(element->name)); } @@ -1140,7 +1142,7 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) make_xml_hier(root_name, root_element, elements, hier, errors, hfs, etts, dtd_data->proto_name); - g_hash_table_insert(root_element->elements, root_element->name, root_element); + g_hash_table_insert(root_element->elements, (gpointer)root_element->name, root_element); orig_root = g_hash_table_lookup(elements, root_name); @@ -1166,7 +1168,7 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) if( ! g_hash_table_lookup(root_element->elements, curr_name) ) { xml_ns_t *new = make_xml_hier(curr_name, root_element, elements, hier, errors, hfs, etts, dtd_data->proto_name); - g_hash_table_insert(root_element->elements, new->name, new); + g_hash_table_insert(root_element->elements, (gpointer)new->name, new); } g_free(curr_name); @@ -1200,7 +1202,7 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) g_ptr_array_free(new->element_names, TRUE); - g_hash_table_insert(root_element->elements, new->name, new); + g_hash_table_insert(root_element->elements, (gpointer)new->name, new); } } @@ -1241,7 +1243,7 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) g_array_free(etts, TRUE); } - g_hash_table_insert(xml_ns.elements, root_element->name, root_element); + g_hash_table_insert(xml_ns.elements, (gpointer)root_element->name, root_element); g_hash_table_foreach_remove(elements, free_elements, NULL); g_hash_table_destroy(elements); @@ -1345,7 +1347,7 @@ static void init_xml_names(void) } } - g_hash_table_foreach(xmpli_names, add_xmlpi_namespace, "xml.xmlpi"); + g_hash_table_foreach(xmpli_names, add_xmlpi_namespace, (gpointer)"xml.xmlpi"); g_free(dummy); } diff --git a/epan/dissectors/packet-xml.h b/epan/dissectors/packet-xml.h index 7bedc9b100..ae76465ed1 100644 --- a/epan/dissectors/packet-xml.h +++ b/epan/dissectors/packet-xml.h @@ -29,7 +29,7 @@ typedef struct _xml_ns_t { gchar* name; /* its fully qualified name */ - gchar* fqn; + const gchar* fqn; /* the contents of the whole element from <> to </> */ int hf_tag; diff --git a/epan/dissectors/packet-xmpp-core.c b/epan/dissectors/packet-xmpp-core.c index 099cc89e79..4f0697afda 100644 --- a/epan/dissectors/packet-xmpp-core.c +++ b/epan/dissectors/packet-xmpp-core.c @@ -243,7 +243,7 @@ xmpp_error(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t * if(cond_element) { fake_condition = xmpp_ep_init_attr_t(cond_element->name, cond_element->offset, cond_element->length); - g_hash_table_insert(element->attrs,"condition", fake_condition); + g_hash_table_insert(element->attrs, (gpointer)"condition", fake_condition); error_info = ep_strdup_printf("%s: %s;", error_info, cond_element->name); } @@ -317,13 +317,13 @@ xmpp_presence(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_ if((show = xmpp_steal_element_by_name(packet, "show"))!=NULL) { xmpp_attr_t *fake_show = xmpp_ep_init_attr_t(show->data?show->data->value:"",show->offset, show->length); - g_hash_table_insert(packet->attrs, "show", fake_show); + g_hash_table_insert(packet->attrs, (gpointer)"show", fake_show); } if((priority = xmpp_steal_element_by_name(packet, "priority"))!=NULL) { xmpp_attr_t *fake_priority = xmpp_ep_init_attr_t(priority->data?priority->data->value:"",priority->offset, priority->length); - g_hash_table_insert(packet->attrs, "priority", fake_priority); + g_hash_table_insert(packet->attrs, (gpointer)"priority", fake_priority); } xmpp_display_attrs(presence_tree, packet, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -352,7 +352,7 @@ xmpp_presence_status(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_e fake_value = xmpp_ep_init_attr_t("(empty)", element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_value); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_value); xmpp_display_attrs(status_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -411,7 +411,7 @@ xmpp_message(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t if((chatstate = xmpp_steal_element_by_attr(packet, "xmlns", "http://jabber.org/protocol/chatstates"))!=NULL) { xmpp_attr_t *fake_chatstate_attr = xmpp_ep_init_attr_t(chatstate->name, chatstate->offset, chatstate->length); - g_hash_table_insert(packet->attrs, "chatstate", fake_chatstate_attr); + g_hash_table_insert(packet->attrs, (gpointer)"chatstate", fake_chatstate_attr); } xmpp_display_attrs(message_tree, packet, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -450,7 +450,7 @@ xmpp_message_body(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_elem body_tree = proto_item_add_subtree(body_item, ett_xmpp_message_body); fake_data_attr = xmpp_ep_init_attr_t(element->data?element->data->value:"", element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_data_attr); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_data_attr); xmpp_display_attrs(body_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -474,7 +474,7 @@ xmpp_message_subject(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_e subject_tree = proto_item_add_subtree(subject_item, ett_xmpp_message_subject); fake_data_attr = xmpp_ep_init_attr_t(element->data?element->data->value:"", element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_data_attr); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_data_attr); xmpp_display_attrs(subject_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -499,7 +499,7 @@ xmpp_message_thread(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_el thread_tree = proto_item_add_subtree(thread_item, ett_xmpp_message_thread); fake_value = xmpp_ep_init_attr_t(element->data?element->data->value:"", element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_value); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_value); xmpp_display_attrs(thread_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -583,7 +583,7 @@ xmpp_failure(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t if((fail_condition = xmpp_steal_element_by_names(packet, fail_names, array_length(fail_names)))!=NULL) { xmpp_attr_t *fake_cond = xmpp_ep_init_attr_t(fail_condition->name, fail_condition->offset, fail_condition->length); - g_hash_table_insert(packet->attrs, "condition", fake_cond); + g_hash_table_insert(packet->attrs, (gpointer)"condition", fake_cond); } if((text = xmpp_steal_element_by_name(packet, "text"))!=NULL) diff --git a/epan/dissectors/packet-xmpp-gtalk.c b/epan/dissectors/packet-xmpp-gtalk.c index 4e643af1eb..24eca11aef 100644 --- a/epan/dissectors/packet-xmpp-gtalk.c +++ b/epan/dissectors/packet-xmpp-gtalk.c @@ -188,14 +188,14 @@ xmpp_gtalk_session_reason(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, x if((condition = xmpp_steal_element_by_names(element, reason_names, array_length(reason_names)))!=NULL) { xmpp_attr_t *fake_cond = xmpp_ep_init_attr_t(condition->name, condition->offset, condition->length); - g_hash_table_insert(element->attrs, "condition", fake_cond); + g_hash_table_insert(element->attrs, (gpointer)"condition", fake_cond); } if((text = xmpp_steal_element_by_name(element, "text"))!=NULL) { xmpp_attr_t *fake_text = xmpp_ep_init_attr_t(text->data?text->data->value:"", text->offset, text->length); - g_hash_table_insert(element->attrs, "text", fake_text); + g_hash_table_insert(element->attrs, (gpointer)"text", fake_text); } xmpp_display_attrs(reason_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -286,7 +286,7 @@ xmpp_gtalk_jingleinfo_relay(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, if((token = xmpp_steal_element_by_name(element, "token"))!=NULL) { xmpp_attr_t *fake_token = xmpp_ep_init_attr_t(token->data?token->data->value:"", token->offset, token->length); - g_hash_table_insert(element->attrs, "token", fake_token); + g_hash_table_insert(element->attrs, (gpointer)"token", fake_token); } xmpp_display_attrs(relay_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -484,12 +484,12 @@ xmpp_gtalk_mail_mail_info(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, x if((labels = xmpp_steal_element_by_name(element,"labels"))!=NULL) { xmpp_attr_t *fake_labels = xmpp_ep_init_attr_t(labels->data?labels->data->value:"",labels->offset, labels->length); - g_hash_table_insert(element->attrs, "labels", fake_labels); + g_hash_table_insert(element->attrs, (gpointer)"labels", fake_labels); } if((subject = xmpp_steal_element_by_name(element,"subject"))!=NULL) { xmpp_attr_t *fake_subject = xmpp_ep_init_attr_t(subject->data?subject->data->value:"",subject->offset, subject->length); - g_hash_table_insert(element->attrs, "subject", fake_subject); + g_hash_table_insert(element->attrs, (gpointer)"subject", fake_subject); } xmpp_display_attrs(mail_info_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -584,20 +584,20 @@ xmpp_gtalk_status_query(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmp if((status = xmpp_steal_element_by_name(element,"status"))!=NULL) { xmpp_attr_t *fake_status = xmpp_ep_init_attr_t(status->data?status->data->value:"",status->offset, status->length); - g_hash_table_insert(element->attrs, "status", fake_status); + g_hash_table_insert(element->attrs, (gpointer)"status", fake_status); } if((show = xmpp_steal_element_by_name(element,"show"))!=NULL) { xmpp_attr_t *fake_show = xmpp_ep_init_attr_t(show->data?show->data->value:"",show->offset, show->length); - g_hash_table_insert(element->attrs, "show", fake_show); + g_hash_table_insert(element->attrs, (gpointer)"show", fake_show); } if((invisible = xmpp_steal_element_by_name(element,"invisible"))!=NULL) { xmpp_attr_t *value = xmpp_get_attr(invisible, "value"); xmpp_attr_t *fake_invisible = xmpp_ep_init_attr_t(value?value->value:"",invisible->offset, invisible->length); - g_hash_table_insert(element->attrs, "invisible", fake_invisible); + g_hash_table_insert(element->attrs, (gpointer)"invisible", fake_invisible); } xmpp_display_attrs(query_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); diff --git a/epan/dissectors/packet-xmpp-jingle.c b/epan/dissectors/packet-xmpp-jingle.c index fb2ba59707..78a7e5f700 100644 --- a/epan/dissectors/packet-xmpp-jingle.c +++ b/epan/dissectors/packet-xmpp-jingle.c @@ -202,7 +202,7 @@ xmpp_jingle_reason(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_ele if((condition = xmpp_steal_element_by_names(element, reason_names, array_length(reason_names)))!=NULL) { xmpp_attr_t *fake_cond = xmpp_ep_init_attr_t(condition->name, condition->offset, condition->length); - g_hash_table_insert(element->attrs, "condition", fake_cond); + g_hash_table_insert(element->attrs, (gpointer)"condition", fake_cond); } else if((condition = xmpp_steal_element_by_name(element, "alternative-session"))!=NULL) { @@ -210,26 +210,26 @@ xmpp_jingle_reason(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_ele xmpp_element_t *sid; fake_cond = xmpp_ep_init_attr_t(condition->name, condition->offset, condition->length); - g_hash_table_insert(element->attrs, "condition", fake_cond); + g_hash_table_insert(element->attrs, (gpointer)"condition", fake_cond); if((sid = xmpp_steal_element_by_name(condition, "sid"))!=NULL) { fake_alter_sid = xmpp_ep_init_attr_t(sid->name, sid->offset, sid->length); - g_hash_table_insert(element->attrs, "sid", fake_alter_sid); + g_hash_table_insert(element->attrs, (gpointer)"sid", fake_alter_sid); } } if((rtp_error = xmpp_steal_element_by_names(element, rtp_error_names, array_length(rtp_error_names)))!=NULL) { xmpp_attr_t *fake_rtp_error = xmpp_ep_init_attr_t(rtp_error->name, rtp_error->offset, rtp_error->length); - g_hash_table_insert(element->attrs, "rtp-error", fake_rtp_error); + g_hash_table_insert(element->attrs, (gpointer)"rtp-error", fake_rtp_error); } if((text = xmpp_steal_element_by_name(element, "text"))!=NULL) { xmpp_attr_t *fake_text = xmpp_ep_init_attr_t(text->data?text->data->value:"", text->offset, text->length); - g_hash_table_insert(element->attrs, "text", fake_text); + g_hash_table_insert(element->attrs, (gpointer)"text", fake_text); } xmpp_display_attrs(reason_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -375,7 +375,7 @@ xmpp_jingle_cont_desc_rtp_enc_zrtp_hash(proto_tree* tree, tvbuff_t* tvb, packet_ if(element->data) { xmpp_attr_t *fake_hash = xmpp_ep_init_attr_t(element->data->value, element->offset, element->length); - g_hash_table_insert(element->attrs, "hash", fake_hash); + g_hash_table_insert(element->attrs, (gpointer)"hash", fake_hash); } xmpp_display_attrs(zrtp_hash_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -422,7 +422,7 @@ xmpp_jingle_cont_desc_rtp_bandwidth(proto_tree* tree, tvbuff_t* tvb, packet_info if(element->data) { xmpp_attr_t *fake_value = xmpp_ep_init_attr_t(element->data->value, element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_value); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_value); } xmpp_display_attrs(bandwidth_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -456,7 +456,7 @@ xmpp_jingle_cont_desc_rtp_hdrext(proto_tree* tree, tvbuff_t* tvb, packet_info *p { xmpp_attr_t *name = xmpp_get_attr(element, "name"); xmpp_attr_t *fake_attr = xmpp_ep_init_attr_t(name?name->value:"", parameter->offset, parameter->length); - g_hash_table_insert(element->attrs, "parameter", fake_attr); + g_hash_table_insert(element->attrs, (gpointer)"parameter", fake_attr); } xmpp_display_attrs(rtp_hdr_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); diff --git a/epan/dissectors/packet-xmpp-other.c b/epan/dissectors/packet-xmpp-other.c index c32a55ea13..3874e581b8 100644 --- a/epan/dissectors/packet-xmpp-other.c +++ b/epan/dissectors/packet-xmpp-other.c @@ -137,7 +137,7 @@ xmpp_vcard(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t * { xmpp_attr_t *fake_cdata; fake_cdata = xmpp_ep_init_attr_t(xmpp_element_to_string(tvb, cdata), cdata->offset, cdata->length); - g_hash_table_insert(element->attrs,"value", fake_cdata); + g_hash_table_insert(element->attrs,(gpointer)"value", fake_cdata); } xmpp_display_attrs(vcard_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -163,7 +163,7 @@ xmpp_vcard_x_update(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_el if((photo = xmpp_steal_element_by_name(element, "photo"))!=NULL) { xmpp_attr_t *fake_photo = xmpp_ep_init_attr_t(photo->data?photo->data->value:"", photo->offset, photo->length); - g_hash_table_insert(element->attrs, "photo", fake_photo); + g_hash_table_insert(element->attrs, (gpointer)"photo", fake_photo); } xmpp_display_attrs(x_tree, element,pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -525,7 +525,7 @@ xmpp_si_file(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t if((desc = xmpp_steal_element_by_name(element, "desc"))!=NULL) { xmpp_attr_t *fake_desc = xmpp_ep_init_attr_t(desc->data?desc->data->value:"", desc->offset, desc->length); - g_hash_table_insert(element->attrs, "desc", fake_desc); + g_hash_table_insert(element->attrs, (gpointer)"desc", fake_desc); } if((range = xmpp_steal_element_by_name(element, "range"))!=NULL) @@ -675,7 +675,7 @@ xmpp_x_data_field_option(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xm if((value = xmpp_steal_element_by_name(element, "value"))!=NULL) { xmpp_attr_t *fake_value = xmpp_ep_init_attr_t(value->data?value->data->value:"",value->offset, value->length); - g_hash_table_insert(element->attrs, "value", fake_value); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_value); } xmpp_display_attrs(option_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -701,7 +701,7 @@ xmpp_x_data_field_value(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmp fake_value = xmpp_ep_init_attr_t(element->data?element->data->value:"",element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_value); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_value); xmpp_display_attrs(value_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -782,7 +782,7 @@ xmpp_ibb_data(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_ if(element->data) { xmpp_attr_t *fake_data = xmpp_ep_init_attr_t(element->data->value, element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_data); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_data); } xmpp_display_attrs(data_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -810,7 +810,7 @@ xmpp_delay(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t * if(element->data) { xmpp_attr_t *fake_value = xmpp_ep_init_attr_t(element->data->value, element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_value); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_value); } xmpp_display_attrs(delay_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -868,7 +868,7 @@ xmpp_x_event(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t if((id = xmpp_steal_element_by_name(element, "id"))!=NULL) { xmpp_attr_t *fake_id = xmpp_ep_init_attr_t(id->data?id->data->value:"", id->offset, id->length); - g_hash_table_insert(element->attrs, "id", fake_id); + g_hash_table_insert(element->attrs, (gpointer)"id", fake_id); } while((cond = xmpp_steal_element_by_names(element, cond_names, array_length(cond_names))) != NULL) @@ -880,7 +880,7 @@ xmpp_x_event(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t } fake_cond = xmpp_ep_init_attr_t(cond_value, element->offset, element->length); - g_hash_table_insert(element->attrs, "condition", fake_cond); + g_hash_table_insert(element->attrs, (gpointer)"condition", fake_cond); xmpp_display_attrs(x_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -908,7 +908,7 @@ xmpp_muc_x(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t * if((pass = xmpp_steal_element_by_name(element, "password"))!=NULL) { xmpp_attr_t *fake_pass = xmpp_ep_init_attr_t(pass->data?pass->data->value:"",pass->offset, pass->length); - g_hash_table_insert(element->attrs, "password", fake_pass); + g_hash_table_insert(element->attrs, (gpointer)"password", fake_pass); } xmpp_display_attrs(x_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -963,7 +963,7 @@ xmpp_muc_user_x(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_elemen if((password = xmpp_steal_element_by_name(element, "password"))!=NULL) { xmpp_attr_t *fake_pass = xmpp_ep_init_attr_t(password->data?password->data->value:"",password->offset, password->length); - g_hash_table_insert(element->attrs, "password", fake_pass); + g_hash_table_insert(element->attrs, (gpointer)"password", fake_pass); } xmpp_display_attrs(x_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -1016,14 +1016,14 @@ xmpp_muc_user_item(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_ele if((reason = xmpp_steal_element_by_name(element, "reason"))!=NULL) { xmpp_attr_t *fake_reason = xmpp_ep_init_attr_t(reason->data?reason->data->value:"",reason->offset, reason->length); - g_hash_table_insert(element->attrs,"reason",fake_reason); + g_hash_table_insert(element->attrs,(gpointer)"reason",fake_reason); } if((actor = xmpp_steal_element_by_name(element, "actor"))!=NULL) { xmpp_attr_t *jid = xmpp_get_attr(actor, "jid"); xmpp_attr_t *fake_actor_jid = xmpp_ep_init_attr_t(jid?jid->value:"",actor->offset, actor->length); - g_hash_table_insert(element->attrs, "actor_jid", fake_actor_jid); + g_hash_table_insert(element->attrs, (gpointer)"actor_jid", fake_actor_jid); } xmpp_display_attrs(item_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -1060,7 +1060,7 @@ xmpp_muc_user_invite(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_e if((reason = xmpp_steal_element_by_name(element, "reason"))!=NULL) { xmpp_attr_t *fake_reason = xmpp_ep_init_attr_t(reason->data?reason->data->value:"",reason->offset, reason->length); - g_hash_table_insert(element->attrs, "reason", fake_reason); + g_hash_table_insert(element->attrs, (gpointer)"reason", fake_reason); } xmpp_display_attrs(invite_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -1148,7 +1148,7 @@ xmpp_last_query(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_elemen if(element->data) { xmpp_attr_t *fake_data = xmpp_ep_init_attr_t(element->data->value, element->data->offset, element->data->length); - g_hash_table_insert(element->attrs, "value", fake_data); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_data); } xmpp_display_attrs(query_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -1179,19 +1179,19 @@ xmpp_version_query(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_ele if((name = xmpp_steal_element_by_name(element,"name"))!=NULL) { xmpp_attr_t *fake_name = xmpp_ep_init_attr_t(name->data?name->data->value:"", name->offset, name->length); - g_hash_table_insert(element->attrs, "name", fake_name); + g_hash_table_insert(element->attrs, (gpointer)"name", fake_name); } if((version = xmpp_steal_element_by_name(element,"version"))!=NULL) { xmpp_attr_t *fake_version = xmpp_ep_init_attr_t(version->data?version->data->value:"", version->offset, version->length); - g_hash_table_insert(element->attrs, "version", fake_version); + g_hash_table_insert(element->attrs, (gpointer)"version", fake_version); } if((os = xmpp_steal_element_by_name(element,"os"))!=NULL) { xmpp_attr_t *fake_os = xmpp_ep_init_attr_t(os->data?os->data->value:"", os->offset, os->length); - g_hash_table_insert(element->attrs, "os", fake_os); + g_hash_table_insert(element->attrs, (gpointer)"os", fake_os); } xmpp_display_attrs(query_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -1249,7 +1249,7 @@ xmpp_hashes_hash(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_eleme }; xmpp_attr_t *fake_cdata = xmpp_ep_init_attr_t(xmpp_elem_cdata(element), element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_cdata); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_cdata); hash_item = proto_tree_add_text(tree, tvb, element->offset, element->length, "HASH"); hash_tree = proto_item_add_subtree(hash_item, ett_xmpp_hashes_hash); @@ -1302,7 +1302,7 @@ xmpp_jitsi_inputevt_rmt_ctrl(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo if((action = xmpp_steal_element_by_names(element, action_names, array_length(action_names)))!=NULL) { xmpp_attr_t *fake_action = xmpp_ep_init_attr_t(action->name, action->offset, action->length); - g_hash_table_insert(element->attrs,"action", fake_action); + g_hash_table_insert(element->attrs,(gpointer)"action", fake_action); if(strcmp(action->name,"mouse-move") == 0) { @@ -1310,21 +1310,21 @@ xmpp_jitsi_inputevt_rmt_ctrl(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo xmpp_attr_t *y = xmpp_get_attr(action,"y"); if(x) - g_hash_table_insert(element->attrs,"x",x); + g_hash_table_insert(element->attrs,(gpointer)"x",x); if(y) - g_hash_table_insert(element->attrs,"y",y); + g_hash_table_insert(element->attrs,(gpointer)"y",y); } else if(strcmp(action->name,"mouse-press") == 0 || strcmp(action->name,"mouse-release") == 0) { xmpp_attr_t *btns = xmpp_get_attr(action,"btns"); if(btns) - g_hash_table_insert(element->attrs,"btns",btns); + g_hash_table_insert(element->attrs,(gpointer)"btns",btns); } else if(strcmp(action->name,"key-press") == 0 || strcmp(action->name,"key-release") == 0) { xmpp_attr_t *keycode = xmpp_get_attr(action,"keycode"); if(keycode) - g_hash_table_insert(element->attrs,"keycode",keycode); + g_hash_table_insert(element->attrs,(gpointer)"keycode",keycode); } } diff --git a/epan/dissectors/packet-xmpp-utils.c b/epan/dissectors/packet-xmpp-utils.c index 48584684b4..eae09919fd 100644 --- a/epan/dissectors/packet-xmpp-utils.c +++ b/epan/dissectors/packet-xmpp-utils.c @@ -366,7 +366,7 @@ xmpp_ep_init_array_t(const gchar** array, gint len) } xmpp_attr_t* -xmpp_ep_init_attr_t(gchar *value, gint offset, gint length) +xmpp_ep_init_attr_t(const gchar *value, gint offset, gint length) { xmpp_attr_t *result; result = ep_alloc(sizeof(xmpp_attr_t)); @@ -552,7 +552,7 @@ xmpp_xml_frame_to_element_t(xml_frame_t *xml_frame, xmpp_element_t *parent, tvbu xmpp_copy_hash_table(parent->namespaces, node->namespaces); } else { - g_hash_table_insert(node->namespaces, "", "jabber:client"); + g_hash_table_insert(node->namespaces, (gpointer)"", (gpointer)"jabber:client"); } if(xml_frame->item != NULL) @@ -613,7 +613,7 @@ xmpp_xml_frame_to_element_t(xml_frame_t *xml_frame, xmpp_element_t *parent, tvbu g_hash_table_insert(node->namespaces, (gpointer)ep_strdup(&attr->name[6]), (gpointer)ep_strdup(attr->value)); } else if(attr->name[5] == '\0') { - g_hash_table_insert(node->namespaces, "", (gpointer)ep_strdup(attr->value)); + g_hash_table_insert(node->namespaces, (gpointer)"", (gpointer)ep_strdup(attr->value)); } } @@ -946,16 +946,16 @@ xmpp_display_attrs_ext(proto_tree *tree, xmpp_element_t *element, packet_info *p struct name_attr_t { - gchar *name; - gchar *attr_name; - gchar *attr_value; + const gchar *name; + const gchar *attr_name; + const gchar *attr_value; }; /* returns pointer to the struct that contains 3 strings(element name, attribute name, attribute value) */ gpointer -xmpp_name_attr_struct(gchar *name, gchar *attr_name, gchar *attr_value) +xmpp_name_attr_struct(const gchar *name, const gchar *attr_name, const gchar *attr_value) { struct name_attr_t *result; @@ -979,7 +979,7 @@ xmpp_display_elems(proto_tree *tree, xmpp_element_t *parent, packet_info *pinfo, { gboolean loop = TRUE; - struct + const struct { gchar *name; gchar *attr_name; @@ -997,7 +997,7 @@ xmpp_display_elems(proto_tree *tree, xmpp_element_t *parent, packet_info *pinfo, } else if(elems[i].type == NAME) { gboolean loop = TRUE; - gchar *name = elems[i].data; + const gchar *name = elems[i].data; while(loop && (elem = xmpp_steal_element_by_name(parent, name))!=NULL) { @@ -1009,7 +1009,7 @@ xmpp_display_elems(proto_tree *tree, xmpp_element_t *parent, packet_info *pinfo, else if(elems[i].type == ATTR) { gboolean loop = TRUE; - struct { + const struct { gchar *name; gchar *attr_name; gchar *attr_value; @@ -1025,7 +1025,7 @@ xmpp_display_elems(proto_tree *tree, xmpp_element_t *parent, packet_info *pinfo, } else if(elems[i].type == NAMES) { gboolean loop = TRUE; - xmpp_array_t *names = elems[i].data; + const xmpp_array_t *names = elems[i].data; while(loop && (elem = xmpp_steal_element_by_names(parent, (const gchar**)names->data, names->length))!=NULL) { @@ -1043,9 +1043,9 @@ xmpp_display_elems(proto_tree *tree, xmpp_element_t *parent, packet_info *pinfo, function checks that variable value is in array ((xmpp_array_t)data)->data */ void -xmpp_val_enum_list(packet_info *pinfo, proto_item *item, gchar *name, gchar *value, gpointer data) +xmpp_val_enum_list(packet_info *pinfo, proto_item *item, const gchar *name, const gchar *value, gconstpointer data) { - xmpp_array_t *enums_array = data; + const xmpp_array_t *enums_array = data; gint i; gboolean value_in_enums = FALSE; diff --git a/epan/dissectors/packet-xmpp-utils.h b/epan/dissectors/packet-xmpp-utils.h index 99e8079692..2addfe4509 100644 --- a/epan/dissectors/packet-xmpp-utils.h +++ b/epan/dissectors/packet-xmpp-utils.h @@ -36,8 +36,8 @@ typedef struct _xmpp_array_t } xmpp_array_t; typedef struct _xmpp_attr_t{ - gchar *value; - gchar *name; + const gchar *value; + const gchar *name; gint offset; gint length; @@ -72,19 +72,19 @@ typedef struct _xmpp_element_t{ /*informations about attributes that are displayed in proto tree*/ typedef struct _xmpp_attr_info{ - gchar *name; + const gchar *name; gint hf; gboolean is_required; gboolean in_short_list; /*function validates this attribute it may impose other restrictions (e.g. validating atribut's name, ...)*/ - void (*val_func)(packet_info *pinfo, proto_item *item, gchar *name, gchar *value, gpointer data); + void (*val_func)(packet_info *pinfo, proto_item *item, const gchar *name, const gchar *value, gconstpointer data); gpointer data; } xmpp_attr_info; typedef struct _xmpp_attr_info_ext{ - gchar* ns; + const gchar* ns; xmpp_attr_info info; } xmpp_attr_info_ext; @@ -103,7 +103,7 @@ typedef enum _xmpp_elem_info_occurrence /*informations about elements that are displayed in proto tree*/ typedef struct _xmpp_elem_info{ xmpp_elem_info_type type; - gpointer data; + gconstpointer data; /*function that displays element in tree*/ void (*elem_func)(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); xmpp_elem_info_occurrence occurrence; @@ -181,7 +181,7 @@ extern void xmpp_element_t_tree_free(xmpp_element_t *root); extern xmpp_array_t* xmpp_ep_init_array_t(const gchar** array, gint len); /*Allocs ephemeral memory for xmpp_attr_t struct*/ -extern xmpp_attr_t* xmpp_ep_init_attr_t(gchar *value, gint offset, gint length); +extern xmpp_attr_t* xmpp_ep_init_attr_t(const gchar *value, gint offset, gint length); /*Allocs ephemeral memory for upcased string*/ extern gchar* xmpp_ep_string_upcase(const gchar* string); @@ -224,7 +224,7 @@ extern void xmpp_proto_tree_show_first_child(proto_tree *tree); extern gchar* proto_item_get_text(proto_item *item); /*Function returns struct that contains 3 strings. It is used to build xmpp_attr_info struct.*/ -extern gpointer xmpp_name_attr_struct(gchar *name, gchar *attr_name, gchar *attr_value); +extern gpointer xmpp_name_attr_struct(const gchar *name, const gchar *attr_name, const gchar *attr_value); /** Function displays attributes from element in way described in attrs. * Elements that doesn't exist in attrs are displayed as text. @@ -258,7 +258,7 @@ extern void xmpp_display_elems(proto_tree *tree, xmpp_element_t *parent, packet_ /* Validates attribute value. Takes string array(gchar**) in parameter data. * Is used in XMPP_ATTR_INFO struct. */ -extern void xmpp_val_enum_list(packet_info *pinfo, proto_item *item, gchar *name, gchar *value, gpointer data); +extern void xmpp_val_enum_list(packet_info *pinfo, proto_item *item, const gchar *name, const gchar *value, gconstpointer data); /** Function changes element to attribute. It searches element by name in parent element, * next it create attribute using transform_func and inserts it to parent attributes hash table diff --git a/epan/dissectors/packet-ypserv.c b/epan/dissectors/packet-ypserv.c index ef80ca3637..e7be63d432 100644 --- a/epan/dissectors/packet-ypserv.c +++ b/epan/dissectors/packet-ypserv.c @@ -187,7 +187,7 @@ dissect_domain_nonack_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, p static int dissect_match_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - char *str; + const char *str; proto_item_append_text(tree, " MATCH call"); @@ -219,7 +219,7 @@ static int dissect_match_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { gint32 status; - char *str; + const char *str; proto_item_append_text(tree, " MATCH reply"); @@ -392,7 +392,7 @@ dissect_xfr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree static int dissect_order_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - char *str; + const char *str; proto_item_append_text(tree, " ORDER call"); diff --git a/epan/dissectors/packet-zbee-aps.c b/epan/dissectors/packet-zbee-aps.c index 2bb0c1549a..7f67873a72 100644 --- a/epan/dissectors/packet-zbee-aps.c +++ b/epan/dissectors/packet-zbee-aps.c @@ -1715,12 +1715,12 @@ zbee_apf_transaction_len(tvbuff_t *tvb, guint offset, guint8 type) switch (kvp_type) { case ZBEE_APP_KVP_ABS_TIME: case ZBEE_APP_KVP_REL_TIME: - kvp_len += sizeof(guint32); + kvp_len += 4; break; case ZBEE_APP_KVP_UINT16: case ZBEE_APP_KVP_INT16: case ZBEE_APP_KVP_FLOAT16: - kvp_len +=2; + kvp_len += 2; break; case ZBEE_APP_KVP_UINT8: case ZBEE_APP_KVP_INT8: diff --git a/epan/dissectors/packet-zbee-zcl.c b/epan/dissectors/packet-zbee-zcl.c index 2866e430e2..9917603da7 100644 --- a/epan/dissectors/packet-zbee-zcl.c +++ b/epan/dissectors/packet-zbee-zcl.c @@ -742,31 +742,31 @@ static void dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree proto_tree_add_boolean(sub_tree, hf_zbee_zcl_fcf_disable_default_resp, tvb, offset, sizeof(guint8), fcf & ZBEE_ZCL_FCF_DISABLE_DEFAULT_RESP); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* If the manufacturer code is present, get and display it. */ if (packet.mfr_spec) { packet.mfr_code = tvb_get_letohs(tvb, offset); if ( tree ) { - proto_tree_add_uint(zcl_tree, hf_zbee_zcl_mfr_code, tvb, offset, sizeof(guint16), + proto_tree_add_uint(zcl_tree, hf_zbee_zcl_mfr_code, tvb, offset, (int)sizeof(guint16), packet.mfr_code); proto_item_append_text(proto_root, ", Mfr: %s (0x%04x)", val_to_str_ext_const(packet.mfr_code, &zbee_mfr_code_names_ext, "Unknown"), packet.mfr_code); } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); } /* Add the transaction sequence number to the tree */ packet.tran_seqno = tvb_get_guint8(tvb, offset); if ( zcl_tree ) { - proto_tree_add_uint(zcl_tree, hf_zbee_zcl_tran_seqno, tvb, offset, sizeof(guint8), + proto_tree_add_uint(zcl_tree, hf_zbee_zcl_tran_seqno, tvb, offset, (int)sizeof(guint8), packet.tran_seqno); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Display the command and sequence number on the proto root and info column. */ packet.cmd_id = tvb_get_guint8(tvb, offset); @@ -786,10 +786,10 @@ static void dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree } if ( zcl_tree ) { - proto_tree_add_uint(zcl_tree, hf_zbee_zcl_cmd_id, tvb, offset, sizeof(guint8), + proto_tree_add_uint(zcl_tree, hf_zbee_zcl_cmd_id, tvb, offset, (int)sizeof(guint8), packet.cmd_id); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } else { if ( tree ) { proto_item_append_text(proto_root, ", Cluster-specific Command: 0x%02x, Seq: %u", @@ -802,10 +802,10 @@ static void dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree } if ( zcl_tree ) { - proto_tree_add_uint(zcl_tree, hf_zbee_zcl_cs_cmd_id, tvb, offset, sizeof(guint8), + proto_tree_add_uint(zcl_tree, hf_zbee_zcl_cs_cmd_id, tvb, offset, (int)sizeof(guint8), packet.cmd_id); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Don't decode cluster-specific commands */ zcl_dump_data(tvb, offset, pinfo, zcl_tree); @@ -1268,8 +1268,8 @@ static void dissect_zcl_default_resp(tvbuff_t *tvb, packet_info *pinfo _U_, prot /* Dissect the command identifier */ cmd_id = tvb_get_guint8(tvb, *offset); - proto_tree_add_uint(tree, hf_zbee_zcl_cmd_id, tvb, *offset, sizeof(guint8), cmd_id); - *offset += sizeof(guint8); + proto_tree_add_uint(tree, hf_zbee_zcl_cmd_id, tvb, *offset, (int)sizeof(guint8), cmd_id); + *offset += (int)sizeof(guint8); /* Dissect the status */ dissect_zcl_attr_uint8(tvb, tree, offset, &hf_zbee_zcl_attr_status); @@ -1368,10 +1368,10 @@ static guint dissect_zcl_attr_data_type(tvbuff_t *tvb, proto_tree *tree, guint * attr_data_type = tvb_get_guint8(tvb, *offset); if ( tree ) { - proto_tree_add_uint(tree, hf_zbee_zcl_attr_data_type, tvb, *offset, sizeof(guint8), + proto_tree_add_uint(tree, hf_zbee_zcl_attr_data_type, tvb, *offset, (int)sizeof(guint8), attr_data_type); } - *offset += sizeof(guint8); + *offset += (int)sizeof(guint8); return attr_data_type; } /* dissect_zcl_attr_data_type */ @@ -1399,9 +1399,9 @@ static void dissect_zcl_attr_id(tvbuff_t *tvb, proto_tree *tree, guint *offset) attr_id = tvb_get_letohs(tvb, *offset); /* Add the identifier */ - proto_tree_add_uint(tree, hf_zbee_zcl_attr_id, tvb, *offset, sizeof(guint16), + proto_tree_add_uint(tree, hf_zbee_zcl_attr_id, tvb, *offset, (int)sizeof(guint16), attr_id); - *offset += sizeof(guint16); + *offset += (int)sizeof(guint16); return; } /* dissect_zcl_attr_id */ @@ -1471,9 +1471,9 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_item_append_text(tree, ", %s: %u", val_to_str_ext_const(data_type, &zbee_zcl_short_data_type_names_ext, "Reserved"), attr_uint); - proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint8, tvb, *offset, sizeof(guint8), + proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint8, tvb, *offset, (int)sizeof(guint8), attr_uint); - *offset += sizeof(guint8); + *offset += (int)sizeof(guint8); break; case ZBEE_ZCL_8_BIT_INT: @@ -1484,10 +1484,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_item_append_text(tree, ", %s: %-d", val_to_str_ext_const(data_type, &zbee_zcl_short_data_type_names_ext, "Reserved"), attr_int); - proto_tree_add_int(tree, hf_zbee_zcl_attr_int8, tvb, *offset, sizeof(gint8), + proto_tree_add_int(tree, hf_zbee_zcl_attr_int8, tvb, *offset, (int)sizeof(gint8), (gint)attr_int); - *offset += sizeof(gint8); + *offset += (int)sizeof(gint8); break; case ZBEE_ZCL_BOOLEAN: @@ -1499,7 +1499,7 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_tree_add_item(tree, hf_zbee_zcl_attr_boolean, tvb, *offset, 1, ENC_BIG_ENDIAN); - *offset += sizeof(guint8); + *offset += (int)sizeof(guint8); break; case ZBEE_ZCL_16_BIT_DATA: @@ -1516,10 +1516,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_item_append_text(tree, ", %s: %u", val_to_str_ext_const(data_type, &zbee_zcl_short_data_type_names_ext, "Reserved"), attr_uint); - proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint16, tvb, *offset, sizeof(guint16), + proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint16, tvb, *offset, (int)sizeof(guint16), attr_uint); - *offset += sizeof(guint16); + *offset += (int)sizeof(guint16); break; case ZBEE_ZCL_16_BIT_INT: @@ -1530,10 +1530,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_item_append_text(tree, ", %s: %-d", val_to_str_ext_const(data_type, &zbee_zcl_short_data_type_names_ext, "Reserved"), attr_int); - proto_tree_add_int(tree, hf_zbee_zcl_attr_int16, tvb, *offset, sizeof(gint16), + proto_tree_add_int(tree, hf_zbee_zcl_attr_int16, tvb, *offset, (int)sizeof(gint16), attr_int); - *offset += sizeof(gint16); + *offset += (int)sizeof(gint16); break; case ZBEE_ZCL_24_BIT_DATA: @@ -1584,10 +1584,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_item_append_text(tree, ", %s: %u", val_to_str_ext_const(data_type, &zbee_zcl_short_data_type_names_ext, "Reserved"), attr_uint); - proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint32, tvb, *offset, sizeof(guint), + proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint32, tvb, *offset, (int)sizeof(guint), attr_uint); - *offset += sizeof(guint); + *offset += (int)sizeof(guint); break; case ZBEE_ZCL_32_BIT_INT: @@ -1598,10 +1598,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_item_append_text(tree, ", %s: %-d", val_to_str_ext_const(data_type, &zbee_zcl_short_data_type_names_ext, "Reserved"), attr_int); - proto_tree_add_int(tree, hf_zbee_zcl_attr_int32, tvb, *offset, sizeof(gint), + proto_tree_add_int(tree, hf_zbee_zcl_attr_int32, tvb, *offset, (int)sizeof(gint), attr_int); - *offset += sizeof(gint); + *offset += (int)sizeof(gint); break; case ZBEE_ZCL_40_BIT_DATA: @@ -1688,10 +1688,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset attr_uint = tvb_get_guint8(tvb, *offset); /* string length */ if (attr_uint == ZBEE_ZCL_INVALID_STR_LENGTH) attr_uint = 0; - proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, sizeof(guint8), + proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, (int)sizeof(guint8), attr_uint); - *offset += sizeof(guint8); + *offset += (int)sizeof(guint8); attr_string = tvb_bytes_to_str_punct(tvb, *offset, attr_uint, ':'); proto_item_append_text(tree, ", Octets: %s", attr_string); @@ -1707,10 +1707,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset attr_uint = tvb_get_guint8(tvb, *offset); /* string length */ if (attr_uint == ZBEE_ZCL_INVALID_STR_LENGTH) attr_uint = 0; - proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, sizeof(guint8), + proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, (int)sizeof(guint8), attr_uint); - *offset += sizeof(guint8); + *offset += (int)sizeof(guint8); attr_string = tvb_get_ephemeral_string(tvb, *offset, attr_uint); @@ -1725,9 +1725,9 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset /* Display long octet string */ attr_uint = tvb_get_letohs(tvb, *offset); /* string length */ if (attr_uint == ZBEE_ZCL_INVALID_LONG_STR_LENGTH) attr_uint = 0; - proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, sizeof(guint16), attr_uint); + proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, (int)sizeof(guint16), attr_uint); - *offset += sizeof(guint16); + *offset += (int)sizeof(guint16); attr_string = tvb_bytes_to_str_punct(tvb, *offset, attr_uint, ':'); proto_item_append_text(tree, ", Octets: %s", attr_string); @@ -1742,9 +1742,9 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset attr_uint = tvb_get_letohs(tvb, *offset); /* string length */ if (attr_uint == ZBEE_ZCL_INVALID_LONG_STR_LENGTH) attr_uint = 0; - proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, sizeof(guint16), attr_uint); + proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, (int)sizeof(guint16), attr_uint); - *offset += sizeof(guint16); + *offset += (int)sizeof(guint16); attr_string = tvb_get_ephemeral_string(tvb, *offset, attr_uint); proto_item_append_text(tree, ", String: %s", attr_string); @@ -1784,10 +1784,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_item_append_text(tree, ", %s", val_to_str_ext_const(data_type, &zbee_zcl_short_data_type_names_ext, "Reserved") ); - proto_tree_add_time(tree, hf_zbee_zcl_attr_utc, tvb, *offset, sizeof(guint), + proto_tree_add_time(tree, hf_zbee_zcl_attr_utc, tvb, *offset, (int)sizeof(guint), &attr_time); - *offset += sizeof(guint32); + *offset += (int)sizeof(guint32); break; case ZBEE_ZCL_CLUSTER_ID: @@ -1877,7 +1877,7 @@ static guint dissect_zcl_attr_uint8(tvbuff_t *tvb, proto_tree *tree, guint *offs guint attr_uint; attr_uint = tvb_get_guint8(tvb, *offset); - proto_tree_add_uint(tree, *hf_zbee_zcl, tvb, *offset, sizeof(guint8), attr_uint); + proto_tree_add_uint(tree, *hf_zbee_zcl, tvb, *offset, (int)sizeof(guint8), attr_uint); (*offset)++; return attr_uint; @@ -1902,8 +1902,8 @@ static guint dissect_zcl_attr_uint16(tvbuff_t *tvb, proto_tree *tree, guint *off guint attr_uint; attr_uint = tvb_get_letohs(tvb, *offset); - proto_tree_add_uint(tree, *hf_zbee_zcl, tvb, *offset, sizeof(guint16), attr_uint); - *offset += sizeof(guint16); + proto_tree_add_uint(tree, *hf_zbee_zcl, tvb, *offset, (int)sizeof(guint16), attr_uint); + *offset += (int)sizeof(guint16); return attr_uint; } /* dissect_zcl_attr_uint16 */ @@ -1982,13 +1982,13 @@ static guint64 tvb_get_letohi(tvbuff_t *tvb, guint offset, guint length, gboolea /* build big int of length bytes */ while ( length-- ) { result += (guint64)tvb_get_guint8(tvb, offset) << shift; - offset += sizeof(guint8); + offset += (int)sizeof(guint8); shift += 8; } if ( signed_flag && (result >> (shift - 1)) ) { /* sign extend remaining bytes */ - while ( shift < (sizeof(guint64) * 8) ) { + while ( shift < ((int)sizeof(guint64) * 8) ) { result += (guint64)0xff << shift; shift += 8; } diff --git a/epan/dissectors/packet-zbee-zdp-binding.c b/epan/dissectors/packet-zbee-zdp-binding.c index 1802ec1565..5ae79ef356 100644 --- a/epan/dissectors/packet-zbee-zdp-binding.c +++ b/epan/dissectors/packet-zbee-zdp-binding.c @@ -70,28 +70,28 @@ zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, packe /* Add the source address. */ src64 = tvb_get_letoh64(tvb, *offset + len); if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "Bind {Src: %s", get_eui64_name(src64)); - len += sizeof(guint64); + len += (int)sizeof(guint64); /* Add the source endpoint. */ src_ep = tvb_get_guint8(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Src Endpoint: %d", src_ep); - len += sizeof(guint8); + len += (int)sizeof(guint8); /* Add the cluster ID. */ if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { cluster = tvb_get_letohs(tvb, *offset + len); - len += sizeof(guint16); + len += (int)sizeof(guint16); } else { cluster = tvb_get_guint8(tvb, *offset + len); - len += sizeof(guint8); + len += (int)sizeof(guint8); } if (tree) proto_item_append_text(ti, ", Cluster: %d", cluster); /* Get the destination address mode. */ if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { mode = tvb_get_guint8(tvb, *offset + len); - len += sizeof(guint8); + len += (int)sizeof(guint8); } else { /* Mode field doesn't exist and always uses unicast in 2003 & earlier. */ @@ -102,16 +102,16 @@ zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, packe if (mode == ZBEE_ZDP_ADDR_MODE_GROUP) { dst = tvb_get_letohs(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Dst: 0x%04x}", dst); - len += sizeof(guint16); + len += (int)sizeof(guint16); } else if (mode == ZBEE_ZDP_ADDR_MODE_UNICAST) { dst64 = tvb_get_letoh64(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Dst: %s", get_eui64_name(dst64)); - len += sizeof(guint64); + len += (int)sizeof(guint64); dst_ep = tvb_get_guint8(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Dst Endpoint: %d}", dst_ep); - len += sizeof(guint8); + len += (int)sizeof(guint8); } else { if (tree) proto_item_append_text(ti, "}"); @@ -144,7 +144,7 @@ zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, packe void dissect_zbee_zdp_req_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - guint sizeof_cluster = (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?sizeof(guint16):sizeof(guint8); + guint sizeof_cluster = (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8); guint i; proto_item *ti; proto_tree *field_tree = NULL; @@ -157,24 +157,24 @@ dissect_zbee_zdp_req_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tr guint8 in_count; guint8 out_count; - target = zbee_parse_uint(tree, hf_zbee_zdp_target, tvb, &offset, sizeof(guint16), NULL); + target = zbee_parse_uint(tree, hf_zbee_zdp_target, tvb, &offset, (guint)sizeof(guint16), NULL); if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { /* Extended address present on ZigBee 2006 & later. */ - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (guint)sizeof(guint64), NULL); } - /*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, sizeof(guint8), NULL); - /*profile =*/ zbee_parse_uint(tree, hf_zbee_zdp_profile, tvb, &offset, sizeof(guint16), NULL); + /*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, (guint)sizeof(guint8), NULL); + /*profile =*/ zbee_parse_uint(tree, hf_zbee_zdp_profile, tvb, &offset, (guint)sizeof(guint16), NULL); - in_count = zbee_parse_uint(tree, hf_zbee_zdp_in_count, tvb, &offset, sizeof(guint8), NULL); + in_count = zbee_parse_uint(tree, hf_zbee_zdp_in_count, tvb, &offset, (guint)sizeof(guint8), NULL); if ((tree) && (in_count)){ - ti = proto_tree_add_text(tree, tvb, offset, in_count*sizeof_cluster, "Input Cluster List"); + ti = proto_tree_add_text(tree, tvb, offset, (int)(in_count*sizeof_cluster), "Input Cluster List"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind_end_in); } - for (i=0; i<in_count; i++) zbee_parse_uint(field_tree, hf_zbee_zdp_in_cluster, tvb, &offset, sizeof_cluster, NULL); + for (i=0; i<in_count; i++) zbee_parse_uint(field_tree, hf_zbee_zdp_in_cluster, tvb, &offset, (guint)sizeof_cluster, NULL); - out_count = zbee_parse_uint(tree, hf_zbee_zdp_out_count, tvb, &offset, sizeof(guint8), NULL); + out_count = zbee_parse_uint(tree, hf_zbee_zdp_out_count, tvb, &offset, (guint)sizeof(guint8), NULL); if ((tree) && (out_count)) { - ti = proto_tree_add_text(tree, tvb, offset, out_count*sizeof_cluster, "Output Cluster List"); + ti = proto_tree_add_text(tree, tvb, offset, (int)(out_count*sizeof_cluster), "Output Cluster List"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind_end_out); } for (i=0; i<out_count; i++) zbee_parse_uint(field_tree, hf_zbee_zdp_out_cluster, tvb, &offset, sizeof_cluster, NULL); @@ -216,11 +216,11 @@ dissect_zbee_zdp_req_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint64 dst64 = 0; /*guint8 dst_ep;*/ - src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, sizeof(guint64), NULL); - /*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, sizeof(guint8), NULL); - /*cluster =*/ zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, ZBEE_HAS_2006(pinfo->zbee_stack_vers)?sizeof(guint16):sizeof(guint8), NULL); + src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL); + /*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL); + /*cluster =*/ zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, ZBEE_HAS_2006(pinfo->zbee_stack_vers)?(int)sizeof(guint16):(int)sizeof(guint8), NULL); if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { - dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, sizeof(guint8), &ti); + dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti); if (tree) { if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) proto_item_append_text(ti, " (Group)"); else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) proto_item_append_text(ti, " (Unicast)"); @@ -233,11 +233,11 @@ dissect_zbee_zdp_req_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) { - dst = zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, sizeof(guint16), NULL); + dst = zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, (int)sizeof(guint16), NULL); } else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) { - dst64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, sizeof(guint64), NULL); - /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, sizeof(guint8), NULL); + dst64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(guint64), NULL); + /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, (int)sizeof(guint8), NULL); } if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { @@ -282,11 +282,11 @@ dissect_zbee_zdp_req_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint64 dst64 = 0; /*guint8 dst_ep;*/ - src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, sizeof(guint64), NULL); - /*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, sizeof(guint8), NULL); - /*cluster =*/ zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?sizeof(guint16):sizeof(guint8), NULL); + src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL); + /*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL); + /*cluster =*/ zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8), NULL); if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { - dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, sizeof(guint8), &ti); + dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti); if (tree) { if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) proto_item_append_text(ti, " (Group)"); else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) proto_item_append_text(ti, " (Unicast)"); @@ -299,11 +299,11 @@ dissect_zbee_zdp_req_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) { - dst = zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, sizeof(guint16), NULL); + dst = zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, (int)sizeof(guint16), NULL); } else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) { - dst64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, sizeof(guint64), NULL); - /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, sizeof(guint8), NULL); + dst64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(guint64), NULL); + /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, (int)sizeof(guint8), NULL); } if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { @@ -340,7 +340,7 @@ dissect_zbee_zdp_req_bind_register(tvbuff_t *tvb, packet_info *pinfo, proto_tree guint offset = 0; guint64 ext_addr; - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); @@ -371,10 +371,10 @@ dissect_zbee_zdp_req_replace_device(tvbuff_t *tvb, packet_info *pinfo, proto_tre guint64 new_addr; /*guint8 new_ep;*/ - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); - /*endpoint =*/ zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, sizeof(guint8), NULL); - new_addr = zbee_parse_eui64(tree, hf_zbee_zdp_replacement, tvb, &offset, sizeof(guint64), NULL); - /*new_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_replacement_ep, tvb, &offset, sizeof(guint8), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); + /*endpoint =*/ zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, (int)sizeof(guint8), NULL); + new_addr = zbee_parse_eui64(tree, hf_zbee_zdp_replacement, tvb, &offset, (int)sizeof(guint64), NULL); + /*new_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_replacement_ep, tvb, &offset, (int)sizeof(guint8), NULL); zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); zbee_append_info(tree, pinfo, ", Replacement: %s", get_eui64_name(new_addr)); @@ -408,22 +408,22 @@ dissect_zbee_zdp_req_store_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, pro guint16 cluster; guint8 dst_mode; - src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, sizeof(guint64), NULL); - src_ep = zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, sizeof(guint8), NULL); - cluster = zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?sizeof(guint16):sizeof(guint8), NULL); - dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, sizeof(guint8), &ti); + src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL); + src_ep = zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL); + cluster = zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8), NULL); + dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti); if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) { /*guint16 dst;*/ if (tree) proto_item_append_text(ti, " (Group)"); - /*dst =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, sizeof(guint16), NULL); + /*dst =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, (int)sizeof(guint16), NULL); } else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) { /*guint64 dst64;*/ /*guint8 dst_ep;*/ if (tree) proto_item_append_text(ti, " (Unicast)"); - /*dst64 =*/ zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, sizeof(guint64), NULL); - /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, sizeof(guint8), NULL); + /*dst64 =*/ zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(guint64), NULL); + /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, (int)sizeof(guint8), NULL); } else if (tree) proto_item_append_text(ti, " (Reserved)"); @@ -460,22 +460,22 @@ dissect_zbee_zdp_req_remove_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, pr guint16 cluster; guint8 dst_mode; - src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, sizeof(guint64), NULL); - src_ep = zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, sizeof(guint8), NULL); - cluster = zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?sizeof(guint16):sizeof(guint8), NULL); - dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, sizeof(guint8), &ti); + src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL); + src_ep = zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL); + cluster = zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8), NULL); + dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti); if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) { /*guint16 dst;*/ if (tree) proto_item_append_text(ti, " (Group)"); - /*dst =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, sizeof(guint16), NULL); + /*dst =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, (int)sizeof(guint16), NULL); } else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) { /*guint64 dst64;*/ /*guint8 dst_ep;*/ if (tree) proto_item_append_text(ti, " (Unicast)"); - /*dst64 =*/ zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, sizeof(guint64), NULL); - /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, sizeof(guint8), NULL); + /*dst64 =*/ zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(guint64), NULL); + /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, (int)sizeof(guint8), NULL); } else if (tree) proto_item_append_text(ti, " (Reserved)"); @@ -513,9 +513,9 @@ dissect_zbee_zdp_req_backup_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_ /*guint16 idx;*/ guint16 table_count; - /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint16), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint16), NULL); - table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint16), NULL); + /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL); + table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint16), NULL); if (tree) { ti = proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Binding Table"); @@ -549,7 +549,7 @@ dissect_zbee_zdp_req_recover_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto guint offset = 0; /*guint16 idx;*/ - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint16), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); @@ -581,15 +581,15 @@ dissect_zbee_zdp_req_backup_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto /*guint16 idx;*/ guint16 count; - /*entries =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint16), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint16), NULL); - count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint16), NULL); + /*entries =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL); + count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint16), NULL); if (tree) { - ti = proto_tree_add_text(tree, tvb, offset, count*sizeof(guint64), "Source Table"); + ti = proto_tree_add_text(tree, tvb, offset, count*(int)sizeof(guint64), "Source Table"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind_source); } - for (i=0; i<count; i++) zbee_parse_eui64(field_tree, hf_zbee_zdp_bind_src64, tvb, &offset, sizeof(guint64), NULL); + for (i=0; i<count; i++) zbee_parse_eui64(field_tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); @@ -615,7 +615,7 @@ dissect_zbee_zdp_req_recover_source_bind(tvbuff_t *tvb, packet_info *pinfo, prot guint offset = 0; /*guint16 idx;*/ - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint16), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); @@ -736,8 +736,8 @@ dissect_zbee_zdp_rsp_bind_register(tvbuff_t *tvb, packet_info *pinfo, proto_tree guint16 table_count; status = zdp_parse_status(tree, tvb, &offset); - /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint16), NULL); - table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint16), NULL); + /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL); + table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint16), NULL); if (tree && table_count) { ti = proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Binding List"); @@ -859,7 +859,7 @@ dissect_zbee_zdp_rsp_backup_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_ /*guint16 count;*/ status = zdp_parse_status(tree, tvb, &offset); - /*count =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint16), NULL); + /*count =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL); zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); @@ -895,9 +895,9 @@ dissect_zbee_zdp_rsp_recover_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto guint16 table_count; status = zdp_parse_status(tree, tvb, &offset); - /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint16), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint16), NULL); - table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint16), NULL); + /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL); + table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint16), NULL); if (tree && table_count) { ti = proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Binding Table"); @@ -969,16 +969,16 @@ dissect_zbee_zdp_rsp_recover_source_bind(tvbuff_t *tvb, packet_info *pinfo, prot guint16 table_count; status = zdp_parse_status(tree, tvb, &offset); - /*table_size = */ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint16), NULL); - /*idx = */ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint16), NULL); - table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint16), NULL); + /*table_size = */ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL); + /*idx = */ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL); + table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint16), NULL); if (tree && table_count) { - ti = proto_tree_add_text(tree, tvb, offset, table_count * sizeof(guint64), "Source Table"); + ti = proto_tree_add_text(tree, tvb, offset, table_count * (int)sizeof(guint64), "Source Table"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind_source); } for (i=0; i<table_count; i++) { - (void)zbee_parse_eui64(field_tree, hf_zbee_zdp_bind_src64, tvb, &offset, sizeof(guint64), NULL); + (void)zbee_parse_eui64(field_tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL); } /* for */ zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); diff --git a/epan/dissectors/packet-zbee-zdp-discovery.c b/epan/dissectors/packet-zbee-zdp-discovery.c index f77524f38f..a2e2a80057 100644 --- a/epan/dissectors/packet-zbee-zdp-discovery.c +++ b/epan/dissectors/packet-zbee-zdp-discovery.c @@ -238,18 +238,18 @@ dissect_zbee_zdp_req_match_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t proto_item *ti; proto_tree *field_tree = NULL; guint offset = 0, i; - guint sizeof_cluster = (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?sizeof(guint16):sizeof(guint8); + guint sizeof_cluster = (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8); guint16 device; guint16 profile; guint8 in_count; guint8 out_count; - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - profile = zbee_parse_uint(tree, hf_zbee_zdp_profile, tvb, &offset, sizeof(guint16), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + profile = zbee_parse_uint(tree, hf_zbee_zdp_profile, tvb, &offset, (int)sizeof(guint16), NULL); /* Add the input cluster list. */ - in_count = zbee_parse_uint(tree, hf_zbee_zdp_in_count, tvb, &offset, sizeof(guint8), NULL); + in_count = zbee_parse_uint(tree, hf_zbee_zdp_in_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && in_count) { ti = proto_tree_add_text(tree, tvb, offset, in_count*sizeof_cluster, "Input Cluster List"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_match_in); @@ -257,7 +257,7 @@ dissect_zbee_zdp_req_match_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t for (i=0; i<in_count; i++) zbee_parse_uint(field_tree, hf_zbee_zdp_in_cluster, tvb, &offset, sizeof_cluster, NULL); /* Add the output cluster list. */ - out_count = zbee_parse_uint(tree, hf_zbee_zdp_out_count, tvb, &offset, sizeof(guint8), NULL); + out_count = zbee_parse_uint(tree, hf_zbee_zdp_out_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && out_count) { ti = proto_tree_add_text(tree, tvb, offset, out_count*sizeof_cluster, "Output Cluster List"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_match_out); @@ -290,7 +290,7 @@ dissect_zbee_zdp_req_complex_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree guint offset = 0; guint16 device; - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); zbee_append_info(tree, pinfo, ", Device: 0x%04x", device); @@ -318,7 +318,7 @@ dissect_zbee_zdp_req_user_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr guint offset = 0; guint16 device; - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); zbee_append_info(tree, pinfo, ", Device: 0x%04x", device); @@ -347,8 +347,8 @@ dissect_zbee_zdp_req_discovery_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tr /*guint16 device;*/ guint64 ext_addr; - /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); + /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); @@ -378,8 +378,8 @@ dissect_zbee_zdp_device_annce(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre guint64 ext_addr; /*guint8 capability;*/ - /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); + /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); /*capability =*/ zdp_parse_cinfo(tree, ett_zbee_zdp_cinfo, tvb, &offset); zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); @@ -410,9 +410,9 @@ dissect_zbee_zdp_req_set_user_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree guint8 user_length; gchar *user; - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { - user_length = zbee_parse_uint(tree, hf_zbee_zdp_user_length, tvb, &offset, sizeof(guint8), NULL); + user_length = zbee_parse_uint(tree, hf_zbee_zdp_user_length, tvb, &offset, (int)sizeof(guint8), NULL); } else { /* No Length field in ZigBee 2003 & earlier, uses a fixed length of 16. */ @@ -487,19 +487,19 @@ dissect_zbee_zdp_req_store_discovery(tvbuff_t *tvb, packet_info *pinfo, proto_tr /*guint8 ep_count;*/ guint8 simple_count; - /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); - /*node_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_disc_node_size, tvb, &offset, sizeof(guint8), NULL); - /*power_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_disc_power_size, tvb, &offset, sizeof(guint8), NULL); - /*ep_count =*/ zbee_parse_uint(tree, hf_zbee_zdp_disc_ep_count, tvb, &offset, sizeof(guint8), NULL); - simple_count= zbee_parse_uint(tree, hf_zbee_zdp_disc_simple_count, tvb, &offset, sizeof(guint8), NULL); + /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); + /*node_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_disc_node_size, tvb, &offset, (int)sizeof(guint8), NULL); + /*power_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_disc_power_size, tvb, &offset, (int)sizeof(guint8), NULL); + /*ep_count =*/ zbee_parse_uint(tree, hf_zbee_zdp_disc_ep_count, tvb, &offset, (int)sizeof(guint8), NULL); + simple_count= zbee_parse_uint(tree, hf_zbee_zdp_disc_simple_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree) { ti = proto_tree_add_text(tree, tvb, offset, simple_count, "Simple Descriptor Sizes"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_simple_sizes); } for (i=0; i<simple_count; i++) { - zbee_parse_uint(field_tree, hf_zbee_zdp_disc_simple_size, tvb, &offset, sizeof(guint8), NULL); + zbee_parse_uint(field_tree, hf_zbee_zdp_disc_simple_size, tvb, &offset, (int)sizeof(guint8), NULL); } zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); @@ -529,8 +529,8 @@ dissect_zbee_zdp_req_store_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tr /*guint16 device;*/ guint64 ext_addr; - /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); + /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); zdp_parse_node_desc(tree, ett_zbee_zdp_node, tvb, &offset, pinfo); zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); @@ -560,8 +560,8 @@ dissect_zbee_zdp_req_store_power_desc(tvbuff_t *tvb, packet_info *pinfo, proto_t /*guint16 device;*/ guint64 ext_addr; - /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); + /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); zdp_parse_power_desc(tree, ett_zbee_zdp_power, tvb, &offset); zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); @@ -596,16 +596,16 @@ dissect_zbee_zdp_req_store_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tr guint64 ext_addr; guint8 ep_count; - /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); - ep_count = zbee_parse_uint(tree, hf_zbee_zdp_ep_count, tvb, &offset, sizeof(guint8), NULL); + /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); + ep_count = zbee_parse_uint(tree, hf_zbee_zdp_ep_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree) { ti = proto_tree_add_text(tree, tvb, offset, ep_count, "Active Endpoints"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_endpoint); } for (i=0; i<ep_count; i++) { - (void)zbee_parse_uint(field_tree, hf_zbee_zdp_endpoint, tvb, &offset, sizeof(guint8), NULL); + (void)zbee_parse_uint(field_tree, hf_zbee_zdp_endpoint, tvb, &offset, (int)sizeof(guint8), NULL); } zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); @@ -636,9 +636,9 @@ dissect_zbee_zdp_req_store_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_ guint64 ext_addr; /*guint8 simple_len;*/ - /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); - /*simple_len =*/ zbee_parse_uint(tree, hf_zbee_zdp_simple_length, tvb, &offset, sizeof(guint8), NULL); + /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); + /*simple_len =*/ zbee_parse_uint(tree, hf_zbee_zdp_simple_length, tvb, &offset, (int)sizeof(guint8), NULL); zdp_parse_simple_desc(tree, ett_zbee_zdp_simple, tvb, &offset, pinfo); zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); @@ -668,8 +668,8 @@ dissect_zbee_zdp_req_remove_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_ /*guint16 device;*/ guint64 ext_addr; - /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); + /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); @@ -698,8 +698,8 @@ dissect_zbee_zdp_req_find_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tr /*guint16 device;*/ guint64 ext_addr; - /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); + /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); @@ -729,9 +729,9 @@ dissect_zbee_zdp_req_ext_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tr guint8 endpt; /*guint8 idx;*/ - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - endpt = zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, sizeof(guint8), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + endpt = zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, (int)sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); zbee_append_info(tree, pinfo, ", Device: 0x%04x, Endpoint: %d", device, endpt); @@ -760,8 +760,8 @@ dissect_zbee_zdp_req_ext_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree guint16 device; /*guint8 idx;*/ - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); zbee_append_info(tree, pinfo, ", Device: 0x%04x", device); @@ -802,20 +802,20 @@ dissect_zbee_zdp_rsp_nwk_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre /*guint8 idx;*/ status = zdp_parse_status(tree, tvb, &offset); - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); - if (tvb_bytes_exist(tvb, offset, 2*sizeof(guint8))) { + if (tvb_bytes_exist(tvb, offset, 2*(int)sizeof(guint8))) { /* The presence of these fields depends on the request message. Include them if they exist. */ - assoc = zbee_parse_uint(tree, hf_zbee_zdp_assoc_device_count, tvb, &offset, sizeof(guint8), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); + assoc = zbee_parse_uint(tree, hf_zbee_zdp_assoc_device_count, tvb, &offset, (int)sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); if ((tree) && (assoc)) { - ti = proto_tree_add_text(tree, tvb, offset, assoc*sizeof(guint16), "Associated Device List"); + ti = proto_tree_add_text(tree, tvb, offset, assoc*(int)sizeof(guint16), "Associated Device List"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_assoc_device); } for (i=0; i<assoc; i++) { - (void)zbee_parse_uint(field_tree, hf_zbee_zdp_assoc_device, tvb, &offset, sizeof(guint16), NULL); + (void)zbee_parse_uint(field_tree, hf_zbee_zdp_assoc_device, tvb, &offset, (int)sizeof(guint16), NULL); } } @@ -857,20 +857,20 @@ dissect_zbee_zdp_rsp_ext_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre /*guint8 idx;*/ status = zdp_parse_status(tree, tvb, &offset); - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); - if (tvb_bytes_exist(tvb, offset, 2*sizeof(guint8))) { + if (tvb_bytes_exist(tvb, offset, 2*(int)sizeof(guint8))) { /* The presence of these fields depends on the request message. Include them if they exist. */ - assoc = zbee_parse_uint(tree, hf_zbee_zdp_assoc_device_count, tvb, &offset, sizeof(guint8), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); + assoc = zbee_parse_uint(tree, hf_zbee_zdp_assoc_device_count, tvb, &offset, (int)sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); if ((tree) && (assoc)) { - ti = proto_tree_add_text(tree, tvb, offset, assoc*sizeof(guint16), "Associated Device List"); + ti = proto_tree_add_text(tree, tvb, offset, assoc*(int)sizeof(guint16), "Associated Device List"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_assoc_device); } for (i=0; i<assoc; i++) { - (void)zbee_parse_uint(field_tree, hf_zbee_zdp_assoc_device, tvb, &offset, sizeof(guint16), NULL); + (void)zbee_parse_uint(field_tree, hf_zbee_zdp_assoc_device, tvb, &offset, (int)sizeof(guint16), NULL); } } @@ -906,7 +906,7 @@ dissect_zbee_zdp_rsp_node_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr guint16 device; status = zdp_parse_status(tree, tvb, &offset); - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); if (status == ZBEE_ZDP_STATUS_SUCCESS) { zdp_parse_node_desc(tree, ett_zbee_zdp_node, tvb, &offset, pinfo); } @@ -941,7 +941,7 @@ dissect_zbee_zdp_rsp_power_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t guint16 device; status = zdp_parse_status(tree, tvb, &offset); - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); if (status == ZBEE_ZDP_STATUS_SUCCESS) { zdp_parse_power_desc(tree, ett_zbee_zdp_power, tvb, &offset); } @@ -977,8 +977,8 @@ dissect_zbee_zdp_rsp_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree * guint16 device; status = zdp_parse_status(tree, tvb, &offset); - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - /*length =*/ zbee_parse_uint(tree, hf_zbee_zdp_simple_length, tvb, &offset, sizeof(guint8), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + /*length =*/ zbee_parse_uint(tree, hf_zbee_zdp_simple_length, tvb, &offset, (int)sizeof(guint8), NULL); if (status == ZBEE_ZDP_STATUS_SUCCESS) { zdp_parse_simple_desc(tree, ett_zbee_zdp_simple, tvb, &offset, pinfo); } @@ -1017,15 +1017,15 @@ dissect_zbee_zdp_rsp_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr guint8 ep_count; status = zdp_parse_status(tree, tvb, &offset); - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - ep_count = zbee_parse_uint(tree, hf_zbee_zdp_ep_count, tvb, &offset, sizeof(guint8), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + ep_count = zbee_parse_uint(tree, hf_zbee_zdp_ep_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && ep_count) { - ti = proto_tree_add_text(tree, tvb, offset, ep_count*sizeof(guint8), "Active Endpoint List"); + ti = proto_tree_add_text(tree, tvb, offset, ep_count*(int)sizeof(guint8), "Active Endpoint List"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_endpoint); } for (i=0; i<ep_count; i++) { - (void)zbee_parse_uint(field_tree, hf_zbee_zdp_endpoint, tvb, &offset, sizeof(guint8), NULL); + (void)zbee_parse_uint(field_tree, hf_zbee_zdp_endpoint, tvb, &offset, (int)sizeof(guint8), NULL); } zbee_append_info(tree, pinfo, ", Device: 0x%04x", device); @@ -1062,15 +1062,15 @@ dissect_zbee_zdp_rsp_match_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t guint8 ep_count; status = zdp_parse_status(tree, tvb, &offset); - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - ep_count = zbee_parse_uint(tree, hf_zbee_zdp_ep_count, tvb, &offset, sizeof(guint8), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + ep_count = zbee_parse_uint(tree, hf_zbee_zdp_ep_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && ep_count) { - ti = proto_tree_add_text(tree, tvb, offset, ep_count*sizeof(guint8), "Matching Endpoint List"); + ti = proto_tree_add_text(tree, tvb, offset, ep_count*(int)sizeof(guint8), "Matching Endpoint List"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_endpoint); } for (i=0; i<ep_count; i++) { - (void)zbee_parse_uint(field_tree, hf_zbee_zdp_endpoint, tvb, &offset, sizeof(guint8), NULL); + (void)zbee_parse_uint(field_tree, hf_zbee_zdp_endpoint, tvb, &offset, (int)sizeof(guint8), NULL); } zbee_append_info(tree, pinfo, ", Device: 0x%04x", device); @@ -1104,8 +1104,8 @@ dissect_zbee_zdp_rsp_complex_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree guint16 device; status = zdp_parse_status(tree, tvb, &offset); - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - length = zbee_parse_uint(tree, hf_zbee_zdp_complex_length, tvb, &offset, sizeof(guint8), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + length = zbee_parse_uint(tree, hf_zbee_zdp_complex_length, tvb, &offset, (int)sizeof(guint8), NULL); if (length) { zdp_parse_complex_desc(tree, -1, tvb, &offset, length); } @@ -1141,10 +1141,10 @@ dissect_zbee_zdp_rsp_user_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr gchar *user; status = zdp_parse_status(tree, tvb, &offset); - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); if ((pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) || (status == ZBEE_ZDP_STATUS_SUCCESS)) { /* In ZigBee 2003 & earlier, the length field is omitted if not successful. */ - user_length = zbee_parse_uint(tree, hf_zbee_zdp_user_length, tvb, &offset, sizeof(guint8), NULL); + user_length = zbee_parse_uint(tree, hf_zbee_zdp_user_length, tvb, &offset, (int)sizeof(guint8), NULL); } else user_length = 0; @@ -1188,7 +1188,7 @@ dissect_zbee_zdp_rsp_user_desc_conf(tvbuff_t *tvb, packet_info *pinfo, proto_tre status = zdp_parse_status(tree, tvb, &offset); if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { /* Device address present only on ZigBee 2006 & later. */ - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); } zbee_append_info(tree, pinfo, ", Device: 0x%04x", device); @@ -1455,9 +1455,9 @@ dissect_zbee_zdp_rsp_find_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tr guint16 device; /*guint64 ext_addr;*/ - cache = zbee_parse_uint(tree, hf_zbee_zdp_cache, tvb, &offset, sizeof(guint16), NULL); - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - /*ext_addr =*/ zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); + cache = zbee_parse_uint(tree, hf_zbee_zdp_cache, tvb, &offset, (int)sizeof(guint16), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + /*ext_addr =*/ zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); zbee_append_info(tree, pinfo, ", Cache: 0x%04x", cache); zbee_append_info(tree, pinfo, ", Device: 0x%04x", device); @@ -1485,7 +1485,7 @@ dissect_zbee_zdp_rsp_ext_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tr { guint offset = 0; guint i; - guint sizeof_cluster = sizeof(guint16); + guint sizeof_cluster = (int)sizeof(guint16); guint8 status; guint16 device; @@ -1495,11 +1495,11 @@ dissect_zbee_zdp_rsp_ext_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tr guint8 idx; status = zdp_parse_status(tree, tvb, &offset); - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - /*endpt =*/ zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, sizeof(guint8), NULL); - in_count = zbee_parse_uint(tree, hf_zbee_zdp_in_count, tvb, &offset, sizeof(guint8), NULL); - out_count = zbee_parse_uint(tree, hf_zbee_zdp_out_count, tvb, &offset, sizeof(guint8), NULL); - idx = zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + /*endpt =*/ zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, (int)sizeof(guint8), NULL); + in_count = zbee_parse_uint(tree, hf_zbee_zdp_in_count, tvb, &offset, (int)sizeof(guint8), NULL); + out_count = zbee_parse_uint(tree, hf_zbee_zdp_out_count, tvb, &offset, (int)sizeof(guint8), NULL); + idx = zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); /* Display the input cluster list. */ for (i=idx; (i<in_count) && tvb_bytes_exist(tvb, offset, sizeof_cluster); i++) { @@ -1544,15 +1544,15 @@ dissect_zbee_zdp_rsp_ext_active_ep(tvbuff_t *tvb, packet_info *pinfo, proto_tree guint8 idx; status = zdp_parse_status(tree, tvb, &offset); - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - ep_count = zbee_parse_uint(tree, hf_zbee_zdp_ep_count, tvb, &offset, sizeof(guint8), NULL); - idx = zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + ep_count = zbee_parse_uint(tree, hf_zbee_zdp_ep_count, tvb, &offset, (int)sizeof(guint8), NULL); + idx = zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && ep_count) { - ti = proto_tree_add_text(tree, tvb, offset, ep_count*sizeof(guint8), "Active Endpoint List"); + ti = proto_tree_add_text(tree, tvb, offset, ep_count*(int)sizeof(guint8), "Active Endpoint List"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_endpoint); - for (i=idx; (i<ep_count) && tvb_bytes_exist(tvb, offset, sizeof(guint8)); i++) { - (void)zbee_parse_uint(field_tree, hf_zbee_zdp_endpoint, tvb, &offset, sizeof(guint8), NULL); + for (i=idx; (i<ep_count) && tvb_bytes_exist(tvb, offset, (int)sizeof(guint8)); i++) { + (void)zbee_parse_uint(field_tree, hf_zbee_zdp_endpoint, tvb, &offset, (int)sizeof(guint8), NULL); } } diff --git a/epan/dissectors/packet-zbee-zdp-management.c b/epan/dissectors/packet-zbee-zdp-management.c index 2e47024b7c..8d9395888f 100644 --- a/epan/dissectors/packet-zbee-zdp-management.c +++ b/epan/dissectors/packet-zbee-zdp-management.c @@ -71,23 +71,23 @@ zdp_parse_nwk_desc(proto_tree *tree, tvbuff_t *tvb, guint *offset, packet_info * /* Extended PAN Identifiers are used in ZigBee 2006 & later. */ ext_pan = tvb_get_letoh64(tvb, *offset + len); if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{Pan: %s", eui64_to_str(ext_pan)); - len += sizeof(guint64); + len += (int)sizeof(guint64); } else { /* Short PAN Identifiers are used in ZigBee 2003 and earlier. */ pan = tvb_get_letohs(tvb, *offset + len); if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{Pan: 0x%04x", pan); - len += sizeof(guint16); + len += (int)sizeof(guint16); } channel = tvb_get_guint8(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Channel: %d", channel); - len += sizeof(guint8); + len += (int)sizeof(guint8); profile = (tvb_get_guint8(tvb, *offset + len) & 0x0f) >> 0; version = (tvb_get_guint8(tvb, *offset + len) & 0xf0) >> 4; if (tree) proto_item_append_text(ti, ", Profile: 0x%01x, Version: %d", profile, version); - len += sizeof(guint8); + len += (int)sizeof(guint8); beacon = (tvb_get_guint8(tvb, *offset + len) & 0x0f) >> 0; superframe = (tvb_get_guint8(tvb, *offset + len) & 0xf0) >> 4; @@ -97,11 +97,11 @@ zdp_parse_nwk_desc(proto_tree *tree, tvbuff_t *tvb, guint *offset, packet_info * else if (tree) { proto_item_append_text(ti, ", BeaconOrder: %d, SuperframeOrder: %d", beacon, superframe); } - len += sizeof(guint8); + len += (int)sizeof(guint8); permit = tvb_get_guint8(tvb, *offset) & 0x01; if (tree) proto_item_append_text(ti, ", PermitJoining: %s}", permit?"True":"False"); - len += sizeof(guint8); + len += (int)sizeof(guint8); if (tree) proto_item_set_len(ti, len); *offset += len; @@ -141,22 +141,22 @@ zdp_parse_neighbor_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, p /* ZigBee 2006 & later use an extended PAN Identifier. */ ext_pan = tvb_get_letoh64(tvb, *offset + len); if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{Extended PAN: %s", eui64_to_str(ext_pan)); - len += sizeof(guint64); + len += (int)sizeof(guint64); } else { /* ZigBee 2003 & earlier use a short PAN Identifier. */ pan = tvb_get_letohs(tvb, *offset + len); if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{PAN: 0x%04x", pan); - len += sizeof(guint16); + len += (int)sizeof(guint16); } ext_addr = tvb_get_letoh64(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Extended Addr: %s", get_eui64_name(ext_addr)); - len += sizeof(guint64); + len += (int)sizeof(guint64); device = tvb_get_letohs(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Addr: 0x%04x", device); - len += sizeof(guint16); + len += (int)sizeof(guint16); if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { type = (tvb_get_guint8(tvb, *offset + len) & 0x03) >> 0; @@ -185,13 +185,13 @@ zdp_parse_neighbor_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, p else if (rel == 0x04) proto_item_append_text(ti, ", Relationship: Previous Child"); else proto_item_append_text(ti, ", Relationship: Unknown"); } - len += sizeof(guint8); + len += (int)sizeof(guint8); if (pinfo->zbee_stack_vers <= ZBEE_VERSION_2004) { /* In ZigBee 2003 & earlier, the depth field is before the permit joining field. */ depth = tvb_get_guint8(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Depth: %d", depth); - len += sizeof(guint8); + len += (int)sizeof(guint8); } permit_joining = (tvb_get_guint8(tvb, *offset + len) & 0x03) >> 0; @@ -200,18 +200,18 @@ zdp_parse_neighbor_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, p else if (permit_joining == 0x01)proto_item_append_text(ti, ", Permit Joining: True"); else proto_item_append_text(ti, ", Permit Joining: Unknown"); } - len += sizeof(guint8); + len += (int)sizeof(guint8); if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { /* In ZigBee 2006 & later, the depth field is after the permit joining field. */ depth = tvb_get_guint8(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Depth: %d", depth); - len += sizeof(guint8); + len += (int)sizeof(guint8); } lqi = tvb_get_guint8(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", LQI: %d}", lqi); - len += sizeof(guint8); + len += (int)sizeof(guint8); if (tree) proto_item_set_len(ti, len); *offset += len; @@ -240,11 +240,11 @@ zdp_parse_routing_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset) guint16 next; dest = tvb_get_letohs(tvb, *offset + len); - if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 2*sizeof(guint16) + sizeof(guint8), "{Destination: 0x%04x", dest); - len += sizeof(guint16); + if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 2*(int)sizeof(guint16) + (int)sizeof(guint8), "{Destination: 0x%04x", dest); + len += (int)sizeof(guint16); status = tvb_get_guint8(tvb, *offset + len); - next = tvb_get_letohs(tvb, *offset + len + sizeof(guint8)); + next = tvb_get_letohs(tvb, *offset + len + (int)sizeof(guint8)); if (tree) { /* Display the next hop first, because it looks a lot cleaner that way. */ proto_item_append_text(ti, ", Next Hop: 0x%04x", next); @@ -255,7 +255,7 @@ zdp_parse_routing_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset) else if (status == 0x03)proto_item_append_text(ti, ", Status: Inactive}"); else proto_item_append_text(ti, ", Status: Unknown}"); } - len += sizeof(guint8) + sizeof(guint16); + len += (int)sizeof(guint8) + (int)sizeof(guint16); *offset += len; } /* zdp_parse_routing_table_entry */ @@ -308,7 +308,7 @@ dissect_zbee_zdp_req_mgmt_nwk_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree channels = tvb_get_letohl(tvb, offset); if (tree) { gboolean first = 1; - ti = proto_tree_add_text(tree, tvb, offset, sizeof(guint32), "Scan Channels: "); + ti = proto_tree_add_text(tree, tvb, offset, (int)sizeof(guint32), "Scan Channels: "); for (i=0; i<27; i++) { if (channels & (1<<i)) { @@ -323,10 +323,10 @@ dissect_zbee_zdp_req_mgmt_nwk_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree } if (first) proto_item_append_text(ti, "None"); } - offset += sizeof(guint32); + offset += (int)sizeof(guint32); - /*duration =*/ zbee_parse_uint(tree, hf_zbee_zdp_duration, tvb, &offset, sizeof(guint8), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); + /*duration =*/ zbee_parse_uint(tree, hf_zbee_zdp_duration, tvb, &offset, (int)sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); @@ -352,7 +352,7 @@ dissect_zbee_zdp_req_mgmt_lqi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre guint offset = 0; /*guint8 idx;*/ - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); @@ -378,7 +378,7 @@ dissect_zbee_zdp_req_mgmt_rtg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre guint offset = 0; /*guint8 idx;*/ - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); @@ -404,7 +404,7 @@ dissect_zbee_zdp_req_mgmt_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr guint offset = 0; /*guint8 idx;*/ - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); @@ -431,15 +431,15 @@ dissect_zbee_zdp_req_mgmt_leave(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t guint64 ext_addr; guint8 flags; - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { /* Flags present on ZigBee 2006 & later. */ flags = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_boolean(tree, hf_zbee_zdp_leave_children, tvb, offset, sizeof(guint8), flags & ZBEE_ZDP_MGMT_LEAVE_CHILDREN); - proto_tree_add_boolean(tree, hf_zbee_zdp_leave_rejoin, tvb, offset, sizeof(guint8), flags & ZBEE_ZDP_MGMT_LEAVE_REJOIN); + proto_tree_add_boolean(tree, hf_zbee_zdp_leave_children, tvb, offset, (int)sizeof(guint8), flags & ZBEE_ZDP_MGMT_LEAVE_CHILDREN); + proto_tree_add_boolean(tree, hf_zbee_zdp_leave_rejoin, tvb, offset, (int)sizeof(guint8), flags & ZBEE_ZDP_MGMT_LEAVE_REJOIN); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); @@ -469,7 +469,7 @@ dissect_zbee_zdp_req_mgmt_direct_join(tvbuff_t *tvb, packet_info *pinfo, proto_t guint64 ext_addr; /*guint8 cinfo;*/ - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); /*cinfo =*/ zdp_parse_cinfo(tree, ett_zbee_zdp_cinfo, tvb, &offset); zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); @@ -499,8 +499,8 @@ dissect_zbee_zdp_req_mgmt_permit_join(tvbuff_t *tvb, packet_info *pinfo, proto_t /*guint8 duration;*/ /*guint8 significance;*/ - /*duration =*/ zbee_parse_uint(tree, hf_zbee_zdp_duration, tvb, &offset, sizeof(guint8), NULL); - /*significance =*/ zbee_parse_uint(tree, hf_zbee_zdp_significance, tvb, &offset, sizeof(guint8), NULL); + /*duration =*/ zbee_parse_uint(tree, hf_zbee_zdp_duration, tvb, &offset, (int)sizeof(guint8), NULL); + /*significance =*/ zbee_parse_uint(tree, hf_zbee_zdp_significance, tvb, &offset, (int)sizeof(guint8), NULL); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); @@ -526,7 +526,7 @@ dissect_zbee_zdp_req_mgmt_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t guint offset = 0; /*guint8 idx;*/ - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); @@ -557,16 +557,16 @@ dissect_zbee_zdp_req_mgmt_nwkupdate(tvbuff_t *tvb, packet_info *pinfo, proto_tre /*guint16 manager;*/ /*channels =*/ zdp_parse_chanmask(tree, tvb, &offset); - duration = zbee_parse_uint(tree, hf_zbee_zdp_duration, tvb, &offset, sizeof(guint8), NULL); + duration = zbee_parse_uint(tree, hf_zbee_zdp_duration, tvb, &offset, (int)sizeof(guint8), NULL); if (duration == ZBEE_ZDP_NWKUPDATE_PARAMETERS) { - /*update_id =*/ zbee_parse_uint(tree, hf_zbee_zdp_update_id, tvb, &offset, sizeof(guint8), NULL); - /*manager =*/ zbee_parse_uint(tree, hf_zbee_zdp_manager, tvb, &offset, sizeof(guint16), NULL); + /*update_id =*/ zbee_parse_uint(tree, hf_zbee_zdp_update_id, tvb, &offset, (int)sizeof(guint8), NULL); + /*manager =*/ zbee_parse_uint(tree, hf_zbee_zdp_manager, tvb, &offset, (int)sizeof(guint16), NULL); } else if (duration == ZBEE_ZDP_NWKUPDATE_CHANNEL_HOP) { - /*update_id =*/ zbee_parse_uint(tree, hf_zbee_zdp_update_id, tvb, &offset, sizeof(guint8), NULL); + /*update_id =*/ zbee_parse_uint(tree, hf_zbee_zdp_update_id, tvb, &offset, (int)sizeof(guint8), NULL); } else if (duration <= ZBEE_ZDP_NWKUPDATE_SCAN_MAX) { - /*count =*/ zbee_parse_uint(tree, hf_zbee_zdp_scan_count, tvb, &offset, sizeof(guint8), NULL); + /*count =*/ zbee_parse_uint(tree, hf_zbee_zdp_scan_count, tvb, &offset, (int)sizeof(guint8), NULL); } /* Dump any leftover bytes. */ @@ -605,9 +605,9 @@ dissect_zbee_zdp_rsp_mgmt_nwk_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree guint8 table_count; status = zdp_parse_status(tree, tvb, &offset); - /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint8), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); - table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint8), NULL); + /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); + table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && table_count) { ti = proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Network List"); @@ -651,9 +651,9 @@ dissect_zbee_zdp_rsp_mgmt_lqi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre guint8 table_count; status = zdp_parse_status(tree, tvb, &offset); - /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint8), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); - table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint8), NULL); + /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); + table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && table_count) { ti = proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Neighbor Table"); @@ -697,9 +697,9 @@ dissect_zbee_zdp_rsp_mgmt_rtg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre guint8 table_count; status = zdp_parse_status(tree, tvb, &offset); - /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint8), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); - table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint8), NULL); + /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); + table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && table_count) { ti = proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Routing Table"); @@ -743,9 +743,9 @@ dissect_zbee_zdp_rsp_mgmt_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr guint8 table_count; status = zdp_parse_status(tree, tvb, &offset); - /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint8), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); - table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint8), NULL); + /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); + table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && table_count) { ti = proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Binding Table"); @@ -873,24 +873,24 @@ dissect_zbee_zdp_rsp_mgmt_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t guint8 table_count; status = zdp_parse_status(tree, tvb, &offset); - /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint8), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); - table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint8), NULL); + /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); + table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && table_count) { - ti = proto_tree_add_text(tree, tvb, offset, table_count*(sizeof(guint16)+sizeof(guint64)), "Discovery Cache"); + ti = proto_tree_add_text(tree, tvb, offset, table_count*((int)sizeof(guint16)+(int)sizeof(guint64)), "Discovery Cache"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_cache); } else { field_tree = NULL; } for (i=0; i<table_count; i++) { guint64 addr64 = tvb_get_letoh64(tvb, offset); - guint16 addr16 = tvb_get_letohs(tvb, offset+sizeof(guint64)); + guint16 addr16 = tvb_get_letohs(tvb, offset+(int)sizeof(guint64)); if (field_tree) { - proto_tree_add_text(field_tree, tvb, offset, sizeof(guint16)+sizeof(guint64), "{%s = 0x%04x}", get_eui64_name(addr64), addr16); + proto_tree_add_text(field_tree, tvb, offset, (int)sizeof(guint16)+(int)sizeof(guint64), "{%s = 0x%04x}", get_eui64_name(addr64), addr16); } - offset += sizeof(guint16)+sizeof(guint64); + offset += (int)sizeof(guint16)+(int)sizeof(guint64); } /* for */ zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); @@ -927,12 +927,12 @@ dissect_zbee_zdp_rsp_mgmt_nwkupdate(tvbuff_t *tvb, packet_info *pinfo, proto_tre /*status =*/ zdp_parse_status(tree, tvb, &offset); channels = zdp_parse_chanmask(tree, tvb, &offset); - /*tx_total =*/ zbee_parse_uint(tree, hf_zbee_zdp_tx_total, tvb, &offset, sizeof(guint16), NULL); - /*tx_fail =*/ zbee_parse_uint(tree, hf_zbee_zdp_tx_fail, tvb, &offset, sizeof(guint16), NULL); - channel_count = zbee_parse_uint(tree, hf_zbee_zdp_channel_count, tvb, &offset, sizeof(guint8), NULL); + /*tx_total =*/ zbee_parse_uint(tree, hf_zbee_zdp_tx_total, tvb, &offset, (int)sizeof(guint16), NULL); + /*tx_fail =*/ zbee_parse_uint(tree, hf_zbee_zdp_tx_fail, tvb, &offset, (int)sizeof(guint16), NULL); + channel_count = zbee_parse_uint(tree, hf_zbee_zdp_channel_count, tvb, &offset, (int)sizeof(guint8), NULL); /* Display the channel list. */ - for (i=0, j=0; i<(8*sizeof(guint32)); i++) { + for (i=0, j=0; i<(8*(int)sizeof(guint32)); i++) { guint8 energy; if ( ! ((1<<i) & channels) ) { @@ -946,9 +946,9 @@ dissect_zbee_zdp_rsp_mgmt_nwkupdate(tvbuff_t *tvb, packet_info *pinfo, proto_tre /* Get and display the channel energy. */ energy = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_text(tree, tvb, offset, sizeof(guint8), "Channel %d Energy = 0x%02x", i, energy); + proto_tree_add_text(tree, tvb, offset, (int)sizeof(guint8), "Channel %d Energy = 0x%02x", i, energy); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Increment the number of channels we found energy values for. */ j++; } /* for */ diff --git a/epan/dissectors/packet-zbee-zdp.c b/epan/dissectors/packet-zbee-zdp.c index 2b95d3c03d..e83186cf13 100644 --- a/epan/dissectors/packet-zbee-zdp.c +++ b/epan/dissectors/packet-zbee-zdp.c @@ -579,7 +579,7 @@ zbee_parse_eui64(proto_tree *tree, int hfindex, tvbuff_t *tvb, guint *offset, gu } /* Increment the offset. */ - *offset += sizeof(guint64); + *offset += (int)sizeof(guint64); /* return the item if requested. */ if (ti) *ti = item; @@ -609,9 +609,9 @@ zdp_parse_status(proto_tree *tree, tvbuff_t *tvb, guint *offset) /* Get and display the flags. */ status = tvb_get_guint8(tvb, *offset); if (tree) { - proto_tree_add_uint(tree, hf_zbee_zdp_status, tvb, *offset, sizeof(guint8), status); + proto_tree_add_uint(tree, hf_zbee_zdp_status, tvb, *offset, (int)sizeof(guint8), status); } - *offset += sizeof(guint8); + *offset += (int)sizeof(guint8); return status; } /* zdp_parse_status */ @@ -639,21 +639,21 @@ zdp_parse_chanmask(proto_tree *tree, tvbuff_t *tvb, guint *offset) /* Get and display the channel mask. */ mask = tvb_get_letohl(tvb, *offset); if (tree) { - ti = proto_tree_add_text(tree, tvb, *offset, sizeof(guint32), "Channels: "); + ti = proto_tree_add_text(tree, tvb, *offset, (int)sizeof(guint32), "Channels: "); /* Check if there are any channels to display. */ if (mask==0) { proto_item_append_text(ti, "None"); } /* Display the first channel #. */ - for (i=0; i<(8*(int)sizeof(guint32)); i++) { + for (i=0; i<(8*(int)(int)sizeof(guint32)); i++) { if ((1<<i) & mask) { proto_item_append_text(ti, "%d", i++); break; } } /* for */ /* Display the rest of the channels. */ - for (;i<(8*(int)sizeof(guint32)); i++) { + for (;i<(8*(int)(int)sizeof(guint32)); i++) { if (!((1<<i) & mask)) { /* This channel isn't selected. */ continue; @@ -674,7 +674,7 @@ zdp_parse_chanmask(proto_tree *tree, tvbuff_t *tvb, guint *offset) } } /* for */ } - *offset += sizeof(guint32); + *offset += (int)sizeof(guint32); return mask; } /* zdp_parse_chanmask */ @@ -705,19 +705,19 @@ zdp_parse_cinfo(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offset) flags = tvb_get_guint8(tvb, *offset); if (tree) { if (ettindex != -1) { - ti = proto_tree_add_text(tree, tvb, *offset, sizeof(guint8), "Capability Information"); + ti = proto_tree_add_text(tree, tvb, *offset, (int)sizeof(guint8), "Capability Information"); field_tree = proto_item_add_subtree(ti, ettindex); } else field_tree = tree; - proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_alt_coord, tvb, *offset, sizeof(guint8), flags & ZBEE_CINFO_ALT_COORD); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_ffd, tvb, *offset, sizeof(guint8), flags & ZBEE_CINFO_FFD); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_power, tvb, *offset, sizeof(guint8), flags & ZBEE_CINFO_POWER); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_idle_rx, tvb, *offset, sizeof(guint8), flags & ZBEE_CINFO_IDLE_RX); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_security, tvb, *offset, sizeof(guint8), flags & ZBEE_CINFO_SECURITY); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_alloc, tvb, *offset, sizeof(guint8), flags & ZBEE_CINFO_ALLOC); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_alt_coord, tvb, *offset, (int)sizeof(guint8), flags & ZBEE_CINFO_ALT_COORD); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_ffd, tvb, *offset, (int)sizeof(guint8), flags & ZBEE_CINFO_FFD); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_power, tvb, *offset, (int)sizeof(guint8), flags & ZBEE_CINFO_POWER); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_idle_rx, tvb, *offset, (int)sizeof(guint8), flags & ZBEE_CINFO_IDLE_RX); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_security, tvb, *offset, (int)sizeof(guint8), flags & ZBEE_CINFO_SECURITY); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_cinfo_alloc, tvb, *offset, (int)sizeof(guint8), flags & ZBEE_CINFO_ALLOC); } - *offset += sizeof(guint8); + *offset += (int)sizeof(guint8); return flags; } /* zdp_parse_cinfo */ @@ -748,19 +748,19 @@ zdp_parse_server_flags(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *of flags = tvb_get_letohs(tvb, *offset); if (tree) { if (ettindex != -1) { - ti = proto_tree_add_text(tree, tvb, *offset, sizeof(guint8), "Server Flags"); + ti = proto_tree_add_text(tree, tvb, *offset, (int)sizeof(guint8), "Server Flags"); field_tree = proto_item_add_subtree(ti, ettindex); } else field_tree = tree; - proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_pri_trust, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_PRIMARY_TRUST); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_bak_trust, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_BACKUP_TRUST); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_pri_bind, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_PRIMARY_BIND); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_bak_bind, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_BACKUP_BIND); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_pri_disc, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_PRIMARY_DISC); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_bak_disc, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_BACKUP_DISC); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_pri_trust, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_PRIMARY_TRUST); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_bak_trust, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_BACKUP_TRUST); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_pri_bind, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_PRIMARY_BIND); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_bak_bind, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_BACKUP_BIND); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_pri_disc, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_PRIMARY_DISC); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_server_bak_disc, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_SERVER_BACKUP_DISC); } - *offset += sizeof(guint16); + *offset += (int)sizeof(guint16); return flags; } /* zdp_parse_server_flags */ @@ -805,12 +805,12 @@ zdp_parse_node_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offse flags = tvb_get_letohs(tvb, *offset); if (tree) { guint16 type = flags & ZBEE_ZDP_NODE_TYPE; - ti = proto_tree_add_uint(field_tree, hf_zbee_zdp_node_type, tvb, *offset, sizeof(guint16), type); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_node_complex, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_NODE_COMPLEX); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_node_user, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_NODE_USER); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_node_freq_868, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_NODE_FREQ_868MHZ); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_node_freq_900, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_NODE_FREQ_900MHZ); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_node_freq_2400, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_NODE_FREQ_2400MHZ); + ti = proto_tree_add_uint(field_tree, hf_zbee_zdp_node_type, tvb, *offset, (int)sizeof(guint16), type); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_node_complex, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_COMPLEX); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_node_user, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_USER); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_node_freq_868, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_FREQ_868MHZ); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_node_freq_900, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_FREQ_900MHZ); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_node_freq_2400, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_NODE_FREQ_2400MHZ); /* Enumerate the type field. */ if (type == ZBEE_ZDP_NODE_TYPE_COORD) proto_item_append_text(ti, " (Coordinator)"); @@ -818,13 +818,13 @@ zdp_parse_node_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offse else if (type == ZBEE_ZDP_NODE_TYPE_RFD) proto_item_append_text(ti, " (End Device)"); else proto_item_append_text(ti, " (Reserved)"); } - *offset += sizeof(guint16); + *offset += (int)sizeof(guint16); /* Get and display the capability flags. */ /*capability =*/ zdp_parse_cinfo(field_tree, ett_zbee_zdp_cinfo, tvb, offset); - /*mfr_code =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_node_manufacturer, tvb, offset, sizeof(guint16), NULL); - /*max_buff =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_node_max_buffer, tvb, offset, sizeof(guint8), NULL); - /*max_transfer =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_node_max_transfer, tvb, offset, sizeof(guint16), NULL); + /*mfr_code =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_node_manufacturer, tvb, offset, (int)sizeof(guint16), NULL); + /*max_buff =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_node_max_buffer, tvb, offset, (int)sizeof(guint8), NULL); + /*max_transfer =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_node_max_transfer, tvb, offset, (int)sizeof(guint16), NULL); /* Get and display the server flags. */ if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { @@ -866,7 +866,7 @@ zdp_parse_power_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offs guint16 level; if ((tree) && (ettindex != -1)) { - ti = proto_tree_add_text(tree, tvb, *offset, sizeof(guint16), "Power Descriptor"); + ti = proto_tree_add_text(tree, tvb, *offset, (int)sizeof(guint16), "Power Descriptor"); field_tree = proto_item_add_subtree(ti, ettindex); } else field_tree = tree; @@ -875,31 +875,31 @@ zdp_parse_power_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offs mode = flags & ZBEE_ZDP_POWER_MODE; level = flags & ZBEE_ZDP_POWER_LEVEL; if (tree) { - ti = proto_tree_add_uint(field_tree, hf_zbee_zdp_power_mode, tvb, *offset, sizeof(guint16), mode); + ti = proto_tree_add_uint(field_tree, hf_zbee_zdp_power_mode, tvb, *offset, (int)sizeof(guint16), mode); if (mode == ZBEE_ZDP_POWER_MODE_RX_ON) proto_item_append_text(ti, " (Receiver Always On)"); else if (mode == ZBEE_ZDP_POWER_MODE_RX_PERIODIC) proto_item_append_text(ti, " (Receiver Periodically On)"); else if (mode == ZBEE_ZDP_POWER_MODE_RX_STIMULATE) proto_item_append_text(ti, " (Receiver On When Stimulated)"); else proto_item_append_text(ti, " (Reserved)"); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_avail_ac, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_POWER_AVAIL_AC); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_avail_recharge, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_POWER_AVAIL_RECHARGEABLE); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_avail_dispose, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_POWER_AVAIL_DISPOSEABLE); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_avail_ac, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_AVAIL_AC); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_avail_recharge, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_AVAIL_RECHARGEABLE); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_avail_dispose, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_AVAIL_DISPOSEABLE); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_source_ac, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_POWER_SOURCE_AC); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_source_recharge, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_POWER_SOURCE_RECHARGEABLE); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_source_dispose, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_POWER_SOURCE_DISPOSEABLE); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_source_ac, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_SOURCE_AC); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_source_recharge, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_SOURCE_RECHARGEABLE); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_source_dispose, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_SOURCE_DISPOSEABLE); if (level == ZBEE_ZDP_POWER_LEVEL_FULL) - proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, sizeof(guint16), level, "Full"); + proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, (int)sizeof(guint16), level, "Full"); else if (level == ZBEE_ZDP_POWER_LEVEL_OK) - proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, sizeof(guint16), level, "OK"); + proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, (int)sizeof(guint16), level, "OK"); else if (level == ZBEE_ZDP_POWER_LEVEL_LOW) - proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, sizeof(guint16), level, "Low"); + proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, (int)sizeof(guint16), level, "Low"); else if (level == ZBEE_ZDP_POWER_LEVEL_CRITICAL) - proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, sizeof(guint16), level, "Critical"); - else proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, sizeof(guint16), level, "Reserved"); + proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, (int)sizeof(guint16), level, "Critical"); + else proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, (int)sizeof(guint16), level, "Reserved"); } - *offset += sizeof(guint16); + *offset += (int)sizeof(guint16); } /* zdp_parse_power_desc */ /*FUNCTION:------------------------------------------------------ @@ -940,14 +940,14 @@ zdp_parse_simple_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *off } else field_tree = tree; - /*endpoint =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_endpoint, tvb, offset, sizeof(guint8), NULL); - /*profile =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_profile, tvb, offset, sizeof(guint16), NULL); - /*app_device =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_simple_app_device, tvb, offset, sizeof(guint16), NULL); - /*app_version =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_simple_app_version, tvb, offset, sizeof(guint8), NULL); + /*endpoint =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_endpoint, tvb, offset, (int)sizeof(guint8), NULL); + /*profile =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_profile, tvb, offset, (int)sizeof(guint16), NULL); + /*app_device =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_simple_app_device, tvb, offset, (int)sizeof(guint16), NULL); + /*app_version =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_simple_app_version, tvb, offset, (int)sizeof(guint8), NULL); - sizeof_cluster = (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?sizeof(guint16):sizeof(guint8); + sizeof_cluster = (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8); - in_count = zbee_parse_uint(field_tree, hf_zbee_zdp_in_count, tvb, offset, sizeof(guint8), NULL); + in_count = zbee_parse_uint(field_tree, hf_zbee_zdp_in_count, tvb, offset, (int)sizeof(guint8), NULL); if ((tree) && (in_count)) { ti = proto_tree_add_text(field_tree, tvb, *offset, in_count*sizeof_cluster, "Input Cluster List"); cluster_tree = proto_item_add_subtree(ti, ett_zbee_zdp_node_in); @@ -956,7 +956,7 @@ zdp_parse_simple_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *off zbee_parse_uint(cluster_tree, hf_zbee_zdp_in_cluster, tvb, offset, sizeof_cluster, NULL); } - out_count = zbee_parse_uint(field_tree, hf_zbee_zdp_out_count, tvb, offset, sizeof(guint8), NULL); + out_count = zbee_parse_uint(field_tree, hf_zbee_zdp_out_count, tvb, offset, (int)sizeof(guint8), NULL); if ((tree) && (out_count)) { ti = proto_tree_add_text(field_tree, tvb, *offset, in_count*sizeof_cluster, "Output Cluster List"); cluster_tree = proto_item_add_subtree(ti, ett_zbee_zdp_node_out); @@ -1031,7 +1031,7 @@ zdp_parse_complex_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *of if (tag == tag_charset) { gchar lang_str[3]; guint8 charset = tvb_get_guint8(tvb, *offset + 3); - gchar *charset_str; + const gchar *charset_str; if (charset == 0x00) charset_str = "ASCII"; else charset_str = "Unknown Character Set"; @@ -1099,9 +1099,9 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Get and display the sequence number. */ seqno = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_uint(zdp_tree, hf_zbee_zdp_seqno, tvb, offset, sizeof(guint8), seqno); + proto_tree_add_uint(zdp_tree, hf_zbee_zdp_seqno, tvb, offset, (int)sizeof(guint8), seqno); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); if (pinfo->zbee_stack_vers <= ZBEE_VERSION_2004) { /* ZigBee 2004 and earlier had different cluster identifiers, need to convert |