Skip to content

Commit

Permalink
Fix Stream.ReadBytes default for count parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
hyazinthh committed Aug 28, 2024
1 parent eb58955 commit f48f7ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Aardvark.Base/Extensions/StreamExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ public static class StreamExtensions
/// <param name="stream">The stream to read from.</param>
/// <param name="buffer">The buffer to read into.</param>
/// <param name="offset">The byte offset in <paramref name="buffer"/> at which to begin storing the data read from the current stream.</param>
/// <param name="count">The number of bytes to be read from the current stream. Defaults to the buffer length if negative.</param>
/// <param name="count">The number of bytes to be read from the current stream. Defaults to <paramref name="buffer"/>.Length - <paramref name="offset"/> if negative.</param>
/// <exception cref="EndOfStreamException"></exception>
public static void ReadBytes(this Stream stream, byte[] buffer, int offset = 0, int count = -1)
{
if (count < 0) count = buffer.Length;
if (count < 0) count = buffer.Length - offset;
#if NET8_0_OR_GREATER
stream.ReadExactly(buffer, offset, count);
#else
Expand Down

0 comments on commit f48f7ee

Please sign in to comment.