Author: tpot
Date: 2005-01-04 05:43:59 +0000 (Tue, 04 Jan 2005)
New Revision: 160

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=lorikeet&rev=160

Log:
When creating subtrees for ndr structures, make the name a bit
friendlier looking than the IDL field name.

Modified:
   trunk/ethereal/plugins/pidl/eparser.c


Changeset:
Modified: trunk/ethereal/plugins/pidl/eparser.c
===================================================================
--- trunk/ethereal/plugins/pidl/eparser.c       2005-01-03 23:38:34 UTC (rev 
159)
+++ trunk/ethereal/plugins/pidl/eparser.c       2005-01-04 05:43:59 UTC (rev 
160)
@@ -517,6 +517,7 @@
        GSList *l;
        proto_item *item;
        struct subtree_info *info;
+       char *item_name, *tmp;
 
        if (!tree->proto_tree)
                return tree;
@@ -530,13 +531,31 @@
                        return &info->subtree;
        }
        
+       /* Create a more friendly looking name */
+
+       item_name = g_strdup(name);
+       
+       for(tmp = item_name; *tmp; tmp++) { /* Underscores to spaces */
+               if (*tmp == '_')
+                       *tmp = ' ';
+       }
+
+       for(tmp = item_name; *tmp; tmp++) { /* Capitalise each word */
+               if (tmp == item_name || *(tmp - 1) == ' ') 
+                       *tmp = toupper(*tmp);
+       }
+
        /* Create new subtree entry */
        
        info = (struct subtree_info *)g_malloc(sizeof(struct subtree_info));
        
        info->name = g_strdup(name);
+
        item = proto_tree_add_text(
-               tree->proto_tree, ndr->tvb, ndr->offset, 0, name);
+               tree->proto_tree, ndr->tvb, ndr->offset, 0, item_name);
+
+       g_free(item_name);
+
        info->subtree.subtree_list = NULL;
        info->subtree.proto_tree = proto_item_add_subtree(item, ett);
 

Reply via email to