Wireshark-dev: Re: [Wireshark-dev] Usage of BASE_CUSTOM
From: Alexis La Goutte <[email protected]>
Date: Thu, 28 Aug 2014 12:39:51 +0200
On Thu, Aug 28, 2014 at 11:45 AM, Juan Jose Martin Carrascosa
<[email protected]> wrote:
> Hi all,
> In a code review I was told to use proto_tree_add_item and BASE_CUSTOM to
> replace this deprecated call:
>       proto_tree_add_text(rtps_parameter_tree, tvb, offset, param_length,
>         "productVersion: %d.%d%c rev%d",
>         major, minor, release, revision);

It will be better to use a proto_tree_add_item for each value ?
 subtree= proto_tree_add_subtree_format(rtps_parameter_tree, tvb, off, 4,
NULL"productVersion: %d.%d%c rev%d", major, minor, release, revision);

proto_tree_add_item(subtree, hf_rtps_param_product_version_major ,
tvb, offset, ENC_NA);
proto_tree_add_item(subtree, hf_rtps_param_product_version_minor, tvb,
offset+1, ENC_NA);
proto_tree_add_item(subtree, hf_rtps_param_product_version_release ,
tvb, offset+2, ENC_NA);
proto_tree_add_item(subtree, hf_rtps_param_product_version_revision ,
tvb, offset+3, ENC_NA);

> I have been looking for documentation or guidelines but I can't find
> anything. Can anyone help me with this? What would be the change? Pointing
> me to any doc would be OK also.

You can look packet-ieee80211.c, there is some case with BASE_CUSTOM
> Thanks,
> Juanjo
> ___________________________________________________________________________
> Sent via:    Wireshark-dev mailing list <[email protected]>
> Archives:    http://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
>              mailto:[email protected]?subject=unsubscribe