svn commit: samba r24454 - in branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3: .

metze at samba.org metze at samba.org
Wed Aug 15 10:23:29 GMT 2007


Author: metze
Date: 2007-08-15 10:23:28 +0000 (Wed, 15 Aug 2007)
New Revision: 24454

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24454

Log:
when level 0 is a pointer we need to look for an array in level 1...

metze
Modified:
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm


Changeset:
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm	2007-08-15 09:52:09 UTC (rev 24453)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm	2007-08-15 10:23:28 UTC (rev 24454)
@@ -83,31 +83,35 @@
 	$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("}");
+			}
 		}
 	}
 



More information about the samba-cvs mailing list