mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 19:29:18 +02: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;
|
||||
var
|
||||
i,h: sizeint;
|
||||
elsize: sizeuint;
|
||||
begin
|
||||
h:=High(indices);
|
||||
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 }
|
||||
typeInfo:=(typeInfo+2+PByte(typeInfo)[1]);
|
||||
{ store the last element size for the index calculation }
|
||||
elsize:=pdynarraytypedata(typeInfo)^.elSize;
|
||||
{ element type info}
|
||||
{$ifdef VER3_0}
|
||||
typeInfo:=pdynarraytypedata(typeInfo)^.elType2;
|
||||
@ -696,7 +699,7 @@ function DynArrayIndex(a: Pointer; const indices: array of SizeInt; typeInfo: Po
|
||||
{ skip kind and name }
|
||||
typeInfo:=(typeInfo+2+PByte(typeInfo)[1]);
|
||||
|
||||
result:=@(PByte(a)[indices[h]*pdynarraytypedata(typeInfo)^.elSize]);
|
||||
result:=@(PByte(a)[indices[h]*elsize]);
|
||||
end;
|
||||
|
||||
{ obsolete but needed for bootstrapping }
|
||||
|
Loading…
Reference in New Issue
Block a user