summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/Samba4/NDR
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-02-18 13:44:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:32 -0500
commit2b43de2ed8025ef598c31d41f0fe710f8e3a3658 (patch)
tree85aaf1780c3d2ae6b8df3368e2dd0007fcf01efa /source4/pidl/lib/Parse/Pidl/Samba4/NDR
parentae76a5a92819bfd2d31bc5d23a540c6c71b47354 (diff)
downloadsamba-2b43de2ed8025ef598c31d41f0fe710f8e3a3658.tar.gz
samba-2b43de2ed8025ef598c31d41f0fe710f8e3a3658.tar.bz2
samba-2b43de2ed8025ef598c31d41f0fe710f8e3a3658.zip
r21428: Handle representation types in Needed().
(This used to be commit 34517c69e67d7eafa00e6fe0072bd04f074cdbde)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba4/NDR')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm34
1 files changed, 27 insertions, 7 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index d4c4d55c57..6e4d5825d0 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -703,7 +703,7 @@ sub ParseElementPush($$$$$)
return unless $primitives or ($deferred and ContainsDeferred($e, $e->{LEVELS}[0]));
# Representation type is different from transmit_as
- if ($e->{REPRESENTATION_TYPE}) {
+ if ($e->{REPRESENTATION_TYPE} ne $e->{TYPE}) {
pidl "{";
indent;
my $transmit_name = "_transmit_$e->{NAME}";
@@ -724,7 +724,7 @@ sub ParseElementPush($$$$$)
end_flags($e);
- if ($e->{REPRESENTATION_TYPE}) {
+ if ($e->{REPRESENTATION_TYPE} ne $e->{TYPE}) {
deindent;
pidl "}";
}
@@ -760,7 +760,7 @@ sub ParseElementPrint($$$)
return if (has_property($e, "noprint"));
- if ($e->{REPRESENTATION_TYPE}) {
+ if ($e->{REPRESENTATION_TYPE} ne $e->{TYPE}) {
pidl "ndr_print_$e->{REPRESENTATION_TYPE}(ndr, \"$e->{NAME}\", $var_name);";
return;
}
@@ -1110,7 +1110,7 @@ sub ParseElementPull($$$$$)
return unless $primitives or ($deferred and ContainsDeferred($e, $e->{LEVELS}[0]));
- if ($e->{REPRESENTATION_TYPE}) {
+ if ($e->{REPRESENTATION_TYPE} ne $e->{TYPE}) {
pidl "{";
indent;
$represent_name = $var_name;
@@ -1128,7 +1128,7 @@ sub ParseElementPull($$$$$)
end_flags($e);
# Representation type is different from transmit_as
- if ($e->{REPRESENTATION_TYPE}) {
+ if ($e->{REPRESENTATION_TYPE} ne $e->{TYPE}) {
pidl "NDR_CHECK(ndr_$e->{TYPE}_to_$e->{REPRESENTATION_TYPE}($transmit_name, ".get_pointer_to($represent_name)."));";
deindent;
pidl "}";
@@ -2488,8 +2488,28 @@ sub NeededElement($$$)
{
my ($e, $dir, $needed) = @_;
- return if (defined($needed->{"$dir\_$e->{TYPE}"}));
- $needed->{"$dir\_$e->{TYPE}"} = 1;
+ return if ($e->{TYPE} eq "EMPTY");
+
+ my @fn = ();
+ if ($dir eq "print") {
+ push(@fn, "print_$e->{REPRESENTATION_TYPE}");
+ } elsif ($dir eq "pull") {
+ push (@fn, "pull_$e->{TYPE}");
+ push (@fn, "ndr_$e->{TYPE}_to_$e->{REPRESENTATION_TYPE}")
+ if ($e->{REPRESENTATION_TYPE} ne $e->{TYPE});
+ } elsif ($dir eq "push") {
+ push (@fn, "push_$e->{TYPE}");
+ push (@fn, "ndr_$e->{REPRESENTATION_TYPE}_to_$e->{TYPE}")
+ if ($e->{REPRESENTATION_TYPE} ne $e->{TYPE});
+ } else {
+ die("invalid direction `$dir'");
+ }
+
+ foreach (@fn) {
+ unless (defined($needed->{$_})) {
+ $needed->{$_} = 1;
+ }
+ }
}
sub NeededFunction($$)