aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-01-22 13:04:15 -0800
committerHadriel Kaplan <hadrielk@yahoo.com>2015-01-23 03:58:29 +0000
commit19a8eafc15aec0b7023b6bb09fc6bb72e8a714ab (patch)
tree983fe2fb80d1886dfa7618ef3e893101b0734b61 /epan/wslua
parent2eaa467b34d78b216a1ba9305bd23a9196209b3b (diff)
Use luaL_{check,opt}integer() rather than luaL_{check,opt}int().
Lua prior to 5.3 defined luaL_{check,opt}int() as macros wrapping luaL_{check,opt}integer() with a cast to int; Lua 5.3 doesn't. It sounds as if the Lua developers are deprecating luaL_{check,opt}int(): http://osdir.com/ml/general/2014-10/msg46568.html Change-Id: I2d0b649dcd57ede124f31d39f7945f342ae9b18f Reviewed-on: https://code.wireshark.org/review/6744 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Tested-by: Hadriel Kaplan <hadrielk@yahoo.com>
Diffstat (limited to 'epan/wslua')
-rw-r--r--epan/wslua/lrexlib_algo.h4
-rw-r--r--epan/wslua/lrexlib_glib.c2
-rw-r--r--epan/wslua/wslua.h10
-rw-r--r--epan/wslua/wslua_dumper.c28
-rw-r--r--epan/wslua/wslua_gui.c2
-rw-r--r--epan/wslua/wslua_int64.c8
-rw-r--r--epan/wslua/wslua_internals.c4
-rw-r--r--epan/wslua/wslua_listener.c2
-rw-r--r--epan/wslua/wslua_pinfo.c4
-rw-r--r--epan/wslua/wslua_proto.c28
-rw-r--r--epan/wslua/wslua_tree.c6
-rw-r--r--epan/wslua/wslua_tvb.c48
12 files changed, 73 insertions, 73 deletions
diff --git a/epan/wslua/lrexlib_algo.h b/epan/wslua/lrexlib_algo.h
index 6b9beb0212..1578bb268f 100644
--- a/epan/wslua/lrexlib_algo.h
+++ b/epan/wslua/lrexlib_algo.h
@@ -64,7 +64,7 @@ static int generate_error (lua_State *L, const TUserdata *ud, int errcode);
#endif
#ifndef ALG_GETEFLAGS
-# define ALG_GETEFLAGS(L,idx) luaL_optint (L, idx, ALG_EFLAGS_DFLT)
+# define ALG_GETEFLAGS(L,idx) ((int) luaL_optinteger (L, idx, ALG_EFLAGS_DFLT))
#endif
#ifndef DO_NAMED_SUBPATTERNS
@@ -118,7 +118,7 @@ static int OptLimit (lua_State *L, int pos) {
static int get_startoffset(lua_State *L, int stackpos, size_t len) {
- int startoffset = luaL_optint(L, stackpos, 1);
+ int startoffset = (int)luaL_optinteger(L, stackpos, 1);
if(startoffset > 0)
startoffset--;
else if(startoffset < 0) {
diff --git a/epan/wslua/lrexlib_glib.c b/epan/wslua/lrexlib_glib.c
index 7b672e6c42..8a9fc6ab11 100644
--- a/epan/wslua/lrexlib_glib.c
+++ b/epan/wslua/lrexlib_glib.c
@@ -231,7 +231,7 @@ static int getcflags (lua_State *L, int pos) {
}
static int check_eflags(lua_State *L, const int idx, const int def) {
- int eflags = luaL_optint (L, idx, def);
+ int eflags = (int) luaL_optinteger (L, idx, def);
if ((eflags & ~G_REGEX_MATCH_MASK) != 0) {
return luaL_error (L, "GLib Regex match flag is invalid");
}
diff --git a/epan/wslua/wslua.h b/epan/wslua/wslua.h
index 9971697914..9fe25bfcf8 100644
--- a/epan/wslua/wslua.h
+++ b/epan/wslua/wslua.h
@@ -68,7 +68,7 @@
#define LOG_DOMAIN_LUA "wslua"
/* type conversion macros - lua_Number is a double, so casting isn't kosher; and
- using Lua's already-available lua_tointeger() and luaL_checkint() might be different
+ using Lua's already-available lua_tointeger() and luaL_checkinteger() might be different
on different machines; so use these instead please! */
#define wslua_togint(L,i) (gint) ( lua_tointeger(L,i) )
#define wslua_togint32(L,i) (gint32) ( lua_tonumber(L,i) )
@@ -77,17 +77,17 @@
#define wslua_toguint32(L,i) (guint32) ( lua_tonumber(L,i) )
#define wslua_toguint64(L,i) (guint64) ( lua_tonumber(L,i) )
-#define wslua_checkgint(L,i) (gint) ( luaL_checkint(L,i) )
+#define wslua_checkgint(L,i) (gint) ( luaL_checkinteger(L,i) )
#define wslua_checkgint32(L,i) (gint32) ( luaL_checknumber(L,i) )
#define wslua_checkgint64(L,i) (gint64) ( luaL_checknumber(L,i) )
-#define wslua_checkguint(L,i) (guint) ( luaL_checkint(L,i) )
+#define wslua_checkguint(L,i) (guint) ( luaL_checkinteger(L,i) )
#define wslua_checkguint32(L,i) (guint32) ( luaL_checknumber(L,i) )
#define wslua_checkguint64(L,i) (guint64) ( luaL_checknumber(L,i) )
-#define wslua_optgint(L,i,d) (gint) ( luaL_optint(L,i,d) )
+#define wslua_optgint(L,i,d) (gint) ( luaL_optinteger(L,i,d) )
#define wslua_optgint32(L,i,d) (gint32) ( luaL_optnumber(L,i,d) )
#define wslua_optgint64(L,i,d) (gint64) ( luaL_optnumber(L,i,d) )
-#define wslua_optguint(L,i,d) (guint) ( luaL_optint(L,i,d) )
+#define wslua_optguint(L,i,d) (guint) ( luaL_optinteger(L,i,d) )
#define wslua_optguint32(L,i,d) (guint32) ( luaL_optnumber(L,i,d) )
#define wslua_optguint64(L,i,d) (guint64) ( luaL_optnumber(L,i,d) )
diff --git a/epan/wslua/wslua_dumper.c b/epan/wslua/wslua_dumper.c
index dba5e7cf7b..c192fc09ca 100644
--- a/epan/wslua/wslua_dumper.c
+++ b/epan/wslua/wslua_dumper.c
@@ -92,7 +92,7 @@ WSLUA_CONSTRUCTOR PseudoHeader_eth(lua_State* L) {
PseudoHeader ph = (PseudoHeader)g_malloc(sizeof(struct lua_pseudo_header));
ph->type = PHDR_ETH;
ph->wph = (union wtap_pseudo_header *)g_malloc(sizeof(union wtap_pseudo_header));
- ph->wph->eth.fcs_len = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_eth_FCSLEN,-1);
+ ph->wph->eth.fcs_len = (gint)luaL_optinteger(L,WSLUA_OPTARG_PseudoHeader_eth_FCSLEN,-1);
pushPseudoHeader(L,ph);
@@ -114,13 +114,13 @@ WSLUA_CONSTRUCTOR PseudoHeader_atm(lua_State* L) {
PseudoHeader ph = (PseudoHeader)g_malloc(sizeof(struct lua_pseudo_header));
ph->type = PHDR_ATM;
ph->wph = (union wtap_pseudo_header *)g_malloc(sizeof(union wtap_pseudo_header));
- ph->wph->atm.aal = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_atm_AAL,5);
- ph->wph->atm.vpi = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_atm_VPI,1);
- ph->wph->atm.vci = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_atm_VCI,1);
- ph->wph->atm.channel = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_atm_CHANNEL,0);
- ph->wph->atm.cells = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_atm_CELLS,1);
- ph->wph->atm.aal5t_u2u = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_atm_AAL5U2U,1);
- ph->wph->atm.aal5t_len = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_atm_AAL5LEN,0);
+ ph->wph->atm.aal = (guint8)luaL_optinteger(L,WSLUA_OPTARG_PseudoHeader_atm_AAL,5);
+ ph->wph->atm.vpi = (guint16)luaL_optinteger(L,WSLUA_OPTARG_PseudoHeader_atm_VPI,1);
+ ph->wph->atm.vci = (guint16)luaL_optinteger(L,WSLUA_OPTARG_PseudoHeader_atm_VCI,1);
+ ph->wph->atm.channel = (guint16)luaL_optinteger(L,WSLUA_OPTARG_PseudoHeader_atm_CHANNEL,0);
+ ph->wph->atm.cells = (guint16)luaL_optinteger(L,WSLUA_OPTARG_PseudoHeader_atm_CELLS,1);
+ ph->wph->atm.aal5t_u2u = (guint16)luaL_optinteger(L,WSLUA_OPTARG_PseudoHeader_atm_AAL5U2U,1);
+ ph->wph->atm.aal5t_len = (guint16)luaL_optinteger(L,WSLUA_OPTARG_PseudoHeader_atm_AAL5LEN,0);
pushPseudoHeader(L,ph);
WSLUA_RETURN(1);
@@ -135,9 +135,9 @@ WSLUA_CONSTRUCTOR PseudoHeader_mtp2(lua_State* L) {
PseudoHeader ph = (PseudoHeader)g_malloc(sizeof(struct lua_pseudo_header));
ph->type = PHDR_MTP2;
ph->wph = (union wtap_pseudo_header *)g_malloc(sizeof(union wtap_pseudo_header));
- ph->wph->mtp2.sent = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_mtp2_SENT,0);
- ph->wph->mtp2.annex_a_used = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_mtp2_ANNEXA,0);
- ph->wph->mtp2.link_number = luaL_optint(L,WSLUA_OPTARG_PseudoHeader_mtp2_LINKNUM,0);
+ ph->wph->mtp2.sent = (guint8)luaL_optinteger(L,WSLUA_OPTARG_PseudoHeader_mtp2_SENT,0);
+ ph->wph->mtp2.annex_a_used = (guint8)luaL_optinteger(L,WSLUA_OPTARG_PseudoHeader_mtp2_ANNEXA,0);
+ ph->wph->mtp2.link_number = (guint16)luaL_optinteger(L,WSLUA_OPTARG_PseudoHeader_mtp2_LINKNUM,0);
pushPseudoHeader(L,ph);
WSLUA_RETURN(1); /* The MTP2 pseudoheader */
@@ -213,8 +213,8 @@ WSLUA_CONSTRUCTOR Dumper_new(lua_State* L) {
#define WSLUA_OPTARG_Dumper_new_ENCAP 3 /* The encapsulation to be used in the file to be created - a number entry from the `wtap_encaps` table in `init.lua`. */
Dumper d;
const char* fname = luaL_checkstring(L,WSLUA_ARG_Dumper_new_FILENAME);
- int filetype = luaL_optint(L,WSLUA_OPTARG_Dumper_new_FILETYPE,WTAP_FILE_TYPE_SUBTYPE_PCAP);
- int encap = luaL_optint(L,WSLUA_OPTARG_Dumper_new_ENCAP,WTAP_ENCAP_ETHERNET);
+ int filetype = (int)luaL_optinteger(L,WSLUA_OPTARG_Dumper_new_FILETYPE,WTAP_FILE_TYPE_SUBTYPE_PCAP);
+ int encap = (int)luaL_optinteger(L,WSLUA_OPTARG_Dumper_new_ENCAP,WTAP_ENCAP_ETHERNET);
int err = 0;
const char* filename = cross_plat_fname(fname);
@@ -363,7 +363,7 @@ WSLUA_METHOD Dumper_new_for_current(lua_State* L) {
#define WSLUA_OPTARG_Dumper_new_for_current_FILETYPE 2 /* The file type. Defaults to pcap. */
Dumper d;
const char* fname = luaL_checkstring(L,1);
- int filetype = luaL_optint(L,WSLUA_OPTARG_Dumper_new_for_current_FILETYPE,WTAP_FILE_TYPE_SUBTYPE_PCAP);
+ int filetype = (int)luaL_optinteger(L,WSLUA_OPTARG_Dumper_new_for_current_FILETYPE,WTAP_FILE_TYPE_SUBTYPE_PCAP);
int encap;
int err = 0;
const char* filename = cross_plat_fname(fname);
diff --git a/epan/wslua/wslua_gui.c b/epan/wslua/wslua_gui.c
index 34623dfd71..4ef48118df 100644
--- a/epan/wslua/wslua_gui.c
+++ b/epan/wslua/wslua_gui.c
@@ -784,7 +784,7 @@ WSLUA_FUNCTION wslua_set_filter(lua_State* L) { /* Set the main filter text. */
WSLUA_FUNCTION wslua_set_color_filter_slot(lua_State* L) { /* Set packet-coloring rule for the current session. */
#define WSLUA_ARG_set_color_filter_slot_ROW 1 /* The index of the desired color in the temporary coloring rules list. */
#define WSLUA_ARG_set_color_filter_slot_TEXT 2 /* Display filter for selecting packets to be colorized. */
- guint8 row = luaL_checkint(L,WSLUA_ARG_set_color_filter_slot_ROW);
+ guint8 row = (guint8)luaL_checkinteger(L,WSLUA_ARG_set_color_filter_slot_ROW);
const gchar* filter_str = luaL_checkstring(L,WSLUA_ARG_set_color_filter_slot_TEXT);
if (!ops->set_color_filter_slot) {
diff --git a/epan/wslua/wslua_int64.c b/epan/wslua/wslua_int64.c
index 6c08373184..5abcf30dae 100644
--- a/epan/wslua/wslua_int64.c
+++ b/epan/wslua/wslua_int64.c
@@ -269,10 +269,10 @@ WSLUA_METHOD Int64_tohex(lua_State* L) {
#define WSLUA_OPTARG_Int64_new_NUMBYTES 2 /* The number of hex-chars/nibbles to generate,
negative means uppercase (default=16). */
gint64 b = getInt64(L,1);
- gint n = luaL_optint(L, WSLUA_OPTARG_Int64_new_NUMBYTES, 16);
+ lua_Integer n = luaL_optinteger(L, WSLUA_OPTARG_Int64_new_NUMBYTES, 16);
const gchar *hexdigits = "0123456789abcdef";
gchar buf[16];
- gint i;
+ lua_Integer i;
if (n < 0) { n = -n; hexdigits = "0123456789ABCDEF"; }
if (n > 16) n = 16;
for (i = n-1; i >= 0; --i) { buf[i] = hexdigits[b & 15]; b >>= 4; }
@@ -829,10 +829,10 @@ WSLUA_METHOD UInt64_tohex(lua_State* L) {
#define WSLUA_OPTARG_UInt64_new_NUMBYTES 2 /* The number of hex-chars/nibbles to generate,
negative means uppercase (default=16). */
guint64 b = getUInt64(L,1);
- gint n = luaL_optint(L, WSLUA_OPTARG_UInt64_new_NUMBYTES, 16);
+ lua_Integer n = luaL_optinteger(L, WSLUA_OPTARG_UInt64_new_NUMBYTES, 16);
const gchar *hexdigits = "0123456789abcdef";
gchar buf[16];
- gint i;
+ lua_Integer i;
if (n < 0) { n = -n; hexdigits = "0123456789ABCDEF"; }
if (n > 16) n = 16;
for (i = n-1; i >= 0; --i) { buf[i] = hexdigits[b & 15]; b >>= 4; }
diff --git a/epan/wslua/wslua_internals.c b/epan/wslua/wslua_internals.c
index e27f5cba6b..5ca92ecb57 100644
--- a/epan/wslua/wslua_internals.c
+++ b/epan/wslua/wslua_internals.c
@@ -52,7 +52,7 @@ WSLUA_API gboolean wslua_toboolean(lua_State* L, int n) {
if ( lua_isboolean(L,n) || lua_isnil(L,n) || lua_gettop(L) < n ) {
val = lua_toboolean(L,n);
} else if ( lua_type(L,n) == LUA_TNUMBER ) {
- int num = luaL_checkint(L,n);
+ int num = (int)luaL_checkinteger(L,n);
val = num != 0 ? TRUE : FALSE;
} else {
luaL_argerror(L,n,"must be a boolean or number");
@@ -61,7 +61,7 @@ WSLUA_API gboolean wslua_toboolean(lua_State* L, int n) {
return val;
}
-/* like luaL_checkint, except for booleans - this does not coerce other types */
+/* like luaL_checkinteger, except for booleans - this does not coerce other types */
WSLUA_API gboolean wslua_checkboolean(lua_State* L, int n) {
if (!lua_isboolean(L,n) ) {
diff --git a/epan/wslua/wslua_listener.c b/epan/wslua/wslua_listener.c
index dd76825b0e..3f7767d347 100644
--- a/epan/wslua/wslua_listener.c
+++ b/epan/wslua/wslua_listener.c
@@ -110,7 +110,7 @@ static int lua_tap_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt
switch ( lua_pcall(tap->L,3,1,1) ) {
case 0:
- retval = luaL_optint(tap->L,-1,1);
+ retval = (int)luaL_optinteger(tap->L,-1,1);
break;
case LUA_ERRRUN:
break;
diff --git a/epan/wslua/wslua_pinfo.c b/epan/wslua/wslua_pinfo.c
index 6ea031d689..b38ed3303d 100644
--- a/epan/wslua/wslua_pinfo.c
+++ b/epan/wslua/wslua_pinfo.c
@@ -81,8 +81,8 @@ WSLUA_CONSTRUCTOR NSTime_new(lua_State *L) {
if (!nstime) return 0;
- nstime->secs = (time_t) luaL_optint(L,WSLUA_OPTARG_NSTime_new_SECONDS,0);
- nstime->nsecs = luaL_optint(L,WSLUA_OPTARG_NSTime_new_NSECONDS,0);
+ nstime->secs = (time_t) luaL_optinteger(L,WSLUA_OPTARG_NSTime_new_SECONDS,0);
+ nstime->nsecs = (int) luaL_optinteger(L,WSLUA_OPTARG_NSTime_new_NSECONDS,0);
pushNSTime(L,nstime);
diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c
index 516b2c773c..ef71da77a3 100644
--- a/epan/wslua/wslua_proto.c
+++ b/epan/wslua/wslua_proto.c
@@ -757,7 +757,7 @@ WSLUA_CONSTRUCTOR ProtoField_new(lua_State* L) {
const gchar *blob = luaL_optstring(L,WSLUA_OPTARG_ProtoField_new_DESCR,NULL);
if (lua_isnumber(L,WSLUA_ARG_ProtoField_new_TYPE)) {
- type = (enum ftenum)luaL_checkint(L,WSLUA_ARG_ProtoField_new_TYPE);
+ type = (enum ftenum)luaL_checkinteger(L,WSLUA_ARG_ProtoField_new_TYPE);
} else {
type = get_ftenum(luaL_checkstring(L,WSLUA_ARG_ProtoField_new_TYPE));
}
@@ -765,7 +765,7 @@ WSLUA_CONSTRUCTOR ProtoField_new(lua_State* L) {
abbr = check_field_name(L,WSLUA_ARG_ProtoField_new_ABBR,type);
if (lua_isnumber(L, WSLUA_OPTARG_ProtoField_new_BASE)) {
- base = luaL_optint(L, WSLUA_OPTARG_ProtoField_new_BASE, BASE_NONE);
+ base = (unsigned)luaL_optinteger(L, WSLUA_OPTARG_ProtoField_new_BASE, BASE_NONE);
} else {
base = string_to_base(luaL_optstring(L, WSLUA_OPTARG_ProtoField_new_BASE, "BASE_NONE"));
}
@@ -905,7 +905,7 @@ static int ProtoField_integer(lua_State* L, enum ftenum type) {
ProtoField f;
const gchar* abbr = check_field_name(L,1,type);
const gchar* name = luaL_optstring(L,2,abbr);
- unsigned base = luaL_optint(L, 3, BASE_DEC);
+ unsigned base = (unsigned)luaL_optinteger(L, 3, BASE_DEC);
value_string* vs32 = NULL;
val64_string* vs64 = NULL;
guint32 mask = wslua_optguint32(L,5,0);
@@ -1077,7 +1077,7 @@ static int ProtoField_boolean(lua_State* L, enum ftenum type) {
ProtoField f;
const gchar* abbr = check_field_name(L,1,type);
const gchar* name = luaL_optstring(L,2,abbr);
- unsigned base = luaL_optint(L, 3, BASE_NONE);
+ unsigned base = (unsigned)luaL_optinteger(L, 3, BASE_NONE);
true_false_string* tfs = NULL;
guint32 mask = wslua_optguint32(L,5,0);
const gchar* blob = luaL_optstring(L,6,NULL);
@@ -1136,7 +1136,7 @@ static int ProtoField_time(lua_State* L,enum ftenum type) {
ProtoField f;
const gchar* abbr = NULL;
const gchar* name = luaL_optstring(L,2,abbr);
- unsigned base = luaL_optint(L,3,ABSOLUTE_TIME_LOCAL);
+ unsigned base = (unsigned)luaL_optinteger(L,3,ABSOLUTE_TIME_LOCAL);
const gchar* blob = NULL;
if (type == FT_ABSOLUTE_TIME) {
@@ -1435,8 +1435,8 @@ WSLUA_CONSTRUCTOR ProtoExpert_new(lua_State* L) {
ProtoExpert pe = NULL;
const gchar* abbr = wslua_checkstring_only(L,WSLUA_ARG_ProtoExpert_new_ABBR);
const gchar* text = wslua_checkstring_only(L,WSLUA_ARG_ProtoExpert_new_TEXT);
- int group = luaL_checkint (L, WSLUA_ARG_ProtoExpert_new_GROUP);
- int severity = luaL_checkint (L, WSLUA_ARG_ProtoExpert_new_SEVERITY);
+ int group = (int)luaL_checkinteger(L, WSLUA_ARG_ProtoExpert_new_GROUP);
+ int severity = (int)luaL_checkinteger(L, WSLUA_ARG_ProtoExpert_new_SEVERITY);
pe = g_new(wslua_expert_field_t,1);
@@ -2213,8 +2213,8 @@ WSLUA_CONSTRUCTOR DissectorTable_new (lua_State *L) {
(defaults to `base.DEC`). */
const gchar* name = (const gchar*)luaL_checkstring(L,WSLUA_ARG_DissectorTable_new_TABLENAME);
const gchar* ui_name = (const gchar*)luaL_optstring(L,WSLUA_OPTARG_DissectorTable_new_UINAME,name);
- enum ftenum type = (enum ftenum)luaL_optint(L,WSLUA_OPTARG_DissectorTable_new_TYPE,FT_UINT32);
- unsigned base = (unsigned)luaL_optint(L,WSLUA_OPTARG_DissectorTable_new_BASE,BASE_DEC);
+ enum ftenum type = (enum ftenum)luaL_optinteger(L,WSLUA_OPTARG_DissectorTable_new_TYPE,FT_UINT32);
+ unsigned base = (unsigned)luaL_optinteger(L,WSLUA_OPTARG_DissectorTable_new_BASE,BASE_DEC);
switch(type) {
case FT_STRING:
@@ -2364,7 +2364,7 @@ WSLUA_METHOD DissectorTable_add (lua_State *L) {
g_free (pattern);
} else if ( type == FT_UINT32 || type == FT_UINT16 || type == FT_UINT8 || type == FT_UINT24 ) {
if (lua_isnumber(L, WSLUA_ARG_DissectorTable_add_PATTERN)) {
- int port = luaL_checkint(L, WSLUA_ARG_DissectorTable_add_PATTERN);
+ int port = (int)luaL_checkinteger(L, WSLUA_ARG_DissectorTable_add_PATTERN);
dissector_add_uint(dt->name, port, handle);
} else {
/* Not a number, try as range */
@@ -2426,7 +2426,7 @@ WSLUA_METHOD DissectorTable_set (lua_State *L) {
dissector_add_string(dt->name, pattern,handle);
} else if ( type == FT_UINT32 || type == FT_UINT16 || type == FT_UINT8 || type == FT_UINT24 ) {
if (lua_isnumber(L, WSLUA_ARG_DissectorTable_set_PATTERN)) {
- int port = luaL_checkint(L, WSLUA_ARG_DissectorTable_set_PATTERN);
+ int port = (int)luaL_checkinteger(L, WSLUA_ARG_DissectorTable_set_PATTERN);
dissector_delete_all(dt->name, handle);
dissector_add_uint(dt->name, port, handle);
} else {
@@ -2482,7 +2482,7 @@ WSLUA_METHOD DissectorTable_remove (lua_State *L) {
g_free (pattern);
} else if ( type == FT_UINT32 || type == FT_UINT16 || type == FT_UINT8 || type == FT_UINT24 ) {
if (lua_isnumber(L, WSLUA_ARG_DissectorTable_remove_PATTERN)) {
- int port = luaL_checkint(L, WSLUA_ARG_DissectorTable_remove_PATTERN);
+ int port = (int)luaL_checkinteger(L, WSLUA_ARG_DissectorTable_remove_PATTERN);
dissector_delete_uint(dt->name, port, handle);
} else {
/* Not a number, try as range */
@@ -2562,7 +2562,7 @@ WSLUA_METHOD DissectorTable_try (lua_State *L) {
handled = TRUE;
}
} else if ( type == FT_UINT32 || type == FT_UINT16 || type == FT_UINT8 || type == FT_UINT24 ) {
- int port = luaL_checkint(L, WSLUA_ARG_DissectorTable_try_PATTERN);
+ int port = (int)luaL_checkinteger(L, WSLUA_ARG_DissectorTable_try_PATTERN);
len = dissector_try_uint(dt->table,port,tvb->ws_tvb,pinfo->ws_pinfo,ti->tree);
if (len > 0) {
@@ -2605,7 +2605,7 @@ WSLUA_METHOD DissectorTable_get_dissector (lua_State *L) {
const gchar* pattern = luaL_checkstring(L,WSLUA_ARG_DissectorTable_get_dissector_PATTERN);
handle = dissector_get_string_handle(dt->table,pattern);
} else if ( type == FT_UINT32 || type == FT_UINT16 || type == FT_UINT8 || type == FT_UINT24 ) {
- int port = luaL_checkint(L, WSLUA_ARG_DissectorTable_get_dissector_PATTERN);
+ int port = (int)luaL_checkinteger(L, WSLUA_ARG_DissectorTable_get_dissector_PATTERN);
handle = dissector_get_uint_handle(dt->table,port);
}
diff --git a/epan/wslua/wslua_tree.c b/epan/wslua/wslua_tree.c
index 6958d3e21e..6a90d41b9e 100644
--- a/epan/wslua/wslua_tree.c
+++ b/epan/wslua/wslua_tree.c
@@ -532,8 +532,8 @@ WSLUA_METHOD TreeItem_add_expert_info(lua_State *L) {
`PI_WARN`, or `PI_ERROR`. */
#define WSLUA_OPTARG_TreeItem_add_expert_info_TEXT 4 /* The text for the expert info display. */
TreeItem ti = checkTreeItem(L,1);
- int group = luaL_optint(L,WSLUA_OPTARG_TreeItem_add_expert_info_GROUP,PI_DEBUG);
- int severity = luaL_optint(L,WSLUA_OPTARG_TreeItem_add_expert_info_SEVERITY,PI_CHAT);
+ int group = (int)luaL_optinteger(L,WSLUA_OPTARG_TreeItem_add_expert_info_GROUP,PI_DEBUG);
+ int severity = (int)luaL_optinteger(L,WSLUA_OPTARG_TreeItem_add_expert_info_SEVERITY,PI_CHAT);
expert_field* ei_info = wslua_get_expert_field(group, severity);
const gchar* str;
@@ -667,7 +667,7 @@ WSLUA_METHOD TreeItem_set_len(lua_State *L) {
*/
#define WSLUA_ARG_TreeItem_set_len_LEN 2 /* The length to be used. */
TreeItem ti = checkTreeItem(L,1);
- gint len = luaL_checkint(L,WSLUA_ARG_TreeItem_set_len_LEN);
+ gint len = (int)luaL_checkinteger(L,WSLUA_ARG_TreeItem_set_len_LEN);
proto_item_set_len(ti->item, len);
diff --git a/epan/wslua/wslua_tvb.c b/epan/wslua/wslua_tvb.c
index a585519e99..3c65d57ef3 100644
--- a/epan/wslua/wslua_tvb.c
+++ b/epan/wslua/wslua_tvb.c
@@ -149,7 +149,7 @@ WSLUA_METHOD ByteArray_set_size(lua_State* L) {
#define WSLUA_ARG_ByteArray_set_size_SIZE 2 /* New size of the array. */
ByteArray ba = checkByteArray(L,1);
- int siz = luaL_checkint(L,WSLUA_ARG_ByteArray_set_size_SIZE);
+ int siz = (int)luaL_checkinteger(L,WSLUA_ARG_ByteArray_set_size_SIZE);
guint8* padding;
if (siz < 0) {
@@ -172,8 +172,8 @@ WSLUA_METHOD ByteArray_set_index(lua_State* L) {
#define WSLUA_ARG_ByteArray_set_index_INDEX 2 /* The position of the byte to be set. */
#define WSLUA_ARG_ByteArray_set_index_VALUE 3 /* The char value to set [0-255]. */
ByteArray ba = checkByteArray(L,1);
- int idx = luaL_checkint(L,WSLUA_ARG_ByteArray_set_index_INDEX);
- int v = luaL_checkint(L,WSLUA_ARG_ByteArray_set_index_VALUE);
+ int idx = (int)luaL_checkinteger(L,WSLUA_ARG_ByteArray_set_index_INDEX);
+ int v = (int)luaL_checkinteger(L,WSLUA_ARG_ByteArray_set_index_VALUE);
if (idx == 0 && ! g_str_equal(luaL_optstring(L,2,""),"0") ) {
luaL_argerror(L,2,"bad index");
@@ -200,7 +200,7 @@ WSLUA_METHOD ByteArray_get_index(lua_State* L) {
/* Get the value of a byte in a `ByteArray`. */
#define WSLUA_ARG_ByteArray_get_index_INDEX 2 /* The position of the byte to get. */
ByteArray ba = checkByteArray(L,1);
- int idx = luaL_checkint(L,WSLUA_ARG_ByteArray_get_index_INDEX);
+ int idx = (int)luaL_checkinteger(L,WSLUA_ARG_ByteArray_get_index_INDEX);
if (idx == 0 && ! g_str_equal(luaL_optstring(L,2,""),"0") ) {
luaL_argerror(L,2,"bad index");
@@ -230,8 +230,8 @@ WSLUA_METHOD ByteArray_subset(lua_State* L) {
#define WSLUA_ARG_ByteArray_set_index_OFFSET 2 /* The position of the first byte (0=first). */
#define WSLUA_ARG_ByteArray_set_index_LENGTH 3 /* The length of the segment. */
ByteArray ba = checkByteArray(L,1);
- int offset = luaL_checkint(L,WSLUA_ARG_ByteArray_set_index_OFFSET);
- int len = luaL_checkint(L,WSLUA_ARG_ByteArray_set_index_LENGTH);
+ int offset = (int)luaL_checkinteger(L,WSLUA_ARG_ByteArray_set_index_OFFSET);
+ int len = (int)luaL_checkinteger(L,WSLUA_ARG_ByteArray_set_index_LENGTH);
ByteArray sub;
if ((offset + len) > (int)ba->len || offset < 0 || len < 1) {
@@ -272,7 +272,7 @@ WSLUA_METHOD ByteArray_raw(lua_State* L) {
#define WSLUA_OPTARG_ByteArray_raw_OFFSET 2 /* The position of the first byte (default=0/first). */
#define WSLUA_OPTARG_ByteArray_raw_LENGTH 3 /* The length of the segment to get (default=all). */
ByteArray ba = checkByteArray(L,1);
- guint offset = (guint) luaL_optint(L,WSLUA_OPTARG_ByteArray_raw_OFFSET,0);
+ guint offset = (guint) luaL_optinteger(L,WSLUA_OPTARG_ByteArray_raw_OFFSET,0);
int len;
if (!ba) return 0;
@@ -281,7 +281,7 @@ WSLUA_METHOD ByteArray_raw(lua_State* L) {
return 0;
}
- len = luaL_optint(L,WSLUA_OPTARG_ByteArray_raw_LENGTH, ba->len - offset);
+ len = (int) luaL_optinteger(L,WSLUA_OPTARG_ByteArray_raw_LENGTH, ba->len - offset);
if ((len < 0) || ((guint)len > (ba->len - offset)))
len = ba->len - offset;
@@ -542,7 +542,7 @@ WSLUA_METHOD Tvb_reported_length_remaining(lua_State* L) {
offset is beyond the end of the `Tvb`. */
#define Tvb_reported_length_remaining_OFFSET 2 /* offset */
Tvb tvb = checkTvb(L,1);
- int offset = luaL_optint(L, Tvb_reported_length_remaining_OFFSET, 0);
+ int offset = (int) luaL_optinteger(L, Tvb_reported_length_remaining_OFFSET, 0);
lua_pushnumber(L,tvb_reported_length_remaining(tvb->ws_tvb, offset));
WSLUA_RETURN(1); /* The captured length of the `Tvb`. */
@@ -611,8 +611,8 @@ WSLUA_METHOD Tvb_range(lua_State* L) {
#define WSLUA_OPTARG_Tvb_range_LENGTH 3 /* The length (in octets) of the range. Defaults to until the end of the `Tvb`. */
Tvb tvb = checkTvb(L,1);
- int offset = luaL_optint(L,WSLUA_OPTARG_Tvb_range_OFFSET,0);
- int len = luaL_optint(L,WSLUA_OPTARG_Tvb_range_LENGTH,-1);
+ int offset = (int) luaL_optinteger(L,WSLUA_OPTARG_Tvb_range_OFFSET,0);
+ int len = (int) luaL_optinteger(L,WSLUA_OPTARG_Tvb_range_LENGTH,-1);
if (push_TvbRange(L,tvb->ws_tvb,offset,len)) {
WSLUA_RETURN(1); /* The TvbRange */
@@ -626,8 +626,8 @@ WSLUA_METHOD Tvb_raw(lua_State* L) {
#define WSLUA_OPTARG_Tvb_raw_OFFSET 2 /* The position of the first byte (default=0/first). */
#define WSLUA_OPTARG_Tvb_raw_LENGTH 3 /* The length of the segment to get (default=all). */
Tvb tvb = checkTvb(L,1);
- int offset = luaL_optint(L,WSLUA_OPTARG_Tvb_raw_OFFSET,0);
- int len = luaL_optint(L,WSLUA_OPTARG_Tvb_raw_LENGTH,-1);
+ int offset = (int) luaL_optinteger(L,WSLUA_OPTARG_Tvb_raw_OFFSET,0);
+ int len = (int) luaL_optinteger(L,WSLUA_OPTARG_Tvb_raw_LENGTH,-1);
if (!tvb) return 0;
if (tvb->expired) {
@@ -1076,7 +1076,7 @@ WSLUA_METHOD TvbRange_nstime(lua_State* L) {
#define WSLUA_OPTARG_TvbRange_nstime_ENCODING 2 /* An optional ENC_* encoding value to use */
TvbRange tvbr = checkTvbRange(L,1);
NSTime nstime;
- const guint encoding = luaL_optint(L, WSLUA_OPTARG_TvbRange_nstime_ENCODING, 0);
+ const guint encoding = (guint) luaL_optinteger(L, WSLUA_OPTARG_TvbRange_nstime_ENCODING, 0);
if ( !(tvbr && tvbr->tvb)) return 0;
if (tvbr->tvb->expired) {
@@ -1157,7 +1157,7 @@ WSLUA_METHOD TvbRange_string(lua_State* L) {
/* Obtain a string from a `TvbRange`. */
#define WSLUA_OPTARG_TvbRange_string_ENCODING 2 /* The encoding to use. Defaults to ENC_ASCII. */
TvbRange tvbr = checkTvbRange(L,1);
- guint encoding = (guint)luaL_optint(L,WSLUA_OPTARG_TvbRange_string_ENCODING, ENC_ASCII|ENC_NA);
+ guint encoding = (guint)luaL_optinteger(L,WSLUA_OPTARG_TvbRange_string_ENCODING, ENC_ASCII|ENC_NA);
if ( !(tvbr && tvbr->tvb)) return 0;
if (tvbr->tvb->expired) {
@@ -1201,7 +1201,7 @@ WSLUA_METHOD TvbRange_stringz(lua_State* L) {
/* Obtain a zero terminated string from a `TvbRange`. */
#define WSLUA_OPTARG_TvbRange_stringz_ENCODING 2 /* The encoding to use. Defaults to ENC_ASCII. */
TvbRange tvbr = checkTvbRange(L,1);
- guint encoding = (guint)luaL_optint(L,WSLUA_OPTARG_TvbRange_stringz_ENCODING, ENC_ASCII|ENC_NA);
+ guint encoding = (guint)luaL_optinteger(L,WSLUA_OPTARG_TvbRange_stringz_ENCODING, ENC_ASCII|ENC_NA);
gint offset;
gunichar2 uchar;
@@ -1245,7 +1245,7 @@ WSLUA_METHOD TvbRange_strsize(lua_State* L) {
The size of the string includes the terminating zero. */
#define WSLUA_OPTARG_TvbRange_strsize_ENCODING 2 /* The encoding to use. Defaults to ENC_ASCII. */
TvbRange tvbr = checkTvbRange(L,1);
- guint encoding = (guint)luaL_optint(L,WSLUA_OPTARG_TvbRange_strsize_ENCODING, ENC_ASCII|ENC_NA);
+ guint encoding = (guint)luaL_optinteger(L,WSLUA_OPTARG_TvbRange_strsize_ENCODING, ENC_ASCII|ENC_NA);
gint offset;
gunichar2 uchar;
@@ -1345,7 +1345,7 @@ WSLUA_METHOD TvbRange_bytes(lua_State* L) {
#define WSLUA_OPTARG_TvbRange_bytes_ENCODING 2 /* An optional ENC_* encoding value to use */
TvbRange tvbr = checkTvbRange(L,1);
GByteArray* ba;
- const guint encoding = luaL_optint(L, WSLUA_OPTARG_TvbRange_bytes_ENCODING, 0);
+ const guint encoding = (guint)luaL_optinteger(L, WSLUA_OPTARG_TvbRange_bytes_ENCODING, 0);
if ( !(tvbr && tvbr->tvb)) return 0;
if (tvbr->tvb->expired) {
@@ -1388,8 +1388,8 @@ WSLUA_METHOD TvbRange_bitfield(lua_State* L) {
#define WSLUA_OPTARG_TvbRange_bitfield_LENGTH 3 /* The length (in bits) of the field. Defaults to 1. */
TvbRange tvbr = checkTvbRange(L,1);
- int pos = luaL_optint(L,WSLUA_OPTARG_TvbRange_bitfield_POSITION,0);
- int len = luaL_optint(L,WSLUA_OPTARG_TvbRange_bitfield_LENGTH,1);
+ int pos = (int)luaL_optinteger(L,WSLUA_OPTARG_TvbRange_bitfield_POSITION,0);
+ int len = (int)luaL_optinteger(L,WSLUA_OPTARG_TvbRange_bitfield_LENGTH,1);
if (!(tvbr && tvbr->tvb)) return 0;
if (tvbr->tvb->expired) {
@@ -1426,12 +1426,12 @@ WSLUA_METHOD TvbRange_range(lua_State* L) {
#define WSLUA_OPTARG_TvbRange_range_LENGTH 3 /* The length (in octets) of the range. Defaults to until the end of the `TvbRange`. */
TvbRange tvbr = checkTvbRange(L,1);
- int offset = luaL_optint(L,WSLUA_OPTARG_TvbRange_range_OFFSET,0);
+ int offset = (int)luaL_optinteger(L,WSLUA_OPTARG_TvbRange_range_OFFSET,0);
int len;
if (!(tvbr && tvbr->tvb)) return 0;
- len = luaL_optint(L,WSLUA_OPTARG_TvbRange_range_LENGTH,tvbr->len-offset);
+ len = (int)luaL_optinteger(L,WSLUA_OPTARG_TvbRange_range_LENGTH,tvbr->len-offset);
if (tvbr->tvb->expired) {
luaL_error(L,"expired tvb");
@@ -1522,8 +1522,8 @@ WSLUA_METHOD TvbRange_raw(lua_State* L) {
#define WSLUA_OPTARG_TvbRange_raw_OFFSET 2 /* The position of the first byte (default=0/first). */
#define WSLUA_OPTARG_TvbRange_raw_LENGTH 3 /* The length of the segment to get (default=all). */
TvbRange tvbr = checkTvbRange(L,1);
- int offset = luaL_optint(L,WSLUA_OPTARG_TvbRange_raw_OFFSET,0);
- int len = luaL_optint(L,WSLUA_OPTARG_TvbRange_raw_LENGTH,-1);
+ int offset = (int)luaL_optinteger(L,WSLUA_OPTARG_TvbRange_raw_OFFSET,0);
+ int len = (int)luaL_optinteger(L,WSLUA_OPTARG_TvbRange_raw_LENGTH,-1);
if (!tvbr || !tvbr->tvb) return 0;
if (tvbr->tvb->expired) {