mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-15 23:30:40 +01:00
* fixed fpc_dynarr_copy() for making copies of arrays of implicit pointer
types (the elements have to be cloned) git-svn-id: branches/jvmbackend@18810 -
This commit is contained in:
parent
44f074ebaa
commit
79e971ea12
@ -372,15 +372,30 @@ function fpc_dynarray_copy(src: JLObject; start, len: longint; ndim: longint; el
|
||||
begin
|
||||
case eletype of
|
||||
FPCJDynArrTypeRecord:
|
||||
fpc_copy_jrecord_array(TJRecordArray(src),TJRecordArray(result),start,len);
|
||||
begin
|
||||
for i:=0 to len-1 do
|
||||
TJObjectArray(result)[i]:=FpcBaseRecordType(TJObjectArray(src)[i]).clone;
|
||||
end;
|
||||
FPCJDynArrTypeEnumSet:
|
||||
fpc_copy_jenumset_array(TJEnumSetArray(src),TJEnumSetArray(result),start,len);
|
||||
begin
|
||||
for i:=0 to len-1 do
|
||||
TJObjectArray(result)[i]:=JUEnumSet(TJObjectArray(src)[i]).clone;
|
||||
end;
|
||||
FPCJDynArrTypeBitSet:
|
||||
fpc_copy_jbitset_array(TJBitSetArray(src),TJBitSetArray(result),start,len);
|
||||
begin
|
||||
for i:=0 to len-1 do
|
||||
TJObjectArray(result)[i]:=FpcBitSet(TJObjectArray(src)[i]).clone;
|
||||
end;
|
||||
FPCJDynArrTypeProcvar:
|
||||
fpc_copy_jprocvar_array(TJProcVarArray(src),TJProcVarArray(result),start,len);
|
||||
begin
|
||||
for i:=0 to len-1 do
|
||||
TJObjectArray(result)[i]:=FpcBaseProcVarType(TJObjectArray(src)[i]).clone;
|
||||
end;
|
||||
FPCJDynArrTypeShortstring:
|
||||
fpc_copy_jshortstring_array(TShortstringArray(src),TShortstringArray(result),start,len);
|
||||
begin
|
||||
for i:=0 to len-1 do
|
||||
TJObjectArray(result)[i]:=ShortStringClass(TJObjectArray(src)[i]).clone;
|
||||
end;
|
||||
else
|
||||
fpc_copy_shallow_array(src,result,start,len);
|
||||
end
|
||||
|
||||
@ -80,5 +80,20 @@ procedure fpc_copy_jshortstring_array(src, dst: TShortstringArray; srcstart: jin
|
||||
function fpc_setlength_dynarr_multidim(aorg, anew: TJObjectArray; deepcopy: boolean; ndim: longint; eletype: jchar): TJObjectArray;
|
||||
|
||||
|
||||
{ create a copy of an array.
|
||||
|
||||
src points to the array.
|
||||
|
||||
Start is the start index and len the length. If both are -1, this means that
|
||||
the entire array has to be copied.
|
||||
|
||||
ndim is the number of array dimensions that needs to be copied (can't be
|
||||
determined by reflection, since we may have dynamic arrays of normal arrays
|
||||
or vice versa).
|
||||
|
||||
eletype is the type of the array elements
|
||||
|
||||
The array copy is returned.
|
||||
}
|
||||
function fpc_dynarray_copy(src: JLObject; start, len: longint; ndim: longint; eletype: jchar): JLObject;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user