TODO CONTAINS_NON_FIXED
authorStefan Metzmacher <metze@samba.org>
Tue, 8 Mar 2011 15:00:20 +0000 (16:00 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 4 Jun 2019 11:15:20 +0000 (13:15 +0200)
pidl/lib/Parse/Pidl/NDR.pm

index 003156e3a11ef7efce7195afe0cb4e12c4ba183d..c3f6796f9aa0a5ee0994e32fe7d70c0f9d1ed4c7 100644 (file)
@@ -364,6 +364,7 @@ sub GetElementLevelTable($$$)
                DATA_TYPE => $e->{TYPE},
                IS_DEFERRED => $is_deferred,
                CONTAINS_DEFERRED => can_contain_deferred($e->{TYPE}),
+               CONTAINS_NON_FIXED => can_contain_non_fixed($e->{TYPE}),
                IS_SURROUNDING => 0 #FIXME
        });
 
@@ -414,6 +415,28 @@ sub can_contain_deferred($)
        return 0;
 }
 
+sub can_contain_non_fixed($)
+{
+       sub can_contain_non_fixed($);
+       my ($type) = @_;
+
+       return 1 if can_contain_deferred($type);
+
+       $type = getType($type);
+
+       return 0 if (is_fixed_size_scalar($type));
+
+       return can_contain_non_fixed($type->{DATA}) if ($type->{TYPE} eq "TYPEDEF");
+
+       return 0 unless defined($type->{ELEMENTS});
+
+       foreach (@{$type->{ELEMENTS}}) {
+               return 1 if ($_->{POINTERS});
+               return 1 if (can_contain_non_fixed ($_->{TYPE}));
+       }
+
+       return 0;
+}
 sub pointer_type($)
 {
        my $e = shift;