wslua: Fix more argument definitions.

This commit is contained in:
Gerald Combs 2022-07-21 17:37:44 -07:00
parent a113fd5c7b
commit b9ee6f4563
3 changed files with 10 additions and 10 deletions

View File

@ -230,11 +230,11 @@ WSLUA_METHOD ByteArray_len(lua_State* L) {
WSLUA_METHOD ByteArray_subset(lua_State* L) {
/* Obtain a segment of a <<lua_class_ByteArray,`ByteArray`>>, as a new <<lua_class_ByteArray,`ByteArray`>>. */
#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. */
#define WSLUA_ARG_ByteArray_subset_OFFSET 2 /* The position of the first byte (0=first). */
#define WSLUA_ARG_ByteArray_subset_LENGTH 3 /* The length of the segment. */
ByteArray ba = checkByteArray(L,1);
int offset = (int)luaL_checkinteger(L,WSLUA_ARG_ByteArray_set_index_OFFSET);
int len = (int)luaL_checkinteger(L,WSLUA_ARG_ByteArray_set_index_LENGTH);
int offset = (int)luaL_checkinteger(L,WSLUA_ARG_ByteArray_subset_OFFSET);
int len = (int)luaL_checkinteger(L,WSLUA_ARG_ByteArray_subset_LENGTH);
ByteArray sub;
if ((offset + len) > (int)ba->len || offset < 0 || len < 1) {

View File

@ -875,8 +875,8 @@ wslua_deregister_filehandler_work(FileHandler fh)
WSLUA_FUNCTION wslua_deregister_filehandler(lua_State* L) {
/* Deregister the FileHandler from Wireshark/TShark, so it no longer gets used for reading/writing/display.
This function cannot be called inside the reading/writing callback functions. */
#define WSLUA_ARG_register_filehandler_FILEHANDLER 1 /* The FileHandler object to be deregistered */
FileHandler fh = checkFileHandler(L,WSLUA_ARG_register_filehandler_FILEHANDLER);
#define WSLUA_ARG_deregister_filehandler_FILEHANDLER 1 /* The FileHandler object to be deregistered */
FileHandler fh = checkFileHandler(L,WSLUA_ARG_deregister_filehandler_FILEHANDLER);
if (in_routine)
return luaL_error(L,"A FileHandler cannot be deregistered during reading/writing callback functions");

View File

@ -304,10 +304,10 @@ WSLUA_METHOD Int64_tohex(lua_State* L) {
/* Returns a hexadecimal string of the <<lua_class_Int64,`Int64`>> value.
@since 1.11.3
*/
#define WSLUA_OPTARG_Int64_new_NUMBYTES 2 /* The number of hex chars/nibbles to generate.
#define WSLUA_OPTARG_Int64_tohex_NUMBYTES 2 /* The number of hex chars/nibbles to generate.
A negative value generates uppercase. Default is 16. */
gint64 b = getInt64(L,1);
lua_Integer n = luaL_optinteger(L, WSLUA_OPTARG_Int64_new_NUMBYTES, 16);
lua_Integer n = luaL_optinteger(L, WSLUA_OPTARG_Int64_tohex_NUMBYTES, 16);
const gchar *hexdigits = "0123456789abcdef";
gchar buf[16];
lua_Integer i;
@ -864,10 +864,10 @@ WSLUA_METHOD UInt64_tohex(lua_State* L) {
/* Returns a hex string of the <<lua_class_UInt64,`UInt64`>> value.
@since 1.11.3
*/
#define WSLUA_OPTARG_UInt64_new_NUMBYTES 2 /* The number of hex-chars/nibbles to generate.
#define WSLUA_OPTARG_UInt64_tohex_NUMBYTES 2 /* The number of hex-chars/nibbles to generate.
Negative means uppercase Default is 16. */
guint64 b = getUInt64(L,1);
lua_Integer n = luaL_optinteger(L, WSLUA_OPTARG_UInt64_new_NUMBYTES, 16);
lua_Integer n = luaL_optinteger(L, WSLUA_OPTARG_UInt64_tohex_NUMBYTES, 16);
const gchar *hexdigits = "0123456789abcdef";
gchar buf[16];
lua_Integer i;