From Bill Parker:

Explicitly declare/cast 'unsigned <variable>' as 'unsigned int <variable>'

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7810

svn path=/trunk/; revision=45418
This commit is contained in:
Anders Broman 2012-10-09 08:40:02 +00:00
parent 41ad59d6a7
commit eb618abad9
8 changed files with 30 additions and 30 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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,

View File

@ -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");

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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,