aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-10-10 01:14:06 -0700
committerGuy Harris <guy@alum.mit.edu>2014-10-10 08:14:38 +0000
commitf5b06c56302954c35d417c38dd6bdde61c10b8b2 (patch)
treed99daee8503793e34b97934a486bc006548454e5
parent3a4cab751ee59881f8ae0963dffc4ee82e36f085 (diff)
Fix some more int-to-enum conversion complaint.
While we're at it, log a message if a Lua file format module lacks a read or a seek-read routine, rather than completely silently ignoring that module if it claims a file. Change-Id: I9778f7835922439e2d3708614689280ef7b61d33 Reviewed-on: https://code.wireshark.org/review/4590 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--epan/wslua/wslua_file.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/epan/wslua/wslua_file.c b/epan/wslua/wslua_file.c
index 9f6cf2297c..5802a1a447 100644
--- a/epan/wslua/wslua_file.c
+++ b/epan/wslua/wslua_file.c
@@ -1661,7 +1661,7 @@ wslua_filehandler_open(wtap *wth, int *err, gchar **err_info)
File *fp = NULL;
CaptureInfo *fc = NULL;
- INIT_FILEHANDLER_ROUTINE(read_open,0);
+ INIT_FILEHANDLER_ROUTINE(read_open,WTAP_OPEN_NOT_MINE);
create_wth_priv(L, wth);
@@ -1671,7 +1671,7 @@ wslua_filehandler_open(wtap *wth, int *err, gchar **err_info)
errno = WTAP_ERR_CANT_OPEN;
switch ( lua_pcall(L,2,1,1) ) {
case 0:
- retval = wslua_optboolint(L,-1,0);
+ retval = (wtap_open_return_val)wslua_optboolint(L,-1,0);
break;
CASE_ERROR_ERRINFO("read_open")
}
@@ -1687,12 +1687,18 @@ wslua_filehandler_open(wtap *wth, int *err, gchar **err_info)
if (fh->read_ref != LUA_NOREF) {
wth->subtype_read = wslua_filehandler_read;
}
- else return 0;
+ else {
+ g_warning("Lua file format module lacks a read routine");
+ return WTAP_OPEN_NOT_MINE;
+ }
if (fh->seek_read_ref != LUA_NOREF) {
wth->subtype_seek_read = wslua_filehandler_seek_read;
}
- else return 0;
+ else {
+ g_warning("Lua file format module lacks a seek-read routine");
+ return WTAP_OPEN_NOT_MINE;
+ }
/* it's ok to not have a close routine */
if (fh->read_close_ref != LUA_NOREF)