diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-10-05 19:53:41 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:39:25 -0500 |
commit | 765f69ce42068cc2a41e010d08922a496da96054 (patch) | |
tree | 91c98495ae972ab5ae1de590ced804be1bc35a1b /source4/pidl/lib | |
parent | f72dee9e3908fb5c4ea3428e3cba703509a7e16f (diff) | |
download | samba-765f69ce42068cc2a41e010d08922a496da96054.tar.gz samba-765f69ce42068cc2a41e010d08922a496da96054.tar.bz2 samba-765f69ce42068cc2a41e010d08922a496da96054.zip |
r10739: Reduce number of calls to prs_align_custom()
(This used to be commit ebeeec5406308d493d45b1088963a87cdb953cac)
Diffstat (limited to 'source4/pidl/lib')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm | 22 | ||||
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba3/Types.pm | 26 |
2 files changed, 26 insertions, 22 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm index b65ece5a12..ac7fde69a6 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba3/Parser.pm @@ -71,14 +71,7 @@ sub ParseElementLevelData($$$$$$$) { my ($e,$l,$nl,$env,$varname,$what,$align) = @_; - my @args = ($e,$l,$varname,$what); - - if (defined($e->{ALIGN})) { - Align($align, $e->{ALIGN}); - } else { - # Default to 4 - Align($align, 4); - } + my @args = ($e,$l,$varname,$what,$align); # See if we need to add a level argument because we're parsing a union foreach (@{$e->{LEVELS}}) { @@ -89,6 +82,13 @@ sub ParseElementLevelData($$$$$$$) my $c = DissectType(@args); return if not $c; + if (defined($e->{ALIGN})) { + Align($align, $e->{ALIGN}); + } else { + # Default to 4 + Align($align, 4); + } + pidl "if (!$c)"; pidl "\treturn False;"; } @@ -300,13 +300,15 @@ sub ParseStruct($$$) pidl "prs_debug(ps, depth, desc, \"$pfn\");"; pidl "depth++;"; + my $align = 8; if ($s->{SURROUNDING_ELEMENT}) { pidl "if (!prs_uint32(\"size_$s->{SURROUNDING_ELEMENT}->{NAME}\", ps, depth, &" . ParseExpr("size_$s->{SURROUNDING_ELEMENT}->{NAME}", $env) . "))"; pidl "\treturn False;"; pidl ""; + $align = 4; + } - my $align = 0; foreach (@{$s->{ELEMENTS}}) { ParseElement($_, $env, PRIMITIVES, \$align); pidl ""; @@ -393,7 +395,7 @@ sub ParseUnion($$$) if ($_->{TYPE} ne "EMPTY") { pidl "depth++;"; my $env = UnionGenerateEnvElement($_); - my $align = 0; + my $align = 8; ParseElement($_, $env, PRIMITIVES, \$align); pidl "depth--;"; } diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm b/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm index 0c66d2c6ad..8cb09343ac 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba3/Types.pm @@ -27,9 +27,9 @@ sub init_scalar($$$$) return "$n = $v;"; } -sub dissect_scalar($$$) +sub dissect_scalar($$$$$) { - my ($e,$l,$n) = @_; + my ($e,$l,$n,$w,$a) = @_; my $t = lc($e->{TYPE}); @@ -94,12 +94,13 @@ sub init_string($$$$) return "init_$t(&$n, $v, $flags);"; } -sub dissect_string($$$) +sub dissect_string($$$$$) { - my ($e,$l,$n) = @_; + my ($e,$l,$n,$w,$a) = @_; my $t = lc(decl_string($e)); + $$a = 1; return "smb_io_$t(\"$e->{NAME}\", &$n, 1, ps, depth)"; } @@ -162,7 +163,7 @@ my $known_types = DECL => "NTTIME", INIT => "", DISSECT_P => sub { - my ($e,$l,$n) = @_; + my ($e,$l,$n,$w,$a) = @_; return "smb_io_nttime(\"$e->{NAME}\", &n, ps, depth)"; } }, @@ -171,7 +172,7 @@ my $known_types = DECL => "DOM_SID", INIT => "", DISSECT_P => sub { - my ($e,$l,$n) = @_; + my ($e,$l,$n,$w,$a) = @_; return "smb_io_dom_sid(\"$e->{NAME}\", &n, ps, depth)"; } }, @@ -180,7 +181,7 @@ my $known_types = DECL => "POLICY_HND", INIT => "", DISSECT_P => sub { - my ($e,$l,$n) = @_; + my ($e,$l,$n,$w,$a) = @_; return "smb_io_pol_hnd(\"$e->{NAME}\", &n, ps, depth)"; } }, @@ -189,7 +190,7 @@ my $known_types = DECL => "uint64", INIT => "", DISSECT_P => sub { - my ($e,$l,$n) = @_; + my ($e,$l,$n,$w,$a) = @_; return "prs_uint64(\"$e->{NAME}\", ps, depth, &$n)"; } }, @@ -311,6 +312,7 @@ sub DissectType my $l = shift @_; my $varname = shift @_; my $what = shift @_; + my $align = shift @_; my $t = $known_types->{$l->{DATA_TYPE}}; @@ -355,25 +357,25 @@ sub LoadTypes($) if ($td->{DATA}->{TYPE} eq "UNION") { $decl.="_CTR"; $dissect_p = sub { - my ($e,$l,$n,$w,$s) = @_; + my ($e,$l,$n,$w,$a,$s) = @_; return "$if->{NAME}_io_$td->{NAME}_p(\"$e->{NAME}\", &$n, $s, ps, depth)"; }; $dissect_d = sub { - my ($e,$l,$n,$w,$s) = @_; + my ($e,$l,$n,$w,$a,$s) = @_; return "$if->{NAME}_io_$td->{NAME}_d(\"$e->{NAME}\", &$n, $s, ps, depth)"; }; } else { $dissect_p = sub { - my ($e,$l,$n,$w) = @_; + my ($e,$l,$n,$w,$a) = @_; return "$if->{NAME}_io_$td->{NAME}_p(\"$e->{NAME}\", &$n, ps, depth)"; }; $dissect_d = sub { - my ($e,$l,$n,$w) = @_; + my ($e,$l,$n,$w,$a) = @_; return "$if->{NAME}_io_$td->{NAME}_d(\"$e->{NAME}\", &$n, ps, depth)"; }; |