From d278cfbf4f804da410b9d5d0d53894e78142fc28 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 1 Apr 2026 11:54:15 +0000
Subject: [PATCH] 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>
---
src/SharpCompress/IO/SeekableSharpCompressStream.cs | 2 +-
src/SharpCompress/IO/SharpCompressStream.cs | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/SharpCompress/IO/SeekableSharpCompressStream.cs b/src/SharpCompress/IO/SeekableSharpCompressStream.cs
index 69dbd147..bad123bb 100644
--- a/src/SharpCompress/IO/SeekableSharpCompressStream.cs
+++ b/src/SharpCompress/IO/SeekableSharpCompressStream.cs
@@ -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;
diff --git a/src/SharpCompress/IO/SharpCompressStream.cs b/src/SharpCompress/IO/SharpCompressStream.cs
index 9a6b2e49..26560024 100644
--- a/src/SharpCompress/IO/SharpCompressStream.cs
+++ b/src/SharpCompress/IO/SharpCompressStream.cs
@@ -179,13 +179,13 @@ public partial class SharpCompressStream : Stream, IStreamStack
/// Begins recording reads so that can replay them.
///
///
- /// Minimum ring buffer capacity in bytes. When greater than zero and larger than
+ /// Minimum ring buffer capacity in bytes. When provided and larger than
/// , 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
- /// when zero or not supplied.
+ /// when null or not supplied.
///
- 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);
}