aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-gmrp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-12-26 05:57:06 +0000
committerGuy Harris <guy@alum.mit.edu>2012-12-26 05:57:06 +0000
commit8ed7a73e22c049a2e013bb436e599bff41fc5b9b (patch)
treead4a4cc6fb4ff4d3e3ffe3a3f8e3d056e441ae46 /epan/dissectors/packet-gmrp.c
parent8ede6b7dc09aa636f87147ab432a137c209e8aca (diff)
Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of sizeof. Cast away some implicit 64-bit-to-32-bit conversion errors due to use of strtol() and strtoul(). Change some data types to avoid those implicit conversion warnings. When assigning a constant to a float, make sure the constant isn't a double, by appending "f" to the constant. Constify a bunch of variables, parameters, and return values to eliminate warnings due to strings being given const qualifiers. Cast away those warnings in some cases where an API we don't control forces us to do so. Enable a bunch of additional warnings by default. Note why at least some of the other warnings aren't enabled. randpkt.c and text2pcap.c are used to build programs, so they don't need to be in EXTRA_DIST. If the user specifies --enable-warnings-as-errors, add -Werror *even if the user specified --enable-extra-gcc-flags; assume they know what they're doing and are willing to have the compile fail due to the extra GCC warnings being treated as errors. svn path=/trunk/; revision=46748
Diffstat (limited to 'epan/dissectors/packet-gmrp.c')
-rw-r--r--epan/dissectors/packet-gmrp.c54
1 files changed, 27 insertions, 27 deletions
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
{