diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-12-26 05:57:06 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-12-26 05:57:06 +0000 |
commit | 8ed7a73e22c049a2e013bb436e599bff41fc5b9b (patch) | |
tree | ad4a4cc6fb4ff4d3e3ffe3a3f8e3d056e441ae46 /plugins/wimax | |
parent | 8ede6b7dc09aa636f87147ab432a137c209e8aca (diff) | |
download | wireshark-8ed7a73e22c049a2e013bb436e599bff41fc5b9b.tar.gz wireshark-8ed7a73e22c049a2e013bb436e599bff41fc5b9b.tar.bz2 wireshark-8ed7a73e22c049a2e013bb436e599bff41fc5b9b.zip |
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 'plugins/wimax')
-rw-r--r-- | plugins/wimax/crc.c | 4 | ||||
-rw-r--r-- | plugins/wimax/mac_hd_generic_decoder.c | 22 | ||||
-rw-r--r-- | plugins/wimax/msg_dlmap.c | 8 | ||||
-rw-r--r-- | plugins/wimax/packet-wmx.c | 14 | ||||
-rw-r--r-- | plugins/wimax/wimax_harq_map_decoder.c | 8 |
5 files changed, 28 insertions, 28 deletions
diff --git a/plugins/wimax/crc.c b/plugins/wimax/crc.c index 7b92868333..b2dc4090dd 100644 --- a/plugins/wimax/crc.c +++ b/plugins/wimax/crc.c @@ -28,7 +28,7 @@ #include "crc.h" -#define WMAX_MAC_CRC32_POLYNOMIAL 0x04c11db7L /* polynomial used in calculating the CRC-32 checksum */ +#define WMAX_MAC_CRC32_POLYNOMIAL 0x04c11db7U /* polynomial used in calculating the CRC-32 checksum */ #define CCITT_X25_CRC16_POLYNOMIAL 0x1021 /* polynomial used in calculating the CRC-16 checksum */ #define WMAX_MAC_CRC8_POLYNOMIAL 0x07 /* polynomial used in calculating the CRC-8 checksum */ #define CRC32_INITIAL_VALUE 0xFFFFFFFF @@ -66,7 +66,7 @@ void wimax_mac_gen_crc32_table(void) crc = ( index << 24 ); for ( bit = 0; bit < 8; bit++ ) { - if ( crc & 0x80000000L ) + if ( crc & 0x80000000U ) crc = ( crc << 1 ) ^ WMAX_MAC_CRC32_POLYNOMIAL; else crc = ( crc << 1 ); diff --git a/plugins/wimax/mac_hd_generic_decoder.c b/plugins/wimax/mac_hd_generic_decoder.c index 1cc60fdfcb..c869c91417 100644 --- a/plugins/wimax/mac_hd_generic_decoder.c +++ b/plugins/wimax/mac_hd_generic_decoder.c @@ -703,9 +703,9 @@ void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto static guint8 frag_number[MAX_CID]; static guint cid_list[MAX_CID]; static guint cid_base; - static char *reassem_str = "Reassembled Data transport PDU (%u bytes)"; - static char *data_str = "Data transport PDU (%u bytes)"; - char *str_ptr; + static const char reassem_str[] = "Reassembled Data transport PDU (%u bytes)"; + static const char data_str[] = "Data transport PDU (%u bytes)"; + const char *str_ptr; gint length, i, cid_index; guint tvb_len, ret_length, ubyte, new_tvb_len; guint new_payload_len = 0; @@ -819,7 +819,7 @@ void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto { if (length >= (gint)sizeof(mac_crc)) { - length -= sizeof(mac_crc); + length -= (int)sizeof(mac_crc); } } generic_item = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, length, "Encrypted PDU (%u bytes)", length); @@ -986,7 +986,7 @@ void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, length, "Error - the frame is too short (%u bytes)", length); return; } - length -= sizeof(mac_crc); + length -= (int)sizeof(mac_crc); } while (length > 0) { @@ -1029,10 +1029,10 @@ void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto while (pinfo->fd->num > cid_adj_array_size) { cid_adj_array_size += 1024; - cid_adj_array = g_realloc(cid_adj_array, sizeof(guint) * cid_adj_array_size); - frag_num_array = g_realloc(frag_num_array, sizeof(guint8) * cid_adj_array_size); + cid_adj_array = g_realloc(cid_adj_array, (int)sizeof(guint) * cid_adj_array_size); + frag_num_array = g_realloc(frag_num_array, (int)sizeof(guint8) * cid_adj_array_size); /* Clear the added memory */ - memset(&cid_adj_array[cid_adj_array_size - 1024], 0, sizeof(guint) * 1024); + memset(&cid_adj_array[cid_adj_array_size - 1024], 0, (int)sizeof(guint) * 1024); } if (first_gmh) { @@ -1220,11 +1220,11 @@ check_crc: /* check the length */ if (MIN(tvb_len, tvb_reported_length(tvb)) >= mac_len) { /* get the CRC */ - mac_crc = tvb_get_ntohl(tvb, mac_len - sizeof(mac_crc)); + mac_crc = tvb_get_ntohl(tvb, mac_len - (int)sizeof(mac_crc)); /* calculate the CRC */ - calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, mac_len - sizeof(mac_crc)), mac_len - sizeof(mac_crc)); + calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, mac_len - (int)sizeof(mac_crc)), mac_len - (int)sizeof(mac_crc)); /* display the CRC */ - generic_item = proto_tree_add_item(tree, hf_mac_header_generic_crc, tvb, mac_len - sizeof(mac_crc), sizeof(mac_crc), ENC_BIG_ENDIAN); + generic_item = proto_tree_add_item(tree, hf_mac_header_generic_crc, tvb, mac_len - (int)sizeof(mac_crc), (int)sizeof(mac_crc), ENC_BIG_ENDIAN); if (mac_crc != calculated_crc) { proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); diff --git a/plugins/wimax/msg_dlmap.c b/plugins/wimax/msg_dlmap.c index 91ca190284..ba51129b0c 100644 --- a/plugins/wimax/msg_dlmap.c +++ b/plugins/wimax/msg_dlmap.c @@ -2180,7 +2180,7 @@ gint wimax_decode_dlmapc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *base_tre ti_dlmap_ies = proto_tree_add_text(tree, tvb, offset, length, "DL-MAP IEs (%d bytes)", length); ie_tree = proto_item_add_subtree(ti_dlmap_ies, ett_dlmap_ie); - /* length = BYTE_TO_NIB(mac_len - sizeof(mac_crc) - 1); */ /* convert length to nibbles */ + /* length = BYTE_TO_NIB(mac_len - (int)sizeof(mac_crc) - 1); */ /* convert length to nibbles */ while (dl_ie_count--) { nib += dissect_dlmap_ie(ie_tree, bufptr, nib, tvb_len * 2, tvb); @@ -2212,11 +2212,11 @@ gint wimax_decode_dlmapc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *base_tre /* check the length */ if (MIN(tvb_len, tvb_reported_length(tvb)) >= mac_len) { /* get the CRC */ - mac_crc = tvb_get_ntohl(tvb, mac_len - sizeof(mac_crc)); + mac_crc = tvb_get_ntohl(tvb, mac_len - (int)sizeof(mac_crc)); /* calculate the CRC */ - calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, mac_len - sizeof(mac_crc)), mac_len - sizeof(mac_crc)); + calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, mac_len - (int)sizeof(mac_crc)), mac_len - (int)sizeof(mac_crc)); /* display the CRC */ - generic_item = proto_tree_add_item(base_tree, hf_mac_header_compress_dlmap_crc, tvb, mac_len - sizeof(mac_crc), sizeof(mac_crc), ENC_BIG_ENDIAN); + generic_item = proto_tree_add_item(base_tree, hf_mac_header_compress_dlmap_crc, tvb, mac_len - (int)sizeof(mac_crc), (int)sizeof(mac_crc), ENC_BIG_ENDIAN); if (mac_crc != calculated_crc) { proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); diff --git a/plugins/wimax/packet-wmx.c b/plugins/wimax/packet-wmx.c index fbb4a7b540..d1574e2f34 100644 --- a/plugins/wimax/packet-wmx.c +++ b/plugins/wimax/packet-wmx.c @@ -597,11 +597,11 @@ static gint ett_wimax_cdma = -1; static gint ett_wimax_ffb = -1; #endif -static gchar *tlv_val_1byte = "TLV value: %s (0x%02x)"; -static gchar *tlv_val_2byte = "TLV value: %s (0x%04x)"; -static gchar *tlv_val_3byte = "TLV value: %s (0x%06x)"; -static gchar *tlv_val_4byte = "TLV value: %s (0x%08x)"; -static gchar *tlv_val_5byte = "TLV value: %s (0x%08x...)"; +static const gchar tlv_val_1byte[] = "TLV value: %s (0x%02x)"; +static const gchar tlv_val_2byte[] = "TLV value: %s (0x%04x)"; +static const gchar tlv_val_3byte[] = "TLV value: %s (0x%06x)"; +static const gchar tlv_val_4byte[] = "TLV value: %s (0x%08x)"; +static const gchar tlv_val_5byte[] = "TLV value: %s (0x%08x...)"; /*************************************************************/ /* add_tlv_subtree() */ @@ -627,7 +627,7 @@ proto_tree *add_tlv_subtree(tlv_info_t *this, gint idx, proto_tree *tree, int hf guint8 size_of_tlv_length_field; guint8 tlv_type; guint32 tlv_value; - gchar *hex_fmt; + const gchar *hex_fmt; /* Retrieve the necessary TLV information */ tlv_val_offset = get_tlv_value_offset(this); @@ -719,7 +719,7 @@ proto_tree *add_protocol_subtree(tlv_info_t *this, gint idx, proto_tree *tree, i guint32 tlv_value; va_list ap; /* points to each unnamed arg in turn */ gchar *message = NULL; - gchar *hex_fmt; + const gchar *hex_fmt; /* Retrieve the necessary TLV information */ tlv_val_offset = get_tlv_value_offset(this); diff --git a/plugins/wimax/wimax_harq_map_decoder.c b/plugins/wimax/wimax_harq_map_decoder.c index 3904e1d2d4..b601b76bef 100644 --- a/plugins/wimax/wimax_harq_map_decoder.c +++ b/plugins/wimax/wimax_harq_map_decoder.c @@ -140,7 +140,7 @@ void dissector_wimax_harq_map_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_t { /* add the UL-MAp IEs info */ proto_item_append_text(parent_item, ",UL-MAP IEs"); /* process the compact ul_map ies */ - while(offset < (length - sizeof(harq_map_msg_crc))) + while(offset < (length - (int)sizeof(harq_map_msg_crc))) { /* decode Compact UL-MAP IEs */ ie_length = wimax_compact_ulmap_ie_decoder(harq_map_tree, pinfo, tvb, offset, nibble_offset); /* Prevent endless loop with erroneous data. */ @@ -160,11 +160,11 @@ void dissector_wimax_harq_map_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_t /* add the CRC info */ proto_item_append_text(parent_item, ",CRC"); /* get the CRC */ - harq_map_msg_crc = tvb_get_ntohl(tvb, length - sizeof(harq_map_msg_crc)); + harq_map_msg_crc = tvb_get_ntohl(tvb, length - (int)sizeof(harq_map_msg_crc)); /* calculate the HARQ MAM Message CRC */ - calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, length - sizeof(harq_map_msg_crc)), length - sizeof(harq_map_msg_crc)); + calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, length - (int)sizeof(harq_map_msg_crc)), length - (int)sizeof(harq_map_msg_crc)); /* display the CRC */ - it = proto_tree_add_item(harq_map_tree, hf_harq_map_msg_crc, tvb, length - sizeof(harq_map_msg_crc), sizeof(harq_map_msg_crc), ENC_BIG_ENDIAN); + it = proto_tree_add_item(harq_map_tree, hf_harq_map_msg_crc, tvb, length - (int)sizeof(harq_map_msg_crc), (int)sizeof(harq_map_msg_crc), ENC_BIG_ENDIAN); /* verify the CRC */ if (harq_map_msg_crc != calculated_crc) { |