Browse Source

* Loop variable must be integer, count can be -1

Michaël Van Canneyt 6 months ago
parent
commit
0914565a52
1 changed files with 5 additions and 3 deletions
  1. 5 3
      packages/fcl-fpcunit/src/testutils.pp

+ 5 - 3
packages/fcl-fpcunit/src/testutils.pp

@@ -94,10 +94,11 @@ type
 
 
 var
 var
   methodTable : pMethodNameTable;
   methodTable : pMethodNameTable;
-  i : dword;
+  i : integer;
   vmt: PVmt;
   vmt: PVmt;
   idx: integer;
   idx: integer;
   pmr: PMethodNameRec;
   pmr: PMethodNameRec;
+  lName : shortstring;
 begin
 begin
   AList.Clear;
   AList.Clear;
   vmt := PVmt(aClass);
   vmt := PVmt(aClass);
@@ -109,11 +110,12 @@ begin
       pmr := @methodTable^.entries[0];
       pmr := @methodTable^.entries[0];
       for i := 0 to MethodTable^.count - 1 do
       for i := 0 to MethodTable^.count - 1 do
       begin
       begin
-        idx := aList.IndexOf(pmr^.name^);
+        lName:=pmr^.name^;
+        idx := aList.IndexOf(lName);
         if (idx <> - 1) then
         if (idx <> - 1) then
         //found overridden method so delete it
         //found overridden method so delete it
           aList.Delete(idx);
           aList.Delete(idx);
-        aList.AddObject(pmr^.name^, TObject(pmr^.addr));
+        aList.AddObject(lName, TObject(pmr^.addr));
         Inc(pmr);
         Inc(pmr);
       end;
       end;
     end;
     end;