From 0db412d710230fa0686fbfc0b08fa8f8fa70425d Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Fri, 13 Feb 2026 15:33:13 +0000 Subject: [PATCH] test fix --- src/SharpCompress/Common/SevenZip/CCoderInfo.cs | 2 +- .../Compressors/LZMA/Bcj2DecoderStream.cs | 7 +------ .../Compressors/LZMA/DecoderRegistry.Async.cs | 12 ++++++------ src/SharpCompress/Compressors/LZMA/Registry.cs | 12 ++++++------ 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/SharpCompress/Common/SevenZip/CCoderInfo.cs b/src/SharpCompress/Common/SevenZip/CCoderInfo.cs index d735b2cd..ce1a8808 100644 --- a/src/SharpCompress/Common/SevenZip/CCoderInfo.cs +++ b/src/SharpCompress/Common/SevenZip/CCoderInfo.cs @@ -3,7 +3,7 @@ namespace SharpCompress.Common.SevenZip; internal class CCoderInfo { internal CMethodId _methodId; - internal byte[] _props = []; + internal byte[]? _props; internal int _numInStreams; internal int _numOutStreams; } diff --git a/src/SharpCompress/Compressors/LZMA/Bcj2DecoderStream.cs b/src/SharpCompress/Compressors/LZMA/Bcj2DecoderStream.cs index 9b89993c..9f2c1011 100644 --- a/src/SharpCompress/Compressors/LZMA/Bcj2DecoderStream.cs +++ b/src/SharpCompress/Compressors/LZMA/Bcj2DecoderStream.cs @@ -88,13 +88,8 @@ internal class Bcj2DecoderStream : DecoderStream2 private bool _mFinished; private bool _isDisposed; - public Bcj2DecoderStream(Stream[] streams, byte[] info, long limit) + public Bcj2DecoderStream(Stream[] streams) { - if (info != null && info.Length > 0) - { - throw new NotSupportedException(); - } - if (streams.Length != 4) { throw new NotSupportedException(); diff --git a/src/SharpCompress/Compressors/LZMA/DecoderRegistry.Async.cs b/src/SharpCompress/Compressors/LZMA/DecoderRegistry.Async.cs index 441a7b4d..8048eee3 100644 --- a/src/SharpCompress/Compressors/LZMA/DecoderRegistry.Async.cs +++ b/src/SharpCompress/Compressors/LZMA/DecoderRegistry.Async.cs @@ -18,7 +18,7 @@ internal static partial class DecoderRegistry internal static async ValueTask CreateDecoderStreamAsync( CMethodId id, Stream[] inStreams, - byte[] info, + byte[]? info, IPasswordProvider pass, long limit, CancellationToken cancellationToken @@ -33,18 +33,18 @@ internal static partial class DecoderRegistry } return inStreams.Single(); case K_DELTA: - return new DeltaFilter(false, inStreams.Single(), info); + return new DeltaFilter(false, inStreams.Single(), info.NotNull()); case K_LZMA: case K_LZMA2: return await LzmaStream - .CreateAsync(info, inStreams.Single(), -1, limit, null, info.Length < 5, false) + .CreateAsync(info.NotNull(), inStreams.Single(), -1, limit, null, info.NotNull().Length < 5, false) .ConfigureAwait(false); case CMethodId.K_AES_ID: - return new AesDecoderStream(inStreams.Single(), info, pass, limit); + return new AesDecoderStream(inStreams.Single(), info.NotNull(), pass, limit); case K_BCJ: return new BCJFilter(false, inStreams.Single()); case K_BCJ2: - return new Bcj2DecoderStream(inStreams, info, limit); + return new Bcj2DecoderStream(inStreams); case K_PPC: return new BCJFilterPPC(false, inStreams.Single()); case K_IA64: @@ -71,7 +71,7 @@ internal static partial class DecoderRegistry case K_PPMD: return await PpmdStream .CreateAsync( - new PpmdProperties(info), + new PpmdProperties(info.NotNull()), inStreams.Single(), false, cancellationToken diff --git a/src/SharpCompress/Compressors/LZMA/Registry.cs b/src/SharpCompress/Compressors/LZMA/Registry.cs index 10bb6129..5085ecef 100644 --- a/src/SharpCompress/Compressors/LZMA/Registry.cs +++ b/src/SharpCompress/Compressors/LZMA/Registry.cs @@ -34,7 +34,7 @@ internal static partial class DecoderRegistry internal static Stream CreateDecoderStream( CMethodId id, Stream[] inStreams, - byte[] info, + byte[]? info, IPasswordProvider pass, long limit ) @@ -48,16 +48,16 @@ internal static partial class DecoderRegistry } return inStreams.Single(); case K_DELTA: - return new DeltaFilter(false, inStreams.Single(), info); + return new DeltaFilter(false, inStreams.Single(), info.NotNull()); case K_LZMA: case K_LZMA2: - return LzmaStream.Create(info, inStreams.Single(), -1, limit); + return LzmaStream.Create(info.NotNull(), inStreams.Single(), -1, limit); case CMethodId.K_AES_ID: - return new AesDecoderStream(inStreams.Single(), info, pass, limit); + return new AesDecoderStream(inStreams.Single(), info.NotNull(), pass, limit); case K_BCJ: return new BCJFilter(false, inStreams.Single()); case K_BCJ2: - return new Bcj2DecoderStream(inStreams, info, limit); + return new Bcj2DecoderStream(inStreams); case K_PPC: return new BCJFilterPPC(false, inStreams.Single()); case K_IA64: @@ -75,7 +75,7 @@ internal static partial class DecoderRegistry case K_B_ZIP2: return BZip2Stream.Create(inStreams.Single(), CompressionMode.Decompress, true); case K_PPMD: - return PpmdStream.Create(new PpmdProperties(info), inStreams.Single(), false); + return PpmdStream.Create(new PpmdProperties(info.NotNull()), inStreams.Single(), false); case K_DEFLATE: return new DeflateStream(inStreams.Single(), CompressionMode.Decompress); case K_ZSTD: