mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-25 02:58:02 +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()
|
public ~this()
|
||||||
{
|
{
|
||||||
Flush();
|
FlushBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Result<void> Seek(int64 pos, SeekKind seekKind = .Absolute)
|
public override Result<void> Seek(int64 pos, SeekKind seekKind = .Absolute)
|
||||||
|
@ -84,7 +84,7 @@ namespace System.IO
|
||||||
data.RemoveFromStart((.)spaceLeft);
|
data.RemoveFromStart((.)spaceLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
Try!(Flush());
|
Try!(FlushBuffer());
|
||||||
|
|
||||||
if ((mBuffer == null) || (data.Length > mBuffer.Count))
|
if ((mBuffer == null) || (data.Length > mBuffer.Count))
|
||||||
{
|
{
|
||||||
|
@ -114,7 +114,7 @@ namespace System.IO
|
||||||
|
|
||||||
if ((mWriteDirtyEnd >= 0) && (mWriteDirtyEnd != mPos))
|
if ((mWriteDirtyEnd >= 0) && (mWriteDirtyEnd != mPos))
|
||||||
{
|
{
|
||||||
Try!(Flush());
|
Try!(FlushBuffer());
|
||||||
}
|
}
|
||||||
|
|
||||||
int writeCount = 0;
|
int writeCount = 0;
|
||||||
|
@ -138,7 +138,7 @@ namespace System.IO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Try!(Flush());
|
Try!(FlushBuffer());
|
||||||
|
|
||||||
if ((mBuffer == null) || (data.Length > mBuffer.Count))
|
if ((mBuffer == null) || (data.Length > mBuffer.Count))
|
||||||
{
|
{
|
||||||
|
@ -158,7 +158,7 @@ namespace System.IO
|
||||||
return writeCount;
|
return writeCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Result<void> Flush()
|
protected Result<void> FlushBuffer()
|
||||||
{
|
{
|
||||||
if (mWriteDirtyPos >= 0)
|
if (mWriteDirtyPos >= 0)
|
||||||
{
|
{
|
||||||
|
@ -170,6 +170,11 @@ namespace System.IO
|
||||||
return .Ok;
|
return .Ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Result<void> Flush()
|
||||||
|
{
|
||||||
|
return FlushBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
public override Result<void> Close()
|
public override Result<void> Close()
|
||||||
{
|
{
|
||||||
let ret = Flush();
|
let ret = Flush();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue