fpspreadsheet: A more general fix of issue #30633 for streams which do not rewind in LoadFromStream.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5205 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-09-23 16:01:54 +00:00
parent 2a43d89371
commit 6fd0ed87e3

View File

@ -894,10 +894,11 @@ function TsEmbeddedObj.LoadFromStream(AStream: TStream; AName: String;
begin
FreeAndNil(FStream);
FStream := TMemoryStream.Create;
if ASize = -1 then
FStream.LoadFromStream(AStream)
else
FStream.CopyFrom(AStream, ASize);
if ASize = -1 then begin
ASize := AStream.Size;
AStream.Position := 0;
end;
FStream.CopyFrom(AStream, ASize);
Result := CheckStream(itUnknown);
if Result then FFileName := AName;
end;