* Fix bug #26370: A multi-dimensional variant array is "empty" when any of its dimensions has zero range, range of other dimensions does not matter.

git-svn-id: trunk@29324 -
This commit is contained in:
sergei 2014-12-25 16:59:52 +00:00
parent d2187257e7
commit ba61a9f95c
3 changed files with 23 additions and 6 deletions

1
.gitattributes vendored
View File

@ -12596,6 +12596,7 @@ tests/test/units/sysutils/twstrcmp.pp svneol=native#text/plain
tests/test/units/ucomplex/tcsqr1.pp svneol=native#text/pascal
tests/test/units/variants/tcustomvariant.pp svneol=native#text/plain
tests/test/units/variants/tvararrayofintf.pp svneol=native#text/plain
tests/test/units/variants/tw26370.pp svneol=native#text/plain
tests/test/units/variants/tw27044.pp svneol=native#text/plain
tests/test/uobjc24.pp svneol=native#text/plain
tests/test/uobjc26.pp svneol=native#text/plain

View File

@ -483,13 +483,10 @@ function TVariantArrayIterator.AtEnd: Boolean;
var
i : sizeint;
begin
result:=true;
result:=false;
for i:=0 to Pred(Dims) do
if Coords^[i] < Bounds^[i].LowBound + Bounds^[i].ElementCount then
begin
result:=false;
exit;
end;
if Coords^[i] >= Bounds^[i].LowBound + Bounds^[i].ElementCount then
result:=true;
end;
{$pop}// {$r-} for TVariantArrayIterator

View File

@ -0,0 +1,19 @@
{$mode objfpc}
uses Variants;
procedure test;
var
Bounds: Array [0..1] of TVarArrayBound;
V1, V2: Variant;
begin
Bounds[0].lowbound := 0;
Bounds[0].elementcount := 1;
Bounds[1].lowbound := 0;
Bounds[1].elementcount := 0;
V1 := VarArrayCreate(@Bounds, 2, varVariant);
V2 := V1; // <- Exception EVariantBadIndexError!!!!!
end;
begin
test;
end.