mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-17 23:56:05 +02:00
properly reset internal state on close
This commit is contained in:
parent
4211c267a6
commit
98da39a3ba
2 changed files with 10 additions and 5 deletions
|
@ -179,7 +179,12 @@ namespace System.IO
|
||||||
|
|
||||||
public override Result<void> Close()
|
public override Result<void> Close()
|
||||||
{
|
{
|
||||||
return Flush();
|
let ret = Flush();
|
||||||
|
|
||||||
|
mPos = 0;
|
||||||
|
mBufferPos = -Int32.MinValue;
|
||||||
|
mBufferEnd = -Int32.MinValue;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -371,14 +371,14 @@ namespace System.IO
|
||||||
|
|
||||||
public override Result<void> Close()
|
public override Result<void> Close()
|
||||||
{
|
{
|
||||||
var hadError = Flush() case .Err;
|
let ret = base.Close();
|
||||||
if (mBfpFile != null)
|
if (mBfpFile != null)
|
||||||
Platform.BfpFile_Release(mBfpFile);
|
Platform.BfpFile_Release(mBfpFile);
|
||||||
|
|
||||||
mBfpFile = null;
|
mBfpFile = null;
|
||||||
mFileAccess = default;
|
mFileAccess = default;
|
||||||
if (hadError)
|
mBfpFilePos = 0;
|
||||||
return .Err;
|
return ret;
|
||||||
return .Ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateLength()
|
protected override void UpdateLength()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue