From cbd3c44776ef24b74e79c9656f92bfeb142b2aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Mon, 20 Jun 2022 20:35:47 +0100 Subject: [PATCH] ftypes: Add FT_UINT_STRING to IS_FT_STRING() macro --- epan/ftypes/ftypes.c | 6 ++---- epan/ftypes/ftypes.h | 9 ++++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/epan/ftypes/ftypes.c b/epan/ftypes/ftypes.c index 133946dc15..722a257238 100644 --- a/epan/ftypes/ftypes.c +++ b/epan/ftypes/ftypes.c @@ -629,8 +629,7 @@ fvalue_set_time(fvalue_t *fv, const nstime_t *value) void fvalue_set_string(fvalue_t *fv, const gchar *value) { - ws_assert(IS_FT_STRING(fv->ftype->ftype) || - fv->ftype->ftype == FT_UINT_STRING); + ws_assert(IS_FT_STRING(fv->ftype->ftype)); ws_assert(fv->ftype->set_value.set_value_string); fv->ftype->set_value.set_value_string(fv, value); } @@ -740,8 +739,7 @@ fvalue_get_time(fvalue_t *fv) const char * fvalue_get_string(fvalue_t *fv) { - ws_assert(IS_FT_STRING(fv->ftype->ftype) || - fv->ftype->ftype == FT_UINT_STRING); + ws_assert(IS_FT_STRING(fv->ftype->ftype)); ws_assert(fv->ftype->get_value.get_value_string); return fv->ftype->get_value.get_value_string(fv); } diff --git a/epan/ftypes/ftypes.h b/epan/ftypes/ftypes.h index b62ce48d6c..28a1f93484 100644 --- a/epan/ftypes/ftypes.h +++ b/epan/ftypes/ftypes.h @@ -77,12 +77,15 @@ enum ftenum { (ft) == FT_INT16 || \ (ft) == FT_INT24 || \ (ft) == FT_INT32) + #define IS_FT_INT64(ft) \ ((ft) == FT_INT40 || \ (ft) == FT_INT48 || \ (ft) == FT_INT56 || \ (ft) == FT_INT64) + #define IS_FT_INT(ft) (IS_FT_INT32(ft) || IS_FT_INT64(ft)) + #define IS_FT_UINT32(ft) \ ((ft) == FT_CHAR || \ (ft) == FT_UINT8 || \ @@ -90,17 +93,21 @@ enum ftenum { (ft) == FT_UINT24 || \ (ft) == FT_UINT32 || \ (ft) == FT_FRAMENUM) + #define IS_FT_UINT64(ft) \ ((ft) == FT_UINT40 || \ (ft) == FT_UINT48 || \ (ft) == FT_UINT56 || \ (ft) == FT_UINT64) + #define IS_FT_UINT(ft) (IS_FT_UINT32(ft) || IS_FT_UINT64(ft)) + #define IS_FT_TIME(ft) \ ((ft) == FT_ABSOLUTE_TIME || (ft) == FT_RELATIVE_TIME) + #define IS_FT_STRING(ft) \ ((ft) == FT_STRING || (ft) == FT_STRINGZ || (ft) == FT_STRINGZPAD || \ - (ft) == FT_STRINGZTRUNC) + (ft) == FT_STRINGZTRUNC || (ft) == FT_UINT_STRING) /* field types lengths */ #define FT_ETHER_LEN 6