From Sylvain Munaut: gsm_a_common: elem_v_short doesn't create subtree for the IE...
authorAnders Broman <anders.broman@ericsson.com>
Thu, 8 Mar 2012 11:09:39 +0000 (11:09 -0000)
committerAnders Broman <anders.broman@ericsson.com>
Thu, 8 Mar 2012 11:09:39 +0000 (11:09 -0000)
svn path=/trunk/; revision=41432

epan/dissectors/packet-gsm_a_common.c

index cbcee491329192469dfd50e1675b0ef477efd067..069c4a35c21e98507f994e903694be62022f59e5 100644 (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);
 }