r23721: For unions, The TAG and the ARM are aligned independently.
authorRonnie Sahlberg <sahlberg@samba.org>
Thu, 5 Jul 2007 07:19:14 +0000 (07:19 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:59:08 +0000 (14:59 -0500)
Move emitting ALIGN_TO_x_BYTES to after the tag has been dissected so the
alignment only affects the ARM.

source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm

index ac923bef74ae85c0b005527e4330ea95ab34b375..ffe104c9418ae950bf0f149392ab6928398a420c 100644 (file)
@@ -614,12 +614,6 @@ sub Union($$$$)
        $self->pidl_code("$switch_type level;");
        $self->pidl_code("");
 
-       if ($e->{ALIGN} > 1) {
-               $self->pidl_code("ALIGN_TO_$e->{ALIGN}_BYTES;");
-       }
-
-       $self->pidl_code("");
-
        $self->pidl_code("old_offset = offset;");
        $self->pidl_code("if (parent_tree) {");
        $self->indent;
@@ -632,6 +626,12 @@ sub Union($$$$)
 
        $self->pidl_code("offset = $switch_dissect(tvb, offset, pinfo, tree, drep, hf_index, &level);");
 
+       if ($e->{ALIGN} > 1) {
+               $self->pidl_code("ALIGN_TO_$e->{ALIGN}_BYTES;");
+               $self->pidl_code("");
+       }
+
+
        $self->pidl_code("switch(level) {$res\t}");
        $self->pidl_code("proto_item_set_len(item, offset-old_offset);\n");
        $self->pidl_code("return offset;");