summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-08-15 10:23:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:01:53 -0500
commit449c9f1f1c03fdc026c56a900dd23b9506dbabf1 (patch)
tree73437a1da0f9628ef1894ff556b7e62c8155a3ee /source4/pidl/lib/Parse/Pidl
parenteab315fe1e584e96fc84cee96ec842610b2dcdce (diff)
downloadsamba-449c9f1f1c03fdc026c56a900dd23b9506dbabf1.tar.gz
samba-449c9f1f1c03fdc026c56a900dd23b9506dbabf1.tar.bz2
samba-449c9f1f1c03fdc026c56a900dd23b9506dbabf1.zip
r24454: when level 0 is a pointer we need to look for an array in level 1...
metze (This used to be commit ca50b1ad3afbf02fef7c6d1fcbe11d23c515d340)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm24
1 files changed, 14 insertions, 10 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
index 5352e41f24..42120bec78 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
@@ -83,31 +83,35 @@ sub ParseFunction($$$)
$self->pidl("/* Return variables */");
foreach my $e (@{$fn->{ELEMENTS}}) {
next unless (grep(/out/, @{$e->{DIRECTION}}));
+ my $level = 0;
fatal($e, "[out] argument is not a pointer or array") if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY");
- if ( ($e->{LEVELS}[0]->{TYPE} eq "POINTER") and
- ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") ) {
- $self->pidl("if ( $e->{NAME} ) {");
- $self->indent;
+ if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") {
+ $level = 1;
+ if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") {
+ $self->pidl("if ( $e->{NAME} ) {");
+ $self->indent;
+ }
}
- if ($e->{LEVELS}[0]->{TYPE} eq "ARRAY") {
+ if ($e->{LEVELS}[$level]->{TYPE} eq "ARRAY") {
# This is a call to GenerateFunctionInEnv intentionally.
# Since the data is being copied into a user-provided data
# structure, the user should be able to know the size beforehand
# to allocate a structure of the right size.
my $env = GenerateFunctionInEnv($fn, "r.");
- my $size_is = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env, $e);
+ my $size_is = ParseExpr($e->{LEVELS}[$level]->{SIZE_IS}, $env, $e->{ORIGINAL});
$self->pidl("memcpy($e->{NAME}, r.out.$e->{NAME}, $size_is);");
} else {
$self->pidl("*$e->{NAME} = *r.out.$e->{NAME};");
}
- if ( ($e->{LEVELS}[0]->{TYPE} eq "POINTER") and
- ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") ) {
- $self->deindent;
- $self->pidl("}");
+ if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") {
+ if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") {
+ $self->deindent;
+ $self->pidl("}");
+ }
}
}