aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-09-24 20:00:16 -0700
committerGuy Harris <guy@alum.mit.edu>2017-09-25 03:01:18 +0000
commitd037bc66c11a6df6525287ce51e4e998a2478fbd (patch)
treef8d70f8c8dd2b5362e1a9085db4848231f379cd4
parent7bb3df70b12efb697fdcec0eaabf879120db8dfa (diff)
pidl:NDR/Parser: fix "skip" for pointers
Pick up change from Samba: commit 3bc6b55385894691792962ecc15978a3b158eca4 Author: Stefan Metzmacher <metze@samba.org> Date: Mon Jun 19 12:15:21 2017 +0200 pidl:NDR/Parser: fix "skip" for pointers We should handle the "skip" at the element level before we traverse trough the element levels. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Change-Id: I8b52e1ad0e0ad2c8a4fc20b94f07441b458e5638 Reviewed-on: https://code.wireshark.org/review/23696 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm40
1 files changed, 30 insertions, 10 deletions
diff --git a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 87ef6ce..eff5a1f 100644
--- a/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/tools/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -721,6 +721,11 @@ sub ParseElementPush($$$$$$)
my $var_name = $env->{$e->{NAME}};
+ if (has_property($e, "skip")) {
+ $self->pidl("/* [skip] '$var_name' */");
+ return;
+ }
+
return if ContainsPipe($e, $e->{LEVELS}[0]);
return unless $primitives or ($deferred and ContainsDeferred($e, $e->{LEVELS}[0]));
@@ -983,11 +988,7 @@ sub ParseDataPull($$$$$$$)
$var_name = get_pointer_to($var_name);
- if (has_property($e, "skip")) {
- $self->pidl("/* [skip] '$var_name' */");
- } else {
- $self->pidl("NDR_CHECK(".TypeFunctionName("ndr_pull", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
- }
+ $self->pidl("NDR_CHECK(".TypeFunctionName("ndr_pull", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
my $pl = GetPrevLevel($e, $l);
@@ -1025,11 +1026,7 @@ sub ParseDataPush($$$$$$$)
$var_name = get_pointer_to($var_name);
}
- if (has_property($e, "skip")) {
- $self->pidl("/* [skip] '$var_name' */");
- } else {
- $self->pidl("NDR_CHECK(".TypeFunctionName("ndr_push", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
- }
+ $self->pidl("NDR_CHECK(".TypeFunctionName("ndr_push", $l->{DATA_TYPE})."($ndr, $ndr_flags, $var_name));");
} else {
$self->ParseTypePush($l->{DATA_TYPE}, $ndr, $var_name, $primitives, $deferred);
}
@@ -1129,6 +1126,11 @@ sub ParseElementPullLevel
my $ndr_flags = CalcNdrFlags($l, $primitives, $deferred);
my $array_length = undef;
+ if (has_property($e, "skip")) {
+ $self->pidl("/* [skip] '$var_name' */");
+ return;
+ }
+
if ($l->{TYPE} eq "ARRAY" and ($l->{IS_VARYING} or $l->{IS_CONFORMANT})) {
$var_name = get_pointer_to($var_name);
}
@@ -1652,6 +1654,11 @@ sub ParseStructPrint($$$$$)
sub DeclarePtrVariables($$)
{
my ($self,$e) = @_;
+
+ if (has_property($e, "skip")) {
+ return;
+ }
+
foreach my $l (@{$e->{LEVELS}}) {
my $size = 32;
if ($l->{TYPE} eq "POINTER" and
@@ -1669,6 +1676,10 @@ sub DeclareArrayVariables($$;$)
{
my ($self,$e,$pull) = @_;
+ if (has_property($e, "skip")) {
+ return;
+ }
+
foreach my $l (@{$e->{LEVELS}}) {
next if ($l->{TYPE} ne "ARRAY");
if (defined($pull)) {
@@ -1687,6 +1698,10 @@ sub DeclareArrayVariablesNoZero($$$)
{
my ($self,$e,$env) = @_;
+ if (has_property($e, "skip")) {
+ return;
+ }
+
foreach my $l (@{$e->{LEVELS}}) {
next if ($l->{TYPE} ne "ARRAY");
next if has_fast_array($e,$l);
@@ -1703,6 +1718,11 @@ sub DeclareArrayVariablesNoZero($$$)
sub DeclareMemCtxVariables($$)
{
my ($self,$e) = @_;
+
+ if (has_property($e, "skip")) {
+ return;
+ }
+
foreach my $l (@{$e->{LEVELS}}) {
my $mem_flags = $self->ParseMemCtxPullFlags($e, $l);