From 961148db3127a0e3785a5389f24aa25e23d87f43 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 9 Mar 2005 15:39:55 +0000 Subject: r5709: Leave out the pull/push call with NDR_BUFFERS for not just scalars but also for structs/unions containing only scalars. (This used to be commit a3e136b2f3bd51159775fea25eff0ea81e9716f7) --- source4/build/pidl/ndr.pm | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/source4/build/pidl/ndr.pm b/source4/build/pidl/ndr.pm index fce7f26f93..fcd6f6d6dd 100644 --- a/source4/build/pidl/ndr.pm +++ b/source4/build/pidl/ndr.pm @@ -171,8 +171,7 @@ sub need_wire_pointer($) sub need_buffers_section($) { my $e = shift; - if ((is_scalar_type($e->{TYPE}) || util::has_property($e, "subcontext")) && - $e->{POINTERS} == 0 && + if (!can_contain_deferred($e) && !util::array_size($e)) { return 0; } @@ -407,6 +406,26 @@ sub align_type return $tmp; } +##################################################################### +# see if a type contains any deferred data +sub can_contain_deferred +{ + my $e = shift; + + return 1 if ($e->{POINTERS}); + return 0 if (is_scalar_type($e->{TYPE})); + return 0 if (util::has_property($e, "subcontext")); + return 1 unless (typelist::hasType($e->{TYPE})); # assume the worst + + my $type = typelist::getType($e->{TYPE}); + + foreach my $x (@{$type->{DATA}->{ELEMENTS}}) { + return 1 if (can_contain_deferred ($x)); + } + + return 0; +} + ##################################################################### # parse array preceding data - push side sub ParseArrayPushPreceding($$$) -- cgit