aboutsummaryrefslogtreecommitdiffstats
path: root/packet-cdp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-08-28 08:28:19 +0000
committerGuy Harris <guy@alum.mit.edu>2001-08-28 08:28:19 +0000
commitaa4cd01b9bcd64fc3785668692f2be0f19f69bb8 (patch)
tree3a75d49278b2ef01f583e4346c84e22e30332616 /packet-cdp.c
parentd9019638eef40ef97c69e7a28277d1886aa800cc (diff)
Get rid of "proto_tree_add_notext()" - if you create a subtree using it,
but, before you set the text, you throw an exception while putting stuff under the subtree, you end up with an absolutely blank protocol tree item, which is really gross. Instead of calling "proto_tree_add_notext()", call "proto_tree_add_text()" with at least a minimal label - yes, it does mean you do some work that will probably be unnecessary, but, absent a scheme to arrange to do that work if it *is* necessary (e.g., catching exceptions), the alternative is an ugly protocol tree display. svn path=/trunk/; revision=3879
Diffstat (limited to 'packet-cdp.c')
-rw-r--r--packet-cdp.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/packet-cdp.c b/packet-cdp.c
index 1ea1862c57..6e516566bc 100644
--- a/packet-cdp.c
+++ b/packet-cdp.c
@@ -2,13 +2,12 @@
* Routines for the disassembly of the "Cisco Discovery Protocol"
* (c) Copyright Hannes R. Boehm <hannes@boehm.org>
*
- * $Id: packet-cdp.c,v 1.38 2001/06/20 05:18:36 guy Exp $
+ * $Id: packet-cdp.c,v 1.39 2001/08/28 08:28:14 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
@@ -384,7 +383,7 @@ dissect_address_tlv(tvbuff_t *tvb, int offset, int length, proto_tree *tree)
if (length < 1)
return -1;
- ti = proto_tree_add_notext(tree, tvb, offset, length);
+ ti = proto_tree_add_text(tree, tvb, offset, length, "Truncated address");
address_tree = proto_item_add_subtree(ti, ett_cdp_address);
protocol_type = tvb_get_guint8(tvb, offset);
proto_tree_add_text(address_tree, tvb, offset, 1, "Protocol type: %s",
@@ -392,10 +391,8 @@ dissect_address_tlv(tvbuff_t *tvb, int offset, int length, proto_tree *tree)
offset += 1;
length -= 1;
- if (length < 1) {
- proto_item_set_text(ti, "Truncated address");
+ if (length < 1)
return -1;
- }
protocol_length = tvb_get_guint8(tvb, offset);
proto_tree_add_text(address_tree, tvb, offset, 1, "Protocol length: %u",
protocol_length);
@@ -403,7 +400,6 @@ dissect_address_tlv(tvbuff_t *tvb, int offset, int length, proto_tree *tree)
length -= 1;
if (length < protocol_length) {
- proto_item_set_text(ti, "Truncated address");
if (length != 0) {
proto_tree_add_text(address_tree, tvb, offset, length,
"Protocol: %s (truncated)",
@@ -424,10 +420,8 @@ dissect_address_tlv(tvbuff_t *tvb, int offset, int length, proto_tree *tree)
offset += protocol_length;
length -= protocol_length;
- if (length < 2) {
- proto_item_set_text(ti, "Truncated address");
+ if (length < 2)
return -1;
- }
address_length = tvb_get_ntohs(tvb, offset);
proto_tree_add_text(address_tree, tvb, offset, 2, "Address length: %u",
address_length);
@@ -435,7 +429,6 @@ dissect_address_tlv(tvbuff_t *tvb, int offset, int length, proto_tree *tree)
length -= 2;
if (length < address_length) {
- proto_item_set_text(ti, "Truncated address");
if (length != 0) {
proto_tree_add_text(address_tree, tvb, offset, length,
"Address: %s (truncated)",