r21574: Fix handling of DECLARE.
authorJelmer Vernooij <jelmer@samba.org>
Wed, 28 Feb 2007 00:28:14 +0000 (00:28 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:48:58 +0000 (14:48 -0500)
(This used to be commit 6a4033464bf269176f928a5b3b7e63aad1bb1e7a)

source4/pidl/lib/Parse/Pidl/NDR.pm
source4/pidl/lib/Parse/Pidl/Typelist.pm
source4/pidl/tests/ndr.pl

index 934aba3a028dd1ac9a4a15c91ac30d4365022379..998b19aabf110ed465502972326bcb5cd36306ca 100644 (file)
@@ -349,7 +349,7 @@ sub align_type($)
 
        my $dt = getType($e);
 
-       if ($dt->{TYPE} eq "TYPEDEF") {
+       if ($dt->{TYPE} eq "TYPEDEF" or $dt->{TYPE} eq "DECLARE") {
                return align_type($dt->{DATA});
        } elsif ($dt->{TYPE} eq "ENUM") {
                return align_type(Parse::Pidl::Typelist::enum_type_fn($dt));
index 72c4b18d0bfb7b1ad3068b4bc3ced982d3858356..8e311554bc9d4c7c9be7c62f1f26c56b0dd7a9e4 100644 (file)
@@ -132,6 +132,7 @@ sub hasType($)
 
 sub is_scalar($)
 {
+       sub is_scalar($);
        my $type = shift;
 
        return 1 if (ref($type) eq "HASH" and $type->{TYPE} eq "SCALAR");
index 3be5992ef0d0b62cb8ee288c992271d78ba726eb..17003d59c46f2d2438a4fb7ac8521116784ef989 100755 (executable)
@@ -4,7 +4,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 22;
+use Test::More tests => 25;
 use FindBin qw($RealBin);
 use lib "$RealBin";
 use Util;
@@ -204,11 +204,17 @@ $e = {
 $ne = ParseElement($e, undef);
 is($ne->{REPRESENTATION_TYPE}, "uint8");
 
+is(align_type("hyper"), 8);
 is(align_type("uint32"), 4);
 is(align_type("uint16"), 2);
 is(align_type("uint8"), 1);
 is(align_type({ TYPE => "STRUCT", "NAME" => "bla", 
                            ELEMENTS => [ { TYPE => "uint16" } ] }), 4);
+is(align_type({ TYPE => "STRUCT", 
+                           ELEMENTS => [ { TYPE => "hyper" } ] }), 8);
+is(align_type({ TYPE => "DECLARE", DATA => { 
+                               TYPE => "STRUCT", 
+                           ELEMENTS => [ { TYPE => "hyper" } ] }}), 8);
 is(align_type({ TYPE => "STRUCT", "NAME" => "bla", 
                            ELEMENTS => [ { TYPE => "uint8" } ] }), 4);