Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Hawkynt committed Dec 23, 2024
2 parents 34246eb + aadc17c commit 496e997
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Corlib.Extensions/System/IO/Stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ static byte[] StructToBytes(TStruct value) {
public static void ReadBytes(this Stream @this, long position, byte[] buffer, SeekOrigin seekOrigin = SeekOrigin.Begin) {
Against.False(@this.CanRead);

_SeekToPositionAndCheck(@this, position, buffer.Length, seekOrigin);
_SeekToPositionAndCheck(@this, position, (int)Math.Min(buffer.Length, @this.Length - position), seekOrigin);
_ReadBytesToArraySeekable(@this, buffer, 0, buffer.Length);
}

Expand All @@ -1188,7 +1188,7 @@ public static void ReadBytes(this Stream @this, long position, byte[] buffer, Se
/// <returns>A awaitable Task representing the operation</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Task<int> ReadBytesAsync(this Stream @this, long position, byte[] buffer, SeekOrigin seekOrigin = SeekOrigin.Begin)
=> ReadBytesAsync(@this, position, buffer, 0, buffer.Length, seekOrigin);
=> ReadBytesAsync(@this, position, buffer, 0, (int)Math.Min(buffer.Length, @this.Length - position), seekOrigin);

/// <summary>
/// Reads async Bytes from a given position with a given SeekOrigin in the given buffer with an offset
Expand Down

0 comments on commit 496e997

Please sign in to comment.