summaryrefslogtreecommitdiff
path: root/wiretap/logcat.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/logcat.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/logcat.c')
-rw-r--r--wiretap/logcat.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/wiretap/logcat.c b/wiretap/logcat.c
index 63eea918a7..cb6e0067ee 100644
--- a/wiretap/logcat.c
+++ b/wiretap/logcat.c
@@ -236,7 +236,7 @@ static gboolean logcat_seek_read(wtap *wth, gint64 seek_off,
return TRUE;
}
-int logcat_open(wtap *wth, int *err, gchar **err_info)
+wtap_open_return_val logcat_open(wtap *wth, int *err, gchar **err_info)
{
gint version;
gint tmp_version;
@@ -245,29 +245,29 @@ int logcat_open(wtap *wth, int *err, gchar **err_info)
/* check first 3 packets (or 2 or 1 if EOF) versions to check file format is correct */
version = detect_version(wth->fh, err, err_info); /* first packet */
if (version == -1)
- return -1; /* I/O error */
+ return WTAP_OPEN_ERROR; /* I/O error */
if (version == 0)
- return 0; /* not a logcat file */
+ return WTAP_OPEN_NOT_MINE; /* not a logcat file */
if (version == -2)
- return 0; /* empty file, so not any type of file */
+ return WTAP_OPEN_NOT_MINE; /* empty file, so not any type of file */
tmp_version = detect_version(wth->fh, err, err_info); /* second packet */
if (tmp_version == -1)
- return -1; /* I/O error */
+ return WTAP_OPEN_ERROR; /* I/O error */
if (tmp_version == 0)
- return 0; /* not a logcat file */
+ return WTAP_OPEN_NOT_MINE; /* not a logcat file */
if (tmp_version != -2) {
/* we've read two packets; do they have the same version? */
if (tmp_version != version) {
/* no, so this is presumably not a logcat file */
- return 0;
+ return WTAP_OPEN_NOT_MINE;
}
tmp_version = detect_version(wth->fh, err, err_info); /* third packet */
if (tmp_version < 0)
- return -1; /* I/O error */
+ return WTAP_OPEN_ERROR; /* I/O error */
if (tmp_version == 0)
- return 0; /* not a logcat file */
+ return WTAP_OPEN_NOT_MINE; /* not a logcat file */
if (tmp_version != -2) {
/*
* we've read three packets and the first two have the same
@@ -275,13 +275,13 @@ int logcat_open(wtap *wth, int *err, gchar **err_info)
*/
if (tmp_version != version) {
/* no, so this is presumably not a logcat file */
- return 0;
+ return WTAP_OPEN_NOT_MINE;
}
}
}
if (file_seek(wth->fh, 0, SEEK_SET, err) == -1)
- return -1;
+ return WTAP_OPEN_ERROR;
logcat = (struct logcat_phdr *) g_malloc(sizeof(struct logcat_phdr));
logcat->version = version;
@@ -296,7 +296,7 @@ int logcat_open(wtap *wth, int *err, gchar **err_info)
wth->subtype_seek_read = logcat_seek_read;
wth->file_tsprec = WTAP_TSPREC_USEC;
- return 1;
+ return WTAP_OPEN_MINE;
}
int logcat_dump_can_write_encap(int encap)