Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item(

From: Dirk Jagdmann <doj@xxxxxxxxx>
Date: Tue, 04 Oct 2011 11:38:48 -0700
I propose to use a perl script to automate as much as reasonable the
replacement of TRUE/FALSE in the encoding parameter of the
proto_tree_add_item() calls in dissectors as follows:

sounds good, but may be difficult to write. Because you would need to write a parser for C function calls in perl. regular expressions won't do the trick, as they can not reliably match parenthesi. Also keep in mind that those proto_tree_*() functions can use multiple lines. But just doing regular expression may give you 90% of the cases which would be good enough.

For the next step is it simply a case of replacing the remaining
TRUE/FALSE encoding parameter by ENC_LITTLE_ENDIAN/ENC_BIG_ENDIAN ?

This sounds right.

One thing I don't quite understand: In a number of the dissectors why do
proto_tree_add_item() encoding parameters for hf items with type
FT_STRING have ENC_ASCII *and* ENC_LITTLE_ENDIAN|ENC_BIG_ENDIAN ?
Shouldn't this be ENC_ASCII | ENC_NA in this case ?

Probably. Don't expect every developer of the various dissectors to have specified 100% correct parameters here, since a lot of combinations so far did just work.

--
---> Dirk Jagdmann
----> http://cubic.org/~doj
-----> http://llg.cubic.org