aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Maynard <Christopher.Maynard@GTECH.COM>2011-11-16 20:09:49 +0000
committerChris Maynard <Christopher.Maynard@GTECH.COM>2011-11-16 20:09:49 +0000
commit934c2ce1a2ddd15b271b6f55efda9c5d9a321396 (patch)
tree8f88823b0bedc278db244c5b934b8fbfc25ffd7d
parent6328122ba376ff6a6f14571663a3eecd2566fe38 (diff)
Move FI_RESET_FLAG and PROTO_ITEM_SET_VISIBLE macros to proto.h and fix the FI_RESET_FLAG macro, being sure to use the 1's complement operator, '~', instead of the logical negation operator, '!'. (Fixes Coverity CID 1326).
svn path=/trunk/; revision=39888
-rw-r--r--epan/dissectors/packet-xmpp-utils.h12
-rw-r--r--epan/proto.h15
2 files changed, 14 insertions, 13 deletions
diff --git a/epan/dissectors/packet-xmpp-utils.h b/epan/dissectors/packet-xmpp-utils.h
index c9c3979bf0..0ac0618092 100644
--- a/epan/dissectors/packet-xmpp-utils.h
+++ b/epan/dissectors/packet-xmpp-utils.h
@@ -26,18 +26,6 @@
#ifndef XMPP_UTILS_H
#define XMPP_UTILS_H
-#define FI_RESET_FLAG(fi, flag) \
- do { \
- if (fi) \
- (fi)->flags = (fi)->flags & !(flag); \
- } while(0)
-
-#define PROTO_ITEM_SET_VISIBLE(proto_item) \
- do { \
- if (proto_item) \
- FI_RESET_FLAG(PITEM_FINFO(proto_item), FI_HIDDEN); \
- } while(0)
-
#define xmpp_elem_cdata(elem) \
elem->data?elem->data->value:""
diff --git a/epan/proto.h b/epan/proto.h
index e7a3622a80..3ea7f155e3 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -418,6 +418,12 @@ typedef struct field_info {
if (fi) \
(fi)->flags = (fi)->flags | (flag); \
} while(0)
+/** convenience macro to reset field_info.flags */
+#define FI_RESET_FLAG(fi, flag) \
+ do { \
+ if (fi) \
+ (fi)->flags = (fi)->flags & ~(flag); \
+ } while(0)
#define FI_GET_BITS_OFFSET(fi) (FI_GET_FLAG(fi, FI_BITS_OFFSET(7)) >> 5)
#define FI_GET_BITS_SIZE(fi) (FI_GET_FLAG(fi, FI_BITS_SIZE(63)) >> 8)
@@ -501,7 +507,14 @@ typedef proto_node proto_item;
do { \
if (proto_item) \
FI_SET_FLAG(PITEM_FINFO(proto_item), FI_HIDDEN); \
- } while(0)
+ } while(0)
+/** mark this protocol field to be visible from the protocol tree display */
+#define PROTO_ITEM_SET_VISIBLE(proto_item) \
+ do { \
+ if (proto_item) \
+ FI_RESET_FLAG(PITEM_FINFO(proto_item), FI_HIDDEN); \
+ } while(0)
+
/** is this protocol field generated by Wireshark (and not read from the packet data)? */
#define PROTO_ITEM_IS_GENERATED(proto_item) \
((proto_item) ? FI_GET_FLAG(PITEM_FINFO(proto_item), FI_GENERATED) : 0)