1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-22 17:48:01 +02:00

buffered stream seek accepts everything by default + fromEnd fix

This commit is contained in:
EinBurgbauer 2021-12-09 19:34:01 +01:00
parent 92738418eb
commit 32966b79a6

View file

@ -19,7 +19,7 @@ namespace System.IO
set
{
mPos = Math.Min(value, Length);
mPos = value;
}
}
@ -43,20 +43,16 @@ namespace System.IO
public override Result<void> Seek(int64 pos, SeekKind seekKind = .Absolute)
{
int64 length = Length;
int64 newPos;
switch (seekKind)
{
case .Absolute:
mPos = Math.Min(pos, length);
if (pos > length)
return .Err;
mPos = pos;
case .FromEnd:
newPos = length - pos;
mPos = Length + pos;
case .Relative:
mPos = Math.Min(mPos + pos, length);
mPos = mPos + pos;
}
return .Ok;
}