Hi,

when i tried to use your code:

pi = proto_tree_add_text(tree, "Test: %s", tvb, 0, 0, _FunctionFunc());

_FunctionFunc() returns a char *
PROTO_ITEM_SET_GENERATED(pi);

I got these errors:

packet-foo.c
packet-foo.c(167) : error C2220: warning treated as error - no 'object' file 
generated
packet-foo.c(167) : warning C4133: 'function' : incompatible types - from 'char 
[9]' to 'tvbuff_t *'
packet-foo.c(167) : warning C4047: 'function' : 'gint' differs in levels of 
indirection from 'tvbuff_t *'
packet-foo.c(167) : warning C4024: 'proto_tree_add_text' : different types for 
formal and actual parameter 3
plugin.c
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 
9.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.


Any ideas as to how to fix this?
_______________________________________________________
> i have looked at those and it doesnt seem to be what i'm looking for. 
> I want to do something such as proto_tree_add_text(tree, "TEST", tvb, 
> 0, 0, function_call_that_returns_"TEST"() );
> 
> so that in the tree it will output something like TEST: TEST. however, 
> the first "TEST" is supposed to be an int, but i do not know how to 
> get around not using a static const value_string.

Try this:

  proto_tree_add_text(tree, "%d: TEST", tvb, 0, 0, function());

Since the value is coming from something other than the packet, put 
brackets around it:

  proto_item *pi;

  pi = proto_tree_add_text(tree, "%d: TEST", tvb, 0, 0, function));;
  PROTO_ITEM_SET_GENERATED(pi);

It will then show up as:

  [5: TEST]


Steve

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@wireshark.org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe

Reply via email to