1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

pidl/NDR/Parser: remember if we already know the array length

metze
This commit is contained in:
Stefan Metzmacher 2012-03-15 15:07:08 +01:00 committed by Karolin Seeger
parent 37313598af
commit 6e53b2db41

View File

@ -1063,6 +1063,7 @@ sub ParseElementPullLevel
my($self,$e,$l,$ndr,$var_name,$env,$primitives,$deferred) = @_; my($self,$e,$l,$ndr,$var_name,$env,$primitives,$deferred) = @_;
my $ndr_flags = CalcNdrFlags($l, $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})) { if ($l->{TYPE} eq "ARRAY" and ($l->{IS_VARYING} or $l->{IS_CONFORMANT})) {
$var_name = get_pointer_to($var_name); $var_name = get_pointer_to($var_name);
@ -1076,6 +1077,7 @@ sub ParseElementPullLevel
$self->ParseSubcontextPullEnd($e, $l, $ndr, $env); $self->ParseSubcontextPullEnd($e, $l, $ndr, $env);
} elsif ($l->{TYPE} eq "ARRAY") { } elsif ($l->{TYPE} eq "ARRAY") {
my $length = $self->ParseArrayPullHeader($e, $l, $ndr, $var_name, $env); my $length = $self->ParseArrayPullHeader($e, $l, $ndr, $var_name, $env);
$array_length = $length;
if (my $range = has_property($e, "range")) { if (my $range = has_property($e, "range")) {
my ($low, $high) = split(/,/, $range, 2); my ($low, $high) = split(/,/, $range, 2);
@ -1157,10 +1159,14 @@ sub ParseElementPullLevel
} }
} elsif ($l->{TYPE} eq "ARRAY" and } elsif ($l->{TYPE} eq "ARRAY" and
not has_fast_array($e,$l) and not is_charset_array($e, $l)) { 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 $counter = "cntr_$e->{NAME}_$l->{LEVEL_INDEX}";
my $array_name = $var_name; 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")) { if (my $range = has_property($e, "range")) {
my ($low, $high) = split(/,/, $range, 2); my ($low, $high) = split(/,/, $range, 2);
if ($low < 0) { if ($low < 0) {