aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>2009-09-06 07:33:07 +0000
committerKovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>2009-09-06 07:33:07 +0000
commit820ce62af5612df64d9e22d103dc7e559f50c117 (patch)
treea75e0cff63caceb76728ca70f254fb2b8dfff7a5
parent9c512f7cb496b3f0e0634bf3e962c26704aef6a6 (diff)
This fix was supposed to be in r29731 which some how only contained whitespace changes.
svn path=/trunk/; revision=29732
-rw-r--r--epan/proto.c98
1 files changed, 90 insertions, 8 deletions
diff --git a/epan/proto.c b/epan/proto.c
index dd8a4c867f..e9825ee138 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -108,6 +108,21 @@ wrs_count_bitshift(guint32 bitmask)
} \
}
+/** See inlined comments.
+ @param tree the tree to append this item to
+ @param pi the created protocol item we're about to return */
+#if 1
+#define TRY_TO_FAKE_THIS_REPR(tree, pi) \
+ DISSECTOR_ASSERT(tree); \
+ if(!(PTREE_DATA(tree)->visible)) { \
+ /* If the tree (GUI) isn't visible it's pointless for us to generate the protocol \
+ * items string representation */ \
+ return pi; \
+ }
+#else
+#define TRY_TO_FAKE_THIS_REPR(tree, pi)
+#endif
+
static gboolean
proto_tree_free_node(proto_node *node, gpointer data);
@@ -997,6 +1012,8 @@ proto_tree_add_text(proto_tree *tree, tvbuff_t *tvb, gint start, gint length,
if (pi == NULL)
return(NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -1018,6 +1035,8 @@ proto_tree_add_text_valist(proto_tree *tree, tvbuff_t *tvb, gint start,
if (pi == NULL)
return(NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
proto_tree_set_representation(pi, format, ap);
return pi;
@@ -1421,8 +1440,7 @@ ptvcursor_add(ptvcursor_t *ptvc, int hfindex, gint length,
/* Coast clear. Try and fake it */
TRY_TO_FAKE_THIS_ITEM(ptvc->tree, hfindex, hfinfo);
- new_fi = new_field_info(ptvc->tree, hfinfo, ptvc->tvb, offset,
- item_length);
+ new_fi = new_field_info(ptvc->tree, hfinfo, ptvc->tvb, offset, item_length);
if (new_fi == NULL)
return NULL;
@@ -1465,6 +1483,8 @@ proto_tree_add_none_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
pi = proto_tree_add_pi(tree, hfindex, tvb, start, &length, NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -1518,16 +1538,14 @@ proto_tree_add_protocol_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gin
pi = proto_tree_add_pi(tree, hfindex, tvb, start, &length, &new_fi);
+ proto_tree_set_protocol_tvb(new_fi, (start == 0 ? tvb : NULL));
+
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
- if (start == 0) {
- proto_tree_set_protocol_tvb(new_fi, tvb);
- }
- else {
- proto_tree_set_protocol_tvb(new_fi, NULL);
- }
return pi;
}
@@ -1566,6 +1584,8 @@ proto_tree_add_bytes_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -1587,6 +1607,8 @@ proto_tree_add_bytes_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint s
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -1648,6 +1670,8 @@ proto_tree_add_time_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -1669,6 +1693,8 @@ proto_tree_add_time_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -1721,6 +1747,8 @@ proto_tree_add_ipxnet_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -1742,6 +1770,8 @@ proto_tree_add_ipxnet_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -1789,6 +1819,8 @@ proto_tree_add_ipv4_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -1810,6 +1842,8 @@ proto_tree_add_ipv4_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -1858,6 +1892,8 @@ proto_tree_add_ipv6_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -1879,6 +1915,8 @@ proto_tree_add_ipv6_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -1934,6 +1972,8 @@ proto_tree_add_guid_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -1955,6 +1995,8 @@ proto_tree_add_guid_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -2013,6 +2055,8 @@ proto_tree_add_oid_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -2034,6 +2078,8 @@ proto_tree_add_oid_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint sta
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -2142,6 +2188,8 @@ proto_tree_add_string_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -2163,6 +2211,8 @@ proto_tree_add_string_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -2284,6 +2334,8 @@ proto_tree_add_ether_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -2305,6 +2357,8 @@ proto_tree_add_ether_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint s
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -2359,6 +2413,8 @@ proto_tree_add_boolean_format_value(proto_tree *tree, int hfindex,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -2380,6 +2436,8 @@ proto_tree_add_boolean_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -2427,6 +2485,8 @@ proto_tree_add_float_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -2448,6 +2508,8 @@ proto_tree_add_float_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint s
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -2495,6 +2557,8 @@ proto_tree_add_double_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -2516,6 +2580,8 @@ proto_tree_add_double_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -2573,6 +2639,8 @@ proto_tree_add_uint_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -2594,6 +2662,8 @@ proto_tree_add_uint_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint st
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -2657,6 +2727,8 @@ proto_tree_add_uint64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -2678,6 +2750,8 @@ proto_tree_add_uint64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -2727,6 +2801,8 @@ proto_tree_add_int_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -2748,6 +2824,8 @@ proto_tree_add_int_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint sta
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);
@@ -2811,6 +2889,8 @@ proto_tree_add_int64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation_value(pi, format, ap);
va_end(ap);
@@ -2832,6 +2912,8 @@ proto_tree_add_int64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint s
if (pi == NULL)
return (NULL);
+ TRY_TO_FAKE_THIS_REPR(tree, pi);
+
va_start(ap, format);
proto_tree_set_representation(pi, format, ap);
va_end(ap);