summaryrefslogtreecommitdiff
path: root/wiretap/packetlogger.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-10-09 16:44:15 -0700
committerGuy Harris <guy@alum.mit.edu>2014-10-09 23:45:30 +0000
commit45e462985db891248ffcb9db21e6b66733de0b84 (patch)
tree90d031f9769c07abaea83330a58dd9d3933eb7b1 /wiretap/packetlogger.c
parent112c90a04b778958985b02b9663743cea1039f47 (diff)
downloadwireshark-45e462985db891248ffcb9db21e6b66733de0b84.tar.gz
Use an enum for the open-routine return value, as per Evan Huus's suggestion.
Clean up some things we ran across while making those changes. Change-Id: Ic0d8943d36e6e120d7af0a6148fad98015d1e83e Reviewed-on: https://code.wireshark.org/review/4581 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/packetlogger.c')
-rw-r--r--wiretap/packetlogger.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/wiretap/packetlogger.c b/wiretap/packetlogger.c
index c8235fd5f8..e94b9c1c04 100644
--- a/wiretap/packetlogger.c
+++ b/wiretap/packetlogger.c
@@ -55,31 +55,31 @@ static gboolean packetlogger_read_packet(FILE_T fh, struct wtap_pkthdr *phdr,
Buffer *buf, int *err,
gchar **err_info);
-int packetlogger_open(wtap *wth, int *err, gchar **err_info)
+wtap_open_return_val packetlogger_open(wtap *wth, int *err, gchar **err_info)
{
packetlogger_header_t pl_hdr;
guint8 type;
if(!packetlogger_read_header(&pl_hdr, wth->fh, err, err_info)) {
if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
- return -1;
- return 0;
+ return WTAP_OPEN_ERROR;
+ return WTAP_OPEN_NOT_MINE;
}
if (!wtap_read_bytes(wth->fh, &type, 1, err, err_info)) {
if (*err != WTAP_ERR_SHORT_READ)
- return -1;
- return 0;
+ return WTAP_OPEN_ERROR;
+ return WTAP_OPEN_NOT_MINE;
}
/* Verify this file belongs to us */
if (!((8 <= pl_hdr.len) && (pl_hdr.len < 65536) &&
(type < 0x04 || type == 0xFB || type == 0xFC || type == 0xFE || type == 0xFF)))
- return 0;
+ return WTAP_OPEN_NOT_MINE;
/* No file header. Reset the fh to 0 so we can read the first packet */
if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
- return -1;
+ return WTAP_OPEN_ERROR;
/* Set up the pointers to the handlers for this file type */
wth->subtype_read = packetlogger_read;
@@ -89,7 +89,7 @@ int packetlogger_open(wtap *wth, int *err, gchar **err_info)
wth->file_encap = WTAP_ENCAP_PACKETLOGGER;
wth->file_tsprec = WTAP_TSPREC_USEC;
- return 1; /* Our kind of file */
+ return WTAP_OPEN_MINE; /* Our kind of file */
}
static gboolean