1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-17 07:44:09 +02:00

properly reset internal state on close

This commit is contained in:
EinBurgbauer 2021-04-13 09:30:59 +02:00
parent 4211c267a6
commit 98da39a3ba
2 changed files with 10 additions and 5 deletions

View file

@ -179,7 +179,12 @@ namespace System.IO
public override Result<void> Close()
{
return Flush();
let ret = Flush();
mPos = 0;
mBufferPos = -Int32.MinValue;
mBufferEnd = -Int32.MinValue;
return ret;
}
}
}

View file

@ -371,14 +371,14 @@ namespace System.IO
public override Result<void> Close()
{
var hadError = Flush() case .Err;
let ret = base.Close();
if (mBfpFile != null)
Platform.BfpFile_Release(mBfpFile);
mBfpFile = null;
mFileAccess = default;
if (hadError)
return .Err;
return .Ok;
mBfpFilePos = 0;
return ret;
}
protected override void UpdateLength()