aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/radcom.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-03-05 08:40:27 +0000
committerGuy Harris <guy@alum.mit.edu>2002-03-05 08:40:27 +0000
commitb5e9cef2bfa66c607b3282952cfb4ce11976dd18 (patch)
tree2c75bbaa81b557864090331ad07e44813683b7ea /wiretap/radcom.c
parente300f4db52ddfcdfbf8a53d69d88e037365cb7a3 (diff)
Make "wtap_seek_read()" return TRUE on success and FALSE on error, like
"wtap_read()". Add some additional error checks to the Sniffer file reader. svn path=/trunk/; revision=4875
Diffstat (limited to 'wiretap/radcom.c')
-rw-r--r--wiretap/radcom.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/wiretap/radcom.c b/wiretap/radcom.c
index 610d934e38..4337ea1dda 100644
--- a/wiretap/radcom.c
+++ b/wiretap/radcom.c
@@ -1,6 +1,6 @@
/* radcom.c
*
- * $Id: radcom.c,v 1.34 2002/03/05 05:58:40 guy Exp $
+ * $Id: radcom.c,v 1.35 2002/03/05 08:39:29 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -68,12 +68,13 @@ struct radcomrec_hdr {
};
static gboolean radcom_read(wtap *wth, int *err, long *data_offset);
-static int radcom_seek_read(wtap *wth, long seek_off,
+static gboolean radcom_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, u_char *pd, int length,
int *err);
static int radcom_read_rec_header(FILE_T fh, struct radcomrec_hdr *hdr,
int *err);
-static int radcom_read_rec_data(FILE_T fh, u_char *pd, int length, int *err);
+static gboolean radcom_read_rec_data(FILE_T fh, u_char *pd, int length,
+ int *err);
int radcom_open(wtap *wth, int *err)
{
@@ -284,8 +285,8 @@ static gboolean radcom_read(wtap *wth, int *err, long *data_offset)
* Read the packet data.
*/
buffer_assure_space(wth->frame_buffer, length);
- if (radcom_read_rec_data(wth->fh,
- buffer_start_ptr(wth->frame_buffer), length, err) < 0)
+ if (!radcom_read_rec_data(wth->fh,
+ buffer_start_ptr(wth->frame_buffer), length, err))
return FALSE; /* Read error */
wth->data_offset += length;
@@ -308,7 +309,7 @@ static gboolean radcom_read(wtap *wth, int *err, long *data_offset)
return TRUE;
}
-static int
+static gboolean
radcom_seek_read(wtap *wth, long seek_off,
union wtap_pseudo_header *pseudo_header, u_char *pd, int length, int *err)
{
@@ -317,7 +318,7 @@ radcom_seek_read(wtap *wth, long seek_off,
if (file_seek(wth->random_fh, seek_off, SEEK_SET) == -1) {
*err = file_error(wth->random_fh);
- return -1;
+ return FALSE;
}
/* Read record header. */
@@ -328,7 +329,7 @@ radcom_seek_read(wtap *wth, long seek_off,
/* EOF means "short read" in random-access mode */
*err = WTAP_ERR_SHORT_READ;
}
- return -1;
+ return FALSE;
}
pseudo_header->x25.flags = (hdr.dce & 0x1) ? 0x00 : 0x80;
@@ -359,7 +360,7 @@ radcom_read_rec_header(FILE_T fh, struct radcomrec_hdr *hdr, int *err)
return 1;
}
-static int
+static gboolean
radcom_read_rec_data(FILE_T fh, u_char *pd, int length, int *err)
{
int bytes_read;
@@ -371,7 +372,7 @@ radcom_read_rec_data(FILE_T fh, u_char *pd, int length, int *err)
*err = file_error(fh);
if (*err == 0)
*err = WTAP_ERR_SHORT_READ;
- return -1;
+ return FALSE;
}
- return 0;
+ return TRUE;
}