From 6de396c4a889a107de4e937313774effb208cdbe Mon Sep 17 00:00:00 2001 From: Gilbert Ramirez Date: Fri, 26 Oct 2001 18:28:17 +0000 Subject: [PATCH] Fix the rest of the signed/unsigned comparison warnings. svn path=/trunk/; revision=4088 --- capture.c | 6 +++--- file.c | 6 +++--- packet-gnutella.c | 10 +++++----- packet-ipv6.c | 4 ++-- packet-kerberos.c | 12 +++++++----- packet-ldap.c | 4 ++-- packet-rsh.c | 4 ++-- packet-rsvp.c | 4 ++-- packet-sip.c | 4 ++-- packet-socks.c | 10 +++++----- packet-x11.c | 10 +++++----- packet-zebra.c | 6 +++--- tethereal.c | 6 +++--- util.c | 4 ++-- 14 files changed, 46 insertions(+), 44 deletions(-) diff --git a/capture.c b/capture.c index 63b4775dd9..31ca305d44 100644 --- a/capture.c +++ b/capture.c @@ -1,7 +1,7 @@ /* capture.c * Routines for packet capture windows * - * $Id: capture.c,v 1.155 2001/10/25 08:06:15 guy Exp $ + * $Id: capture.c,v 1.156 2001/10/26 18:28:15 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1058,7 +1058,7 @@ pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ld, char *ebuf) close(fd); return -1; } - while (bytes_read < sizeof(struct pcap_hdr)) + while ((unsigned) bytes_read < sizeof(struct pcap_hdr)) { b = read(fd, ((char *)&hdr)+bytes_read, sizeof(struct pcap_hdr) - bytes_read); if (b <= 0) { @@ -1125,7 +1125,7 @@ pipe_dispatch(int fd, loop_data *ld, struct pcap_hdr *hdr) ld->go = FALSE; return 0; } - while (bytes_read < rechdr.hdr.incl_len) + while ((unsigned) bytes_read < rechdr.hdr.incl_len) { b = read(fd, pd+bytes_read, rechdr.hdr.incl_len - bytes_read); if (b <= 0) { diff --git a/file.c b/file.c index ed2e69fc07..4aa801ec5e 100644 --- a/file.c +++ b/file.c @@ -1,7 +1,7 @@ /* file.c * File I/O routines * - * $Id: file.c,v 1.245 2001/10/04 08:30:33 guy Exp $ + * $Id: file.c,v 1.246 2001/10/26 18:28:15 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -699,8 +699,8 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf, /* If it's greater than the current elapsed time, set the elapsed time to it (we check for "greater than" so as not to be confused by time moving backwards). */ - if (cf->esec < fdata->rel_secs - || (cf->esec == fdata->rel_secs && cf->eusec < fdata->rel_usecs)) { + if ((gint32)cf->esec < fdata->rel_secs + || ((gint32)cf->esec == fdata->rel_secs && (gint32)cf->eusec < fdata->rel_usecs)) { cf->esec = fdata->rel_secs; cf->eusec = fdata->rel_usecs; } diff --git a/packet-gnutella.c b/packet-gnutella.c index e03b55a864..dba10d9e09 100644 --- a/packet-gnutella.c +++ b/packet-gnutella.c @@ -2,7 +2,7 @@ * Routines for gnutella dissection * Copyright 2001, B. Johannessen * - * $Id: packet-gnutella.c,v 1.6 2001/10/26 02:09:01 gram Exp $ + * $Id: packet-gnutella.c,v 1.7 2001/10/26 18:28:16 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -94,7 +94,7 @@ static int hf_gnutella_push_port = -1; static gint ett_gnutella = -1; -static void dissect_gnutella_pong(tvbuff_t *tvb, int offset, proto_tree *tree, int size) { +static void dissect_gnutella_pong(tvbuff_t *tvb, guint offset, proto_tree *tree, guint size) { if(offset + size > tvb_length(tvb)) { proto_tree_add_item(tree, @@ -136,7 +136,7 @@ static void dissect_gnutella_pong(tvbuff_t *tvb, int offset, proto_tree *tree, i } -static void dissect_gnutella_query(tvbuff_t *tvb, int offset, proto_tree *tree, int size) { +static void dissect_gnutella_query(tvbuff_t *tvb, guint offset, proto_tree *tree, guint size) { if(offset + size > tvb_length(tvb)) { proto_tree_add_item(tree, @@ -172,7 +172,7 @@ static void dissect_gnutella_query(tvbuff_t *tvb, int offset, proto_tree *tree, } } -static void dissect_gnutella_queryhit(tvbuff_t *tvb, int offset, proto_tree *tree, int size) { +static void dissect_gnutella_queryhit(tvbuff_t *tvb, guint offset, proto_tree *tree, guint size) { proto_tree *qhi, *hit_tree; int hit_count, i; @@ -329,7 +329,7 @@ static void dissect_gnutella_queryhit(tvbuff_t *tvb, int offset, proto_tree *tre } -static void dissect_gnutella_push(tvbuff_t *tvb, int offset, proto_tree *tree, int size) { +static void dissect_gnutella_push(tvbuff_t *tvb, guint offset, proto_tree *tree, guint size) { if(offset + size > tvb_length(tvb)) { proto_tree_add_item(tree, diff --git a/packet-ipv6.c b/packet-ipv6.c index 6d7cf9399a..cd2c310d4a 100644 --- a/packet-ipv6.c +++ b/packet-ipv6.c @@ -1,7 +1,7 @@ /* packet-ipv6.c * Routines for IPv6 packet disassembly * - * $Id: packet-ipv6.c,v 1.63 2001/09/30 23:07:12 guy Exp $ + * $Id: packet-ipv6.c,v 1.64 2001/10/26 18:28:16 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -126,7 +126,7 @@ ipv6_reassemble_init(void) static int dissect_routing6(tvbuff_t *tvb, int offset, proto_tree *tree) { struct ip6_rthdr rt; - int len; + guint len; proto_tree *rthdr_tree; proto_item *ti; char buf[sizeof(struct ip6_rthdr0) + sizeof(struct e_in6_addr) * 23]; diff --git a/packet-kerberos.c b/packet-kerberos.c index fea11c6839..0e7a5349bb 100644 --- a/packet-kerberos.c +++ b/packet-kerberos.c @@ -3,7 +3,7 @@ * Wes Hardaker (c) 2000 * wjhardaker@ucdavis.edu * - * $Id: packet-kerberos.c,v 1.16 2001/04/15 08:50:37 guy Exp $ + * $Id: packet-kerberos.c,v 1.17 2001/10/26 18:28:16 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -548,10 +548,11 @@ dissect_kerberos_main(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ASN1_SCK asn1, *asn1p = &asn1; proto_item *item = NULL; - guint length; + gint length; guint cls, con, tag; gboolean def; - guint item_len, total_len; + gint item_len; + guint total_len; int start, end, message_end, sequence_end; int ret; @@ -1263,11 +1264,12 @@ dissect_Ticket(char *title, ASN1_SCK *asn1p, packet_info *pinfo, int start; guint cls, con, tag; - guint header_len, item_len, total_len; + guint header_len, total_len; + gint item_len; int ret; proto_item *item = NULL; - guint length; + gint length; gboolean def; guint32 val; diff --git a/packet-ldap.c b/packet-ldap.c index 409c12eaf6..447f196860 100644 --- a/packet-ldap.c +++ b/packet-ldap.c @@ -1,7 +1,7 @@ /* packet-ldap.c * Routines for ldap packet dissection * - * $Id: packet-ldap.c,v 1.27 2001/06/18 02:17:48 guy Exp $ + * $Id: packet-ldap.c,v 1.28 2001/10/26 18:28:16 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -781,7 +781,7 @@ static int dissect_ldap_request_modifyrdn(ASN1_SCK *a, proto_tree *tree, read_string(a, tree, hf_ldap_message_modrdn_name, 0, 0, ASN1_UNI, ASN1_OTS); read_boolean(a, tree, hf_ldap_message_modrdn_delete, 0, 0); - if (a->offset < (start + length)) { + if (a->offset < (int) (start + length)) { /* LDAP V3 Modify DN operation, with newSuperior */ read_string(a, tree, hf_ldap_message_modrdn_superior, 0, 0, ASN1_UNI, ASN1_OTS); } diff --git a/packet-rsh.c b/packet-rsh.c index dd5a375745..a8d2473ea9 100644 --- a/packet-rsh.c +++ b/packet-rsh.c @@ -4,7 +4,7 @@ * Robert Tsai * Liberally copied from packet-http.c, by Guy Harris * - * $Id: packet-rsh.c,v 1.11 2001/06/18 02:17:51 guy Exp $ + * $Id: packet-rsh.c,v 1.12 2001/10/26 18:28:16 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -68,7 +68,7 @@ dissect_rsh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * the captured data in the packet, so we don't throw * an exception in the "tvb_get_ptr()" call. */ - if (linelen > tvb_length(tvb)) + if (linelen > (int) tvb_length(tvb)) linelen = tvb_length(tvb); col_add_str(pinfo->fd, COL_INFO, tvb_format_text(tvb, offset, linelen)); diff --git a/packet-rsvp.c b/packet-rsvp.c index 842af9ee94..660f84a240 100644 --- a/packet-rsvp.c +++ b/packet-rsvp.c @@ -3,7 +3,7 @@ * * (c) Copyright Ashok Narayanan * - * $Id: packet-rsvp.c,v 1.46 2001/06/26 20:50:30 guy Exp $ + * $Id: packet-rsvp.c,v 1.47 2001/10/26 18:28:16 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -700,7 +700,7 @@ dissect_rsvp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset+1, 1, 1); } cksum = tvb_get_ntohs(tvb, offset+2); - if (!pinfo->fragmented && tvb_length(tvb) >= msg_length) { + if (!pinfo->fragmented && (int) tvb_length(tvb) >= msg_length) { /* The packet isn't part of a fragmented datagram and isn't truncated, so we can checksum it. */ cksum_vec[0].ptr = tvb_get_ptr(tvb, 0, msg_length); diff --git a/packet-sip.c b/packet-sip.c index 8de25e128e..6c13520fbe 100644 --- a/packet-sip.c +++ b/packet-sip.c @@ -15,7 +15,7 @@ * Copyright 2000, Heikki Vatiainen * Copyright 2001, Jean-Francois Mule * - * $Id: packet-sip.c,v 1.16 2001/08/23 00:18:56 guy Exp $ + * $Id: packet-sip.c,v 1.17 2001/10/26 18:28:16 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -135,7 +135,7 @@ static void dissect_sip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) hdr_tree = proto_item_add_subtree(th, ett_sip_hdr); /* - 2 since we have a CRLF separating the message-body */ - while (msg_offset - 2 > offset) { + while (msg_offset - 2 > (int) offset) { eol = tvb_find_line_end(tvb, offset, -1, &next_offset); proto_tree_add_text(hdr_tree, tvb, offset, next_offset - offset, "%s", tvb_format_text(tvb, offset, eol)); diff --git a/packet-socks.c b/packet-socks.c index ed79a3f3c5..fdfcb273dc 100644 --- a/packet-socks.c +++ b/packet-socks.c @@ -2,7 +2,7 @@ * Routines for socks versions 4 &5 packet dissection * Copyright 2000, Jeffrey C. Foster * - * $Id: packet-socks.c,v 1.23 2001/09/03 10:33:07 guy Exp $ + * $Id: packet-socks.c,v 1.24 2001/10/26 18:28:16 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -297,8 +297,8 @@ static int display_address( const u_char *pd, int offset, proto_tree_add_text( tree, NullTVB, offset, 1, "Address Type: %d (%s)", a_type, - address_type_table[ MAX( 0, MIN( a_type, - array_length( address_type_table)-1))]); + address_type_table[ MIN( (guint) a_type, + array_length( address_type_table)-1) ]); ++offset; @@ -416,7 +416,7 @@ static void socks_udp_dissector( const u_char *pd, int offset, frame_data *fd, /* set pi src/dst port and call the udp sub-dissector lookup */ - if ( pi.srcport == hash_info->port) + if ( pi.srcport == (guint32) hash_info->port) ptr = &pi.destport; else ptr = &pi.srcport; @@ -562,7 +562,7 @@ void display_socks_v5( const u_char *pd, int offset, frame_data *fd, "Count: %u ", temp); ++offset; - CHECK_PACKET_LENGTH( temp); + CHECK_PACKET_LENGTH( (int)temp); for( i = 0; i < temp; ++i) { diff --git a/packet-x11.c b/packet-x11.c index a03f2133e4..5f47355f63 100644 --- a/packet-x11.c +++ b/packet-x11.c @@ -2,7 +2,7 @@ * Routines for X11 dissection * Copyright 2000, Christophe Tronche * - * $Id: packet-x11.c,v 1.23 2001/10/04 00:30:23 guy Exp $ + * $Id: packet-x11.c,v 1.24 2001/10/26 18:28:16 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1043,7 +1043,7 @@ static void stringCopy(char *dest, const char *source, int length) static void listOfString8(tvbuff_t *tvb, int hf, int hf_item, int length) { char *s = NULL; - int allocated = 0; + guint allocated = 0; proto_tree *tt; int i; @@ -1060,7 +1060,7 @@ static void listOfString8(tvbuff_t *tvb, int hf, int hf_item, int length) while(length--) { unsigned l = VALUE8(tvb, cur_offset); - if (allocated < l + 1) { + if (allocated < (l + 1)) { /* g_realloc doesn't work ??? */ g_free(s); s = g_malloc(l + 1); @@ -1103,7 +1103,7 @@ static void string16_with_buffer_preallocated(tvbuff_t *tvb, proto_tree *t, truncated = TRUE; l = STRING16_MAX_DISPLAYED_LENGTH; } - if (*sLength < l + 3) { + if (*sLength < (int) l + 3) { g_free(*s); *s = g_malloc(l + 3); *sLength = l + 3; @@ -1163,7 +1163,7 @@ static void listOfTextItem(tvbuff_t *tvb, int hf, int sizeIs16) proto_tree *ttt; gint8 delta = VALUE8(tvb, cur_offset + 1); if (sizeIs16) l += l; - if (allocated < l + 1) { + if ((unsigned) allocated < l + 1) { /* g_realloc doesn't work ??? */ g_free(s); s = g_malloc(l + 1); diff --git a/packet-zebra.c b/packet-zebra.c index e569938349..cba1f2f846 100644 --- a/packet-zebra.c +++ b/packet-zebra.c @@ -3,7 +3,7 @@ * * Jochen Friedrich * - * $Id: packet-zebra.c,v 1.14 2001/07/16 06:09:02 guy Exp $ + * $Id: packet-zebra.c,v 1.15 2001/10/26 18:28:16 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -315,7 +315,7 @@ dissect_zebra_request(proto_tree *tree, gboolean request, tvbuff_t *tvb, prefix = tvb_get_ptr(tvb, offset, PSIZE(prefixlen)); prefix4 = 0; memcpy(&prefix4, prefix, - MIN(PSIZE(prefixlen), sizeof prefix4)); + MIN((unsigned) PSIZE(prefixlen), sizeof prefix4)); proto_tree_add_ipv4(tree, hf_zebra_prefix4, tvb, offset, PSIZE(prefixlen), prefix4); offset += PSIZE(prefixlen); @@ -393,7 +393,7 @@ dissect_zebra_request(proto_tree *tree, gboolean request, tvbuff_t *tvb, prefix = tvb_get_ptr(tvb, offset, PSIZE(prefixlen)); memset(buffer6, '\0', sizeof buffer6); memcpy(buffer6, prefix, - MIN(PSIZE(prefixlen), sizeof buffer6)); + MIN((unsigned) PSIZE(prefixlen), sizeof buffer6)); proto_tree_add_ipv6(tree, hf_zebra_prefix6, tvb, offset, PSIZE(prefixlen), buffer6); offset += PSIZE(prefixlen); diff --git a/tethereal.c b/tethereal.c index 35be1a6287..9035db8e0c 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1,6 +1,6 @@ /* tethereal.c * - * $Id: tethereal.c,v 1.94 2001/10/25 06:41:48 guy Exp $ + * $Id: tethereal.c,v 1.95 2001/10/26 18:28:16 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1031,8 +1031,8 @@ fill_in_fdata(frame_data *fdata, capture_file *cf, /* If it's greater than the current elapsed time, set the elapsed time to it (we check for "greater than" so as not to be confused by time moving backwards). */ - if (cf->esec < fdata->rel_secs - || (cf->esec == fdata->rel_secs && cf->eusec < fdata->rel_usecs)) { + if ((gint32)cf->esec < fdata->rel_secs + || ((gint32)cf->esec == fdata->rel_secs && (gint32)cf->eusec < fdata->rel_usecs)) { cf->esec = fdata->rel_secs; cf->eusec = fdata->rel_usecs; } diff --git a/util.c b/util.c index dc078b8793..ea2d62971c 100644 --- a/util.c +++ b/util.c @@ -1,7 +1,7 @@ /* util.c * Utility routines * - * $Id: util.c,v 1.52 2001/08/21 06:39:15 guy Exp $ + * $Id: util.c,v 1.53 2001/10/26 18:28:17 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -401,7 +401,7 @@ get_interface_list(int *err, char *err_str) goto fail; } } else { - if (ifc.ifc_len < sizeof(struct ifreq)) { + if ((unsigned) ifc.ifc_len < sizeof(struct ifreq)) { sprintf(err_str, "SIOCGIFCONF ioctl gave too small return buffer"); goto fail;