summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse/Pidl
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-01-31 14:05:52 +0100
committerStefan Metzmacher <metze@samba.org>2011-02-01 11:21:43 +0100
commit6124148d66d90064ebe3fa2ecb2c6588705495a0 (patch)
tree97a6955e918001238b37a884ebdee2dc857fddce /pidl/lib/Parse/Pidl
parent76f2ddf5a9cef9e8253b11dec1304d51e47eda54 (diff)
downloadsamba-6124148d66d90064ebe3fa2ecb2c6588705495a0.tar.gz
samba-6124148d66d90064ebe3fa2ecb2c6588705495a0.tar.bz2
samba-6124148d66d90064ebe3fa2ecb2c6588705495a0.zip
pidl:Samba4/NDR/Parser: only do the switch type alignment when we have a switch type
This doesn't change the logic, it just doesn't call the same aligment function twice. metze
Diffstat (limited to 'pidl/lib/Parse/Pidl')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm15
1 files changed, 8 insertions, 7 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 5802f9b393..7bc5a32d5e 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -1688,11 +1688,11 @@ sub ParseUnionPushPrimitives($$$$)
$self->pidl("uint32_t level = ndr_push_get_switch_value($ndr, $varname);");
- if (defined($e->{ALIGN})) {
- $self->pidl("NDR_CHECK(ndr_push_union_align($ndr, $e->{ALIGN}));");
- }
-
if (defined($e->{SWITCH_TYPE})) {
+ if (defined($e->{ALIGN})) {
+ $self->pidl("NDR_CHECK(ndr_push_union_align($ndr, $e->{ALIGN}));");
+ }
+
$self->pidl("NDR_CHECK(ndr_push_$e->{SWITCH_TYPE}($ndr, NDR_SCALARS, level));");
}
@@ -1837,11 +1837,12 @@ sub ParseUnionPullPrimitives($$$$$)
my ($self,$e,$ndr,$varname,$switch_type) = @_;
my $have_default = 0;
- if (defined($e->{ALIGN})) {
- $self->pidl("NDR_CHECK(ndr_pull_union_align($ndr, $e->{ALIGN}));");
- }
if (defined($switch_type)) {
+ if (defined($e->{ALIGN})) {
+ $self->pidl("NDR_CHECK(ndr_pull_union_align($ndr, $e->{ALIGN}));");
+ }
+
$self->pidl("NDR_CHECK(ndr_pull_$switch_type($ndr, NDR_SCALARS, &_level));");
$self->pidl("if (_level != level) {");
$self->pidl("\treturn ndr_pull_error($ndr, NDR_ERR_BAD_SWITCH, \"Bad switch value %u for $varname at \%s\", _level, __location__);");