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-07 16:26:08 +0200
commit3e89dbfa0dd0c8cd4bcec8ea868a401f9b132aa3 (patch)
tree009ea2f91c1342523e551add2c4ae69391fdc21b /pidl/lib/Parse/Pidl
parent586c3fab85cde3bd6a5141fbba3bb5fcb6b67ab5 (diff)
downloadsamba-3e89dbfa0dd0c8cd4bcec8ea868a401f9b132aa3.tar.gz
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 77223b63916..5c4150aeb6e 100644
--- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -1028,6 +1028,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);
@@ -1041,6 +1042,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);
@@ -1111,10 +1113,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) {