mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-05 08:09:49 +01:00
* fix DynArrayIndex(): as the last typeinfo entry is no longer a dynamic array the elSize needs to be remembered
git-svn-id: trunk@36942 -
This commit is contained in:
parent
9291fb1eed
commit
c45f738081
@ -673,6 +673,7 @@ function IsDynArrayRectangular(a: Pointer; typeInfo: Pointer): Boolean;
|
|||||||
function DynArrayIndex(a: Pointer; const indices: array of SizeInt; typeInfo: Pointer): Pointer;
|
function DynArrayIndex(a: Pointer; const indices: array of SizeInt; typeInfo: Pointer): Pointer;
|
||||||
var
|
var
|
||||||
i,h: sizeint;
|
i,h: sizeint;
|
||||||
|
elsize: sizeuint;
|
||||||
begin
|
begin
|
||||||
h:=High(indices);
|
h:=High(indices);
|
||||||
for i:=0 to h do
|
for i:=0 to h do
|
||||||
@ -682,6 +683,8 @@ function DynArrayIndex(a: Pointer; const indices: array of SizeInt; typeInfo: Po
|
|||||||
|
|
||||||
{ skip kind and name }
|
{ skip kind and name }
|
||||||
typeInfo:=(typeInfo+2+PByte(typeInfo)[1]);
|
typeInfo:=(typeInfo+2+PByte(typeInfo)[1]);
|
||||||
|
{ store the last element size for the index calculation }
|
||||||
|
elsize:=pdynarraytypedata(typeInfo)^.elSize;
|
||||||
{ element type info}
|
{ element type info}
|
||||||
{$ifdef VER3_0}
|
{$ifdef VER3_0}
|
||||||
typeInfo:=pdynarraytypedata(typeInfo)^.elType2;
|
typeInfo:=pdynarraytypedata(typeInfo)^.elType2;
|
||||||
@ -696,7 +699,7 @@ function DynArrayIndex(a: Pointer; const indices: array of SizeInt; typeInfo: Po
|
|||||||
{ skip kind and name }
|
{ skip kind and name }
|
||||||
typeInfo:=(typeInfo+2+PByte(typeInfo)[1]);
|
typeInfo:=(typeInfo+2+PByte(typeInfo)[1]);
|
||||||
|
|
||||||
result:=@(PByte(a)[indices[h]*pdynarraytypedata(typeInfo)^.elSize]);
|
result:=@(PByte(a)[indices[h]*elsize]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ obsolete but needed for bootstrapping }
|
{ obsolete but needed for bootstrapping }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user