mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 20:29:33 +02:00
* use deep copies rather than cloning when copying array contents
(since the elements in the destination array are guaranteed to exist already) git-svn-id: branches/jvmbackend@18719 -
This commit is contained in:
parent
3ac950eed7
commit
7092f2957a
rtl/java
@ -26,7 +26,7 @@ type
|
||||
TJObjectArray = array of JLObject;
|
||||
TJRecordArray = array of FpcBaseRecordType;
|
||||
TJEnumSetArray = array of JUEnumSet;
|
||||
TJBitSetArray = array of JUBitSet;
|
||||
TJBitSetArray = array of FpcBitSet;
|
||||
TJProcVarArray = array of FpcBaseProcVarType;
|
||||
TShortstringArray = array of ShortstringClass;
|
||||
TJStringArray = array of unicodestring;
|
||||
|
@ -336,7 +336,7 @@ procedure fpc_copy_jrecord_array(src, dst: TJRecordArray; srcstart: jint = -1; s
|
||||
srccopylen:=srclen-srcstart;
|
||||
{ no arraycopy, have to clone each element }
|
||||
for i:=0 to min(srccopylen,dstlen)-1 do
|
||||
dst[i]:=FpcBaseRecordType(src[srcstart+i].clone);
|
||||
src[srcstart+i].fpcDeepCopy(dst[i]);
|
||||
end;
|
||||
|
||||
|
||||
@ -357,7 +357,10 @@ procedure fpc_copy_jenumset_array(src, dst: TJEnumSetArray; srcstart: jint = -1;
|
||||
srccopylen:=srclen-srcstart;
|
||||
{ no arraycopy, have to clone each element }
|
||||
for i:=0 to min(srccopylen,dstlen)-1 do
|
||||
dst[i]:=JUEnumSet(src[srcstart+i].clone);
|
||||
begin
|
||||
dst[i].clear;
|
||||
dst[i].addAll(src[srcstart+i]);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -378,7 +381,10 @@ procedure fpc_copy_jbitset_array(src, dst: TJBitSetArray; srcstart: jint = -1; s
|
||||
srccopylen:=srclen-srcstart;
|
||||
{ no arraycopy, have to clone each element }
|
||||
for i:=0 to min(srccopylen,dstlen)-1 do
|
||||
dst[i]:=JUBitset(src[srcstart+i].clone);
|
||||
begin
|
||||
dst[i].clear;
|
||||
dst[i].addAll(src[srcstart+i]);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -399,7 +405,7 @@ procedure fpc_copy_jprocvar_array(src, dst: TJProcVarArray; srcstart: jint = -1;
|
||||
srccopylen:=srclen-srcstart;
|
||||
{ no arraycopy, have to clone each element }
|
||||
for i:=0 to min(srccopylen,dstlen)-1 do
|
||||
dst[i]:=FpcBaseProcVarType(src[srcstart+i].clone);
|
||||
src[srcstart+i].fpcDeepCopy(dst[i]);
|
||||
end;
|
||||
|
||||
|
||||
@ -420,7 +426,7 @@ procedure fpc_copy_jshortstring_array(src, dst: TShortstringArray; srcstart: jin
|
||||
srccopylen:=srclen-srcstart;
|
||||
{ no arraycopy, have to clone each element }
|
||||
for i:=0 to min(srccopylen,dstlen)-1 do
|
||||
dst[i]:=ShortstringClass(src[srcstart+i].clone);
|
||||
pshortstring(src[srcstart+i])^:=pshortstring(dst[i])^;
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user