diff options
author | Gerald Combs <gerald@zing.org> | 2015-02-15 17:58:12 -0800 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2015-02-18 00:05:38 +0000 |
commit | 3f765b3ef94fd6044279d47d0b30b46c344e5943 (patch) | |
tree | 1218985b912e24bc88d72617d61a7491911ee092 /epan/proto.h | |
parent | be5e595da7beb355d385c6a9d96fdd1dad569e61 (diff) | |
download | wireshark-3f765b3ef94fd6044279d47d0b30b46c344e5943.tar.gz wireshark-3f765b3ef94fd6044279d47d0b30b46c344e5943.tar.bz2 wireshark-3f765b3ef94fd6044279d47d0b30b46c344e5943.zip |
Add a CF_FUNC macro for casting BASE_CUSTOM functions.
Add a CF_FUNC macro to match VALS, TFS, etc. This should help us to avoid
the following warning:
warning: ISO C forbids initialization between function pointer and 'void *' [-Wpedantic]
We could start adding DIAG_OFF+DIAG_ON everywhere but this seems to be
more consistent with the other macros in proto.h. Update each instance
of BASE_CUSTOM to use CF_FUNC.
Adjust a dummy variable name generated by asn2wrs.py that was triggering
an invalid error in checkhf.pl.
Fix an encoding arguement in packet-elasticsearch.c found by
fix-encoding-args.pl.
Change-Id: Id0e75076c2d71736639d486f47b87bab84e07d22
Reviewed-on: https://code.wireshark.org/review/7150
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'epan/proto.h')
-rw-r--r-- | epan/proto.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/epan/proto.h b/epan/proto.h index 10c8fe57e5..62514708c3 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -82,6 +82,14 @@ struct expert_field; #define TFS(x) (const struct true_false_string*)(x) typedef void (*custom_fmt_func_t)(gchar *, guint32); +/** Make a custom format function pointer look like a void pointer. Used to set header_field_info.strings. + * + * We cast to gsize first, which 1) is guaranteed to be wide enough to + * hold a pointer and 2) lets us side-step warnings about casting function + * pointers to 'void *'. This violates ISO C but should be fine on POSIX + * and Windows. + */ +#define CF_FUNC(x) ((const void *) (gsize) (x)) /** Make a const range_string[] look like a _range_string pointer, used to set * header_field_info.strings */ |