mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-24 18:48:01 +02:00
Remove unneeded physical flushing with BufferedFileStream
This commit is contained in:
parent
46db1b61d4
commit
b549c820c7
1 changed files with 10 additions and 5 deletions
|
@ -38,7 +38,7 @@ namespace System.IO
|
|||
|
||||
public ~this()
|
||||
{
|
||||
Flush();
|
||||
FlushBuffer();
|
||||
}
|
||||
|
||||
public override Result<void> Seek(int64 pos, SeekKind seekKind = .Absolute)
|
||||
|
@ -84,7 +84,7 @@ namespace System.IO
|
|||
data.RemoveFromStart((.)spaceLeft);
|
||||
}
|
||||
|
||||
Try!(Flush());
|
||||
Try!(FlushBuffer());
|
||||
|
||||
if ((mBuffer == null) || (data.Length > mBuffer.Count))
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ namespace System.IO
|
|||
|
||||
if ((mWriteDirtyEnd >= 0) && (mWriteDirtyEnd != mPos))
|
||||
{
|
||||
Try!(Flush());
|
||||
Try!(FlushBuffer());
|
||||
}
|
||||
|
||||
int writeCount = 0;
|
||||
|
@ -138,7 +138,7 @@ namespace System.IO
|
|||
}
|
||||
}
|
||||
|
||||
Try!(Flush());
|
||||
Try!(FlushBuffer());
|
||||
|
||||
if ((mBuffer == null) || (data.Length > mBuffer.Count))
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ namespace System.IO
|
|||
return writeCount;
|
||||
}
|
||||
|
||||
public override Result<void> Flush()
|
||||
protected Result<void> FlushBuffer()
|
||||
{
|
||||
if (mWriteDirtyPos >= 0)
|
||||
{
|
||||
|
@ -170,6 +170,11 @@ namespace System.IO
|
|||
return .Ok;
|
||||
}
|
||||
|
||||
public override Result<void> Flush()
|
||||
{
|
||||
return FlushBuffer();
|
||||
}
|
||||
|
||||
public override Result<void> Close()
|
||||
{
|
||||
let ret = Flush();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue