summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm17
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm18
2 files changed, 13 insertions, 22 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
index 27b71053fb..5352e41f24 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
@@ -16,6 +16,7 @@ use Parse::Pidl::Typelist qw(hasType getType mapTypeName scalar_is_reference);
use Parse::Pidl::Util qw(has_property is_constant ParseExpr);
use Parse::Pidl::NDR qw(GetPrevLevel GetNextLevel ContainsDeferred);
use Parse::Pidl::Samba4 qw(DeclLong);
+use Parse::Pidl::Samba4::NDR::Parser qw(GenerateFunctionInEnv);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -33,20 +34,6 @@ sub new($)
bless($self, $class);
}
-sub GenerateFunctionInEnv($)
-{
- my $fn = shift;
- my %env;
-
- foreach my $e (@{$fn->{ELEMENTS}}) {
- if (grep (/in/, @{$e->{DIRECTION}})) {
- $env{$e->{NAME}} = "r.in.$e->{NAME}";
- }
- }
-
- return \%env;
-}
-
sub ParseFunction($$$)
{
my ($self, $uif, $fn) = @_;
@@ -110,7 +97,7 @@ sub ParseFunction($$$)
# Since the data is being copied into a user-provided data
# structure, the user should be able to know the size beforehand
# to allocate a structure of the right size.
- my $env = GenerateFunctionInEnv($fn);
+ my $env = GenerateFunctionInEnv($fn, "r.");
my $size_is = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env, $e);
$self->pidl("memcpy($e->{NAME}, r.out.$e->{NAME}, $size_is);");
} else {
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index b65df06884..73ff28eed0 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -243,30 +243,34 @@ sub EnvSubstituteValue($$)
return $env;
}
-sub GenerateFunctionInEnv($)
+sub GenerateFunctionInEnv($;$)
{
- my $fn = shift;
+ my ($fn, $base) = @_;
my %env;
+ $base = "r->" unless defined($base);
+
foreach my $e (@{$fn->{ELEMENTS}}) {
if (grep (/in/, @{$e->{DIRECTION}})) {
- $env{$e->{NAME}} = "r->in.$e->{NAME}";
+ $env{$e->{NAME}} = $base."in.$e->{NAME}";
}
}
return \%env;
}
-sub GenerateFunctionOutEnv($)
+sub GenerateFunctionOutEnv($;$)
{
- my $fn = shift;
+ my ($fn, $base) = @_;
my %env;
+ $base = "r->" unless defined($base);
+
foreach my $e (@{$fn->{ELEMENTS}}) {
if (grep (/out/, @{$e->{DIRECTION}})) {
- $env{$e->{NAME}} = "r->out.$e->{NAME}";
+ $env{$e->{NAME}} = $base."out.$e->{NAME}";
} elsif (grep (/in/, @{$e->{DIRECTION}})) {
- $env{$e->{NAME}} = "r->in.$e->{NAME}";
+ $env{$e->{NAME}} = $base."in.$e->{NAME}";
}
}