From Sylvain Munaut: gsm_a_common: elem_v_short doesn't create subtree for the IE https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6923

svn path=/trunk/; revision=41432
This commit is contained in:
Anders Broman 2012-03-08 11:09:39 +00:00
parent e06cb4430c
commit e512e8b691
1 changed files with 27 additions and 10 deletions

View File

@ -1749,29 +1749,46 @@ guint16 elem_v(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gint pdu_typ
guint16 elem_v_short(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gint pdu_type, int idx, guint32 offset, guint32 nibble)
{
guint16 consumed = 1;
guint32 curr_offset;
const value_string *elem_names;
gint *elem_ett;
guint16 (**elem_funcs)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
gchar *a_add_string;
guint16 consumed = 1;
guint32 curr_offset;
proto_tree *subtree;
proto_item *item;
const value_string *elem_names;
gint *elem_ett;
elem_fcn *elem_funcs;
gchar *a_add_string;
curr_offset = offset;
SET_ELEM_VARS(pdu_type, elem_names, elem_ett, elem_funcs);
a_add_string=ep_alloc(1024);
a_add_string[0] = '\0';
item = proto_tree_add_text(tree,
tvb, curr_offset, 0,
"%s%s",
elem_names[idx].strptr,
"");
subtree = proto_item_add_subtree(item, elem_ett[idx]);
a_add_string=ep_alloc(1024);
a_add_string[0] = '\0';
if (elem_funcs[idx] == NULL)
{
/* NOT NECESSARILY A BAD THING - LENGTH IS HALF OCTET */
(void)de_spare_nibble(tvb, tree, pinfo, curr_offset, nibble, a_add_string, 1024);
(void)de_spare_nibble(tvb, subtree, pinfo, curr_offset, nibble, a_add_string, 1024);
}
else
{
(void)(*elem_funcs[idx])(tvb, tree, pinfo, curr_offset, nibble, a_add_string, 1024);
(void)(*elem_funcs[idx])(tvb, subtree, pinfo, curr_offset, nibble, a_add_string, 1024);
}
if (a_add_string[0] != '\0')
{
proto_item_append_text(item, "%s", a_add_string);
}
proto_item_set_len(item, consumed);
return(consumed);
}