summaryrefslogtreecommitdiff
path: root/wiretap
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>2001-10-25 20:29:24 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>2001-10-25 20:29:24 +0000
commita505b64912ec7e142a17444864fdf828fd4e39b9 (patch)
treeac3dbc449ac146bdabe310a9d2afba72f46b603c /wiretap
parent3820d7e2a511235fd81f810bc01aec5329695bc9 (diff)
downloadwireshark-a505b64912ec7e142a17444864fdf828fd4e39b9.tar.gz
Get rid of signed/unsigned comparison warnings in wiretap.
svn path=/trunk/; revision=4077
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/libpcap.c4
-rw-r--r--wiretap/netmon.c8
-rw-r--r--wiretap/netxray.c6
-rw-r--r--wiretap/ngsniffer.c10
-rw-r--r--wiretap/snoop.c8
-rw-r--r--wiretap/toshiba.c11
6 files changed, 24 insertions, 23 deletions
diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c
index 323ff46909..715161cd6c 100644
--- a/wiretap/libpcap.c
+++ b/wiretap/libpcap.c
@@ -1,6 +1,6 @@
/* libpcap.c
*
- * $Id: libpcap.c,v 1.51 2001/10/04 08:30:36 guy Exp $
+ * $Id: libpcap.c,v 1.52 2001/10/25 20:29:23 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -728,7 +728,7 @@ static gboolean libpcap_read(wtap *wth, int *err, long *data_offset)
bytes_read = file_read(buffer_start_ptr(wth->frame_buffer), 1,
packet_size, wth->fh);
- if (bytes_read != packet_size) {
+ if ((guint)bytes_read != packet_size) {
*err = file_error(wth->fh);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
index aa3ebf9872..3cca9b4bc0 100644
--- a/wiretap/netmon.c
+++ b/wiretap/netmon.c
@@ -1,6 +1,6 @@
/* netmon.c
*
- * $Id: netmon.c,v 1.41 2001/10/04 08:30:36 guy Exp $
+ * $Id: netmon.c,v 1.42 2001/10/25 20:29:23 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -252,7 +252,7 @@ int netmon_open(wtap *wth, int *err)
errno = WTAP_ERR_CANT_READ;
file_seek(wth->fh, frame_table_offset, SEEK_SET);
bytes_read = file_read(frame_table, 1, frame_table_length, wth->fh);
- if (bytes_read != frame_table_length) {
+ if ((guint32)bytes_read != frame_table_length) {
*err = file_error(wth->fh);
if (*err != 0)
return -1;
@@ -361,7 +361,7 @@ static gboolean netmon_read(wtap *wth, int *err, long *data_offset)
bytes_read = file_read(buffer_start_ptr(wth->frame_buffer), 1,
packet_size, wth->fh);
- if (bytes_read != packet_size) {
+ if ((guint32)bytes_read != packet_size) {
*err = file_error(wth->fh);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -435,7 +435,7 @@ int netmon_dump_can_write_encap(int filetype, int encap)
if (encap == WTAP_ENCAP_PER_PACKET)
return WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED;
- if (encap < 0 || encap >= NUM_WTAP_ENCAPS || wtap_encap[encap] == -1)
+ if (encap < 0 || (unsigned) encap >= NUM_WTAP_ENCAPS || wtap_encap[encap] == -1)
return WTAP_ERR_UNSUPPORTED_ENCAP;
return 0;
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
index 898476bf0e..86e562b0f5 100644
--- a/wiretap/netxray.c
+++ b/wiretap/netxray.c
@@ -1,6 +1,6 @@
/* netxray.c
*
- * $Id: netxray.c,v 1.41 2001/10/04 08:30:36 guy Exp $
+ * $Id: netxray.c,v 1.42 2001/10/25 20:29:23 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -292,7 +292,7 @@ reread:
bytes_read = file_read(buffer_start_ptr(wth->frame_buffer), 1,
packet_size, wth->fh);
- if (bytes_read != packet_size) {
+ if ((guint32)bytes_read != packet_size) {
*err = file_error(wth->fh);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
@@ -346,7 +346,7 @@ int netxray_dump_can_write_encap(int filetype, int encap)
if (encap == WTAP_ENCAP_PER_PACKET)
return WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED;
- if (encap < 0 || encap >= NUM_WTAP_ENCAPS || wtap_encap[encap] == -1)
+ if (encap < 0 || (unsigned)encap >= NUM_WTAP_ENCAPS || wtap_encap[encap] == -1)
return WTAP_ERR_UNSUPPORTED_ENCAP;
return 0;
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
index 710751e95d..46b3d60d70 100644
--- a/wiretap/ngsniffer.c
+++ b/wiretap/ngsniffer.c
@@ -1,6 +1,6 @@
/* ngsniffer.c
*
- * $Id: ngsniffer.c,v 1.67 2001/10/04 08:30:36 guy Exp $
+ * $Id: ngsniffer.c,v 1.68 2001/10/25 20:29:23 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -1139,7 +1139,7 @@ int ngsniffer_dump_can_write_encap(int filetype, int encap)
if (encap == WTAP_ENCAP_PER_PACKET)
return WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED;
- if (encap < 0 || encap >= NUM_WTAP_ENCAPS || wtap_encap[encap] == -1)
+ if (encap < 0 || (unsigned)encap >= NUM_WTAP_ENCAPS || wtap_encap[encap] == -1)
return WTAP_ERR_UNSUPPORTED_ENCAP;
return 0;
@@ -1712,7 +1712,7 @@ ng_file_seek_seq(wtap *wth, long offset, int whence)
/* Ok, now read and discard "delta" bytes. */
while (delta != 0) {
amount_to_read = delta;
- if (amount_to_read > sizeof buf)
+ if ((unsigned long)amount_to_read > sizeof buf)
amount_to_read = sizeof buf;
if (ng_file_read(buf, 1, amount_to_read, wth, FALSE, &err) < 0)
return -1; /* error */
@@ -1765,7 +1765,7 @@ ng_file_seek_rand(wtap *wth, long offset, int whence)
if (delta > 0) {
/* We're going forwards.
Is the place to which we're seeking within the current buffer? */
- if (ngsniffer->rand.nextout + delta >= ngsniffer->rand.nbytes) {
+ if ((unsigned)ngsniffer->rand.nextout + delta >= ngsniffer->rand.nbytes) {
/* No. Search for a blob that contains the target offset in
the uncompressed byte stream, starting with the blob
following the current blob. */
@@ -1834,7 +1834,7 @@ ng_file_seek_rand(wtap *wth, long offset, int whence)
the blob, as otherwise it'd mean we need to seek before
the beginning or after the end of this blob. */
delta = offset - ngsniffer->rand.uncomp_offset;
- g_assert(delta >= 0 && delta < ngsniffer->rand.nbytes);
+ g_assert(delta >= 0 && (unsigned long)delta < ngsniffer->rand.nbytes);
}
/* OK, the place to which we're seeking is in the buffer; adjust
diff --git a/wiretap/snoop.c b/wiretap/snoop.c
index 85c169baa1..511d7d0596 100644
--- a/wiretap/snoop.c
+++ b/wiretap/snoop.c
@@ -1,6 +1,6 @@
/* snoop.c
*
- * $Id: snoop.c,v 1.37 2001/10/04 08:30:36 guy Exp $
+ * $Id: snoop.c,v 1.38 2001/10/25 20:29:24 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -385,7 +385,7 @@ static gboolean snoop_read(wtap *wth, int *err, long *data_offset)
padbytes = rec_size - (sizeof hdr + packet_size);
while (padbytes != 0) {
bytes_to_read = padbytes;
- if (bytes_to_read > sizeof padbuf)
+ if ((unsigned)bytes_to_read > sizeof padbuf)
bytes_to_read = sizeof padbuf;
errno = WTAP_ERR_CANT_READ;
bytes_read = file_read(padbuf, 1, bytes_to_read, wth->fh);
@@ -510,7 +510,7 @@ int snoop_dump_can_write_encap(int filetype, int encap)
if (encap == WTAP_ENCAP_PER_PACKET)
return WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED;
- if (encap < 0 || encap >= NUM_WTAP_ENCAPS || wtap_encap[encap] == -1)
+ if (encap < 0 || (unsigned)encap >= NUM_WTAP_ENCAPS || wtap_encap[encap] == -1)
return WTAP_ERR_UNSUPPORTED_ENCAP;
return 0;
@@ -560,7 +560,7 @@ static gboolean snoop_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr,
struct snooprec_hdr rec_hdr;
size_t nwritten;
int reclen;
- int padlen;
+ guint padlen;
static char zeroes[4];
/* Record length = header length plus data length... */
diff --git a/wiretap/toshiba.c b/wiretap/toshiba.c
index de52620553..1360483dc6 100644
--- a/wiretap/toshiba.c
+++ b/wiretap/toshiba.c
@@ -1,6 +1,6 @@
/* toshiba.c
*
- * $Id: toshiba.c,v 1.16 2001/10/04 08:30:36 guy Exp $
+ * $Id: toshiba.c,v 1.17 2001/10/25 20:29:24 gram Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -107,7 +107,7 @@ static const char toshiba_rec_magic[] = { '[', 'N', 'o', '.' };
static gboolean toshiba_read(wtap *wth, int *err, long *data_offset);
static int toshiba_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, guint8 *pd, int len);
-static gboolean parse_single_hex_dump_line(char* rec, guint8 *buf, int byte_offset);
+static gboolean parse_single_hex_dump_line(char* rec, guint8 *buf, guint byte_offset);
static int parse_toshiba_hex_dump(FILE_T fh, int pkt_len, guint8* buf, int *err);
static int parse_toshiba_rec_hdr(wtap *wth, FILE_T fh,
union wtap_pseudo_header *pseudo_header, int *err);
@@ -118,7 +118,7 @@ static int parse_toshiba_rec_hdr(wtap *wth, FILE_T fh,
static long toshiba_seek_next_packet(wtap *wth)
{
int byte;
- int level = 0;
+ guint level = 0;
while ((byte = file_getc(wth->fh)) != EOF) {
if (byte == toshiba_rec_magic[level]) {
@@ -145,7 +145,8 @@ static long toshiba_seek_next_packet(wtap *wth)
static gboolean toshiba_check_file_type(wtap *wth)
{
char buf[TOSHIBA_LINE_LENGTH];
- int reclen, i, line, byte, level;
+ guint i, reclen, level, line;
+ char byte;
buf[TOSHIBA_LINE_LENGTH-1] = 0;
@@ -386,7 +387,7 @@ parse_toshiba_hex_dump(FILE_T fh, int pkt_len, guint8* buf, int *err)
* Returns TRUE if good hex dump, FALSE if bad.
*/
static gboolean
-parse_single_hex_dump_line(char* rec, guint8 *buf, int byte_offset) {
+parse_single_hex_dump_line(char* rec, guint8 *buf, guint byte_offset) {
int pos, i;
char *s;