Skip to content

Commit 5fdbe7b

Browse files
Merge branch 'main' into bp/tiff-jpeg-cmyk
2 parents 55224ec + dd3893e commit 5fdbe7b

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
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 => offset,
219+
SeekOrigin.Current => this.Position + offset,
220+
SeekOrigin.End => this.Length + offset,
221+
_ => throw new ArgumentOutOfRangeException(nameof(offset)),
222+
};
230223

231224
return this.readerPosition;
232225
}

src/ImageSharp/IO/ChunkedMemoryStream.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ public override long Seek(long offset, SeekOrigin origin)
7676

7777
this.Position = origin switch
7878
{
79-
SeekOrigin.Begin => (int)offset,
80-
SeekOrigin.Current => (int)(this.Position + offset),
81-
SeekOrigin.End => (int)(this.Length + offset),
79+
SeekOrigin.Begin => offset,
80+
SeekOrigin.Current => this.Position + offset,
81+
SeekOrigin.End => this.Length + offset,
8282
_ => throw new ArgumentOutOfRangeException(nameof(offset)),
8383
};
8484

0 commit comments

Comments
 (0)