aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/wslua_proto_field.c
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2021-12-26 16:53:23 +0000
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-12-27 22:31:31 +0000
commita566076839b308cbad7822745f39b36e64b5e3e2 (patch)
tree61b7ed425d27adf2fa24197015c06c984b149600 /epan/wslua/wslua_proto_field.c
parent0258ef3a041381f73dcdf447e6c857b2028019fb (diff)
epan: Move time display types to field_display_e
This makes it easier to understand the code, avoids conflicts and ugly and unnecessary casts. The field display enum has evolved over time from integer types to a type generic parameter.
Diffstat (limited to 'epan/wslua/wslua_proto_field.c')
-rw-r--r--epan/wslua/wslua_proto_field.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/epan/wslua/wslua_proto_field.c b/epan/wslua/wslua_proto_field.c
index 5c96a798d7..a0a7eaa8ac 100644
--- a/epan/wslua/wslua_proto_field.c
+++ b/epan/wslua/wslua_proto_field.c
@@ -109,7 +109,7 @@ static const struct field_display_string_t base_displays[] = {
{"16",16},
{"24",24},
{"32",32},
- /* for FT_ABSOLUTE_TIME use values in absolute_time_display_e */
+ /* FT_ABSOLUTE_TIME */
{"base.LOCAL", ABSOLUTE_TIME_LOCAL},
{"base.UTC", ABSOLUTE_TIME_UTC},
{"base.DOY_UTC", ABSOLUTE_TIME_DOY_UTC},
@@ -664,7 +664,7 @@ WSLUA_CONSTRUCTOR ProtoField_new(lua_State* L) {
case FT_ABSOLUTE_TIME:
if (base == BASE_NONE) {
base = ABSOLUTE_TIME_LOCAL; /* Default base for FT_ABSOLUTE_TIME */
- } else if (base < ABSOLUTE_TIME_LOCAL || base > ABSOLUTE_TIME_DOY_UTC) {
+ } else if (!FIELD_DISPLAY_IS_ABSOLUTE_TIME(base)) {
WSLUA_OPTARG_ERROR(ProtoField_new,BASE,"Base must be either base.LOCAL, base.UTC, or base.DOY_UTC");
return 0;
}
@@ -1131,7 +1131,7 @@ static int ProtoField_time(lua_State* L,enum ftenum type) {
}
if (type == FT_ABSOLUTE_TIME) {
- if (base < ABSOLUTE_TIME_LOCAL || base > ABSOLUTE_TIME_DOY_UTC) {
+ if (!FIELD_DISPLAY_IS_ABSOLUTE_TIME(base)) {
luaL_argerror(L, 3, "Base must be either base.LOCAL, base.UTC, or base.DOY_UTC");
return 0;
}