You've already forked lazarus-ccr
fpspreadsheet: Introduce a TBufStream.Clear method and make the Size property read-only to avoid issues when setting Size to arbitrary values.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8930 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -30,7 +30,6 @@ type
|
|||||||
function GetPosition: Int64; override;
|
function GetPosition: Int64; override;
|
||||||
function GetSize: Int64; override;
|
function GetSize: Int64; override;
|
||||||
class function IsWritingMode(AMode: Word): Boolean;
|
class function IsWritingMode(AMode: Word): Boolean;
|
||||||
procedure SetSize64(const NewSize: Int64); override;
|
|
||||||
public
|
public
|
||||||
constructor Create(AFileName: String; AMode: Word;
|
constructor Create(AFileName: String; AMode: Word;
|
||||||
ABufSize: Cardinal = Cardinal(-1)); overload;
|
ABufSize: Cardinal = Cardinal(-1)); overload;
|
||||||
@ -38,11 +37,13 @@ type
|
|||||||
ABufSize: Cardinal = Cardinal(-1)); overload;
|
ABufSize: Cardinal = Cardinal(-1)); overload;
|
||||||
constructor Create(ABufSize: Cardinal = Cardinal(-1)); overload;
|
constructor Create(ABufSize: Cardinal = Cardinal(-1)); overload;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
procedure Clear;
|
||||||
procedure FillBuffer;
|
procedure FillBuffer;
|
||||||
procedure FlushBuffer;
|
procedure FlushBuffer;
|
||||||
function Read(var Buffer; Count: Longint): Longint; override;
|
function Read(var Buffer; Count: Longint): Longint; override;
|
||||||
function Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; override;
|
function Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; override;
|
||||||
function Write(const ABuffer; ACount: Longint): Longint; override;
|
function Write(const ABuffer; ACount: Longint): Longint; override;
|
||||||
|
property Size64: Int64 read GetSize;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ResetStream(var AStream: TStream);
|
procedure ResetStream(var AStream: TStream);
|
||||||
@ -326,18 +327,14 @@ begin
|
|||||||
FillBuffer;
|
FillBuffer;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBufStream.SetSize64(const NewSize: Int64);
|
procedure TBufStream.Clear;
|
||||||
begin
|
begin
|
||||||
if NewSize = 0 then
|
FMemoryStream.Clear;
|
||||||
begin
|
if not Assigned(FFileStream) then
|
||||||
FMemoryStream.Clear;
|
CreateFileStream;
|
||||||
if not Assigned(FFileStream) then
|
FFileStream.Size := 0;
|
||||||
CreateFileStream;
|
FFileStream.Position := 0;
|
||||||
FFileStream.Size := 0;
|
FFileStreamPos := 0;
|
||||||
FFileStream.Position := 0;
|
|
||||||
FFileStreamPos := 0;
|
|
||||||
end;
|
|
||||||
inherited;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBufStream.Write(const ABuffer; ACount: LongInt): LongInt;
|
function TBufStream.Write(const ABuffer; ACount: LongInt): LongInt;
|
||||||
|
Reference in New Issue
Block a user