ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] r45266: proto_tree_add_uint_format_value(..., value, ..., va

From: Mike Morrin <morrinmike@xxxxxxxxx>
Date: Thu, 11 Oct 2012 06:57:27 +0100
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?