Improve the message for "this field has an integral type" assertions.

(Along the lines of provious changes.)

Change-Id: I22d76f22400d4a93242392ff4688acc753eb0039
Reviewed-on: https://code.wireshark.org/review/5961
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2014-12-21 16:09:15 -08:00
parent c30aa115fe
commit 147ca45683
2 changed files with 12 additions and 3 deletions

View File

@ -7628,7 +7628,7 @@ proto_tree_add_bitmask(proto_tree *parent_tree, tvbuff_t *tvb,
int len;
PROTO_REGISTRAR_GET_NTH(hf_hdr,hf);
DISSECTOR_ASSERT(IS_FT_INT(hf->type) || IS_FT_UINT(hf->type));
DISSECTOR_ASSERT_FIELD_TYPE_IS_INTEGRAL(hf);
len = ftype_length(hf->type);
if (parent_tree) {
@ -7652,7 +7652,7 @@ proto_tree_add_bitmask_with_flags(proto_tree *parent_tree, tvbuff_t *tvb, const
int len;
PROTO_REGISTRAR_GET_NTH(hf_hdr,hf);
DISSECTOR_ASSERT(IS_FT_INT(hf->type) || IS_FT_UINT(hf->type));
DISSECTOR_ASSERT_FIELD_TYPE_IS_INTEGRAL(hf);
len = ftype_length(hf->type);
if (parent_tree) {
@ -7688,7 +7688,7 @@ proto_tree_add_bitmask_len(proto_tree *parent_tree, tvbuff_t *tvb,
guint32 decodable_value;
PROTO_REGISTRAR_GET_NTH(hf_hdr, hf);
DISSECTOR_ASSERT(IS_FT_INT(hf->type) || IS_FT_UINT(hf->type));
DISSECTOR_ASSERT_FIELD_TYPE_IS_INTEGRAL(hf);
decodable_offset = offset;
decodable_len = MIN(len, (guint) ftype_length(hf->type));

View File

@ -249,6 +249,15 @@ WS_DLL_PUBLIC WS_MSVC_NORETURN void proto_report_dissector_bug(const char *messa
__DISSECTOR_ASSERT_FIELD_TYPE ((hfinfo), t))) \
__DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT((hfinfo)->type == t)
#define DISSECTOR_ASSERT_FIELD_TYPE_IS_INTEGRAL(hfinfo) \
((void) ((IS_FT_INT((hfinfo)->type) || \
IS_FT_UINT((hfinfo)->type)) ? (void)0 : \
REPORT_DISSECTOR_BUG( \
ep_strdup_printf("%s:%u: field %s is not of an FT_{U}INTn type", \
__FILE__, __LINE__, (hfinfo)->abbrev)))) \
__DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(IS_FT_INT((hfinfo)->type) || \
IS_FT_UINT((hfinfo)->type))
#define DISSECTOR_ASSERT_FIELD_TYPE_IS_TIME(hfinfo) \
((void) (((hfinfo)->type == FT_ABSOLUTE_TIME || \
(hfinfo)->type == FT_RELATIVE_TIME) ? (void)0 : \