summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9e32c83)
raw | patch | inline | side by side (parent: 9e32c83)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 8 Apr 2016 08:15:24 +0000 (11:15 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 8 Apr 2016 08:15:46 +0000 (11:15 +0300) |
src/sfs/xstreams.pas | patch | blob | history |
diff --git a/src/sfs/xstreams.pas b/src/sfs/xstreams.pas
index 20a503f6edb1a3fd3ba8a59b5cab8fbea40137b6..1861c616d0972578f2fcb967dc051dc4e9fc9443 100644 (file)
--- a/src/sfs/xstreams.pas
+++ b/src/sfs/xstreams.pas
end;
TSFSMemoryStreamRO = class(TCustomMemoryStream)
+ private
+ fFreeMem: Boolean;
+ fMem: Pointer;
+
public
- constructor Create (pMem: Pointer; pSize: Integer);
+ constructor Create (pMem: Pointer; pSize: Integer; aFreeMem: Boolean=false);
+ destructor Destroy (); override;
function Write (const buffer; count: LongInt): LongInt; override;
end;
{ TSFSMemoryStreamRO }
-constructor TSFSMemoryStreamRO.Create (pMem: Pointer; pSize: Integer);
+constructor TSFSMemoryStreamRO.Create (pMem: Pointer; pSize: Integer; aFreeMem: Boolean=false);
begin
+ fFreeMem := aFreeMem;
+ fMem := pMem;
inherited Create();
SetPointer(pMem, pSize);
Position := 0;
end;
+destructor TSFSMemoryStreamRO.Destroy ();
+begin
+ if fFreeMem and (fMem <> nil) then FreeMem(fMem);
+end;
+
function TSFSMemoryStreamRO.Write (const buffer; count: LongInt): LongInt;
begin
result := 0;