mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 22:20:22 +02:00
range checking clean up
git-svn-id: trunk@5516 -
This commit is contained in:
parent
25fab3727c
commit
23cf0a0fb6
@ -201,6 +201,8 @@ type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
{$IFOPT R+}{$DEFINE RangeCheckOn}{$ENDIF}
|
||||||
|
|
||||||
var
|
var
|
||||||
MyFindGlobalComponentProc:function(const AName:AnsiString):TComponent of object;
|
MyFindGlobalComponentProc:function(const AName:AnsiString):TComponent of object;
|
||||||
|
|
||||||
@ -616,7 +618,7 @@ type
|
|||||||
TMethodNameTable = packed record
|
TMethodNameTable = packed record
|
||||||
Count : DWord;
|
Count : DWord;
|
||||||
// for runtime range checking it is important to give a range
|
// for runtime range checking it is important to give a range
|
||||||
Entries : packed array[0..0] of TMethodNameRec;
|
Entries : packed array[0..1000000] of TMethodNameRec;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
PMethodNameTable = ^TMethodNameTable;
|
PMethodNameTable = ^TMethodNameTable;
|
||||||
@ -676,9 +678,7 @@ procedure TJITComponentList.FreevmtCopy(vmtCopy:Pointer);
|
|||||||
if CurCount=BaseCount then exit;
|
if CurCount=BaseCount then exit;
|
||||||
i:=CurCount;
|
i:=CurCount;
|
||||||
while i>BaseCount do begin
|
while i>BaseCount do begin
|
||||||
{$R-}
|
|
||||||
CurMethod:=MethodTable^.Entries[i-1];
|
CurMethod:=MethodTable^.Entries[i-1];
|
||||||
{$R+}
|
|
||||||
if CurMethod.Name<>nil then
|
if CurMethod.Name<>nil then
|
||||||
FreeMem(CurMethod.Name);
|
FreeMem(CurMethod.Name);
|
||||||
if CurMethod.Addr<>nil then
|
if CurMethod.Addr<>nil then
|
||||||
@ -741,7 +741,7 @@ begin
|
|||||||
//for a:=0 to NewMethodTable^.Count-1 do
|
//for a:=0 to NewMethodTable^.Count-1 do
|
||||||
// writeln(a,'=',NewMethodTable^.Entries[a].Name^,' $'
|
// writeln(a,'=',NewMethodTable^.Entries[a].Name^,' $'
|
||||||
// ,HexStr(Integer(NewMethodTable^.Entries[a].Name),8));
|
// ,HexStr(Integer(NewMethodTable^.Entries[a].Name),8));
|
||||||
{$R+}
|
{$IFDEF RangeCheckOn}{$R+}{$ENDIF}
|
||||||
PMethodNameTable((Pointer(JITClass)+vmtMethodTable)^):=NewMethodTable;
|
PMethodNameTable((Pointer(JITClass)+vmtMethodTable)^):=NewMethodTable;
|
||||||
if Assigned(OldMethodTable) then
|
if Assigned(OldMethodTable) then
|
||||||
FreeMem(OldMethodTable);
|
FreeMem(OldMethodTable);
|
||||||
@ -783,7 +783,7 @@ begin
|
|||||||
FreeMem(OldMethodTable);
|
FreeMem(OldMethodTable);
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
{$R+}
|
{$IFDEF RangeCheckOn}{$R+}{$ENDIF}
|
||||||
inc(a);
|
inc(a);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -802,10 +802,8 @@ begin
|
|||||||
MethodTable:=PMethodNameTable((Pointer(JITClass)+vmtMethodTable)^);
|
MethodTable:=PMethodNameTable((Pointer(JITClass)+vmtMethodTable)^);
|
||||||
if Assigned(MethodTable) then begin
|
if Assigned(MethodTable) then begin
|
||||||
for a:=0 to MethodTable^.Count-1 do begin
|
for a:=0 to MethodTable^.Count-1 do begin
|
||||||
{$R-}
|
|
||||||
if uppercase(MethodTable^.Entries[a].Name^)=OldName then
|
if uppercase(MethodTable^.Entries[a].Name^)=OldName then
|
||||||
MethodTable^.Entries[a].Name^:=NewName;
|
MethodTable^.Entries[a].Name^:=NewName;
|
||||||
{$R+}
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user