@@ -896,9 +896,11 @@ function TPyDelphiComponent.InternalReadComponent(const AResFile: string;
896896 const AInstance: TComponent): boolean;
897897
898898 procedure ReadRootComponent (const AStream: TStream);
899+ var
900+ Reader: TPyReader;
899901 begin
900902 AStream.Position := 0 ;
901- var LReader := TPyReader.Create(Self, AStream, 4096 );
903+ LReader := TPyReader.Create(Self, AStream, 4096 );
902904 try
903905 LReader.ReadRootComponent(DelphiObject);
904906 finally
@@ -911,9 +913,10 @@ function TPyDelphiComponent.InternalReadComponent(const AResFile: string;
911913 FilerSignature: UInt32 = $30465054 ; // ($54, $50, $46, $30) 'TPF0'
912914 var
913915 LSignature: UInt32;
916+ LReader : TReader;
914917 begin
915918 AStream.Position := 0 ;
916- var LReader := TReader.Create(AStream, AStream.Size);
919+ LReader := TReader.Create(AStream, AStream.Size);
917920 try
918921 LReader.Read(LSignature, SizeOf(LSignature));
919922 Result := (LSignature = FilerSignature);
@@ -923,17 +926,20 @@ function TPyDelphiComponent.InternalReadComponent(const AResFile: string;
923926 end ;
924927 end ;
925928
929+ var
930+ LInput: TFileStream;
931+ LOutput: TMemoryStream;
926932begin
927933 if AResFile.IsEmpty or not TFile.Exists(AResFile) then
928934 Exit(false);
929935
930- var LInput := TFileStream.Create(AResFile, fmOpenRead);
936+ LInput := TFileStream.Create(AResFile, fmOpenRead);
931937 try
932938 // The current form file is a valid binary file
933939 if HasValidSignature(LInput) then
934940 ReadRootComponent(LInput)
935941 else begin
936- var LOutput := TMemoryStream.Create();
942+ LOutput := TMemoryStream.Create();
937943 try
938944 // we assume the form file is a text file, then we try to get the bin info
939945 ObjectTextToBinary(LInput, LOutput);
0 commit comments