Wireshark mailing list archives
Re: Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script.
From: Jeff Morriss <jeff.morriss.ws () gmail com>
Date: Tue, 04 Oct 2011 16:08:22 -0400
Dirk Jagdmann wrote:
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.
I had a fair amount of luck with the (currently not run) checkAPIsCalledWithTvbGetPtr() function in checkAPIs.pl . It definitely is not 100%, but it served my purposes well. It avoids dealing with parenthesis by assuming the only semi-colon it will find is the end of the function call ;-).
I imagine regexp'ing for proto_tree_add_item[^;]*[TRUE|FALSE]\s*\)\s*; would be sufficient to find offenders. ___________________________________________________________________________ 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-request () wireshark org?subject=unsubscribe
Current thread:
- Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. Bill Meier (Oct 04)
- Re: Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. Dirk Jagdmann (Oct 04)
- Re: Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. David Young (Oct 04)
- Re: Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. Bill Meier (Oct 04)
- Re: [Wireshark-dev] Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. Chris Maynard (Oct 05)
- Re: Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. Anders Broman (Oct 05)
- Re: Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. Bill Meier (Oct 13)
- Re: Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. David Young (Oct 04)
- Re: Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. Dirk Jagdmann (Oct 04)
- Re: Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. Bill Meier (Oct 10)
- Re: Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. Bill Meier (Oct 10)
- Re: Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. Guy Harris (Oct 10)
- Re: Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. Bill Meier (Oct 12)
- Re: Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. Guy Harris (Oct 12)
- Re: Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. Guy Harris (Oct 12)
- Re: Replace TRUE/FALSE with proper ENC_* in proto_tree_add_item() using a script. Dirk Jagdmann (Oct 13)