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/mime_file.c | |
parent | 112c90a04b778958985b02b9663743cea1039f47 (diff) | |
download | wireshark-45e462985db891248ffcb9db21e6b66733de0b84.tar.gz wireshark-45e462985db891248ffcb9db21e6b66733de0b84.tar.bz2 wireshark-45e462985db891248ffcb9db21e6b66733de0b84.zip |
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/mime_file.c')
-rw-r--r-- | wiretap/mime_file.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/wiretap/mime_file.c b/wiretap/mime_file.c index 7b67dbe830..f42ac76b9d 100644 --- a/wiretap/mime_file.c +++ b/wiretap/mime_file.c @@ -161,7 +161,7 @@ mime_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *buf return mime_read_file(wth, wth->random_fh, phdr, buf, err, err_info); } -int +wtap_open_return_val mime_file_open(wtap *wth, int *err, gchar **err_info) { char magic_buf[128]; /* increase buffer size when needed */ @@ -180,10 +180,10 @@ mime_file_open(wtap *wth, int *err, gchar **err_info) if (bytes_read < 0) { *err = file_error(wth->fh, err_info); - return -1; + return WTAP_OPEN_ERROR; } if (bytes_read == 0) - return 0; + return WTAP_OPEN_NOT_MINE; found_file = FALSE; for (i = 0; i < N_MAGIC_TYPES; i++) { @@ -192,15 +192,15 @@ mime_file_open(wtap *wth, int *err, gchar **err_info) found_file = TRUE; /* file_ok = i; */ } else - return 0; /* many files matched, bad file */ + return WTAP_OPEN_NOT_MINE; /* many files matched, bad file */ } } if (!found_file) - return 0; + return WTAP_OPEN_NOT_MINE; if (file_seek(wth->fh, 0, SEEK_SET, err) == -1) - return -1; + return WTAP_OPEN_ERROR; wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_MIME; wth->file_encap = WTAP_ENCAP_MIME; @@ -209,5 +209,5 @@ mime_file_open(wtap *wth, int *err, gchar **err_info) wth->subtype_seek_read = mime_seek_read; wth->snapshot_length = 0; - return 1; + return WTAP_OPEN_MINE; } |