From 50388800f0b6dc6614126c7c96b0cc0b20461951 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 2 Jun 2005 05:17:08 +0000 Subject: r7187: fix alignment of unions metze (This used to be commit b9e50a47f165ba120cd99f2a2b25256b6420681b) --- source4/build/pidl/ndr_parser.pm | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'source4/build/pidl/ndr_parser.pm') diff --git a/source4/build/pidl/ndr_parser.pm b/source4/build/pidl/ndr_parser.pm index dcc17b2984..6000043041 100644 --- a/source4/build/pidl/ndr_parser.pm +++ b/source4/build/pidl/ndr_parser.pm @@ -1542,14 +1542,6 @@ sub ParseUnionPush($$) 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 @@ sub ParseUnionPush($$) 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 @@ sub ParseUnionPull($$) 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 @@ sub ParseUnionPull($$) 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; } -- cgit