summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse/Pidl
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-03-15 15:07:08 +0100
committerKarolin Seeger <kseeger@samba.org>2012-04-10 16:48:07 +0200
commit6e53b2db41af6c9ab6edd60c46bf9bee08c29c1b (patch)
tree5b098dc6ab4734e606f132e450d839a1a5a0a253 /pidl/lib/Parse/Pidl
parent37313598af769f3e9fbe463c2abb6af1ebabfa21 (diff)
downloadsamba-6e53b2db41af6c9ab6edd60c46bf9bee08c29c1b.tar.gz
samba-6e53b2db41af6c9ab6edd60c46bf9bee08c29c1b.tar.bz2
samba-6e53b2db41af6c9ab6edd60c46bf9bee08c29c1b.zip
pidl/NDR/Parser: remember if we already know the array length
metze
Diffstat (limited to 'pidl/lib/Parse/Pidl')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index fe93ae19a4..ebdc918c2b 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -1063,6 +1063,7 @@ sub ParseElementPullLevel
my($self,$e,$l,$ndr,$var_name,$env,$primitives,$deferred) = @_;
my $ndr_flags = CalcNdrFlags($l, $primitives, $deferred);
+ my $array_length = undef;
if ($l->{TYPE} eq "ARRAY" and ($l->{IS_VARYING} or $l->{IS_CONFORMANT})) {
$var_name = get_pointer_to($var_name);
@@ -1076,6 +1077,7 @@ sub ParseElementPullLevel
$self->ParseSubcontextPullEnd($e, $l, $ndr, $env);
} elsif ($l->{TYPE} eq "ARRAY") {
my $length = $self->ParseArrayPullHeader($e, $l, $ndr, $var_name, $env);
+ $array_length = $length;
if (my $range = has_property($e, "range")) {
my ($low, $high) = split(/,/, $range, 2);
@@ -1157,10 +1159,14 @@ sub ParseElementPullLevel
}
} elsif ($l->{TYPE} eq "ARRAY" and
not has_fast_array($e,$l) and not is_charset_array($e, $l)) {
- my $length = $self->ParseArrayPullGetLength($e, $l, $ndr, $var_name, $env);
+ my $length = $array_length;
my $counter = "cntr_$e->{NAME}_$l->{LEVEL_INDEX}";
my $array_name = $var_name;
+ if (not defined($length)) {
+ $length = $self->ParseArrayPullGetLength($e, $l, $ndr, $var_name, $env);
+ }
+
if (my $range = has_property($e, "range")) {
my ($low, $high) = split(/,/, $range, 2);
if ($low < 0) {