aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-per.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2020-06-18 18:14:46 -0700
committerAnders Broman <a.broman58@gmail.com>2020-06-19 11:32:26 +0000
commite1d9a226a2b8f2824a0eb162a8dc972e6e6c2dd4 (patch)
tree75f56e3f0dde68ec92613cea3f482f7f426625de /epan/dissectors/packet-per.c
parent51bb2c4d7f515a24659ba0c0048392a81becda4e (diff)
Fix the type of arrays of pointers to hf_ values for bitfield routines.
The static arrays are supposed to be arrays of const pointers to int, not arrays of non-const pointers to const int. Fixing that means some bugs (scribbling on what's *supposed* to be a const array) will be caught (see packet-ieee80211-radiotap.c for examples, the first of which inspired this change and the second of which was discovered while testing compiles with this change), and removes the need for some annoying casts. Also make some of those arrays static while we're at it. Update documentation and dissector-generator tools. Change-Id: I789da5fc60aadc15797cefecfd9a9fbe9a130ccc Reviewed-on: https://code.wireshark.org/review/37517 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-per.c')
-rw-r--r--epan/dissectors/packet-per.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c
index b14db61abd..03cfcb73d8 100644
--- a/epan/dissectors/packet-per.c
+++ b/epan/dissectors/packet-per.c
@@ -2074,7 +2074,7 @@ DEBUG_ENTRY("dissect_per_sequence_eag");
*/
-static tvbuff_t *dissect_per_bit_string_display(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, header_field_info *hfi, guint32 length, const int **named_bits, gint num_named_bits _U_)
+static tvbuff_t *dissect_per_bit_string_display(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, header_field_info *hfi, guint32 length, int * const *named_bits, gint num_named_bits _U_)
{
tvbuff_t *out_tvb = NULL;
guint32 pad_length=0;
@@ -2135,12 +2135,12 @@ static tvbuff_t *dissect_per_bit_string_display(tvbuff_t *tvb, guint32 offset, a
// Process 8 bits at a time instead of 64, each field masks a
// single byte.
- const int** section_named_bits = named_bits + bit_offset;
+ int* const * section_named_bits = named_bits + bit_offset;
int* flags[9];
if (num_named_bits - bit_offset > 8) {
memcpy(&flags[0], named_bits + bit_offset, 8 * sizeof(int*));
flags[8] = NULL;
- section_named_bits = (const int** )flags;
+ section_named_bits = flags;
}
// TODO should non-zero pad bits be masked from the value?
@@ -2156,7 +2156,7 @@ static tvbuff_t *dissect_per_bit_string_display(tvbuff_t *tvb, guint32 offset, a
return out_tvb;
}
guint32
-dissect_per_bit_string(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, const int **named_bits, gint num_named_bits, tvbuff_t **value_tvb, int *len)
+dissect_per_bit_string(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, int * const *named_bits, gint num_named_bits, tvbuff_t **value_tvb, int *len)
{
/*gint val_start, val_length;*/
guint32 length, fragmented_length = 0;