From 3f9812f951bb110700077503a96b9d7d8cfdb2dc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 12 Jan 2008 23:38:05 +0100 Subject: pidl/ejs: Fix bug that filled in the body for types without body. (This used to be commit 4f4dfa6042178c157a09df61d72a42af7aa5c67b) --- source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm | 10 +++++++--- source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'source4/pidl/lib/Parse/Pidl') diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm index fa0c97961c..24270340b9 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm @@ -11,7 +11,7 @@ use Exporter; @EXPORT_OK = qw(check_null_pointer fn_declare TypeFunctionName); use strict; -use Parse::Pidl::Typelist; +use Parse::Pidl::Typelist qw(typeHasBody); use Parse::Pidl::CUtil qw(get_pointer_to get_value_of); use Parse::Pidl::Util qw(has_property ParseExpr); use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel); @@ -274,6 +274,7 @@ sub EjsUnionPull($$$) sub EjsEnumConstant($$) { my ($self, $d) = @_; + return unless (defined($d->{ELEMENTS})); my $v = 0; foreach my $e (@{$d->{ELEMENTS}}) { my $el = $e; @@ -572,6 +573,7 @@ sub EjsEnumPush($$$) sub EjsBitmapPush($$$) { my ($self, $d, $varname) = @_; + return unless (defined($d->{ELEMENTS})); my $type_fn = $d->{BASE_TYPE}; # put the bitmap elements in the constants array foreach my $e (@{$d->{ELEMENTS}}) { @@ -710,6 +712,7 @@ sub EjsInterface($$$) $self->pidl_hdr("\n"); foreach my $d (@{$interface->{TYPES}}) { + next unless (typeHasBody($d)); ($needed->{TypeFunctionName("ejs_push", $d)}) && $self->EjsTypePushFunction($d, $d->{NAME}); ($needed->{TypeFunctionName("ejs_pull", $d)}) && $self->EjsTypePullFunction($d, $d->{NAME}); } @@ -823,8 +826,9 @@ sub NeededType($$$) NeededType($t->{DATA}, $needed, $req) if ($t->{TYPE} eq "TYPEDEF"); - return if (($t->{TYPE} ne "STRUCT") and - ($t->{TYPE} ne "UNION")); + return unless (($t->{TYPE} eq "STRUCT") or ($t->{TYPE} eq "UNION")); + + return unless(typeHasBody($t)); foreach (@{$t->{ELEMENTS}}) { next if (has_property($_, "subcontext")); #FIXME: Support subcontexts diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index cfd16c7b40..451e899ffb 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -2543,7 +2543,8 @@ sub ParseInterface($$$) # Typedefs foreach my $d (@{$interface->{TYPES}}) { - next unless typeHasBody($d); + next unless(typeHasBody($d)); + ($needed->{TypeFunctionName("ndr_push", $d)}) && $self->ParseTypePushFunction($d, "r"); ($needed->{TypeFunctionName("ndr_pull", $d)}) && $self->ParseTypePullFunction($d, "r"); ($needed->{TypeFunctionName("ndr_print", $d)}) && $self->ParseTypePrintFunction($d, "r"); -- cgit