Rev 11609: Fix handling of DECLARE. in file:///home/jelmer/bzr.samba/SAMBA_4_0/

Jelmer Vernooij jelmer at samba.org
Wed Feb 28 00:24:46 GMT 2007


At file:///home/jelmer/bzr.samba/SAMBA_4_0/

------------------------------------------------------------
revno: 11609
revision-id: jelmer at samba.org-20070228002439-a604a1yg8myq8qlr
parent: svn-v2:21573 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: SAMBA_4_0
timestamp: Wed 2007-02-28 01:24:39 +0100
message:
  Fix handling of DECLARE.
modified:
  source/pidl/lib/Parse/Pidl/NDR.pm svn-v2:9460 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2flib%2fParse%2fPidl%2fNDR.pm
  source/pidl/lib/Parse/Pidl/Typelist.pm svn-v2:9460 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2flib%2fParse%2fPidl%2fTypelist.pm
  source/pidl/tests/ndr.pl       svn-v2:20631 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fpidl%2ftests%2fndr.pl
=== modified file 'source/pidl/lib/Parse/Pidl/NDR.pm'
--- a/source/pidl/lib/Parse/Pidl/NDR.pm	2007-02-28 00:19:57 +0000
+++ b/source/pidl/lib/Parse/Pidl/NDR.pm	2007-02-28 00:24:39 +0000
@@ -349,7 +349,7 @@
 
 	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));

=== modified file 'source/pidl/lib/Parse/Pidl/Typelist.pm'
--- a/source/pidl/lib/Parse/Pidl/Typelist.pm	2007-02-28 00:19:57 +0000
+++ b/source/pidl/lib/Parse/Pidl/Typelist.pm	2007-02-28 00:24:39 +0000
@@ -132,6 +132,7 @@
 
 sub is_scalar($)
 {
+	sub is_scalar($);
 	my $type = shift;
 
 	return 1 if (ref($type) eq "HASH" and $type->{TYPE} eq "SCALAR");

=== modified file 'source/pidl/tests/ndr.pl'
--- a/source/pidl/tests/ndr.pl	2007-02-28 00:19:57 +0000
+++ b/source/pidl/tests/ndr.pl	2007-02-28 00:24:39 +0000
@@ -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 @@
 $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);
 



More information about the samba-cvs mailing list