diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-08-23 13:19:33 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:34:26 -0500 |
commit | ae88822b8c7fd45d9d96ef0d08f9d39ecaf3ba83 (patch) | |
tree | 3961d98716c3f2de75aa50addfb0be6e9bece740 /source4/pidl/lib/Parse | |
parent | 838597393580aea0dcc8f461e30928bddd6f87c9 (diff) | |
download | samba-ae88822b8c7fd45d9d96ef0d08f9d39ecaf3ba83.tar.gz samba-ae88822b8c7fd45d9d96ef0d08f9d39ecaf3ba83.tar.bz2 samba-ae88822b8c7fd45d9d96ef0d08f9d39ecaf3ba83.zip |
r9519: Use the value() value of an element when that element is used in
limited expressions (size_is,length_is,subcontext_size,etc)
(This used to be commit 886780c298a794f304b0fce851bbb58c53605d17)
Diffstat (limited to 'source4/pidl/lib/Parse')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm index ef22ff9788..513fa0826d 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba/NDR/Parser.pm @@ -235,6 +235,20 @@ sub GenerateStructEnv($) return \%env; } +sub EnvSubstituteValue($$) +{ + my ($env,$s) = @_; + + # Substitute the value() values in the env + foreach my $e (@{$s->{ELEMENTS}}) { + next unless (my $v = has_property($e, "value")); + + $env->{$e->{NAME}} = ParseExpr($v, $env); + } + + return $env; +} + sub GenerateFunctionInEnv($) { my $fn = shift; @@ -1095,6 +1109,8 @@ sub ParseStructPush($$) my $env = GenerateStructEnv($struct); + EnvSubstituteValue($env, $struct); + # save the old relative_base_offset pidl "uint32_t _save_relative_base_offset = ndr_push_get_relative_base_offset(ndr);" if defined($struct->{PROPERTIES}{relative_base}); @@ -1326,6 +1342,8 @@ sub ParseStructPrint($$) my $env = GenerateStructEnv($struct); + EnvSubstituteValue($env, $struct); + foreach my $e (@{$struct->{ELEMENTS}}) { DeclareArrayVariables($e); } @@ -1870,6 +1888,7 @@ sub ParseFunctionPrint($) pidl "ndr->depth++;"; my $env = GenerateFunctionInEnv($fn); + EnvSubstituteValue($env, $fn); foreach my $e (@{$fn->{ELEMENTS}}) { if (grep(/in/,@{$e->{DIRECTION}})) { @@ -1925,6 +1944,8 @@ sub ParseFunctionPush($) my $env = GenerateFunctionInEnv($fn); + EnvSubstituteValue($env, $fn); + foreach my $e (@{$fn->{ELEMENTS}}) { if (grep(/in/,@{$e->{DIRECTION}})) { ParseElementPush($e, "ndr", "r->in.", $env, 1, 1); |