Skip to content

Commit 0e40a8a

Browse files
author
Pierre le Riche
committed
#87 and #88: Fix compatibility with Delphi 7 and older compilers
1 parent aa51f3e commit 0e40a8a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

FastMM4.pas

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3612,7 +3612,7 @@ function AppendClassNameToBuffer(AClass: TClass; ADestination: PAnsiChar): PAnsi
36123612
{$ifdef EnableMemoryLeakReportingUsesQualifiedClassName}
36133613
FirstUnitNameChar: PAnsiChar;
36143614
LClassInfo: Pointer;
3615-
UnitName: PShortString;
3615+
LPUnitName: PShortString;
36163616
{$endif EnableMemoryLeakReportingUsesQualifiedClassName}
36173617
LPClassName: PShortString;
36183618
begin
@@ -3625,13 +3625,13 @@ function AppendClassNameToBuffer(AClass: TClass; ADestination: PAnsiChar): PAnsi
36253625
LClassInfo := AClass.ClassInfo;
36263626
if LClassInfo <> nil then // prepend the UnitName
36273627
begin
3628-
UnitName := @PClassData(PByte(LClassInfo) + 2 + PByte(PByte(LClassInfo) + 1)^).UnitName;
3629-
FirstUnitNameChar := @UnitName^[1];
3628+
LPUnitName := @(PClassData(IntPtr(LClassInfo) + 2 + IntPtr(PByte(IntPtr(LClassInfo) + 1)^))^.UnitName);
3629+
FirstUnitNameChar := @LPUnitName^[1];
36303630
if FirstUnitNameChar^ <> '@' then
3631-
Result := AppendStringToBuffer(FirstUnitNameChar, Result, Length(UnitName^))
3631+
Result := AppendStringToBuffer(FirstUnitNameChar, Result, Length(LPUnitName^))
36323632
else // Pos does no memory allocations, so it is safe to use
36333633
begin // Skip the '@', then copy until the ':' - never seen this happen in Delphi, but might be a C++ thing
3634-
Result := AppendStringToBuffer(@UnitName^[2], Result, Pos(ShortString(':'), UnitName^) - 2)
3634+
Result := AppendStringToBuffer(@LPUnitName^[2], Result, Pos(ShortString(':'), LPUnitName^) - 2)
36353635
;
36363636
end;
36373637
// dot between unit name and class name:

0 commit comments

Comments
 (0)