]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pidl: Wireshark: Another C99 type conversion
authorJohn Thacker <johnthacker@gmail.com>
Wed, 3 Jul 2024 12:03:41 +0000 (08:03 -0400)
committerStefan Metzmacher <metze@samba.org>
Fri, 12 Jul 2024 11:08:03 +0000 (11:08 +0000)
Pick up change from Wireshark:

    commit bdb719f846f9d8f7800b9f50dadfde5e7f7a89e1
    Author: John Thacker <johnthacker@gmail.com>
    Date:   Sun Jun 23 08:15:45 2024 -0400

        pidl: Another C99 type conversion

        Change an automated sizeof() call in the pidl dissector generation from
        prefixing a "g" to getting the actual C type.

        Ping #19116

Signed-off-by: John Thacker <johnthacker@gmail.com>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jul 12 11:08:03 UTC 2024 on atb-devel-224

pidl/lib/Parse/Pidl/Wireshark/NDR.pm

index ee28e8a7c36e1d5e82629811730f847d1eacef47..3d8b74bab45cdaa750196a00fad73f20f50c3b19 100644 (file)
@@ -23,7 +23,7 @@ use Exporter;
 use strict;
 use warnings;
 use Parse::Pidl qw(error warning);
-use Parse::Pidl::Typelist qw(getType);
+use Parse::Pidl::Typelist qw(getType mapScalarType);
 use Parse::Pidl::Util qw(has_property property_matches make_str);
 use Parse::Pidl::NDR qw(ContainsString GetNextLevel);
 use Parse::Pidl::Dump qw(DumpType DumpFunction);
@@ -336,9 +336,10 @@ sub ElementLevel($$$$$$$$)
                                $self->pidl_code("offset = dissect_ndr_u" . $type . "array(tvb, offset, pinfo, tree, di, drep, $myname\_);");
                        } else {
                                my $nl = GetNextLevel($e,$l);
+                               my $nl_ctype = mapScalarType($nl->{DATA_TYPE});
                                $self->pidl_code("char *data;");
                                $self->pidl_code("");
-                               $self->pidl_code("offset = dissect_ndr_$type" . "string(tvb, offset, pinfo, tree, di, drep, sizeof(g$nl->{DATA_TYPE}), $hf, false, &data);");
+                               $self->pidl_code("offset = dissect_ndr_$type" . "string(tvb, offset, pinfo, tree, di, drep, sizeof($nl_ctype), $hf, false, &data);");
                                $self->pidl_code("proto_item_append_text(tree, \": %s\", data);");
                        }
                }