diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2017-03-04 16:15:54 +0100 |
---|---|---|
committer | Martin Kaiser <wireshark@kaiser.cx> | 2017-03-07 21:55:22 +0000 |
commit | 25015a00a3d1f877f053940b59d5b96c1b80c744 (patch) | |
tree | 5074c791d1c1a1785522042c1d1efb0c26066660 /epan/ftypes/ftypes.c | |
parent | 4caa64fc18dfbde99b6f8b0f5d2aa211292d9ffe (diff) | |
download | wireshark-25015a00a3d1f877f053940b59d5b96c1b80c744.tar.gz |
ftypes: create a set_value union
struct _ftype_t contains a number of pointers to set_value_...()
functions. For each pre-defined ftype_t, only one of these pointers
is != NULL.
As the comment already says, we should move these functions into a
union. ftenum_t ftype will be used for selecting the correct function
pointer from the union.
Create a set_value union and move the FvalueSetByteArrayFunc pointer
into the union. Update fvalue_set_byte_array() accordingly. Check
that the fvalue_t parameter is of the correct type.
Change-Id: I6568d8f47108311289c0cd425f28ea8b38046141
Reviewed-on: https://code.wireshark.org/review/20433
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Diffstat (limited to 'epan/ftypes/ftypes.c')
-rw-r--r-- | epan/ftypes/ftypes.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/epan/ftypes/ftypes.c b/epan/ftypes/ftypes.c index 4ad8f317be..6bdc466460 100644 --- a/epan/ftypes/ftypes.c +++ b/epan/ftypes/ftypes.c @@ -499,8 +499,13 @@ fvalue_slice(fvalue_t *fv, drange_t *d_range) void fvalue_set_byte_array(fvalue_t *fv, GByteArray *value) { - g_assert(fv->ftype->set_value_byte_array); - fv->ftype->set_value_byte_array(fv, value); + g_assert(fv->ftype->ftype == FT_BYTES || + fv->ftype->ftype == FT_UINT_BYTES || + fv->ftype->ftype == FT_OID || + fv->ftype->ftype == FT_REL_OID || + fv->ftype->ftype == FT_SYSTEM_ID); + g_assert(fv->ftype->set_value.set_value_byte_array); + fv->ftype->set_value.set_value_byte_array(fv, value); } void |