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 /epan/wslua/wslua_file.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 'epan/wslua/wslua_file.c')
-rw-r--r-- | epan/wslua/wslua_file.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/epan/wslua/wslua_file.c b/epan/wslua/wslua_file.c index b2c466cab4..9f6cf2297c 100644 --- a/epan/wslua/wslua_file.c +++ b/epan/wslua/wslua_file.c @@ -1652,11 +1652,11 @@ wslua_filehandler_sequential_close(wtap *wth); * If the routine handles this type of file, it should set the "file_type" * field in the "struct wtap" to the type of the file. */ -static int +static wtap_open_return_val wslua_filehandler_open(wtap *wth, int *err, gchar **err_info) { FileHandler fh = (FileHandler)(wth->wslua_data); - int retval = 0; + wtap_open_return_val retval = WTAP_OPEN_NOT_MINE; lua_State* L = NULL; File *fp = NULL; CaptureInfo *fc = NULL; @@ -1681,7 +1681,7 @@ wslua_filehandler_open(wtap *wth, int *err, gchar **err_info) (*fp)->expired = TRUE; (*fc)->expired = TRUE; - if (retval == 1) { + if (retval == WTAP_OPEN_MINE) { /* this is our file type - set the routines and settings into wtap */ if (fh->read_ref != LUA_NOREF) { @@ -1708,13 +1708,13 @@ wslua_filehandler_open(wtap *wth, int *err, gchar **err_info) wth->file_type_subtype = fh->file_type; } - else if (retval == -1) { + else if (retval == WTAP_OPEN_ERROR) { /* open error - we *must* return an error code! */ if (err) { *err = WTAP_ERR_CANT_OPEN; } } - else if (retval == 0) { + else if (retval == WTAP_OPEN_NOT_MINE) { /* not our file type */ remove_wth_priv(L, wth); } @@ -1724,7 +1724,7 @@ wslua_filehandler_open(wtap *wth, int *err, gchar **err_info) if (err) { *err = WTAP_ERR_INTERNAL; } - retval = -1; + retval = WTAP_OPEN_ERROR; } lua_settop(L,0); |