wslua: Fix the build.

Fix

    wireshark\epan\wslua\wslua_proto_field.c(423,29): error C2220: the following warning is treated as an error [wireshark\build\epan\wslua\wslua.vcxproj]
    wireshark\epan\wslua\wslua_proto_field.c(423,29): error C2220:             mask = (guint64)wslua_optguint32(L, idx, default_value); [wireshark\build\epan\wslua\wslua.vcxproj]
    wireshark\epan\wslua\wslua_proto_field.c(423,29): error C2220:                             ^ [wireshark\build\epan\wslua\wslua.vcxproj]
    wireshark\epan\wslua\wslua_proto_field.c(423,29): warning C4244: 'function': conversion from 'guint64' to 'lua_Number', possible loss of data [wireshark\build\epan\wslua\wslua.vcxproj]
    wireshark\epan\wslua\wslua_proto_field.c(423,29): warning C4244:             mask = (guint64)wslua_optguint32(L, idx, default_value); [wireshark\build\epan\wslua\wslua.vcxproj]
    wireshark\epan\wslua\wslua_proto_field.c(423,29): warning C4244:                             ^ [wireshark\build\epan\wslua\wslua.vcxproj]

on Windows and

    wireshark/epan/wslua/wslua_proto_field.c:1462:48: error: format specifies type 'unsigned long' but the argument has type 'guint64' (aka 'unsigned long long') [-Werror,-Wformat]
                                             f->vs,f->mask,f->blob);
                                                   ^~~~~~~
    wireshark/wsutil/wmem/wmem_strutl.h:51:56: note: expanded from macro 'ws_strdup_printf'
    #define ws_strdup_printf(...) wmem_strdup_printf(NULL, __VA_ARGS__)
                                                       ^~~~~~~~~~~

on macOS.
This commit is contained in:
Gerald Combs 2023-01-04 09:54:52 -08:00
parent 90084d8269
commit 3120e64570
1 changed files with 2 additions and 2 deletions

View File

@ -420,7 +420,7 @@ static guint64 get_mask(lua_State* L, int idx, guint64 default_value) {
switch(lua_type(L, idx)) {
case LUA_TNUMBER:
mask = (guint64)wslua_optguint32(L, idx, default_value);
mask = (guint64)wslua_optguint32(L, idx, (lua_Number)default_value);
break;
case LUA_TSTRING:
case LUA_TUSERDATA:
@ -1455,7 +1455,7 @@ PROTOFIELD_OTHER(eui64,FT_EUI64)
WSLUA_METAMETHOD ProtoField__tostring(lua_State* L) {
/* Returns a string with info about a protofield (for debugging purposes). */
ProtoField f = checkProtoField(L,1);
gchar* s = ws_strdup_printf("ProtoField(%i): %s %s %s %s %p %.16lx %s",
gchar* s = ws_strdup_printf("ProtoField(%i): %s %s %s %s %p %.16" PRIu64 "x %s",
f->hfid,f->name,f->abbrev,
ftenum_to_string(f->type),
base_to_string(f->base),