From 982fc7184d46621948e53b485c7504c9d11f3350 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 17 May 2024 17:00:59 +0200 Subject: Merging upstream version 4.2.5. Signed-off-by: Daniel Baumann --- epan/wslua/wslua_tvb.c | 56 +++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'epan/wslua/wslua_tvb.c') diff --git a/epan/wslua/wslua_tvb.c b/epan/wslua/wslua_tvb.c index f315e83e..031023d0 100644 --- a/epan/wslua/wslua_tvb.c +++ b/epan/wslua/wslua_tvb.c @@ -135,7 +135,7 @@ WSLUA_METHOD Tvb_reported_len(lua_State* L) { /* Obtain the reported length (length on the network) of a <>. */ Tvb tvb = checkTvb(L,1); - lua_pushinteger(L,tvb_reported_length(tvb->ws_tvb)); + lua_pushnumber(L,tvb_reported_length(tvb->ws_tvb)); WSLUA_RETURN(1); /* The reported length of the <>. */ } @@ -143,7 +143,7 @@ WSLUA_METHOD Tvb_captured_len(lua_State* L) { /* Obtain the captured length (amount saved in the capture process) of a <>. */ Tvb tvb = checkTvb(L,1); - lua_pushinteger(L,tvb_captured_length(tvb->ws_tvb)); + lua_pushnumber(L,tvb_captured_length(tvb->ws_tvb)); WSLUA_RETURN(1); /* The captured length of the <>. */ } @@ -152,18 +152,18 @@ WSLUA_METHOD Tvb_len(lua_State* L) { Same as captured_len; kept only for backwards compatibility */ Tvb tvb = checkTvb(L,1); - lua_pushinteger(L,tvb_captured_length(tvb->ws_tvb)); + lua_pushnumber(L,tvb_captured_length(tvb->ws_tvb)); WSLUA_RETURN(1); /* The captured length of the <>. */ } WSLUA_METHOD Tvb_reported_length_remaining(lua_State* L) { /* Obtain the reported (not captured) length of packet data to end of a <> or 0 if the offset is beyond the end of the <>. */ -#define Tvb_reported_length_remaining_OFFSET 2 /* offset */ +#define WSLUA_OPTARG_Tvb_reported_length_remaining_OFFSET 2 /* offset */ Tvb tvb = checkTvb(L,1); - int offset = (int) luaL_optinteger(L, Tvb_reported_length_remaining_OFFSET, 0); + int offset = (int) luaL_optinteger(L, WSLUA_OPTARG_Tvb_reported_length_remaining_OFFSET, 0); - lua_pushinteger(L,tvb_reported_length_remaining(tvb->ws_tvb, offset)); + lua_pushnumber(L,tvb_reported_length_remaining(tvb->ws_tvb, offset)); WSLUA_RETURN(1); /* The captured length of the <>. */ } @@ -210,7 +210,7 @@ WSLUA_METHOD Tvb_offset(lua_State* L) { /* Returns the raw offset (from the beginning of the source <>) of a sub <>. */ Tvb tvb = checkTvb(L,1); - lua_pushinteger(L,tvb_raw_offset(tvb->ws_tvb)); + lua_pushnumber(L,tvb_raw_offset(tvb->ws_tvb)); WSLUA_RETURN(1); /* The raw offset of the <>. */ } @@ -441,16 +441,16 @@ WSLUA_METHOD TvbRange_uint(lua_State* L) { switch (tvbr->len) { case 1: - lua_pushinteger(L,tvb_get_guint8(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,tvb_get_guint8(tvbr->tvb->ws_tvb,tvbr->offset)); return 1; case 2: - lua_pushinteger(L,tvb_get_ntohs(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,tvb_get_ntohs(tvbr->tvb->ws_tvb,tvbr->offset)); return 1; case 3: - lua_pushinteger(L,tvb_get_ntoh24(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,tvb_get_ntoh24(tvbr->tvb->ws_tvb,tvbr->offset)); return 1; case 4: - lua_pushinteger(L,tvb_get_ntohl(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,tvb_get_ntohl(tvbr->tvb->ws_tvb,tvbr->offset)); WSLUA_RETURN(1); /* The unsigned integer value. */ default: luaL_error(L,"TvbRange:uint() does not handle %d byte integers",tvbr->len); @@ -474,16 +474,16 @@ WSLUA_METHOD TvbRange_le_uint(lua_State* L) { switch (tvbr->len) { case 1: /* XXX unsigned anyway */ - lua_pushinteger(L,(lua_Integer)(guint)tvb_get_guint8(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,(lua_Number)(guint)tvb_get_guint8(tvbr->tvb->ws_tvb,tvbr->offset)); return 1; case 2: - lua_pushinteger(L,tvb_get_letohs(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,tvb_get_letohs(tvbr->tvb->ws_tvb,tvbr->offset)); return 1; case 3: - lua_pushinteger(L,tvb_get_letoh24(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,tvb_get_letoh24(tvbr->tvb->ws_tvb,tvbr->offset)); return 1; case 4: - lua_pushinteger(L,tvb_get_letohl(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,tvb_get_letohl(tvbr->tvb->ws_tvb,tvbr->offset)); WSLUA_RETURN(1); /* The unsigned integer value */ default: luaL_error(L,"TvbRange:le_uint() does not handle %d byte integers",tvbr->len); @@ -594,16 +594,16 @@ WSLUA_METHOD TvbRange_int(lua_State* L) { switch (tvbr->len) { case 1: - lua_pushinteger(L,tvb_get_gint8(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,tvb_get_gint8(tvbr->tvb->ws_tvb,tvbr->offset)); return 1; case 2: - lua_pushinteger(L,tvb_get_ntohis(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,tvb_get_ntohis(tvbr->tvb->ws_tvb,tvbr->offset)); return 1; case 3: - lua_pushinteger(L,tvb_get_ntohi24(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,tvb_get_ntohi24(tvbr->tvb->ws_tvb,tvbr->offset)); return 1; case 4: - lua_pushinteger(L,tvb_get_ntohil(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,tvb_get_ntohil(tvbr->tvb->ws_tvb,tvbr->offset)); WSLUA_RETURN(1); /* The signed integer value. */ /* * XXX: @@ -633,16 +633,16 @@ WSLUA_METHOD TvbRange_le_int(lua_State* L) { switch (tvbr->len) { case 1: - lua_pushinteger(L,tvb_get_gint8(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,tvb_get_gint8(tvbr->tvb->ws_tvb,tvbr->offset)); return 1; case 2: - lua_pushinteger(L,tvb_get_letohis(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,tvb_get_letohis(tvbr->tvb->ws_tvb,tvbr->offset)); return 1; case 3: - lua_pushinteger(L,tvb_get_letohi24(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,tvb_get_letohi24(tvbr->tvb->ws_tvb,tvbr->offset)); return 1; case 4: - lua_pushinteger(L,tvb_get_letohil(tvbr->tvb->ws_tvb,tvbr->offset)); + lua_pushnumber(L,tvb_get_letohil(tvbr->tvb->ws_tvb,tvbr->offset)); WSLUA_RETURN(1); /* The signed integer value. */ default: luaL_error(L,"TvbRange:le_int() does not handle %d byte integers",tvbr->len); @@ -1237,13 +1237,13 @@ WSLUA_METHOD TvbRange_bitfield(lua_State* L) { } if (len <= 8) { - lua_pushinteger(L,(lua_Integer)(guint)tvb_get_bits8(tvbr->tvb->ws_tvb,tvbr->offset*8 + pos, len)); + lua_pushnumber(L,(lua_Number)(guint)tvb_get_bits8(tvbr->tvb->ws_tvb,tvbr->offset*8 + pos, len)); return 1; } else if (len <= 16) { - lua_pushinteger(L,tvb_get_bits16(tvbr->tvb->ws_tvb,tvbr->offset*8 + pos, len, FALSE)); + lua_pushnumber(L,tvb_get_bits16(tvbr->tvb->ws_tvb,tvbr->offset*8 + pos, len, FALSE)); return 1; } else if (len <= 32) { - lua_pushinteger(L,tvb_get_bits32(tvbr->tvb->ws_tvb,tvbr->offset*8 + pos, len, FALSE)); + lua_pushnumber(L,tvb_get_bits32(tvbr->tvb->ws_tvb,tvbr->offset*8 + pos, len, FALSE)); return 1; } else if (len <= 64) { pushUInt64(L,tvb_get_bits64(tvbr->tvb->ws_tvb,tvbr->offset*8 + pos, len, FALSE)); @@ -1334,7 +1334,7 @@ WSLUA_METHOD TvbRange_len(lua_State* L) { luaL_error(L,"expired tvb"); return 0; } - lua_pushinteger(L,(lua_Integer)tvbr->len); + lua_pushnumber(L,(lua_Number)tvbr->len); return 1; } @@ -1347,7 +1347,7 @@ WSLUA_METHOD TvbRange_offset(lua_State* L) { luaL_error(L,"expired tvb"); return 0; } - lua_pushinteger(L,(lua_Integer)tvbr->offset); + lua_pushnumber(L,(lua_Number)tvbr->offset); return 1; } -- cgit v1.2.3