Change StartRecording minBufferSize parameter default from 0 to null

Agent-Logs-Url: https://github.com/adamhathcock/sharpcompress/sessions/5c7bd74e-7315-4dfd-a5a4-e8fd2804f7be

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-01 11:54:15 +00:00
committed by GitHub
parent 97c4ad2509
commit d278cfbf4f
2 changed files with 6 additions and 6 deletions

View File

@@ -80,7 +80,7 @@ internal sealed partial class SeekableSharpCompressStream : SharpCompressStream
}
}
public override void StartRecording(int minBufferSize = 0) =>
public override void StartRecording(int? minBufferSize = null) =>
_recordedPosition = _stream.Position;
public override void StopRecording() => _recordedPosition = null;

View File

@@ -179,13 +179,13 @@ public partial class SharpCompressStream : Stream, IStreamStack
/// Begins recording reads so that <see cref="Rewind()"/> can replay them.
/// </summary>
/// <param name="minBufferSize">
/// Minimum ring buffer capacity in bytes. When greater than zero and larger than
/// Minimum ring buffer capacity in bytes. When provided and larger than
/// <see cref="Common.Constants.RewindableBufferSize"/>, the ring buffer is allocated
/// with this size. Pass the largest amount of compressed data that may be consumed
/// during format detection before the first rewind. Defaults to
/// <see cref="Common.Constants.RewindableBufferSize"/> when zero or not supplied.
/// <see cref="Common.Constants.RewindableBufferSize"/> when null or not supplied.
/// </param>
public virtual void StartRecording(int minBufferSize = 0)
public virtual void StartRecording(int? minBufferSize = null)
{
if (_isPassthrough)
{
@@ -204,8 +204,8 @@ public partial class SharpCompressStream : Stream, IStreamStack
if (_ringBuffer is null)
{
var size =
minBufferSize > Constants.RewindableBufferSize
? minBufferSize
minBufferSize.GetValueOrDefault() > Constants.RewindableBufferSize
? minBufferSize.GetValueOrDefault()
: Constants.RewindableBufferSize;
_ringBuffer = new RingBuffer(size);
}