@@ -896,9 +896,11 @@ function TPyDelphiComponent.InternalReadComponent(const AResFile: string;
896
896
const AInstance: TComponent): boolean;
897
897
898
898
procedure ReadRootComponent (const AStream: TStream);
899
+ var
900
+ Reader: TPyReader;
899
901
begin
900
902
AStream.Position := 0 ;
901
- var LReader := TPyReader.Create(Self, AStream, 4096 );
903
+ LReader := TPyReader.Create(Self, AStream, 4096 );
902
904
try
903
905
LReader.ReadRootComponent(DelphiObject);
904
906
finally
@@ -911,9 +913,10 @@ function TPyDelphiComponent.InternalReadComponent(const AResFile: string;
911
913
FilerSignature: UInt32 = $30465054 ; // ($54, $50, $46, $30) 'TPF0'
912
914
var
913
915
LSignature: UInt32;
916
+ LReader : TReader;
914
917
begin
915
918
AStream.Position := 0 ;
916
- var LReader := TReader.Create(AStream, AStream.Size);
919
+ LReader := TReader.Create(AStream, AStream.Size);
917
920
try
918
921
LReader.Read(LSignature, SizeOf(LSignature));
919
922
Result := (LSignature = FilerSignature);
@@ -923,17 +926,20 @@ function TPyDelphiComponent.InternalReadComponent(const AResFile: string;
923
926
end ;
924
927
end ;
925
928
929
+ var
930
+ LInput: TFileStream;
931
+ LOutput: TMemoryStream;
926
932
begin
927
933
if AResFile.IsEmpty or not TFile.Exists(AResFile) then
928
934
Exit(false);
929
935
930
- var LInput := TFileStream.Create(AResFile, fmOpenRead);
936
+ LInput := TFileStream.Create(AResFile, fmOpenRead);
931
937
try
932
938
// The current form file is a valid binary file
933
939
if HasValidSignature(LInput) then
934
940
ReadRootComponent(LInput)
935
941
else begin
936
- var LOutput := TMemoryStream.Create();
942
+ LOutput := TMemoryStream.Create();
937
943
try
938
944
// we assume the form file is a text file, then we try to get the bin info
939
945
ObjectTextToBinary(LInput, LOutput);
0 commit comments