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] r45266: proto_tree_add_uint_format_value(..., value, ..., va

From: Pascal Quantin <pascal.quantin@xxxxxxxxx>
Date: Thu, 11 Oct 2012 08:35:51 +0200


2012/10/11 Mike Morrin <morrinmike@xxxxxxxxx>
On 11/10/2012 06:26, Pascal Quantin wrote:
Le 11/10/2012 05:10, mmann78@xxxxxxxxxxxx a écrit :
Pascal,
Did you settle on the value, value+1?  I think I have the exact same
problem in bug 7728
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7768)
Hi,

right now I'm displaying the value like what we would do with a
value_string array: computed value and raw value in parenthesis. It is
the best trade-off I could think to so far:
             oct = tvb_get_guint8(tvb, curr_offset) & 0x0f;
             proto_tree_add_uint_format_value(tf_tree,
hf_gsm_a_sm_tft_pkt_flt_id, tvb, curr_offset, 1, oct, "%d (%d)", oct+1,
oct);
Any other idea is welcome.

Why not use an hf with BASE_CUSTOM and write a custom display function to format the string?

Hi Mike,

you are right I could have used it. Given the low complexity of my display and the fact that it is called twice in the code, I'm not sure it is worth it though. But I should think more often to the existence of BASE_CUSTOM.

Regards,
Pascal.