diff options
author | Guy Harris <gharris@sonic.net> | 2020-06-18 18:14:46 -0700 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2020-06-19 11:32:26 +0000 |
commit | e1d9a226a2b8f2824a0eb162a8dc972e6e6c2dd4 (patch) | |
tree | 75f56e3f0dde68ec92613cea3f482f7f426625de /tools | |
parent | 51bb2c4d7f515a24659ba0c0048392a81becda4e (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 'tools')
-rwxr-xr-x | tools/asn2wrs.py | 4 | ||||
-rw-r--r-- | tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 2 | ||||
-rwxr-xr-x | tools/process-x11-xcb.pl | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/tools/asn2wrs.py b/tools/asn2wrs.py index 408a5795f5..33898fb7b3 100755 --- a/tools/asn2wrs.py +++ b/tools/asn2wrs.py @@ -1468,8 +1468,8 @@ class EthCtx: #--- eth_bits --------------------------------------------------------------- def eth_bits(self, tname, bits): out = "" - out += "static const " - out += "int * %(TABLE)s[] = {\n" + out += "static int * const " + out += "%(TABLE)s[] = {\n" for (val, id) in bits: out += ' &hf_%s_%s_%s,\n' % (self.eproto, tname, asn2c(id)) out += " NULL\n};\n" diff --git a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm index 41d788ffce..4307b812eb 100644 --- a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm +++ b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm @@ -218,7 +218,7 @@ sub Bitmap($$$$) } if ($element_count > 0) { $self->pidl_code("proto_item *item;"); - $self->pidl_code("static const int * $ifname\_$name\_fields[] = {"); + $self->pidl_code("static int * const $ifname\_$name\_fields[] = {"); $self->indent; foreach (@{$e->{ELEMENTS}}) { next unless (/([^ ]*) (.*)/); diff --git a/tools/process-x11-xcb.pl b/tools/process-x11-xcb.pl index 4808d94554..91dcf4270c 100755 --- a/tools/process-x11-xcb.pl +++ b/tools/process-x11-xcb.pl @@ -804,7 +804,7 @@ sub dissect_element($$$$$;$$) } my $bitmask_field = $fieldname . "_bits"; say $impl $indent."{"; - say $impl $indent." const int* $bitmask_field [] = {"; + say $impl $indent." int* const $bitmask_field [] = {"; my $bit = $enum{$enum_name{$e->att('mask')}}{bit}; for my $val (sort { $a <=> $b } keys %$bit) { my $item = $regname . '_mask_' . $$bit{$val}; |