svn commit: samba r7187 - in branches/SAMBA_4_0/source/build/pidl: .

metze at samba.org metze at samba.org
Thu Jun 2 05:17:08 GMT 2005


Author: metze
Date: 2005-06-02 05:17:08 +0000 (Thu, 02 Jun 2005)
New Revision: 7187

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

Log:
fix alignment of unions

metze
Modified:
   branches/SAMBA_4_0/source/build/pidl/ndr.pm
   branches/SAMBA_4_0/source/build/pidl/ndr_parser.pm


Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/ndr.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/ndr.pm	2005-06-02 03:41:12 UTC (rev 7186)
+++ branches/SAMBA_4_0/source/build/pidl/ndr.pm	2005-06-02 05:17:08 UTC (rev 7187)
@@ -273,7 +273,8 @@
 		NAME => $e->{NAME},
 		TYPE => $e->{TYPE},
 		PROPERTIES => $e->{PROPERTIES},
-		LEVELS => GetElementLevelTable($e)
+		LEVELS => GetElementLevelTable($e),
+		ALIGN => align_type($e->{TYPE})
 	};
 }
 

Modified: branches/SAMBA_4_0/source/build/pidl/ndr_parser.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/ndr_parser.pm	2005-06-02 03:41:12 UTC (rev 7186)
+++ branches/SAMBA_4_0/source/build/pidl/ndr_parser.pm	2005-06-02 05:17:08 UTC (rev 7187)
@@ -1542,14 +1542,6 @@
 		pidl "NDR_CHECK(ndr_push_$e->{SWITCH_TYPE}(ndr, NDR_SCALARS, level));";
 	}
 
-	pidl "NDR_CHECK(ndr_push_align(ndr, $e->{ALIGN}));";
-
-	if (defined($e->{PROPERTIES}{relative_base})) {
-		# set the current offset as base for relative pointers
-		# and store it based on the toplevel struct/union
-		pidl "NDR_CHECK(ndr_push_setup_relative_base_offset1(ndr, r, ndr->offset));";
-	}
-
 	pidl "switch (level) {";
 	indent;
 	foreach my $el (@{$e->{ELEMENTS}}) {
@@ -1560,6 +1552,12 @@
 
 		if ($el->{TYPE} ne "EMPTY") {
 			indent;
+			if (defined($e->{PROPERTIES}{relative_base})) {
+				pidl "NDR_CHECK(ndr_push_align(ndr, $el->{ALIGN}));";
+				# set the current offset as base for relative pointers
+				# and store it based on the toplevel struct/union
+				pidl "NDR_CHECK(ndr_push_setup_relative_base_offset1(ndr, r, ndr->offset));";
+			}
 			DeclareArrayVariables($el);
 			ParseElementPush($el, "ndr", "r->", {}, 1, 0);
 			deindent;
@@ -1683,14 +1681,6 @@
 		pidl "}";
 	}
 
-	pidl "NDR_CHECK(ndr_pull_align(ndr, $e->{ALIGN}));";
-
-	if (defined($e->{PROPERTIES}{relative_base})) {
-		# set the current offset as base for relative pointers
-		# and store it based on the toplevel struct/union
-		pidl "NDR_CHECK(ndr_pull_setup_relative_base_offset1(ndr, r, ndr->offset));";
-	}
-
 	pidl "switch (level) {";
 	indent;
 	foreach my $el (@{$e->{ELEMENTS}}) {
@@ -1703,6 +1693,12 @@
 			indent;
 			DeclarePtrVariables($el);
 			DeclareArrayVariables($el);
+			if (defined($e->{PROPERTIES}{relative_base})) {
+				pidl "NDR_CHECK(ndr_pull_align(ndr, $el->{ALIGN}));";
+				# set the current offset as base for relative pointers
+				# and store it based on the toplevel struct/union
+				pidl "NDR_CHECK(ndr_pull_setup_relative_base_offset1(ndr, r, ndr->offset));";
+			}
 			ParseElementPull($el, "ndr", "r->", {}, 1, 0);
 			deindent;
 		}



More information about the samba-cvs mailing list