forked from osmocom/wireshark
If possible use proto_tree_add_item(), not proto_tree_add_bytes_item().
Only use proto_tree_add_bytes_item() if you 1) are processing a hex string rather than binary byte array; 2) need the raw byte data. While we're at it, fix the encoding argument in some calls adding FT_BYTES fields to be ENC_NA, and, for some cases that could use FT_UINT_BYTES, use proto_tree_add_item_ret_uint() to handle the length and add a comment about that. Change-Id: I6a1baca5c7da3001c0a6669f9c251e9773346c8c Reviewed-on: https://code.wireshark.org/review/36967 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
This commit is contained in:
parent
50806f2f1b
commit
76a69be324
|
@ -3297,7 +3297,7 @@ dissect_ieee802154_tap_tlvs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
proto_tree_add_bytes_item(tlvtree, hf_ieee802154_tap_tlv_unknown, tvb, offset, length, ENC_NA, NULL, NULL, NULL);
|
||||
proto_tree_add_item(tlvtree, hf_ieee802154_tap_tlv_unknown, tvb, offset, length, ENC_NA);
|
||||
proto_item_append_text(proto_tree_get_parent(tlvtree), "Unknown TLV");
|
||||
break;
|
||||
} /* switch (tlv_type) */
|
||||
|
|
|
@ -394,7 +394,7 @@ dissect_net_dm_attrs(tvbuff_t *tvb, void *data, struct packet_netlink_data *nl_d
|
|||
proto_tree_add_item(tree, &hfi_net_dm_hw, tvb, offset, len, nl_data->encoding);
|
||||
return 1;
|
||||
case WS_NET_DM_ATTR_FLOW_ACTION_COOKIE:
|
||||
proto_tree_add_bytes_item(tree, &hfi_net_dm_flow_action_cookie, tvb, offset, len, ENC_NA, NULL, NULL, NULL);
|
||||
proto_tree_add_item(tree, &hfi_net_dm_flow_action_cookie, tvb, offset, len, ENC_NA);
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
|
|
|
@ -736,13 +736,8 @@ static void dissect_optommp_data_block_byte(proto_item **ti, proto_tree *tree,
|
|||
{
|
||||
if( tvb_reported_length(tvb) >= *poffset + 1 )
|
||||
{
|
||||
GByteArray *unused_ret_val = NULL;
|
||||
unused_ret_val = g_byte_array_new();
|
||||
/* CheckAPI.pl complained when using ENC_BIG_ENDIAN as the sixth
|
||||
* parameter, so set it to 0x0 */
|
||||
*ti = proto_tree_add_bytes_item(tree, hf_optommp_data_block_byte, tvb,
|
||||
*poffset, 1, 0x0, unused_ret_val, NULL, NULL);
|
||||
g_byte_array_free(unused_ret_val, TRUE);
|
||||
*ti = proto_tree_add_item(tree, hf_optommp_data_block_byte, tvb,
|
||||
*poffset, 1, ENC_NA);
|
||||
}
|
||||
|
||||
++(*poffset);
|
||||
|
|
|
@ -973,11 +973,13 @@ dissect_attr_sda(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr
|
|||
|
||||
if (service_ctr_byte & BITMASK_SERVICE_INFO_PRESENT)
|
||||
{
|
||||
proto_tree_add_item(attr_tree, hf_nan_attr_sda_service_info_len, tvb,
|
||||
offset, 1, ENC_BIG_ENDIAN);
|
||||
gint service_info_len = tvb_get_guint8(tvb, offset);
|
||||
proto_tree_add_bytes_item(attr_tree, hf_nan_attr_sda_service_info, tvb,
|
||||
offset + 1, service_info_len, ENC_BIG_ENDIAN, NULL, NULL, NULL);
|
||||
guint32 service_info_len;
|
||||
|
||||
/* XXX - use FT_UINT_BYTES? */
|
||||
proto_tree_add_item_ret_uint(attr_tree, hf_nan_attr_sda_service_info_len, tvb,
|
||||
offset, 1, ENC_BIG_ENDIAN, &service_info_len);
|
||||
proto_tree_add_item(attr_tree, hf_nan_attr_sda_service_info, tvb,
|
||||
offset + 1, service_info_len, ENC_NA);
|
||||
// offset += service_info_len + 1;
|
||||
}
|
||||
}
|
||||
|
@ -1540,8 +1542,8 @@ dissect_attr_availability(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, gui
|
|||
time_bitmap_ctr_fields, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_item_ret_uint(entry_tree, hf_nan_time_bitmap_len, tvb,
|
||||
offset + 2, 1, ENC_LITTLE_ENDIAN, &time_bitmap_len);
|
||||
proto_tree_add_bytes_item(entry_tree, hf_nan_time_bitmap, tvb,
|
||||
offset + 3, time_bitmap_len, ENC_BIG_ENDIAN, NULL, NULL, NULL);
|
||||
proto_tree_add_item(entry_tree, hf_nan_time_bitmap, tvb,
|
||||
offset + 3, time_bitmap_len, ENC_NA);
|
||||
hdr_len = 5;
|
||||
offset += 3 + time_bitmap_len;
|
||||
}
|
||||
|
@ -1669,8 +1671,8 @@ dissect_attr_ndc(proto_tree* attr_tree, tvbuff_t* tvb, gint offset, guint16 attr
|
|||
time_bitmap_ctr_fields, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_item(entry_tree, hf_nan_time_bitmap_len, tvb,
|
||||
offset + 3, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_bytes_item(entry_tree, hf_nan_time_bitmap, tvb,
|
||||
offset + 4, time_bitmap_len, ENC_BIG_ENDIAN, NULL, NULL, NULL);
|
||||
proto_tree_add_item(entry_tree, hf_nan_time_bitmap, tvb,
|
||||
offset + 4, time_bitmap_len, ENC_NA);
|
||||
|
||||
offset += time_bitmap_len + 4;
|
||||
dissected_len += time_bitmap_len + 4;
|
||||
|
|
Loading…
Reference in New Issue