r25114: handle structs and unions without typedefs better
authorStefan Metzmacher <metze@samba.org>
Wed, 12 Sep 2007 12:31:19 +0000 (12:31 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:06:42 +0000 (15:06 -0500)
in can_contain_deffered()

jelmer: we need to handle this more genericly, I assume
        we have a lot of other related bugs

metze
(This used to be commit 3e0f22c85769cac7a5f439836be7b692259ddd81)

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

index 11fdbb2390128c42b1acd678445e2aa9605eb98d..0ec4e6523b86a24f32bd1032b53aa7e7d3365495 100644 (file)
@@ -288,9 +288,20 @@ sub can_contain_deferred($)
 
        return 1 if ($type->{TYPE} eq "DECLARE"); # assume the worst
 
-       foreach my $x (@{$type->{DATA}->{ELEMENTS}}) {
-               return 1 if ($x->{POINTERS});
-               return 1 if (can_contain_deferred ($x));
+       if ($type->{TYPE} eq "TYPEDEF") {
+               return 0 unless defined($type->{DATA}->{ELEMENTS});
+
+               foreach my $x (@{$type->{DATA}->{ELEMENTS}}) {
+                       return 1 if ($x->{POINTERS});
+                       return 1 if (can_contain_deferred ($x));
+               }
+       } else {
+               return 0 unless defined($type->{ELEMENTS});
+
+               foreach my $x (@{$type->{ELEMENTS}}) {
+                       return 1 if ($x->{POINTERS});
+                       return 1 if (can_contain_deferred ($x));
+               }
        }
        
        return 0;