From eb618abad9a969fcdf32129ab807f6cf7c5acb55 Mon Sep 17 00:00:00 2001 From: Anders Broman Date: Tue, 9 Oct 2012 08:40:02 +0000 Subject: [PATCH] From Bill Parker: Explicitly declare/cast 'unsigned ' as 'unsigned int ' https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7810 svn path=/trunk/; revision=45418 --- asn1/mpeg-pes/packet-mpeg-pes-template.c | 20 ++++++++++---------- asn1/snmp/packet-snmp-template.c | 6 +++--- asn1/spnego/packet-spnego-template.c | 2 +- capture-pcap-util-unix.c | 2 +- editcap.c | 2 +- epan/dissectors/packet-mpeg-pes.c | 20 ++++++++++---------- epan/dissectors/packet-snmp.c | 6 +++--- epan/dissectors/packet-spnego.c | 2 +- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/asn1/mpeg-pes/packet-mpeg-pes-template.c b/asn1/mpeg-pes/packet-mpeg-pes-template.c index 82f917ef44..32a6f96306 100644 --- a/asn1/mpeg-pes/packet-mpeg-pes-template.c +++ b/asn1/mpeg-pes/packet-mpeg-pes-template.c @@ -167,7 +167,7 @@ static guint64 decode_time_stamp(tvbuff_t *tvb, gint offset, nstime_t *nst) (bytes >> 33 & 0x0007) << 30 | (bytes >> 17 & 0x7fff) << 15 | (bytes >> 1 & 0x7fff) << 0; - unsigned rem = (unsigned)(ts % TSHZ); + unsigned int rem = (unsigned int)(ts % TSHZ); nst->secs = (time_t)(ts / TSHZ); nst->nsecs = (int)(G_GINT64_CONSTANT(1000000000) * rem / TSHZ); return ts; @@ -183,9 +183,9 @@ static guint64 decode_clock_reference(tvbuff_t *tvb, gint offset, (bytes >> 43 & 0x0007) << 30 | (bytes >> 27 & 0x7fff) << 15 | (bytes >> 11 & 0x7fff) << 0; - unsigned ext = (unsigned)((bytes >> 1) & 0x1ff); + unsigned int ext = (unsigned int)((bytes >> 1) & 0x1ff); guint64 cr = 300 * ts + ext; - unsigned rem = (unsigned)(cr % SCRHZ); + unsigned int rem = (unsigned int)(cr % SCRHZ); nst->secs = (time_t)(cr / SCRHZ); nst->nsecs = (int)(G_GINT64_CONSTANT(1000000000) * rem / SCRHZ); return cr; @@ -193,7 +193,7 @@ static guint64 decode_clock_reference(tvbuff_t *tvb, gint offset, static int dissect_mpeg_pes_header_data(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *root, unsigned flags) + proto_tree *root, unsigned int flags) { proto_item *item = proto_tree_add_item(root, hf_mpeg_pes_header_data, tvb, 0, -1, ENC_NA); @@ -236,7 +236,7 @@ dissect_mpeg_pes_header_data(tvbuff_t *tvb, packet_info *pinfo, offset += 6; } if (flags & ES_RATE_FLAG) { - unsigned es_rate = (tvb_get_ntohs(tvb, offset) >> 1 & 0x3fff) * 50; + unsigned int es_rate = (tvb_get_ntohs(tvb, offset) >> 1 & 0x3fff) * 50; proto_tree_add_uint(tree, hf_mpeg_pes_es_rate, tvb, offset, 3, es_rate); offset += 3; @@ -330,7 +330,7 @@ dissect_mpeg_pes_header_data(tvbuff_t *tvb, packet_info *pinfo, offset += 2; } if (flags2 & PSTD_BUFFER_FLAG) { - unsigned pstd = tvb_get_ntohs(tvb, offset); + unsigned int pstd = tvb_get_ntohs(tvb, offset); proto_tree_add_uint(tree, hf_mpeg_pes_pstd_buffer, tvb, offset, 2, (pstd & 0x2000 ? 1024 : 128) * (pstd & 0x1ff)); offset += 2; @@ -348,7 +348,7 @@ static gint dissect_mpeg_pes_pack_header(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *root) { - unsigned program_mux_rate, stuffing_length; + unsigned int program_mux_rate, stuffing_length; proto_item *item = proto_tree_add_item(root, hf_mpeg_pes_pack_header, tvb, offset / 8, 10, ENC_NA); @@ -469,7 +469,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data offset / 8, 8, ENC_NA); } } else if (stream == STREAM_SYSTEM || stream == STREAM_PRIVATE2) { - unsigned data_length = tvb_get_ntohs(tvb, offset / 8); + unsigned int data_length = tvb_get_ntohs(tvb, offset / 8); proto_tree_add_item(tree, hf_mpeg_pes_length, tvb, offset / 8, 2, ENC_BIG_ENDIAN); offset += 2 * 8; @@ -477,7 +477,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data proto_tree_add_item(tree, hf_mpeg_pes_data, tvb, offset / 8, data_length, ENC_NA); } else if (stream == STREAM_PADDING) { - unsigned padding_length = tvb_get_ntohs(tvb, offset / 8); + unsigned int padding_length = tvb_get_ntohs(tvb, offset / 8); proto_tree_add_item(tree, hf_mpeg_pes_length, tvb, offset / 8, 2, ENC_BIG_ENDIAN); offset += 2 * 8; @@ -532,7 +532,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data proto_tree_add_item(tree, hf_mpeg_pes_data, es, 0, -1, ENC_NA); } else { - unsigned data_length = tvb_get_ntohs(tvb, offset / 8); + unsigned int data_length = tvb_get_ntohs(tvb, offset / 8); proto_tree_add_item(tree, hf_mpeg_pes_length, tvb, offset / 8, 2, ENC_BIG_ENDIAN); offset += 2 * 8; diff --git a/asn1/snmp/packet-snmp-template.c b/asn1/snmp/packet-snmp-template.c index f926eb7bb3..0ba757093c 100644 --- a/asn1/snmp/packet-snmp-template.c +++ b/asn1/snmp/packet-snmp-template.c @@ -754,8 +754,8 @@ indexing_done: case BER_CLASS_UNI|(BER_UNI_TAG_INTEGER<<4): { gint64 val=0; - unsigned int_val_offset = value_offset; - unsigned i; + unsigned int int_val_offset = value_offset; + unsigned int i; max_len = 4; min_len = 1; if (value_len > (guint)max_len || value_len < (guint)min_len) { @@ -2002,7 +2002,7 @@ snmp_users_update_cb(void* p _U_, const char** err) { snmp_ue_assoc_t* ue = (snmp_ue_assoc_t*)p; emem_strbuf_t* es = ep_strbuf_new(""); - unsigned i; + unsigned int i; *err = NULL; diff --git a/asn1/spnego/packet-spnego-template.c b/asn1/spnego/packet-spnego-template.c index 7d516f4a4e..71b60affc6 100644 --- a/asn1/spnego/packet-spnego-template.c +++ b/asn1/spnego/packet-spnego-template.c @@ -378,7 +378,7 @@ usage2arcfour(int usage) static int arcfour_mic_cksum(guint8 *key_data, int key_length, - unsigned usage, + unsigned int usage, guint8 sgn_cksum[8], const void *v1, size_t l1, const void *v2, size_t l2, diff --git a/capture-pcap-util-unix.c b/capture-pcap-util-unix.c index 0e094b1add..df78f03176 100644 --- a/capture-pcap-util-unix.c +++ b/capture-pcap-util-unix.c @@ -151,7 +151,7 @@ get_interface_list(int *err, char **err_str) goto fail; } } else { - if ((unsigned) ifc.ifc_len < sizeof(struct ifreq)) { + if ((unsigned int) ifc.ifc_len < sizeof(struct ifreq)) { if (err_str != NULL) { *err_str = g_strdup( "Can't get list of interfaces: SIOCGIFCONF ioctl gave too small return buffer"); diff --git a/editcap.c b/editcap.c index a5ee3503ab..a75f85a2a6 100644 --- a/editcap.c +++ b/editcap.c @@ -822,7 +822,7 @@ main(int argc, char *argv[]) int choplen = 0; /* No chop */ wtap_dumper *pdh = NULL; unsigned int count = 1; - unsigned duplicate_count = 0; + unsigned int duplicate_count = 0; gint64 data_offset; struct wtap_pkthdr snap_phdr; const struct wtap_pkthdr *phdr; diff --git a/epan/dissectors/packet-mpeg-pes.c b/epan/dissectors/packet-mpeg-pes.c index 1bf27c27db..af92a0de6e 100644 --- a/epan/dissectors/packet-mpeg-pes.c +++ b/epan/dissectors/packet-mpeg-pes.c @@ -608,7 +608,7 @@ static guint64 decode_time_stamp(tvbuff_t *tvb, gint offset, nstime_t *nst) (bytes >> 33 & 0x0007) << 30 | (bytes >> 17 & 0x7fff) << 15 | (bytes >> 1 & 0x7fff) << 0; - unsigned rem = (unsigned)(ts % TSHZ); + unsigned int rem = (unsigned int)(ts % TSHZ); nst->secs = (time_t)(ts / TSHZ); nst->nsecs = (int)(G_GINT64_CONSTANT(1000000000) * rem / TSHZ); return ts; @@ -624,9 +624,9 @@ static guint64 decode_clock_reference(tvbuff_t *tvb, gint offset, (bytes >> 43 & 0x0007) << 30 | (bytes >> 27 & 0x7fff) << 15 | (bytes >> 11 & 0x7fff) << 0; - unsigned ext = (unsigned)((bytes >> 1) & 0x1ff); + unsigned int ext = (unsigned int)((bytes >> 1) & 0x1ff); guint64 cr = 300 * ts + ext; - unsigned rem = (unsigned)(cr % SCRHZ); + unsigned int rem = (unsigned int)(cr % SCRHZ); nst->secs = (time_t)(cr / SCRHZ); nst->nsecs = (int)(G_GINT64_CONSTANT(1000000000) * rem / SCRHZ); return cr; @@ -634,7 +634,7 @@ static guint64 decode_clock_reference(tvbuff_t *tvb, gint offset, static int dissect_mpeg_pes_header_data(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *root, unsigned flags) + proto_tree *root, unsigned int flags) { proto_item *item = proto_tree_add_item(root, hf_mpeg_pes_header_data, tvb, 0, -1, ENC_NA); @@ -677,7 +677,7 @@ dissect_mpeg_pes_header_data(tvbuff_t *tvb, packet_info *pinfo, offset += 6; } if (flags & ES_RATE_FLAG) { - unsigned es_rate = (tvb_get_ntohs(tvb, offset) >> 1 & 0x3fff) * 50; + unsigned int es_rate = (tvb_get_ntohs(tvb, offset) >> 1 & 0x3fff) * 50; proto_tree_add_uint(tree, hf_mpeg_pes_es_rate, tvb, offset, 3, es_rate); offset += 3; @@ -771,7 +771,7 @@ dissect_mpeg_pes_header_data(tvbuff_t *tvb, packet_info *pinfo, offset += 2; } if (flags2 & PSTD_BUFFER_FLAG) { - unsigned pstd = tvb_get_ntohs(tvb, offset); + unsigned int pstd = tvb_get_ntohs(tvb, offset); proto_tree_add_uint(tree, hf_mpeg_pes_pstd_buffer, tvb, offset, 2, (pstd & 0x2000 ? 1024 : 128) * (pstd & 0x1ff)); offset += 2; @@ -789,7 +789,7 @@ static gint dissect_mpeg_pes_pack_header(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *root) { - unsigned program_mux_rate, stuffing_length; + unsigned int program_mux_rate, stuffing_length; proto_item *item = proto_tree_add_item(root, hf_mpeg_pes_pack_header, tvb, offset / 8, 10, ENC_NA); @@ -910,7 +910,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data offset / 8, 8, ENC_NA); } } else if (stream == STREAM_SYSTEM || stream == STREAM_PRIVATE2) { - unsigned data_length = tvb_get_ntohs(tvb, offset / 8); + unsigned int data_length = tvb_get_ntohs(tvb, offset / 8); proto_tree_add_item(tree, hf_mpeg_pes_length, tvb, offset / 8, 2, ENC_BIG_ENDIAN); offset += 2 * 8; @@ -918,7 +918,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data proto_tree_add_item(tree, hf_mpeg_pes_data, tvb, offset / 8, data_length, ENC_NA); } else if (stream == STREAM_PADDING) { - unsigned padding_length = tvb_get_ntohs(tvb, offset / 8); + unsigned int padding_length = tvb_get_ntohs(tvb, offset / 8); proto_tree_add_item(tree, hf_mpeg_pes_length, tvb, offset / 8, 2, ENC_BIG_ENDIAN); offset += 2 * 8; @@ -973,7 +973,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data proto_tree_add_item(tree, hf_mpeg_pes_data, es, 0, -1, ENC_NA); } else { - unsigned data_length = tvb_get_ntohs(tvb, offset / 8); + unsigned int data_length = tvb_get_ntohs(tvb, offset / 8); proto_tree_add_item(tree, hf_mpeg_pes_length, tvb, offset / 8, 2, ENC_BIG_ENDIAN); offset += 2 * 8; diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c index a3d1f28b7c..d4a37aa87f 100644 --- a/epan/dissectors/packet-snmp.c +++ b/epan/dissectors/packet-snmp.c @@ -856,8 +856,8 @@ indexing_done: case BER_CLASS_UNI|(BER_UNI_TAG_INTEGER<<4): { gint64 val=0; - unsigned int_val_offset = value_offset; - unsigned i; + unsigned int int_val_offset = value_offset; + unsigned int i; max_len = 4; min_len = 1; if (value_len > (guint)max_len || value_len < (guint)min_len) { @@ -3226,7 +3226,7 @@ snmp_users_update_cb(void* p _U_, const char** err) { snmp_ue_assoc_t* ue = (snmp_ue_assoc_t*)p; emem_strbuf_t* es = ep_strbuf_new(""); - unsigned i; + unsigned int i; *err = NULL; diff --git a/epan/dissectors/packet-spnego.c b/epan/dissectors/packet-spnego.c index d321f36de2..69719b8c77 100644 --- a/epan/dissectors/packet-spnego.c +++ b/epan/dissectors/packet-spnego.c @@ -859,7 +859,7 @@ usage2arcfour(int usage) static int arcfour_mic_cksum(guint8 *key_data, int key_length, - unsigned usage, + unsigned int usage, guint8 sgn_cksum[8], const void *v1, size_t l1, const void *v2, size_t l2,