1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

r21574: Fix handling of DECLARE.

(This used to be commit 6a4033464b)
This commit is contained in:
Jelmer Vernooij 2007-02-28 00:28:14 +00:00 committed by Gerald (Jerry) Carter
parent c1aef15fe7
commit a635df47da
3 changed files with 9 additions and 2 deletions

View 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));

View 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");

View File

@ -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);