diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:53 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:53 +0000 |
commit | a86c5f7cae7ec9a3398300555a0b644689d946a1 (patch) | |
tree | 39fe4b107c71174fd1e8a8ceb9a4d2aa14116248 /epan/wslua/wslua_pref.c | |
parent | Releasing progress-linux version 4.2.6-1~progress7.99u1. (diff) | |
download | wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.tar.xz wireshark-a86c5f7cae7ec9a3398300555a0b644689d946a1.zip |
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/wslua/wslua_pref.c')
-rw-r--r-- | epan/wslua/wslua_pref.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/epan/wslua/wslua_pref.c b/epan/wslua/wslua_pref.c index 234170d3..52b3706a 100644 --- a/epan/wslua/wslua_pref.c +++ b/epan/wslua/wslua_pref.c @@ -29,9 +29,9 @@ static range_t* get_range(lua_State *L, int idx_r, int idx_m); static enum_val_t* get_enum(lua_State *L, int idx) { double seq; - const gchar *str1, *str2; + const char *str1, *str2; enum_val_t *ret, last = {NULL, NULL, -1}; - GArray* es = g_array_new(TRUE,TRUE,sizeof(enum_val_t)); + GArray* es = g_array_new(true,true,sizeof(enum_val_t)); luaL_checktype(L, idx, LUA_TTABLE); lua_pushnil(L); /* first key */ @@ -44,7 +44,7 @@ static enum_val_t* get_enum(lua_State *L, int idx) lua_next(L, -2); if (! lua_isstring(L,-1)) { luaL_argerror(L,idx,"First value of an enum table must be string"); - g_array_free(es,TRUE); + g_array_free(es,true); return NULL; } str1 = lua_tostring(L, -1); @@ -53,7 +53,7 @@ static enum_val_t* get_enum(lua_State *L, int idx) lua_next(L, -2); if (! lua_isstring(L,-1)) { luaL_argerror(L,idx,"Second value of an enum table must be string"); - g_array_free(es,TRUE); + g_array_free(es,true); return NULL; } str2 = lua_tostring(L, -1); @@ -62,14 +62,14 @@ static enum_val_t* get_enum(lua_State *L, int idx) lua_next(L, -2); if (! lua_isnumber(L,-1)) { luaL_argerror(L,idx,"Third value of an enum table must be an integer"); - g_array_free(es,TRUE); + g_array_free(es,true); return NULL; } seq = lua_tonumber(L, -1); e.name = g_strdup(str1); e.description = g_strdup(str2); - e.value = (guint32)seq; + e.value = (uint32_t)seq; g_array_append_val(es,e); @@ -78,14 +78,14 @@ static enum_val_t* get_enum(lua_State *L, int idx) g_array_append_val(es,last); - ret = (enum_val_t*)(void*)g_array_free(es, FALSE); + ret = (enum_val_t*)(void*)g_array_free(es, false); return ret; } static int new_pref(lua_State* L, pref_type_t type) { - const gchar* label = luaL_optstring(L,1,NULL); - const gchar* descr = luaL_optstring(L,3,""); + const char* label = luaL_optstring(L,1,NULL); + const char* descr = luaL_optstring(L,3,""); Pref pref = g_new0(wslua_pref_t, 1); pref->label = g_strdup(label); @@ -95,17 +95,17 @@ static int new_pref(lua_State* L, pref_type_t type) { switch(type) { case PREF_BOOL: { - gboolean def = wslua_toboolean(L,2); + bool def = wslua_toboolean(L,2); pref->value.b = def; break; } case PREF_UINT: { - guint32 def = wslua_optgint32(L,2,0); + uint32_t def = wslua_optint32(L,2,0); pref->value.u = def; break; } case PREF_STRING: { - gchar* def = g_strdup(luaL_optstring(L,2,"")); + char* def = g_strdup(luaL_optstring(L,2,"")); /* * prefs_register_string_preference() assumes that the * variable for the preference points to a static @@ -132,9 +132,9 @@ static int new_pref(lua_State* L, pref_type_t type) { break; } case PREF_ENUM: { - guint32 def = wslua_optgint32(L,2,0); + uint32_t def = wslua_optint32(L,2,0); enum_val_t *enum_val = get_enum(L,4); - gboolean radio = wslua_toboolean(L,5); + bool radio = wslua_toboolean(L,5); pref->value.e = def; pref->info.enum_info.enumvals = enum_val; pref->info.enum_info.radio_buttons = radio; @@ -142,7 +142,7 @@ static int new_pref(lua_State* L, pref_type_t type) { } case PREF_RANGE: { range_t *range = get_range(L,2,4); - guint32 max = wslua_optgint32(L,4,0); + uint32_t max = wslua_optint32(L,4,0); pref->value.r = range; pref->info.max_value = max; break; @@ -177,7 +177,7 @@ WSLUA_CONSTRUCTOR Pref_bool(lua_State* L) { #define WSLUA_ARG_Pref_bool_LABEL 1 /* The Label (text in the right side of the preference input) for this preference. */ #define WSLUA_ARG_Pref_bool_DEFAULT 2 /* The default value for this preference. */ -#define WSLUA_ARG_Pref_bool_DESCR 3 /* A description of this preference. */ +#define WSLUA_ARG_Pref_bool_DESCRIPTION 3 /* A description of this preference. */ return new_pref(L,PREF_BOOL); } @@ -186,7 +186,7 @@ WSLUA_CONSTRUCTOR Pref_uint(lua_State* L) { #define WSLUA_ARG_Pref_uint_LABEL 1 /* The Label (text in the right side of the preference input) for this preference. */ #define WSLUA_ARG_Pref_uint_DEFAULT 2 /* The default value for this preference. */ -#define WSLUA_ARG_Pref_uint_DESCR 3 /* A description of what this preference is. */ +#define WSLUA_ARG_Pref_uint_DESCRIPTION 3 /* A description of what this preference is. */ return new_pref(L,PREF_UINT); } @@ -195,7 +195,7 @@ WSLUA_CONSTRUCTOR Pref_string(lua_State* L) { #define WSLUA_ARG_Pref_string_LABEL 1 /* The Label (text in the right side of the preference input) for this preference. */ #define WSLUA_ARG_Pref_string_DEFAULT 2 /* The default value for this preference. */ -#define WSLUA_ARG_Pref_string_DESCR 3 /* A description of what this preference is. */ +#define WSLUA_ARG_Pref_string_DESCRIPTION 3 /* A description of what this preference is. */ return new_pref(L,PREF_STRING); } @@ -240,7 +240,7 @@ WSLUA_CONSTRUCTOR Pref_enum(lua_State* L) { #define WSLUA_ARG_Pref_enum_LABEL 1 /* The Label (text in the right side of the preference input) for this preference. */ #define WSLUA_ARG_Pref_enum_DEFAULT 2 /* The default value for this preference. */ -#define WSLUA_ARG_Pref_enum_DESCR 3 /* A description of what this preference is. */ +#define WSLUA_ARG_Pref_enum_DESCRIPTION 3 /* A description of what this preference is. */ #define WSLUA_ARG_Pref_enum_ENUM 4 /* An enum Lua table. */ #define WSLUA_ARG_Pref_enum_RADIO 5 /* Radio button (true) or Combobox (false). */ return new_pref(L,PREF_ENUM); @@ -252,7 +252,7 @@ WSLUA_CONSTRUCTOR Pref_range(lua_State* L) { input) for this preference. */ #define WSLUA_ARG_Pref_range_DEFAULT 2 /* The default value for this preference, e.g., "53", "10-30", or "10-30,53,55,100-120". */ -#define WSLUA_ARG_Pref_range_DESCR 3 /* A description of what this preference is. */ +#define WSLUA_ARG_Pref_range_DESCRIPTION 3 /* A description of what this preference is. */ #define WSLUA_ARG_Pref_range_MAX 4 /* The maximum value. */ return new_pref(L,PREF_RANGE); } @@ -260,16 +260,16 @@ WSLUA_CONSTRUCTOR Pref_range(lua_State* L) { WSLUA_CONSTRUCTOR Pref_statictext(lua_State* L) { /* Creates a static text string to be added to a <<lua_class_attrib_proto_prefs,`Proto.prefs`>> Lua table. */ #define WSLUA_ARG_Pref_statictext_LABEL 1 /* The static text. */ -#define WSLUA_ARG_Pref_statictext_DESCR 2 /* The static text description. */ +#define WSLUA_ARG_Pref_statictext_DESCRIPTION 2 /* The static text description. */ return new_pref(L,PREF_STATIC_TEXT); } static range_t* get_range(lua_State *L, int idx_r, int idx_m) { static range_t *ret = NULL; - const gchar *pattern = luaL_checkstring(L, idx_r); + const char *pattern = luaL_checkstring(L, idx_r); - switch (range_convert_str(wmem_epan_scope(), &ret, pattern, wslua_togint32(L, idx_m))) { + switch (range_convert_str(wmem_epan_scope(), &ret, pattern, wslua_toint32(L, idx_m))) { case CVT_NO_ERROR: break; case CVT_SYNTAX_ERROR: @@ -358,10 +358,10 @@ WSLUA_METAMETHOD Prefs__newindex(lua_State* L) { #define WSLUA_ARG_Prefs__newindex_PREF 3 /* A valid but still unassigned Pref object. */ Pref prefs_p = checkPrefs(L,1); - const gchar* name = luaL_checkstring(L,WSLUA_ARG_Prefs__newindex_NAME); + const char* name = luaL_checkstring(L,WSLUA_ARG_Prefs__newindex_NAME); Pref pref = checkPref(L,WSLUA_ARG_Prefs__newindex_PREF); Pref p; - const gchar *c; + const char *c; if (! prefs_p ) return 0; @@ -500,7 +500,7 @@ WSLUA_METAMETHOD Prefs__index(lua_State* L) { #define WSLUA_ARG_Prefs__index_NAME 2 /* The abbreviation of this preference. */ Pref prefs_p = checkPrefs(L,1); - const gchar* name = luaL_checkstring(L,WSLUA_ARG_Prefs__index_NAME); + const char* name = luaL_checkstring(L,WSLUA_ARG_Prefs__index_NAME); if (! prefs_p ) return 0; @@ -515,9 +515,9 @@ WSLUA_METAMETHOD Prefs__index(lua_State* L) { if ( g_str_equal(prefs_p->name,name) ) { switch (prefs_p->type) { case PREF_BOOL: lua_pushboolean(L, prefs_p->value.b); break; - case PREF_UINT: lua_pushnumber(L,(lua_Number)prefs_p->value.u); break; + case PREF_UINT: lua_pushinteger(L,(lua_Integer)prefs_p->value.u); break; case PREF_STRING: lua_pushstring(L,prefs_p->value.s); break; - case PREF_ENUM: lua_pushnumber(L,(lua_Number)prefs_p->value.e); break; + case PREF_ENUM: lua_pushinteger(L,(lua_Integer)prefs_p->value.e); break; case PREF_RANGE: { char *push_str = range_convert_range(NULL, prefs_p->value.r); |