From b36a0aedd2dbe47429bfc2dda6ea802a92efb526 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 13 Jan 2008 00:05:24 +0100 Subject: pidl: Avoid accidently filling in empty body for types without body. (This used to be commit 1fe5c1ad07c574dc094f59f728025dfcafa0cf22) --- source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 1 + source4/pidl/lib/Parse/Pidl/Typelist.pm | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'source4/pidl/lib/Parse/Pidl') diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index 451e899ffb..8eb2f9ad15 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -2688,6 +2688,7 @@ sub NeededType($$$) NeededType($t->{DATA}, $needed, $req) if ($t->{TYPE} eq "TYPEDEF"); if ($t->{TYPE} eq "STRUCT" or $t->{TYPE} eq "UNION") { + return unless defined($t->{ELEMENTS}); for my $e (@{$t->{ELEMENTS}}) { $e->{PARENT} = $t; if (has_property($e, "compression")) { diff --git a/source4/pidl/lib/Parse/Pidl/Typelist.pm b/source4/pidl/lib/Parse/Pidl/Typelist.pm index aad0cf426c..e54ef11b88 100644 --- a/source4/pidl/lib/Parse/Pidl/Typelist.pm +++ b/source4/pidl/lib/Parse/Pidl/Typelist.pm @@ -135,7 +135,9 @@ sub is_scalar($) sub is_scalar($); my $type = shift; - return 1 if (ref($type) eq "HASH" and $type->{TYPE} eq "SCALAR"); + return 1 if (ref($type) eq "HASH" and + ($type->{TYPE} eq "SCALAR" or $type->{TYPE} eq "ENUM" or + $type->{TYPE} eq "BITMAP")); if (my $dt = getType($type)) { return is_scalar($dt->{DATA}) if ($dt->{TYPE} eq "TYPEDEF"); @@ -149,7 +151,7 @@ sub is_scalar($) sub scalar_is_reference($) { my $name = shift; - + return 1 if (grep(/^$name$/, @reference_scalars)); return 0; } -- cgit