summaryrefslogtreecommitdiff
path: root/source4/build/pidl/ndr_parser.pm
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-06-02 05:17:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:24 -0500
commit50388800f0b6dc6614126c7c96b0cc0b20461951 (patch)
treede6c276025a479205c997338b3491f345248223e /source4/build/pidl/ndr_parser.pm
parent19a154fe2b3c8f1d78ed4052a31f88f27d06b8b3 (diff)
downloadsamba-50388800f0b6dc6614126c7c96b0cc0b20461951.tar.gz
samba-50388800f0b6dc6614126c7c96b0cc0b20461951.tar.bz2
samba-50388800f0b6dc6614126c7c96b0cc0b20461951.zip
r7187: fix alignment of unions
metze (This used to be commit b9e50a47f165ba120cd99f2a2b25256b6420681b)
Diffstat (limited to 'source4/build/pidl/ndr_parser.pm')
-rw-r--r--source4/build/pidl/ndr_parser.pm28
1 files changed, 12 insertions, 16 deletions
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;
}