Browse Source

Merged revisions 7699,7713,7779 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r7699 | florian | 2007-06-17 12:47:05 +0300 (Вс, 17 июн 2007) | 2 lines

* fixed copying of remaining elements
........
r7713 | jonas | 2007-06-17 18:07:52 +0300 (Вс, 17 июн 2007) | 2 lines

* fix for fpc_copy on 64 bit systems from Florian
........
r7779 | florian | 2007-06-23 12:16:21 +0300 (Сб, 23 июн 2007) | 2 lines

* comment fixed
........

git-svn-id: branches/fixes_2_2@7862 -

yury 18 years ago
parent
commit
8b7bb8eac1
1 changed files with 9 additions and 4 deletions
  1. 9 4
      rtl/inc/rtti.inc

+ 9 - 4
rtl/inc/rtti.inc

@@ -148,7 +148,7 @@ begin
   case PByte(TypeInfo)^ of
   case PByte(TypeInfo)^ of
     tkAstring :
     tkAstring :
       begin
       begin
-       fpc_AnsiStr_Decr_Ref(PPointer(Data)^);
+        fpc_AnsiStr_Decr_Ref(PPointer(Data)^);
         PPointer(Data)^:=nil;
         PPointer(Data)^:=nil;
       end;
       end;
     tkWstring :
     tkWstring :
@@ -255,9 +255,11 @@ begin
         namelen:=Temp^;
         namelen:=Temp^;
         inc(temp,namelen+1);
         inc(temp,namelen+1);
         temp:=aligntoptr(temp);
         temp:=aligntoptr(temp);
+
         { Element size }
         { Element size }
         size:=PSizeInt(Temp)^;
         size:=PSizeInt(Temp)^;
         inc(Temp,sizeof(Size));
         inc(Temp,sizeof(Size));
+
         { Element count }
         { Element count }
         Count:=PSizeInt(Temp)^;
         Count:=PSizeInt(Temp)^;
         inc(Temp,sizeof(Count));
         inc(Temp,sizeof(Count));
@@ -278,14 +280,14 @@ begin
         inc(temp,namelen+1);
         inc(temp,namelen+1);
         temp:=aligntoptr(temp);
         temp:=aligntoptr(temp);
 
 
-        { copy data }
         Result:=plongint(temp)^;
         Result:=plongint(temp)^;
 
 
         { Skip size }
         { Skip size }
         inc(Temp,4);
         inc(Temp,4);
+
         { Element count }
         { Element count }
         Count:=PLongint(Temp)^;
         Count:=PLongint(Temp)^;
-        inc(Temp,sizeof(Count));
+        inc(Temp,sizeof(longint));
         expectedoffset:=0;
         expectedoffset:=0;
         { Process elements with rtti }
         { Process elements with rtti }
         for i:=1 to count Do
         for i:=1 to count Do
@@ -295,10 +297,13 @@ begin
             Offset:=PLongint(Temp)^;
             Offset:=PLongint(Temp)^;
             if Offset>expectedoffset then
             if Offset>expectedoffset then
               move((Src+expectedoffset)^,(Dest+expectedoffset)^,Offset-expectedoffset);
               move((Src+expectedoffset)^,(Dest+expectedoffset)^,Offset-expectedoffset);
-            inc(Temp,sizeof(Offset));
+            inc(Temp,sizeof(longint));
             copiedsize:=fpc_Copy_internal(Src+Offset,Dest+Offset,Info);
             copiedsize:=fpc_Copy_internal(Src+Offset,Dest+Offset,Info);
             expectedoffset:=Offset+copiedsize;
             expectedoffset:=Offset+copiedsize;
           end;
           end;
+        { elements remaining? }
+        if result>expectedoffset then
+          move((Src+expectedoffset)^,(Dest+expectedoffset)^,Result-expectedoffset);
       end;
       end;
     tkDynArray:
     tkDynArray:
       begin
       begin