Skip to content

Commit 0b8cfb1

Browse files
committed
Fix Typo and Offset
* While checking ChunkedMemoryStream i saw differences in the Seek method.
1 parent c19a82e commit 0b8cfb1

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/ImageSharp/IO/BufferedReadStream.cs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public BufferedReadStream(Configuration configuration, Stream stream, Cancellati
6969
}
7070

7171
/// <summary>
72-
/// Gets the number indicating the EOF hits occured while reading from this instance.
72+
/// Gets the number indicating the EOF hits occurred while reading from this instance.
7373
/// </summary>
7474
public int EofHitCount { get; private set; }
7575

@@ -213,20 +213,13 @@ public override void Flush()
213213
[MethodImpl(MethodImplOptions.AggressiveInlining)]
214214
public override long Seek(long offset, SeekOrigin origin)
215215
{
216-
switch (origin)
216+
this.Position = origin switch
217217
{
218-
case SeekOrigin.Begin:
219-
this.Position = offset;
220-
break;
221-
222-
case SeekOrigin.Current:
223-
this.Position += offset;
224-
break;
225-
226-
case SeekOrigin.End:
227-
this.Position = this.Length - offset;
228-
break;
229-
}
218+
SeekOrigin.Begin => (int)offset,
219+
SeekOrigin.Current => (int)(this.Position + offset),
220+
SeekOrigin.End => (int)(this.Length + offset),
221+
_ => throw new ArgumentOutOfRangeException(nameof(offset)),
222+
};
230223

231224
return this.readerPosition;
232225
}

0 commit comments

Comments
 (0)