diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-10-09 16:44:15 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-10-09 23:45:30 +0000 |
commit | 45e462985db891248ffcb9db21e6b66733de0b84 (patch) | |
tree | 90d031f9769c07abaea83330a58dd9d3933eb7b1 /wiretap/nettl.c | |
parent | 112c90a04b778958985b02b9663743cea1039f47 (diff) |
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/nettl.c')
-rw-r--r-- | wiretap/nettl.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/wiretap/nettl.c b/wiretap/nettl.c index b45652d4c4..f859c2e265 100644 --- a/wiretap/nettl.c +++ b/wiretap/nettl.c @@ -185,7 +185,7 @@ static gboolean nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, static gboolean nettl_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, const guint8 *pd, int *err); -int nettl_open(wtap *wth, int *err, gchar **err_info) +wtap_open_return_val nettl_open(wtap *wth, int *err, gchar **err_info) { struct nettl_file_hdr file_hdr; guint16 dummy[2]; @@ -197,19 +197,19 @@ int nettl_open(wtap *wth, int *err, gchar **err_info) /* Read in the string that should be at the start of a HP file */ if (!wtap_read_bytes(wth->fh, file_hdr.magic, MAGIC_SIZE, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) - return -1; - return 0; + return WTAP_OPEN_ERROR; + return WTAP_OPEN_NOT_MINE; } if (memcmp(file_hdr.magic, nettl_magic_hpux9, MAGIC_SIZE) && memcmp(file_hdr.magic, nettl_magic_hpux10, MAGIC_SIZE)) { - return 0; + return WTAP_OPEN_NOT_MINE; } /* Read the rest of the file header */ if (!wtap_read_bytes(wth->fh, file_hdr.file_name, FILE_HDR_SIZE - MAGIC_SIZE, err, err_info)) - return -1; + return WTAP_OPEN_ERROR; /* This is an nettl file */ wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_NETTL; @@ -227,9 +227,9 @@ int nettl_open(wtap *wth, int *err, gchar **err_info) if (!wtap_read_bytes_or_eof(wth->fh, dummy, 4, err, err_info)) { if (*err == 0) { /* EOF, so no records */ - return 0; + return WTAP_OPEN_NOT_MINE; } - return -1; + return WTAP_OPEN_ERROR; } subsys = g_ntohs(dummy[1]); @@ -266,11 +266,11 @@ int nettl_open(wtap *wth, int *err, gchar **err_info) } if (file_seek(wth->fh, FILE_HDR_SIZE, SEEK_SET, err) == -1) { - return -1; + return WTAP_OPEN_ERROR; } wth->file_tsprec = WTAP_TSPREC_USEC; - return 1; + return WTAP_OPEN_MINE; } /* Read the next packet */ |