r25185: Check that can_contain_deferred returns true if one of the members of a type...
authorJelmer Vernooij <jelmer@samba.org>
Sat, 15 Sep 2007 23:03:34 +0000 (23:03 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:06:47 +0000 (15:06 -0500)
(This used to be commit 9e804e0c21f09b699707bb88d534bde55d265087)

source4/pidl/lib/Parse/Pidl/NDR.pm
source4/pidl/tests/ndr.pl

index 033217c8bfb8f8e188629e82bd441f331be9e400..f624d2bdc03ea3791bb865ad164edf18de372e1c 100644 (file)
@@ -289,15 +289,13 @@ sub can_contain_deferred($)
 
        return 1 if ($type->{TYPE} eq "DECLARE"); # assume the worst
 
-       if ($type->{TYPE} eq "TYPEDEF") {
-               return can_contain_deferred($type->{DATA});
-       } 
+       return can_contain_deferred($type->{DATA}) if ($type->{TYPE} eq "TYPEDEF");
 
        return 0 unless defined($type->{ELEMENTS});
 
-       foreach my $x (@{$type->{ELEMENTS}}) {
-               return 1 if ($x->{POINTERS});
-               return 1 if (can_contain_deferred ($x));
+       foreach (@{$type->{ELEMENTS}}) {
+               return 1 if ($_->{POINTERS});
+               return 1 if (can_contain_deferred ($_->{TYPE}));
        }
        
        return 0;
index 6e91ad2a6ab071f325db660c8690e0546c8b5b7f..1512f19d525d981bd8b188a36f2c3234770da206 100755 (executable)
@@ -4,7 +4,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 33;
+use Test::More tests => 34;
 use FindBin qw($RealBin);
 use lib "$RealBin";
 use Util;
@@ -266,3 +266,5 @@ ok(not can_contain_deferred({ TYPE => "STRUCT",
 ok(not can_contain_deferred({ TYPE => "TYPEDEF",
                        DATA => { TYPE => "STRUCT", 
                ELEMENTS => [ { TYPE => "uint32" } ]}}));
+ok(can_contain_deferred({ TYPE => "STRUCT", 
+               ELEMENTS => [ { TYPE => "someunknowntype" } ]}));