Wireshark-dev: Re: [Wireshark-dev] proto_tree -> proto_item

From: Luca Ceresoli <list@xxxxxxxxxxxxxxxx>
Date: Wed, 25 Feb 2009 20:57:13 +0100
Sébastien Tandel ha scritto:
proto_item_set_text is meant to work with proto_item*
Sure, as declared in epan/proto.h.
What do you mean by it compiles and works with a proto_tree*?
I mean this:

 proto_tree * my_tree;
 const gchar *my_string;
 /* ... */
 my_tree =  ptvcursor_add_text_with_subtree(cursor, .....,  "foo");
 /* ...do some more decoding, including some ptvcursor_add()... */
 /* now I know which text to place there instead of "foo": */
 my_string = val_to_str(...);
 proto_item_set_text(my_tree, "<%s>", my_string);

The last line compiles and runs without runtime errors, and the text of the node created by ptvcursor_add_text_with_subtree() changes from "foo" to "<" + my_string + ">".

Could you describe what is not "working" when you're passing a proto_item*? Compilation error, which? other?
Nothing. I just have no proto_item* to pass, since ptvcursor_add_text_with_subtree() doesn't return any.

Luca