pidl:Samba4/NDR/Parser: add support for 'ms_union' style aligment
authorStefan Metzmacher <metze@samba.org>
Mon, 31 Jan 2011 13:09:02 +0000 (14:09 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 1 Feb 2011 11:13:45 +0000 (12:13 +0100)
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Tue Feb  1 12:13:45 CET 2011 on sn-devel-104

pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm

index 7bc5a32d5e353cb85b840850fa3cb3bb659b3f05..69c13866250f6d997da62a32e7a36d1e6a50fc4a 100644 (file)
@@ -1697,7 +1697,12 @@ sub ParseUnionPushPrimitives($$$$)
        }
 
        if (defined($e->{ALIGN})) {
-               $self->pidl("NDR_CHECK(ndr_push_union_align($ndr, $e->{ALIGN}));");
+               if ($e->{IS_MS_UNION}) {
+                       $self->pidl("/* ms_union is always aligned to the largest union arm*/");
+                       $self->pidl("NDR_CHECK(ndr_push_align($ndr, $e->{ALIGN}));");
+               } else {
+                       $self->pidl("NDR_CHECK(ndr_push_union_align($ndr, $e->{ALIGN}));");
+               }
        }
 
        $self->pidl("switch (level) {");
@@ -1850,7 +1855,12 @@ sub ParseUnionPullPrimitives($$$$$)
        }
 
        if (defined($e->{ALIGN})) {
-               $self->pidl("NDR_CHECK(ndr_pull_union_align($ndr, $e->{ALIGN}));");
+               if ($e->{IS_MS_UNION}) {
+                       $self->pidl("/* ms_union is always aligned to the largest union arm*/");
+                       $self->pidl("NDR_CHECK(ndr_push_align($ndr, $e->{ALIGN}));");
+               } else {
+                       $self->pidl("NDR_CHECK(ndr_pull_union_align($ndr, $e->{ALIGN}));");
+               }
        }
 
        $self->pidl("switch (level) {");