From 0da7cb74498709928e269eafb8f9354657d68840 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 29 Jun 2026 13:20:52 +0000
Subject: [PATCH 1/7] Initial plan
From 1ddb78fb17cbefdb1ca9a4af6b8d5f98dcaaf425 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 29 Jun 2026 13:58:43 +0000
Subject: [PATCH 2/7] Rename compression option WindowLog properties
Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
---
.../CompressionStreamUnitTestBase.cs | 4 ++--
.../ref/System.IO.Compression.Brotli.cs | 2 +-
.../enc/BrotliCompressionOptions.cs | 10 ++++-----
.../Compression/enc/BrotliStream.Compress.cs | 2 +-
.../CompressionStreamUnitTests.Brotli.cs | 14 ++++++------
.../ref/System.IO.Compression.cs | 6 ++---
.../System/IO/Compression/DeflateEncoder.cs | 2 +-
.../Compression/DeflateZLib/DeflateStream.cs | 2 +-
.../src/System/IO/Compression/GZipStream.cs | 2 +-
.../IO/Compression/ZLibCompressionOptions.cs | 8 +++----
.../src/System/IO/Compression/ZLibStream.cs | 2 +-
.../Zstandard.PlatformNotSupported.cs | 4 ++--
.../Zstandard/ZstandardCompressionOptions.cs | 6 ++---
.../Compression/Zstandard/ZstandardDecoder.cs | 4 ++--
.../ZstandardDecompressionOptions.cs | 6 ++---
.../Compression/Zstandard/ZstandardEncoder.cs | 4 ++--
.../tests/ZLibCompressionOptionsUnitTests.cs | 14 ++++++------
.../ZstandardCompressionOptionsTests.cs | 22 +++++++++----------
.../Zstandard/ZstandardEncoderDecoderTests.cs | 2 +-
19 files changed, 58 insertions(+), 58 deletions(-)
diff --git a/src/libraries/Common/tests/System/IO/Compression/CompressionStreamUnitTestBase.cs b/src/libraries/Common/tests/System/IO/Compression/CompressionStreamUnitTestBase.cs
index ac0ad043200502..f21edcf9c1f49d 100644
--- a/src/libraries/Common/tests/System/IO/Compression/CompressionStreamUnitTestBase.cs
+++ b/src/libraries/Common/tests/System/IO/Compression/CompressionStreamUnitTestBase.cs
@@ -817,7 +817,7 @@ private async Task TestStreamRewindsOnlyOnce(bool useAsync)
[InlineData(10)]
[InlineData(15)]
[InlineData(-1)]
- public void RoundTrip_WithWindowLog(int windowLog)
+ public void RoundTrip_WithWindowLog2(int windowLog2)
{
byte[] input = new byte[1024];
Random.Shared.NextBytes(input);
@@ -825,7 +825,7 @@ public void RoundTrip_WithWindowLog(int windowLog)
var options = new ZLibCompressionOptions
{
CompressionLevel = 6,
- WindowLog = windowLog
+ WindowLog2 = windowLog2
};
using var compressed = new MemoryStream();
diff --git a/src/libraries/System.IO.Compression.Brotli/ref/System.IO.Compression.Brotli.cs b/src/libraries/System.IO.Compression.Brotli/ref/System.IO.Compression.Brotli.cs
index 4d6071a83c186f..b60adea4dfae3a 100644
--- a/src/libraries/System.IO.Compression.Brotli/ref/System.IO.Compression.Brotli.cs
+++ b/src/libraries/System.IO.Compression.Brotli/ref/System.IO.Compression.Brotli.cs
@@ -10,7 +10,7 @@ public sealed partial class BrotliCompressionOptions
{
public BrotliCompressionOptions() { }
public int Quality { get { throw null; } set { } }
- public int WindowLog { get { throw null; } set { } }
+ public int WindowLog2 { get { throw null; } set { } }
}
public partial struct BrotliDecoder : System.IDisposable
{
diff --git a/src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliCompressionOptions.cs b/src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliCompressionOptions.cs
index 7211b31e80799e..cb7f5322d05d1a 100644
--- a/src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliCompressionOptions.cs
+++ b/src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliCompressionOptions.cs
@@ -9,7 +9,7 @@ namespace System.IO.Compression
public sealed class BrotliCompressionOptions
{
private int _quality = BrotliUtils.Quality_Default;
- private int _windowLog = BrotliUtils.WindowBits_Default;
+ private int _windowLog2 = BrotliUtils.WindowBits_Default;
///
/// Gets or sets the compression quality for a Brotli compression stream.
@@ -31,21 +31,21 @@ public int Quality
}
///
- /// Gets or sets the window size for a Brotli compression stream.
+ /// Gets or sets the base-2 logarithm of the window size for a Brotli compression stream.
///
/// The value is less than 10 or greater than 24.
///
/// The value is expressed as the base-2 logarithm of the size in bytes of the sliding window used by the LZ77 algorithm. Larger window sizes can improve compression ratio but use more memory. Range is from 10 to 24. The default value is 22.
///
- public int WindowLog
+ public int WindowLog2
{
- get => _windowLog;
+ get => _windowLog2;
set
{
ArgumentOutOfRangeException.ThrowIfLessThan(value, BrotliUtils.WindowBits_Min, nameof(value));
ArgumentOutOfRangeException.ThrowIfGreaterThan(value, BrotliUtils.WindowBits_Max, nameof(value));
- _windowLog = value;
+ _windowLog2 = value;
}
}
}
diff --git a/src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliStream.Compress.cs b/src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliStream.Compress.cs
index f77234c762746f..50cd37b0b65d3f 100644
--- a/src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliStream.Compress.cs
+++ b/src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliStream.Compress.cs
@@ -41,7 +41,7 @@ public BrotliStream(Stream stream, BrotliCompressionOptions compressionOptions,
ArgumentNullException.ThrowIfNull(compressionOptions);
_encoder.SetQuality(compressionOptions.Quality);
- _encoder.SetWindow(compressionOptions.WindowLog);
+ _encoder.SetWindow(compressionOptions.WindowLog2);
}
/// Writes compressed bytes to the underlying stream from the specified byte array.
diff --git a/src/libraries/System.IO.Compression.Brotli/tests/CompressionStreamUnitTests.Brotli.cs b/src/libraries/System.IO.Compression.Brotli/tests/CompressionStreamUnitTests.Brotli.cs
index 21c8dc59dd4058..f69aae87bf661b 100644
--- a/src/libraries/System.IO.Compression.Brotli/tests/CompressionStreamUnitTests.Brotli.cs
+++ b/src/libraries/System.IO.Compression.Brotli/tests/CompressionStreamUnitTests.Brotli.cs
@@ -100,14 +100,14 @@ public void InvalidBrotliCompressionQuality()
}
[Fact]
- public void InvalidBrotliCompressionWindowLog()
+ public void InvalidBrotliCompressionWindowLog2()
{
BrotliCompressionOptions options = new();
- Assert.Equal(22, options.WindowLog); // default value
- Assert.Throws("value", () => options.WindowLog = -1);
- Assert.Throws("value", () => options.WindowLog = 9);
- Assert.Throws("value", () => options.WindowLog = 25);
+ Assert.Equal(22, options.WindowLog2); // default value
+ Assert.Throws("value", () => options.WindowLog2 = -1);
+ Assert.Throws("value", () => options.WindowLog2 = 9);
+ Assert.Throws("value", () => options.WindowLog2 = 25);
}
[Theory]
@@ -115,7 +115,7 @@ public void InvalidBrotliCompressionWindowLog()
[InlineData(15)]
[InlineData(22)]
[InlineData(24)]
- public void BrotliCompressionWindowLog_RoundTrip(int windowLog)
+ public void BrotliCompressionWindowLog2_RoundTrip(int windowLog2)
{
byte[] testData = new byte[10000];
Random.Shared.NextBytes(testData);
@@ -124,7 +124,7 @@ public void BrotliCompressionWindowLog_RoundTrip(int windowLog)
byte[] compressed;
using (var ms = new MemoryStream())
{
- using (var compressor = new BrotliStream(ms, new BrotliCompressionOptions() { WindowLog = windowLog }, leaveOpen: true))
+ using (var compressor = new BrotliStream(ms, new BrotliCompressionOptions() { WindowLog2 = windowLog2 }, leaveOpen: true))
{
compressor.Write(testData);
}
diff --git a/src/libraries/System.IO.Compression/ref/System.IO.Compression.cs b/src/libraries/System.IO.Compression/ref/System.IO.Compression.cs
index 3861dd42123ed7..17a77967c8e1ed 100644
--- a/src/libraries/System.IO.Compression/ref/System.IO.Compression.cs
+++ b/src/libraries/System.IO.Compression/ref/System.IO.Compression.cs
@@ -194,7 +194,7 @@ public sealed partial class ZLibCompressionOptions
public ZLibCompressionOptions() { }
public int CompressionLevel { get { throw null; } set { } }
public System.IO.Compression.ZLibCompressionStrategy CompressionStrategy { get { throw null; } set { } }
- public int WindowLog { get { throw null; } set { } }
+ public int WindowLog2 { get { throw null; } set { } }
}
public enum ZLibCompressionStrategy
{
@@ -277,7 +277,7 @@ public ZstandardCompressionOptions() { }
public static int MinWindowLog { get { throw null; } }
public int Quality { get { throw null; } set { } }
public int TargetBlockSize { get { throw null; } set { } }
- public int WindowLog { get { throw null; } set { } }
+ public int WindowLog2 { get { throw null; } set { } }
}
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")]
@@ -302,7 +302,7 @@ public sealed partial class ZstandardDecompressionOptions
{
public ZstandardDecompressionOptions() { }
public System.IO.Compression.ZstandardDictionary? Dictionary { get { throw null; } set { } }
- public int MaxWindowLog { get { throw null; } set { } }
+ public int MaxWindowLog2 { get { throw null; } set { } }
}
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")]
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs
index 0b70ce1f51da35..bced10ba8b0a33 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs
@@ -88,7 +88,7 @@ internal DeflateEncoder(ZLibCompressionOptions options, CompressionFormat format
{
ArgumentNullException.ThrowIfNull(options);
- int windowBits = CompressionFormatHelper.ResolveWindowBits(options.WindowLog, format);
+ int windowBits = CompressionFormatHelper.ResolveWindowBits(options.WindowLog2, format);
int memLevel = options.CompressionLevel == (int)ZLibNative.CompressionLevel.NoCompression
? ZLibNative.Deflate_NoCompressionMemLevel
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs
index 8b551c82e0ed1d..335a57b90fb5de 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs
@@ -58,7 +58,7 @@ public DeflateStream(Stream stream, ZLibCompressionOptions compressionOptions, b
ArgumentNullException.ThrowIfNull(stream);
ArgumentNullException.ThrowIfNull(compressionOptions);
- int windowBits = CompressionFormatHelper.ResolveWindowBits(compressionOptions.WindowLog, CompressionFormat.Deflate);
+ int windowBits = CompressionFormatHelper.ResolveWindowBits(compressionOptions.WindowLog2, CompressionFormat.Deflate);
InitializeDeflater(stream, (ZLibNative.CompressionLevel)compressionOptions.CompressionLevel, (CompressionStrategy)compressionOptions.CompressionStrategy, leaveOpen, windowBits);
}
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipStream.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipStream.cs
index 3c309078cbb3eb..ed1bbc930d67d9 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipStream.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipStream.cs
@@ -44,7 +44,7 @@ public GZipStream(Stream stream, ZLibCompressionOptions compressionOptions, bool
ArgumentNullException.ThrowIfNull(stream);
ArgumentNullException.ThrowIfNull(compressionOptions);
- int windowBits = CompressionFormatHelper.ResolveWindowBits(compressionOptions.WindowLog, CompressionFormat.GZip);
+ int windowBits = CompressionFormatHelper.ResolveWindowBits(compressionOptions.WindowLog2, CompressionFormat.GZip);
_deflateStream = new DeflateStream(stream, compressionOptions, leaveOpen, windowBits);
}
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibCompressionOptions.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibCompressionOptions.cs
index 24af90d002ac3e..f47c7ca295407f 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibCompressionOptions.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibCompressionOptions.cs
@@ -19,7 +19,7 @@ public sealed class ZLibCompressionOptions
private int _compressionLevel = -1;
private ZLibCompressionStrategy _strategy;
- private int _windowLog = -1;
+ private int _windowLog2 = -1;
///
/// Gets or sets the compression level for a compression stream.
@@ -69,9 +69,9 @@ public ZLibCompressionStrategy CompressionStrategy
/// When used with or , a value of 8 is treated as 9 by the underlying implementation.
/// -1 requests the default window log which is currently equivalent to 15 (32KB window). The default value is -1.
///
- public int WindowLog
+ public int WindowLog2
{
- get => _windowLog;
+ get => _windowLog2;
set
{
if (value != -1)
@@ -80,7 +80,7 @@ public int WindowLog
ArgumentOutOfRangeException.ThrowIfGreaterThan(value, ZLibNative.MaxWindowLog, nameof(value));
}
- _windowLog = value;
+ _windowLog2 = value;
}
}
}
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibStream.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibStream.cs
index c7ae969d3eb153..a8f421f5232adf 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibStream.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibStream.cs
@@ -57,7 +57,7 @@ public ZLibStream(Stream stream, ZLibCompressionOptions compressionOptions, bool
ArgumentNullException.ThrowIfNull(stream);
ArgumentNullException.ThrowIfNull(compressionOptions);
- int windowBits = CompressionFormatHelper.ResolveWindowBits(compressionOptions.WindowLog, CompressionFormat.ZLib);
+ int windowBits = CompressionFormatHelper.ResolveWindowBits(compressionOptions.WindowLog2, CompressionFormat.ZLib);
_deflateStream = new DeflateStream(stream, compressionOptions, leaveOpen, windowBits);
}
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/Zstandard.PlatformNotSupported.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/Zstandard.PlatformNotSupported.cs
index 1da10593dd660c..e8f1766716cf7c 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/Zstandard.PlatformNotSupported.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/Zstandard.PlatformNotSupported.cs
@@ -11,7 +11,7 @@ public sealed class ZstandardDecompressionOptions
{
public ZstandardDecompressionOptions() => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public ZstandardDictionary? Dictionary { get => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); set => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); }
- public int MaxWindowLog { get => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); set => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); }
+ public int MaxWindowLog2 { get => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); set => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); }
}
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
@@ -30,7 +30,7 @@ public sealed class ZstandardCompressionOptions
public static int MinWindowLog => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public int Quality { get => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); set => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); }
public int TargetBlockSize { get => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); set => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); }
- public int WindowLog { get => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); set => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); }
+ public int WindowLog2 { get => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); set => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); }
}
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardCompressionOptions.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardCompressionOptions.cs
index 451b963211bf37..e89bc8b5ce3b8d 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardCompressionOptions.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardCompressionOptions.cs
@@ -56,8 +56,8 @@ public int Quality
}
}
- /// Gets or sets the window size to use for Zstandard compression.
- /// The window size for compression, expressed as base 2 logarithm.
+ /// Gets or sets the base-2 logarithm of the window size to use for Zstandard compression.
+ /// The base-2 logarithm of the window size for compression.
///
/// The window size determines how much data the compressor can reference for finding matches.
/// Larger window sizes can improve compression ratios for large files but require more memory.
@@ -65,7 +65,7 @@ public int Quality
/// Value 0 indicates the implementation-defined default window size.
///
/// The value is not 0 and is not between and .
- public int WindowLog
+ public int WindowLog2
{
get;
set
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs
index 4c347d389c9e9e..294616ede81e43 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs
@@ -93,9 +93,9 @@ public ZstandardDecoder(ZstandardDecompressionOptions decompressionOptions)
try
{
- if (decompressionOptions.MaxWindowLog != 0)
+ if (decompressionOptions.MaxWindowLog2 != 0)
{
- SetWindowLog(decompressionOptions.MaxWindowLog);
+ SetWindowLog(decompressionOptions.MaxWindowLog2);
}
if (decompressionOptions.Dictionary is not null)
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecompressionOptions.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecompressionOptions.cs
index ed1cea2457dcce..452c903b5ecf09 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecompressionOptions.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecompressionOptions.cs
@@ -9,14 +9,14 @@ namespace System.IO.Compression
public sealed class ZstandardDecompressionOptions
{
- /// Gets or sets the maximum allowed window size when decompressing payloads, expressed as base 2 logarithm.
- /// The maximum window size for decompression, expressed as base 2 logarithm.
+ /// Gets or sets the maximum allowed base-2 logarithm of the window size when decompressing payloads.
+ /// The maximum allowed base-2 logarithm of the window size for decompression.
///
/// The valid range is from to .
/// Value 0 indicates the implementation-defined default window size.
///
/// The value is not 0 and is not between and .
- public int MaxWindowLog
+ public int MaxWindowLog2
{
get;
set
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs
index bae287f0da1f91..67808734d7db03 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs
@@ -153,9 +153,9 @@ public ZstandardEncoder(ZstandardCompressionOptions compressionOptions)
SetQuality(_context, compressionOptions.Quality);
}
- if (compressionOptions.WindowLog != 0)
+ if (compressionOptions.WindowLog2 != 0)
{
- SetWindowLog(_context, compressionOptions.WindowLog);
+ SetWindowLog(_context, compressionOptions.WindowLog2);
}
if (compressionOptions.AppendChecksum)
diff --git a/src/libraries/System.IO.Compression/tests/ZLibCompressionOptionsUnitTests.cs b/src/libraries/System.IO.Compression/tests/ZLibCompressionOptionsUnitTests.cs
index 151778052ad8a2..7e829cd300859d 100644
--- a/src/libraries/System.IO.Compression/tests/ZLibCompressionOptionsUnitTests.cs
+++ b/src/libraries/System.IO.Compression/tests/ZLibCompressionOptionsUnitTests.cs
@@ -43,11 +43,11 @@ public void ZLibCompressionOptionsValidOptions()
}
[Fact]
- public void WindowLog_DefaultValue()
+ public void WindowLog2_DefaultValue()
{
ZLibCompressionOptions options = new();
- Assert.Equal(-1, options.WindowLog);
+ Assert.Equal(-1, options.WindowLog2);
}
[Theory]
@@ -55,11 +55,11 @@ public void WindowLog_DefaultValue()
[InlineData(10)]
[InlineData(15)]
[InlineData(-1)]
- public void WindowLog_SetToValidRange_Succeeds(int windowLog)
+ public void WindowLog2_SetToValidRange_Succeeds(int windowLog2)
{
ZLibCompressionOptions options = new();
- options.WindowLog = windowLog;
- Assert.Equal(windowLog, options.WindowLog);
+ options.WindowLog2 = windowLog2;
+ Assert.Equal(windowLog2, options.WindowLog2);
}
[Theory]
@@ -69,10 +69,10 @@ public void WindowLog_SetToValidRange_Succeeds(int windowLog)
[InlineData(16)]
[InlineData(int.MinValue)]
[InlineData(int.MaxValue)]
- public void WindowLog_SetOutOfRange_ThrowsArgumentOutOfRangeException(int windowLog)
+ public void WindowLog2_SetOutOfRange_ThrowsArgumentOutOfRangeException(int windowLog2)
{
ZLibCompressionOptions options = new();
- Assert.Throws("value", () => options.WindowLog = windowLog);
+ Assert.Throws("value", () => options.WindowLog2 = windowLog2);
}
[Fact]
diff --git a/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardCompressionOptionsTests.cs b/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardCompressionOptionsTests.cs
index f5b6f5a9bfdfbc..545232bc2d6698 100644
--- a/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardCompressionOptionsTests.cs
+++ b/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardCompressionOptionsTests.cs
@@ -12,7 +12,7 @@ public void Parameters_SetToZero_Succeeds()
{
ZstandardCompressionOptions options = new();
options.Quality = 0;
- options.WindowLog = 0;
+ options.WindowLog2 = 0;
options.TargetBlockSize = 0;
}
@@ -40,20 +40,20 @@ public void Quality_SetOutOfRange_ThrowsArgumentOutOfRangeException(int quality)
[InlineData(10)]
[InlineData(23)]
[InlineData(30)]
- public void WindowLog_SetToValidRange_Succeeds(int windowLog)
+ public void WindowLog2_SetToValidRange_Succeeds(int windowLog2)
{
ZstandardCompressionOptions options = new();
- options.WindowLog = windowLog; // Should not throw
- Assert.Equal(windowLog, options.WindowLog);
+ options.WindowLog2 = windowLog2; // Should not throw
+ Assert.Equal(windowLog2, options.WindowLog2);
}
[Theory]
[InlineData(9)]
[InlineData(32)]
- public void WindowLog_SetOutOfRange_ThrowsArgumentOutOfRangeException(int windowLog)
+ public void WindowLog2_SetOutOfRange_ThrowsArgumentOutOfRangeException(int windowLog2)
{
ZstandardCompressionOptions options = new();
- Assert.Throws(() => options.WindowLog = windowLog);
+ Assert.Throws(() => options.WindowLog2 = windowLog2);
}
[Theory]
@@ -84,21 +84,21 @@ public class ZstandardDecompressionOptionsTests
[InlineData(10)]
[InlineData(23)]
[InlineData(30)]
- public void MaxWindowLog_SetToValidRange_Succeeds(int maxWindowLog)
+ public void MaxWindowLog2_SetToValidRange_Succeeds(int maxWindowLog2)
{
ZstandardDecompressionOptions options = new();
- options.MaxWindowLog = maxWindowLog;
- Assert.Equal(maxWindowLog, options.MaxWindowLog);
+ options.MaxWindowLog2 = maxWindowLog2;
+ Assert.Equal(maxWindowLog2, options.MaxWindowLog2);
}
[Theory]
[InlineData(1)]
[InlineData(9)]
[InlineData(32)]
- public void MaxWindowLog_SetOutOfRange_ThrowsArgumentOutOfRangeException(int maxWindowLog)
+ public void MaxWindowLog2_SetOutOfRange_ThrowsArgumentOutOfRangeException(int maxWindowLog2)
{
ZstandardDecompressionOptions options = new();
- Assert.Throws(() => options.MaxWindowLog = maxWindowLog);
+ Assert.Throws(() => options.MaxWindowLog2 = maxWindowLog2);
}
[Fact]
diff --git a/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardEncoderDecoderTests.cs b/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardEncoderDecoderTests.cs
index 8eeace81547b8c..da0ba6bd14e0f1 100644
--- a/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardEncoderDecoderTests.cs
+++ b/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardEncoderDecoderTests.cs
@@ -588,7 +588,7 @@ public void Decoder_Ctor_DecompressionOptions_Null_ThrowsArgumentNullException()
[InlineData(10)]
public void Decoder_Ctor_DecompressionOptions_Succeeds(int maxWindowLog)
{
- ZstandardDecompressionOptions options = new() { MaxWindowLog = maxWindowLog };
+ ZstandardDecompressionOptions options = new() { MaxWindowLog2 = maxWindowLog };
using ZstandardDecoder decoder = new(options);
byte[] testData = ZstandardTestUtils.CreateTestData(100);
From 84509ac2884536345e530ab524bffedab9cc2b21 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 29 Jun 2026 14:07:06 +0000
Subject: [PATCH 3/7] Checkpoint compression WindowLog2 rename work
Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
---
.../IO/Compression/EncoderDecoderTestBase.cs | 14 ++++----
.../ref/System.IO.Compression.cs | 36 +++++++++----------
.../src/Resources/Strings.resx | 2 +-
.../System/IO/Compression/DeflateEncoder.cs | 14 ++++----
.../src/System/IO/Compression/GZipEncoder.cs | 14 ++++----
.../IO/Compression/ZLibCompressionOptions.cs | 14 ++++----
.../src/System/IO/Compression/ZLibEncoder.cs | 14 ++++----
.../Zstandard.PlatformNotSupported.cs | 18 +++++-----
.../Zstandard/ZstandardCompressionOptions.cs | 16 ++++-----
.../Compression/Zstandard/ZstandardDecoder.cs | 20 +++++------
.../ZstandardDecompressionOptions.cs | 4 +--
.../Compression/Zstandard/ZstandardEncoder.cs | 36 +++++++++----------
.../tests/ZLibCompressionOptionsUnitTests.cs | 6 ++--
.../tests/ZLibEncoderDecoderTestBase.cs | 4 +--
.../Zstandard/ZstandardEncoderDecoderTests.cs | 16 ++++-----
15 files changed, 114 insertions(+), 114 deletions(-)
diff --git a/src/libraries/Common/tests/System/IO/Compression/EncoderDecoderTestBase.cs b/src/libraries/Common/tests/System/IO/Compression/EncoderDecoderTestBase.cs
index b27712a3dd9f4d..c7d5a248c64163 100644
--- a/src/libraries/Common/tests/System/IO/Compression/EncoderDecoderTestBase.cs
+++ b/src/libraries/Common/tests/System/IO/Compression/EncoderDecoderTestBase.cs
@@ -19,7 +19,7 @@ public abstract class EncoderDecoderTestBase
protected virtual bool SupportsDictionaries => false;
protected virtual bool SupportsReset => false;
- protected virtual string WindowLogParamName => "windowLog";
+ protected virtual string WindowLogParamName => "windowLog2";
protected virtual string InputLengthParamName => "inputLength";
protected abstract int ValidQuality { get; }
@@ -100,8 +100,8 @@ public abstract class DictionaryAdapter : IDisposable
protected abstract DictionaryAdapter CreateDictionary(ReadOnlySpan data, int quality);
protected abstract bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten);
- protected abstract bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog);
- protected abstract bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, DictionaryAdapter dictionary, int windowLog);
+ protected abstract bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog2);
+ protected abstract bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, DictionaryAdapter dictionary, int windowLog2);
protected abstract bool TryDecompress(ReadOnlySpan source, Span destination, out int bytesWritten);
protected abstract bool TryDecompress(ReadOnlySpan source, Span destination, out int bytesWritten, DictionaryAdapter dictionary);
@@ -117,7 +117,7 @@ public void InvalidQuality_ThrowsArgumentOutOfRangeException()
foreach (int quality in InvalidQualitiesTestData)
{
Assert.Throws("quality", () => CreateEncoder(quality, ValidWindowLog));
- Assert.Throws("quality", () => TryCompress(input, output, out _, quality: quality, windowLog: ValidWindowLog));
+ Assert.Throws("quality", () => TryCompress(input, output, out _, quality: quality, windowLog2: ValidWindowLog));
}
}
@@ -130,7 +130,7 @@ public void InvalidWindowLog_ThrowsArgumentOutOfRangeException()
foreach (int windowLog in InvalidWindowLogsTestData)
{
Assert.Throws(WindowLogParamName, () => CreateEncoder(ValidQuality, windowLog));
- Assert.Throws(WindowLogParamName, () => TryCompress(input, output, out _, quality: ValidQuality, windowLog: windowLog));
+ Assert.Throws(WindowLogParamName, () => TryCompress(input, output, out _, quality: ValidQuality, windowLog2: windowLog));
}
}
@@ -166,7 +166,7 @@ public void TryCompress_WithQualityAndWindowLog_CompressesData()
byte[] input = CreateTestData();
byte[] output = new byte[GetMaxCompressedLength(input.Length)];
- bool result = TryCompress(input, output, out int bytesWritten, quality: ValidQuality, windowLog: ValidWindowLog);
+ bool result = TryCompress(input, output, out int bytesWritten, quality: ValidQuality, windowLog2: ValidWindowLog);
Assert.True(result);
Assert.True(bytesWritten > 0);
@@ -182,7 +182,7 @@ public void TryCompress_WithDictionary_WithQuality_Succeeds()
byte[] output = new byte[GetMaxCompressedLength(input.Length)];
using DictionaryAdapter dictionary = CreateDictionary(CreateSampleDictionary(), ValidQuality);
- bool result = TryCompress(input, output, out int bytesWritten, dictionary: dictionary, windowLog: ValidWindowLog);
+ bool result = TryCompress(input, output, out int bytesWritten, dictionary: dictionary, windowLog2: ValidWindowLog);
Assert.True(result);
Assert.True(bytesWritten > 0);
diff --git a/src/libraries/System.IO.Compression/ref/System.IO.Compression.cs b/src/libraries/System.IO.Compression/ref/System.IO.Compression.cs
index 17a77967c8e1ed..98c71c7062994d 100644
--- a/src/libraries/System.IO.Compression/ref/System.IO.Compression.cs
+++ b/src/libraries/System.IO.Compression/ref/System.IO.Compression.cs
@@ -29,7 +29,7 @@ public sealed partial class DeflateEncoder : System.IDisposable
{
public DeflateEncoder() { }
public DeflateEncoder(int quality) { }
- public DeflateEncoder(int quality, int windowLog) { }
+ public DeflateEncoder(int quality, int windowLog2) { }
public DeflateEncoder(System.IO.Compression.ZLibCompressionOptions options) { }
public System.Buffers.OperationStatus Compress(System.ReadOnlySpan source, System.Span destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock) { throw null; }
public void Dispose() { }
@@ -37,7 +37,7 @@ public void Dispose() { }
public static long GetMaxCompressedLength(long inputLength) { throw null; }
public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; }
public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten, int quality) { throw null; }
- public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten, int quality, int windowLog) { throw null; }
+ public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten, int quality, int windowLog2) { throw null; }
}
public partial class DeflateStream : System.IO.Stream
{
@@ -86,7 +86,7 @@ public sealed partial class GZipEncoder : System.IDisposable
{
public GZipEncoder() { }
public GZipEncoder(int quality) { }
- public GZipEncoder(int quality, int windowLog) { }
+ public GZipEncoder(int quality, int windowLog2) { }
public GZipEncoder(System.IO.Compression.ZLibCompressionOptions options) { }
public System.Buffers.OperationStatus Compress(System.ReadOnlySpan source, System.Span destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock) { throw null; }
public void Dispose() { }
@@ -94,7 +94,7 @@ public void Dispose() { }
public static long GetMaxCompressedLength(long inputLength) { throw null; }
public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; }
public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten, int quality) { throw null; }
- public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten, int quality, int windowLog) { throw null; }
+ public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten, int quality, int windowLog2) { throw null; }
}
public partial class GZipStream : System.IO.Stream
{
@@ -188,9 +188,9 @@ public enum ZipCompressionMethod
}
public sealed partial class ZLibCompressionOptions
{
- public static int DefaultWindowLog { get { throw null; } }
- public static int MaxWindowLog { get { throw null; } }
- public static int MinWindowLog { get { throw null; } }
+ public static int DefaultWindowLog2 { get { throw null; } }
+ public static int MaxWindowLog2 { get { throw null; } }
+ public static int MinWindowLog2 { get { throw null; } }
public ZLibCompressionOptions() { }
public int CompressionLevel { get { throw null; } set { } }
public System.IO.Compression.ZLibCompressionStrategy CompressionStrategy { get { throw null; } set { } }
@@ -215,7 +215,7 @@ public sealed partial class ZLibEncoder : System.IDisposable
{
public ZLibEncoder() { }
public ZLibEncoder(int quality) { }
- public ZLibEncoder(int quality, int windowLog) { }
+ public ZLibEncoder(int quality, int windowLog2) { }
public ZLibEncoder(System.IO.Compression.ZLibCompressionOptions options) { }
public System.Buffers.OperationStatus Compress(System.ReadOnlySpan source, System.Span destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock) { throw null; }
public void Dispose() { }
@@ -223,7 +223,7 @@ public void Dispose() { }
public static long GetMaxCompressedLength(long inputLength) { throw null; }
public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; }
public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten, int quality) { throw null; }
- public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten, int quality, int windowLog) { throw null; }
+ public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten, int quality, int windowLog2) { throw null; }
}
public sealed partial class ZLibStream : System.IO.Stream
{
@@ -268,13 +268,13 @@ public sealed partial class ZstandardCompressionOptions
public ZstandardCompressionOptions() { }
public bool AppendChecksum { get { throw null; } set { } }
public static int DefaultQuality { get { throw null; } }
- public static int DefaultWindowLog { get { throw null; } }
+ public static int DefaultWindowLog2 { get { throw null; } }
public System.IO.Compression.ZstandardDictionary? Dictionary { get { throw null; } set { } }
public bool EnableLongDistanceMatching { get { throw null; } set { } }
public static int MaxQuality { get { throw null; } }
- public static int MaxWindowLog { get { throw null; } }
+ public static int MaxWindowLog2 { get { throw null; } }
public static int MinQuality { get { throw null; } }
- public static int MinWindowLog { get { throw null; } }
+ public static int MinWindowLog2 { get { throw null; } }
public int Quality { get { throw null; } set { } }
public int TargetBlockSize { get { throw null; } set { } }
public int WindowLog2 { get { throw null; } set { } }
@@ -284,10 +284,10 @@ public ZstandardCompressionOptions() { }
public sealed partial class ZstandardDecoder : System.IDisposable
{
public ZstandardDecoder() { }
- public ZstandardDecoder(int maxWindowLog) { }
+ public ZstandardDecoder(int maxWindowLog2) { }
public ZstandardDecoder(System.IO.Compression.ZstandardDecompressionOptions decompressionOptions) { }
public ZstandardDecoder(System.IO.Compression.ZstandardDictionary dictionary) { }
- public ZstandardDecoder(System.IO.Compression.ZstandardDictionary dictionary, int maxWindowLog) { }
+ public ZstandardDecoder(System.IO.Compression.ZstandardDictionary dictionary, int maxWindowLog2) { }
public System.Buffers.OperationStatus Decompress(System.ReadOnlySpan source, System.Span destination, out int bytesConsumed, out int bytesWritten) { throw null; }
public void Dispose() { }
public void Reset() { }
@@ -321,10 +321,10 @@ public sealed partial class ZstandardEncoder : System.IDisposable
{
public ZstandardEncoder() { }
public ZstandardEncoder(int quality) { }
- public ZstandardEncoder(int quality, int windowLog) { }
+ public ZstandardEncoder(int quality, int windowLog2) { }
public ZstandardEncoder(System.IO.Compression.ZstandardCompressionOptions compressionOptions) { }
public ZstandardEncoder(System.IO.Compression.ZstandardDictionary dictionary) { }
- public ZstandardEncoder(System.IO.Compression.ZstandardDictionary dictionary, int windowLog) { }
+ public ZstandardEncoder(System.IO.Compression.ZstandardDictionary dictionary, int windowLog2) { }
public System.Buffers.OperationStatus Compress(System.ReadOnlySpan source, System.Span destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock) { throw null; }
public void Dispose() { }
public System.Buffers.OperationStatus Flush(System.Span destination, out int bytesWritten) { throw null; }
@@ -333,8 +333,8 @@ public void Reset() { }
public void SetPrefix(System.ReadOnlyMemory prefix) { }
public void SetSourceLength(long length) { }
public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten) { throw null; }
- public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten, int quality, int windowLog) { throw null; }
- public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten, System.IO.Compression.ZstandardDictionary dictionary, int windowLog) { throw null; }
+ public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten, int quality, int windowLog2) { throw null; }
+ public static bool TryCompress(System.ReadOnlySpan source, System.Span destination, out int bytesWritten, System.IO.Compression.ZstandardDictionary dictionary, int windowLog2) { throw null; }
}
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("wasi")]
diff --git a/src/libraries/System.IO.Compression/src/Resources/Strings.resx b/src/libraries/System.IO.Compression/src/Resources/Strings.resx
index 8640d06b6dfb08..cd302237d0a2d1 100644
--- a/src/libraries/System.IO.Compression/src/Resources/Strings.resx
+++ b/src/libraries/System.IO.Compression/src/Resources/Strings.resx
@@ -321,7 +321,7 @@
Found truncated data while decoding.
- Data requires too much memory for decoding. Consider increasing the 'maxWindowLog' parameter.
+ Data requires too much memory for decoding. Consider increasing the 'maxWindowLog2' parameter.
The provided dictionary is not valid for decoding the current data.
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs
index bced10ba8b0a33..2d7798f93d693f 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs
@@ -51,11 +51,11 @@ public DeflateEncoder(ZLibCompressionOptions options)
/// Initializes a new instance of the class using the specified quality and window size.
///
/// The compression quality value between 0 (no compression) and 9 (maximum compression), or -1 to use the default value.
- /// The base-2 logarithm of the window size (8-15), or -1 to use the default value. Larger values result in better compression at the expense of memory usage.
- /// is not in the valid range (0-9 or -1), or is not in the valid range (8-15 or -1).
+ /// The base-2 logarithm of the window size (8-15), or -1 to use the default value. Larger values result in better compression at the expense of memory usage.
+ /// is not in the valid range (0-9 or -1), or is not in the valid range (8-15 or -1).
/// Failed to create the instance.
- public DeflateEncoder(int quality, int windowLog)
- : this(quality, windowLog, CompressionFormat.Deflate)
+ public DeflateEncoder(int quality, int windowLog2)
+ : this(quality, windowLog2, CompressionFormat.Deflate)
{
}
@@ -324,11 +324,11 @@ public static bool TryCompress(ReadOnlySpan source, Span destination
/// When this method returns, a span of bytes where the compressed data is stored.
/// When this method returns, the total number of bytes that were written to .
/// The compression quality value between 0 (no compression) and 9 (maximum compression), or -1 to use the default value.
- /// The base-2 logarithm of the window size (8-15), or -1 to use the default value. Larger values result in better compression at the expense of memory usage.
+ /// The base-2 logarithm of the window size (8-15), or -1 to use the default value. Larger values result in better compression at the expense of memory usage.
/// if the compression operation was successful; otherwise.
- public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog)
+ public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog2)
{
- using var encoder = new DeflateEncoder(quality, windowLog);
+ using var encoder = new DeflateEncoder(quality, windowLog2);
OperationStatus status = encoder.Compress(source, destination, out int consumed, out bytesWritten, isFinalBlock: true);
bool success = status == OperationStatus.Done && consumed == source.Length;
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipEncoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipEncoder.cs
index 513474672594ac..b839dae37a03ed 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipEncoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipEncoder.cs
@@ -48,12 +48,12 @@ public GZipEncoder(ZLibCompressionOptions options)
/// Initializes a new instance of the class using the specified quality and window size.
///
/// The compression quality value between 0 (no compression) and 9 (maximum compression), or -1 to use the default value.
- /// The base-2 logarithm of the window size (8-15), or -1 to use the default value. Larger values result in better compression at the expense of memory usage.
- /// is not in the valid range (0-9 or -1), or is not in the valid range (8-15 or -1).
+ /// The base-2 logarithm of the window size (8-15), or -1 to use the default value. Larger values result in better compression at the expense of memory usage.
+ /// is not in the valid range (0-9 or -1), or is not in the valid range (8-15 or -1).
/// Failed to create the instance.
- public GZipEncoder(int quality, int windowLog)
+ public GZipEncoder(int quality, int windowLog2)
{
- _deflateEncoder = new DeflateEncoder(quality, windowLog, CompressionFormat.GZip);
+ _deflateEncoder = new DeflateEncoder(quality, windowLog2, CompressionFormat.GZip);
}
///
@@ -147,11 +147,11 @@ public static bool TryCompress(ReadOnlySpan source, Span destination
/// When this method returns, a span of bytes where the compressed data is stored.
/// When this method returns, the total number of bytes that were written to .
/// The compression quality value between 0 (no compression) and 9 (maximum compression), or -1 to use the default value.
- /// The base-2 logarithm of the window size (8-15), or -1 to use the default value. Larger values result in better compression at the expense of memory usage.
+ /// The base-2 logarithm of the window size (8-15), or -1 to use the default value. Larger values result in better compression at the expense of memory usage.
/// if the compression operation was successful; otherwise.
- public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog)
+ public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog2)
{
- using var encoder = new GZipEncoder(quality, windowLog);
+ using var encoder = new GZipEncoder(quality, windowLog2);
OperationStatus status = encoder.Compress(source, destination, out int consumed, out bytesWritten, isFinalBlock: true);
bool success = status == OperationStatus.Done && consumed == source.Length;
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibCompressionOptions.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibCompressionOptions.cs
index f47c7ca295407f..c0c463b1528563 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibCompressionOptions.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibCompressionOptions.cs
@@ -8,14 +8,14 @@ namespace System.IO.Compression
///
public sealed class ZLibCompressionOptions
{
- /// Gets the default window log (base-2 logarithm of the window size) for zlib compression.
- public static int DefaultWindowLog => ZLibNative.DefaultWindowLog;
+ /// Gets the default base-2 logarithm of the window size for zlib compression.
+ public static int DefaultWindowLog2 => ZLibNative.DefaultWindowLog;
- /// Gets the minimum window log (base-2 logarithm of the window size) for zlib compression.
- public static int MinWindowLog => ZLibNative.MinWindowLog;
+ /// Gets the minimum base-2 logarithm of the window size for zlib compression.
+ public static int MinWindowLog2 => ZLibNative.MinWindowLog;
- /// Gets the maximum window log (base-2 logarithm of the window size) for zlib compression.
- public static int MaxWindowLog => ZLibNative.MaxWindowLog;
+ /// Gets the maximum base-2 logarithm of the window size for zlib compression.
+ public static int MaxWindowLog2 => ZLibNative.MaxWindowLog;
private int _compressionLevel = -1;
private ZLibCompressionStrategy _strategy;
@@ -67,7 +67,7 @@ public ZLibCompressionStrategy CompressionStrategy
///
/// Can accept -1 or any value between 8 and 15 (inclusive). Larger values result in better compression at the expense of memory usage.
/// When used with or , a value of 8 is treated as 9 by the underlying implementation.
- /// -1 requests the default window log which is currently equivalent to 15 (32KB window). The default value is -1.
+ /// -1 requests the default base-2 logarithm of the window size, which is currently equivalent to 15 (32KB window). The default value is -1.
///
public int WindowLog2
{
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibEncoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibEncoder.cs
index c6bc045f8e4b31..42091b946ce526 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibEncoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibEncoder.cs
@@ -48,12 +48,12 @@ public ZLibEncoder(ZLibCompressionOptions options)
/// Initializes a new instance of the class using the specified quality and window size.
///
/// The compression quality value between 0 (no compression) and 9 (maximum compression), or -1 to use the default value.
- /// The base-2 logarithm of the window size (8-15), or -1 to use the default value. Larger values result in better compression at the expense of memory usage.
- /// is not in the valid range (0-9 or -1), or is not in the valid range (8-15 or -1).
+ /// The base-2 logarithm of the window size (8-15), or -1 to use the default value. Larger values result in better compression at the expense of memory usage.
+ /// is not in the valid range (0-9 or -1), or is not in the valid range (8-15 or -1).
/// Failed to create the instance.
- public ZLibEncoder(int quality, int windowLog)
+ public ZLibEncoder(int quality, int windowLog2)
{
- _deflateEncoder = new DeflateEncoder(quality, windowLog, CompressionFormat.ZLib);
+ _deflateEncoder = new DeflateEncoder(quality, windowLog2, CompressionFormat.ZLib);
}
///
@@ -139,11 +139,11 @@ public static bool TryCompress(ReadOnlySpan source, Span destination
/// When this method returns, a span of bytes where the compressed data is stored.
/// When this method returns, the total number of bytes that were written to .
/// The compression quality value between 0 (no compression) and 9 (maximum compression), or -1 to use the default value.
- /// The base-2 logarithm of the window size (8-15), or -1 to use the default value. Larger values result in better compression at the expense of memory usage.
+ /// The base-2 logarithm of the window size (8-15), or -1 to use the default value. Larger values result in better compression at the expense of memory usage.
/// if the compression operation was successful; otherwise.
- public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog)
+ public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog2)
{
- using var encoder = new ZLibEncoder(quality, windowLog);
+ using var encoder = new ZLibEncoder(quality, windowLog2);
OperationStatus status = encoder.Compress(source, destination, out int consumed, out bytesWritten, isFinalBlock: true);
bool success = status == OperationStatus.Done && consumed == source.Length;
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/Zstandard.PlatformNotSupported.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/Zstandard.PlatformNotSupported.cs
index e8f1766716cf7c..2e5987531101bf 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/Zstandard.PlatformNotSupported.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/Zstandard.PlatformNotSupported.cs
@@ -21,13 +21,13 @@ public sealed class ZstandardCompressionOptions
public ZstandardCompressionOptions() => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public bool AppendChecksum { get => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); set => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); }
public static int DefaultQuality => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
- public static int DefaultWindowLog => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
+ public static int DefaultWindowLog2 => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public ZstandardDictionary? Dictionary { get => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); set => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); }
public bool EnableLongDistanceMatching { get => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); set => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); }
public static int MaxQuality => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
- public static int MaxWindowLog => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
+ public static int MaxWindowLog2 => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public static int MinQuality => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
- public static int MinWindowLog => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
+ public static int MinWindowLog2 => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public int Quality { get => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); set => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); }
public int TargetBlockSize { get => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); set => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); }
public int WindowLog2 { get => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); set => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression); }
@@ -38,10 +38,10 @@ public sealed class ZstandardCompressionOptions
public sealed class ZstandardDecoder : IDisposable
{
public ZstandardDecoder() => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
- public ZstandardDecoder(int maxWindowLog) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
+ public ZstandardDecoder(int maxWindowLog2) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public ZstandardDecoder(ZstandardDecompressionOptions decompressionOptions) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public ZstandardDecoder(ZstandardDictionary dictionary) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
- public ZstandardDecoder(ZstandardDictionary dictionary, int maxWindowLog) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
+ public ZstandardDecoder(ZstandardDictionary dictionary, int maxWindowLog2) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public System.Buffers.OperationStatus Decompress(ReadOnlySpan source, Span destination, out int bytesConsumed, out int bytesWritten) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public void Dispose() { }
public void Reset() => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
@@ -69,10 +69,10 @@ public sealed class ZstandardEncoder : IDisposable
{
public ZstandardEncoder() => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public ZstandardEncoder(int quality) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
- public ZstandardEncoder(int quality, int windowLog) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
+ public ZstandardEncoder(int quality, int windowLog2) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public ZstandardEncoder(ZstandardCompressionOptions compressionOptions) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public ZstandardEncoder(ZstandardDictionary dictionary) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
- public ZstandardEncoder(ZstandardDictionary dictionary, int windowLog) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
+ public ZstandardEncoder(ZstandardDictionary dictionary, int windowLog2) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public System.Buffers.OperationStatus Compress(ReadOnlySpan source, Span destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public void Dispose() { }
public System.Buffers.OperationStatus Flush(Span destination, out int bytesWritten) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
@@ -81,8 +81,8 @@ public void Dispose() { }
public void SetPrefix(ReadOnlyMemory prefix) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public void SetSourceLength(long length) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
- public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
- public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, ZstandardDictionary dictionary, int windowLog) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
+ public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog2) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
+ public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, ZstandardDictionary dictionary, int windowLog2) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ZstandardCompression);
}
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardCompressionOptions.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardCompressionOptions.cs
index e89bc8b5ce3b8d..57f28fb65e7e7f 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardCompressionOptions.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardCompressionOptions.cs
@@ -17,14 +17,14 @@ public sealed class ZstandardCompressionOptions
/// Gets the maximum compression quality level.
public static int MaxQuality => ZstandardUtils.Quality_Max;
- /// Gets the default window size to use for Zstandard compression.
- public static int DefaultWindowLog => ZstandardUtils.WindowLog_Default;
+ /// Gets the default base-2 logarithm of the window size to use for Zstandard compression.
+ public static int DefaultWindowLog2 => ZstandardUtils.WindowLog_Default;
- /// Gets the minimum window size to use for Zstandard compression.
- public static int MinWindowLog => ZstandardUtils.WindowLog_Min;
+ /// Gets the minimum base-2 logarithm of the window size to use for Zstandard compression.
+ public static int MinWindowLog2 => ZstandardUtils.WindowLog_Min;
- /// Gets the maximum window size to use for Zstandard compression.
- public static int MaxWindowLog => ZstandardUtils.WindowLog_Max;
+ /// Gets the maximum base-2 logarithm of the window size to use for Zstandard compression.
+ public static int MaxWindowLog2 => ZstandardUtils.WindowLog_Max;
/// Initializes a new instance of the class.
public ZstandardCompressionOptions()
@@ -61,10 +61,10 @@ public int Quality
///
/// The window size determines how much data the compressor can reference for finding matches.
/// Larger window sizes can improve compression ratios for large files but require more memory.
- /// The valid range is from to .
+ /// The valid range is from to .
/// Value 0 indicates the implementation-defined default window size.
///
- /// The value is not 0 and is not between and .
+ /// The value is not 0 and is not between and .
public int WindowLog2
{
get;
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs
index 294616ede81e43..9398ac3445c331 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs
@@ -33,10 +33,10 @@ public ZstandardDecoder()
}
/// Initializes a new instance of the class with the specified maximum window size.
- /// The maximum window size to use for decompression, expressed as base 2 logarithm.
- /// is not between the minimum and maximum allowed values.
+ /// The maximum base-2 logarithm of the window size to use for decompression.
+ /// is not between the minimum and maximum allowed values.
/// Failed to create the instance.
- public ZstandardDecoder(int maxWindowLog)
+ public ZstandardDecoder(int maxWindowLog2)
{
_disposed = false;
@@ -44,9 +44,9 @@ public ZstandardDecoder(int maxWindowLog)
try
{
- if (maxWindowLog != 0)
+ if (maxWindowLog2 != 0)
{
- SetWindowLog(maxWindowLog);
+ SetWindowLog(maxWindowLog2);
}
}
catch
@@ -112,11 +112,11 @@ public ZstandardDecoder(ZstandardDecompressionOptions decompressionOptions)
/// Initializes a new instance of the class with the specified dictionary and maximum window size.
/// The decompression dictionary to use.
- /// The maximum window size to use for decompression, expressed as base 2 logarithm.
+ /// The maximum base-2 logarithm of the window size to use for decompression.
/// is null.
- /// is not between the minimum and maximum allowed values.
+ /// is not between the minimum and maximum allowed values.
/// Failed to create the instance.
- public ZstandardDecoder(ZstandardDictionary dictionary, int maxWindowLog)
+ public ZstandardDecoder(ZstandardDictionary dictionary, int maxWindowLog2)
{
ArgumentNullException.ThrowIfNull(dictionary);
@@ -126,9 +126,9 @@ public ZstandardDecoder(ZstandardDictionary dictionary, int maxWindowLog)
try
{
- if (maxWindowLog != 0)
+ if (maxWindowLog2 != 0)
{
- SetWindowLog(maxWindowLog);
+ SetWindowLog(maxWindowLog2);
}
SetDictionary(dictionary);
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecompressionOptions.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecompressionOptions.cs
index 452c903b5ecf09..20ca85904f2a61 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecompressionOptions.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecompressionOptions.cs
@@ -12,10 +12,10 @@ public sealed class ZstandardDecompressionOptions
/// Gets or sets the maximum allowed base-2 logarithm of the window size when decompressing payloads.
/// The maximum allowed base-2 logarithm of the window size for decompression.
///
- /// The valid range is from to .
+ /// The valid range is from to .
/// Value 0 indicates the implementation-defined default window size.
///
- /// The value is not 0 and is not between and .
+ /// The value is not 0 and is not between and .
public int MaxWindowLog2
{
get;
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs
index 67808734d7db03..cbd3fb9eff15df 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs
@@ -75,10 +75,10 @@ public ZstandardEncoder(ZstandardDictionary dictionary)
/// Initializes a new instance of the class with the specified quality and window size.
/// The compression quality level.
- /// The window size for compression, expressed as base 2 logarithm.
- /// is not between the minimum and maximum allowed values, or is not between the minimum and maximum allowed values.
+ /// The base-2 logarithm of the window size for compression.
+ /// is not between the minimum and maximum allowed values, or is not between the minimum and maximum allowed values.
/// Failed to create the instance.
- public ZstandardEncoder(int quality, int windowLog)
+ public ZstandardEncoder(int quality, int windowLog2)
{
_disposed = false;
InitializeEncoder();
@@ -89,9 +89,9 @@ public ZstandardEncoder(int quality, int windowLog)
{
SetQuality(_context, quality);
}
- if (windowLog != 0)
+ if (windowLog2 != 0)
{
- SetWindowLog(_context, windowLog);
+ SetWindowLog(_context, windowLog2);
}
}
catch
@@ -103,11 +103,11 @@ public ZstandardEncoder(int quality, int windowLog)
/// Initializes a new instance of the class with the specified dictionary and window size.
/// The compression dictionary to use.
- /// The window size for compression, expressed as base 2 logarithm.
+ /// The base-2 logarithm of the window size for compression.
/// is null.
- /// is not between the minimum and maximum allowed values.
+ /// is not between the minimum and maximum allowed values.
/// Failed to create the instance.
- public ZstandardEncoder(ZstandardDictionary dictionary, int windowLog)
+ public ZstandardEncoder(ZstandardDictionary dictionary, int windowLog2)
{
ArgumentNullException.ThrowIfNull(dictionary);
@@ -118,9 +118,9 @@ public ZstandardEncoder(ZstandardDictionary dictionary, int windowLog)
{
SetDictionary(dictionary);
- if (windowLog != 0)
+ if (windowLog2 != 0)
{
- SetWindowLog(_context, windowLog);
+ SetWindowLog(_context, windowLog2);
}
}
catch
@@ -321,12 +321,12 @@ public static bool TryCompress(ReadOnlySpan source, Span destination
/// The buffer to write the compressed data to.
/// When this method returns , contains the number of bytes written to the destination.
/// The compression quality level.
- /// The window size for compression, expressed as base 2 logarithm.
+ /// The base-2 logarithm of the window size for compression.
/// on success; if the destination buffer is too small.
- /// or is out of the valid range.
- public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog)
+ /// or is out of the valid range.
+ public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog2)
{
- return TryCompressCore(source, destination, out bytesWritten, quality, windowLog, null);
+ return TryCompressCore(source, destination, out bytesWritten, quality, windowLog2, null);
}
/// Attempts to compress the specified data with the specified dictionary and window size.
@@ -334,14 +334,14 @@ public static bool TryCompress(ReadOnlySpan source, Span destination
/// The buffer to write the compressed data to.
/// When this method returns , contains the number of bytes written to the destination.
/// The compression dictionary to use.
- /// The window size for compression, expressed as base 2 logarithm.
+ /// The base-2 logarithm of the window size for compression.
/// on success; if the destination buffer is too small.
/// is null.
- /// is out of the valid range.
- public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, ZstandardDictionary dictionary, int windowLog)
+ /// is out of the valid range.
+ public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, ZstandardDictionary dictionary, int windowLog2)
{
ArgumentNullException.ThrowIfNull(dictionary);
- return TryCompressCore(source, destination, out bytesWritten, 0, windowLog, dictionary);
+ return TryCompressCore(source, destination, out bytesWritten, 0, windowLog2, dictionary);
}
internal static bool TryCompressCore(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog, ZstandardDictionary? dictionary)
diff --git a/src/libraries/System.IO.Compression/tests/ZLibCompressionOptionsUnitTests.cs b/src/libraries/System.IO.Compression/tests/ZLibCompressionOptionsUnitTests.cs
index 7e829cd300859d..c267e9fc80f046 100644
--- a/src/libraries/System.IO.Compression/tests/ZLibCompressionOptionsUnitTests.cs
+++ b/src/libraries/System.IO.Compression/tests/ZLibCompressionOptionsUnitTests.cs
@@ -78,9 +78,9 @@ public void WindowLog2_SetOutOfRange_ThrowsArgumentOutOfRangeException(int windo
[Fact]
public void StaticWindowLogProperties_ReturnExpectedValues()
{
- Assert.Equal(15, ZLibCompressionOptions.DefaultWindowLog);
- Assert.Equal(8, ZLibCompressionOptions.MinWindowLog);
- Assert.Equal(15, ZLibCompressionOptions.MaxWindowLog);
+ Assert.Equal(15, ZLibCompressionOptions.DefaultWindowLog2);
+ Assert.Equal(8, ZLibCompressionOptions.MinWindowLog2);
+ Assert.Equal(15, ZLibCompressionOptions.MaxWindowLog2);
}
}
}
diff --git a/src/libraries/System.IO.Compression/tests/ZLibEncoderDecoderTestBase.cs b/src/libraries/System.IO.Compression/tests/ZLibEncoderDecoderTestBase.cs
index 703133663df626..13174f9b87430e 100644
--- a/src/libraries/System.IO.Compression/tests/ZLibEncoderDecoderTestBase.cs
+++ b/src/libraries/System.IO.Compression/tests/ZLibEncoderDecoderTestBase.cs
@@ -11,7 +11,7 @@ public abstract class ZLibEncoderDecoderTestBase : EncoderDecoderTestBase
protected override bool SupportsDictionaries => false;
protected override bool SupportsReset => false;
- protected override string WindowLogParamName => "windowLog";
+ protected override string WindowLogParamName => "windowLog2";
protected override string InputLengthParamName => "inputLength";
// Quality maps to zlib compression level (0-9)
@@ -38,7 +38,7 @@ protected override DecoderAdapter CreateDecoder(DictionaryAdapter dictionary) =>
protected override DictionaryAdapter CreateDictionary(ReadOnlySpan dictionaryData, int quality) =>
throw new NotSupportedException();
- protected override bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, DictionaryAdapter dictionary, int windowLog) =>
+ protected override bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, DictionaryAdapter dictionary, int windowLog2) =>
throw new NotSupportedException();
protected override bool TryDecompress(ReadOnlySpan source, Span destination, out int bytesWritten, DictionaryAdapter dictionary) =>
diff --git a/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardEncoderDecoderTests.cs b/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardEncoderDecoderTests.cs
index da0ba6bd14e0f1..e784268bc214c2 100644
--- a/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardEncoderDecoderTests.cs
+++ b/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardEncoderDecoderTests.cs
@@ -115,10 +115,10 @@ public void Decoder_Ctor_MaxWindowLog_InvalidValues()
{
using ZstandardDictionary dictionary = ZstandardDictionary.Create(new byte[] { 0x01, 0x02, 0x03, 0x04 }, quality: 3);
- Assert.Throws("maxWindowLog", () => new ZstandardDecoder(maxWindowLog: 8));
- Assert.Throws("maxWindowLog", () => new ZstandardDecoder(maxWindowLog: 33));
- Assert.Throws("maxWindowLog", () => new ZstandardDecoder(dictionary, maxWindowLog: 8));
- Assert.Throws("maxWindowLog", () => new ZstandardDecoder(dictionary, maxWindowLog: 33));
+ Assert.Throws("maxWindowLog2", () => new ZstandardDecoder(maxWindowLog2: 8));
+ Assert.Throws("maxWindowLog2", () => new ZstandardDecoder(maxWindowLog2: 33));
+ Assert.Throws("maxWindowLog2", () => new ZstandardDecoder(dictionary, maxWindowLog2: 8));
+ Assert.Throws("maxWindowLog2", () => new ZstandardDecoder(dictionary, maxWindowLog2: 33));
}
[Fact]
@@ -513,7 +513,7 @@ public void Decompress_WindowTooLarge_ThrowsIOException()
// by default, decoder will not allow windows larger than 27 to protect against memory DOS attacks
int largeWindowLog = 28; // 256 MB window
- using ZstandardEncoder encoder = new(quality: 3, windowLog: largeWindowLog);
+ using ZstandardEncoder encoder = new(quality: 3, windowLog2: largeWindowLog);
// perform in two steps so that the encoder does not know the size upfront
OperationStatus result = encoder.Compress(input, output, out int bytesConsumed, out int bytesWritten, isFinalBlock: false);
@@ -529,10 +529,10 @@ public void Decompress_WindowTooLarge_ThrowsIOException()
using ZstandardDecoder decoder = new();
var ex = Assert.Throws(() => decoder.Decompress(output.AsSpan(0, compressedSize), decompressed, out _, out _));
- Assert.Contains("maxWindowLog", ex.Message);
+ Assert.Contains("maxWindowLog2", ex.Message);
- // now try with increased maxWindowLog
- using ZstandardDecoder adjustedDecoder = new(maxWindowLog: largeWindowLog);
+ // now try with increased maxWindowLog2
+ using ZstandardDecoder adjustedDecoder = new(maxWindowLog2: largeWindowLog);
var decompressResult = adjustedDecoder.Decompress(output.AsSpan(0, compressedSize), decompressed, out bytesConsumed, out bytesWritten);
Assert.Equal(OperationStatus.Done, decompressResult);
Assert.Equal(input.Length, bytesWritten);
From fd2097876ff82247f54f8d01cda0f3ab2d5c7311 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 29 Jun 2026 14:09:42 +0000
Subject: [PATCH 4/7] Fix WindowLog2 exception parameter names
Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
---
.../System/IO/Compression/DeflateEncoder.cs | 12 ++++++------
.../src/System/IO/Compression/GZipEncoder.cs | 2 +-
.../src/System/IO/Compression/ZLibEncoder.cs | 2 +-
.../Compression/Zstandard/ZstandardDecoder.cs | 10 +++++-----
.../Compression/Zstandard/ZstandardEncoder.cs | 18 +++++++++---------
5 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs
index 2d7798f93d693f..b219775a83c886 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs
@@ -55,7 +55,7 @@ public DeflateEncoder(ZLibCompressionOptions options)
/// is not in the valid range (0-9 or -1), or is not in the valid range (8-15 or -1).
/// Failed to create the instance.
public DeflateEncoder(int quality, int windowLog2)
- : this(quality, windowLog2, CompressionFormat.Deflate)
+ : this(quality, windowLog2, CompressionFormat.Deflate, nameof(windowLog2))
{
}
@@ -63,10 +63,10 @@ public DeflateEncoder(int quality, int windowLog2)
/// Internal constructor that accepts quality, windowLog (8-15), and format.
/// Validates both parameters and transforms windowLog to windowBits based on format.
///
- internal DeflateEncoder(int quality, int windowLog, CompressionFormat format)
+ internal DeflateEncoder(int quality, int windowLog, CompressionFormat format, string windowLogParamName = "windowLog")
{
ValidateQuality(quality);
- ValidateWindowLog(windowLog);
+ ValidateWindowLog(windowLog, windowLogParamName);
int windowBits = CompressionFormatHelper.ResolveWindowBits(windowLog, format);
@@ -110,12 +110,12 @@ private static void ValidateQuality(int quality)
}
}
- private static void ValidateWindowLog(int windowLog)
+ private static void ValidateWindowLog(int windowLog, string paramName)
{
if (windowLog != -1)
{
- ArgumentOutOfRangeException.ThrowIfLessThan(windowLog, ZLibNative.MinWindowLog, nameof(windowLog));
- ArgumentOutOfRangeException.ThrowIfGreaterThan(windowLog, ZLibNative.MaxWindowLog, nameof(windowLog));
+ ArgumentOutOfRangeException.ThrowIfLessThan(windowLog, ZLibNative.MinWindowLog, paramName);
+ ArgumentOutOfRangeException.ThrowIfGreaterThan(windowLog, ZLibNative.MaxWindowLog, paramName);
}
}
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipEncoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipEncoder.cs
index b839dae37a03ed..63e133ec48e934 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipEncoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipEncoder.cs
@@ -53,7 +53,7 @@ public GZipEncoder(ZLibCompressionOptions options)
/// Failed to create the instance.
public GZipEncoder(int quality, int windowLog2)
{
- _deflateEncoder = new DeflateEncoder(quality, windowLog2, CompressionFormat.GZip);
+ _deflateEncoder = new DeflateEncoder(quality, windowLog2, CompressionFormat.GZip, nameof(windowLog2));
}
///
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibEncoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibEncoder.cs
index 42091b946ce526..23fed2fd126d93 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibEncoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibEncoder.cs
@@ -53,7 +53,7 @@ public ZLibEncoder(ZLibCompressionOptions options)
/// Failed to create the instance.
public ZLibEncoder(int quality, int windowLog2)
{
- _deflateEncoder = new DeflateEncoder(quality, windowLog2, CompressionFormat.ZLib);
+ _deflateEncoder = new DeflateEncoder(quality, windowLog2, CompressionFormat.ZLib, nameof(windowLog2));
}
///
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs
index 9398ac3445c331..09a6288aa2ef8e 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs
@@ -46,7 +46,7 @@ public ZstandardDecoder(int maxWindowLog2)
{
if (maxWindowLog2 != 0)
{
- SetWindowLog(maxWindowLog2);
+ SetWindowLog(maxWindowLog2, nameof(maxWindowLog2));
}
}
catch
@@ -128,7 +128,7 @@ public ZstandardDecoder(ZstandardDictionary dictionary, int maxWindowLog2)
{
if (maxWindowLog2 != 0)
{
- SetWindowLog(maxWindowLog2);
+ SetWindowLog(maxWindowLog2, nameof(maxWindowLog2));
}
SetDictionary(dictionary);
@@ -388,14 +388,14 @@ private void EnsureNotDisposed()
ObjectDisposedException.ThrowIf(_disposed, this);
}
- internal void SetWindowLog(int maxWindowLog)
+ internal void SetWindowLog(int maxWindowLog, string paramName = "maxWindowLog")
{
Debug.Assert(_context != null);
if (maxWindowLog != 0)
{
- ArgumentOutOfRangeException.ThrowIfLessThan(maxWindowLog, ZstandardUtils.WindowLog_Min, nameof(maxWindowLog));
- ArgumentOutOfRangeException.ThrowIfGreaterThan(maxWindowLog, ZstandardUtils.WindowLog_Max, nameof(maxWindowLog));
+ ArgumentOutOfRangeException.ThrowIfLessThan(maxWindowLog, ZstandardUtils.WindowLog_Min, paramName);
+ ArgumentOutOfRangeException.ThrowIfGreaterThan(maxWindowLog, ZstandardUtils.WindowLog_Max, paramName);
}
nuint result = Interop.Zstd.ZSTD_DCtx_setParameter(_context, Interop.Zstd.ZstdDParameter.ZSTD_d_windowLogMax, maxWindowLog);
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs
index cbd3fb9eff15df..ed8488ad21fe4a 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs
@@ -91,7 +91,7 @@ public ZstandardEncoder(int quality, int windowLog2)
}
if (windowLog2 != 0)
{
- SetWindowLog(_context, windowLog2);
+ SetWindowLog(_context, windowLog2, nameof(windowLog2));
}
}
catch
@@ -120,7 +120,7 @@ public ZstandardEncoder(ZstandardDictionary dictionary, int windowLog2)
if (windowLog2 != 0)
{
- SetWindowLog(_context, windowLog2);
+ SetWindowLog(_context, windowLog2, nameof(windowLog2));
}
}
catch
@@ -326,7 +326,7 @@ public static bool TryCompress(ReadOnlySpan source, Span destination
/// or is out of the valid range.
public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog2)
{
- return TryCompressCore(source, destination, out bytesWritten, quality, windowLog2, null);
+ return TryCompressCore(source, destination, out bytesWritten, quality, windowLog2, null, nameof(windowLog2));
}
/// Attempts to compress the specified data with the specified dictionary and window size.
@@ -341,10 +341,10 @@ public static bool TryCompress(ReadOnlySpan source, Span destination
public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, ZstandardDictionary dictionary, int windowLog2)
{
ArgumentNullException.ThrowIfNull(dictionary);
- return TryCompressCore(source, destination, out bytesWritten, 0, windowLog2, dictionary);
+ return TryCompressCore(source, destination, out bytesWritten, 0, windowLog2, dictionary, nameof(windowLog2));
}
- internal static bool TryCompressCore(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog, ZstandardDictionary? dictionary)
+ internal static bool TryCompressCore(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog, ZstandardDictionary? dictionary, string windowLogParamName = "windowLog")
{
bytesWritten = 0;
@@ -365,7 +365,7 @@ internal static bool TryCompressCore(ReadOnlySpan source, Span desti
if (windowLog != 0)
{
- SetWindowLog(ctx, windowLog);
+ SetWindowLog(ctx, windowLog, windowLogParamName);
}
unsafe
@@ -467,12 +467,12 @@ internal static void SetQuality(SafeZstdCompressHandle handle, int quality)
SetParameter(handle, Interop.Zstd.ZstdCParameter.ZSTD_c_compressionLevel, quality);
}
- internal static void SetWindowLog(SafeZstdCompressHandle handle, int windowLog)
+ internal static void SetWindowLog(SafeZstdCompressHandle handle, int windowLog, string paramName = "windowLog")
{
if (windowLog != 0)
{
- ArgumentOutOfRangeException.ThrowIfLessThan(windowLog, ZstandardUtils.WindowLog_Min, nameof(windowLog));
- ArgumentOutOfRangeException.ThrowIfGreaterThan(windowLog, ZstandardUtils.WindowLog_Max, nameof(windowLog));
+ ArgumentOutOfRangeException.ThrowIfLessThan(windowLog, ZstandardUtils.WindowLog_Min, paramName);
+ ArgumentOutOfRangeException.ThrowIfGreaterThan(windowLog, ZstandardUtils.WindowLog_Max, paramName);
}
SetParameter(handle, Interop.Zstd.ZstdCParameter.ZSTD_c_windowLog, windowLog);
From e2c16404b33ab326678118c738287615cec94d73 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 29 Jun 2026 15:19:50 +0000
Subject: [PATCH 5/7] Adjust WindowLog2 parameter renames per review
Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
---
.../Compression/Zstandard/ZstandardDecoder.cs | 14 +++++------
.../Compression/Zstandard/ZstandardEncoder.cs | 24 +++++++++----------
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs
index 09a6288aa2ef8e..145683dc459107 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs
@@ -46,7 +46,7 @@ public ZstandardDecoder(int maxWindowLog2)
{
if (maxWindowLog2 != 0)
{
- SetWindowLog(maxWindowLog2, nameof(maxWindowLog2));
+ SetWindowLog(maxWindowLog2);
}
}
catch
@@ -128,7 +128,7 @@ public ZstandardDecoder(ZstandardDictionary dictionary, int maxWindowLog2)
{
if (maxWindowLog2 != 0)
{
- SetWindowLog(maxWindowLog2, nameof(maxWindowLog2));
+ SetWindowLog(maxWindowLog2);
}
SetDictionary(dictionary);
@@ -388,17 +388,17 @@ private void EnsureNotDisposed()
ObjectDisposedException.ThrowIf(_disposed, this);
}
- internal void SetWindowLog(int maxWindowLog, string paramName = "maxWindowLog")
+ internal void SetWindowLog(int maxWindowLog2)
{
Debug.Assert(_context != null);
- if (maxWindowLog != 0)
+ if (maxWindowLog2 != 0)
{
- ArgumentOutOfRangeException.ThrowIfLessThan(maxWindowLog, ZstandardUtils.WindowLog_Min, paramName);
- ArgumentOutOfRangeException.ThrowIfGreaterThan(maxWindowLog, ZstandardUtils.WindowLog_Max, paramName);
+ ArgumentOutOfRangeException.ThrowIfLessThan(maxWindowLog2, ZstandardUtils.WindowLog_Min, nameof(maxWindowLog2));
+ ArgumentOutOfRangeException.ThrowIfGreaterThan(maxWindowLog2, ZstandardUtils.WindowLog_Max, nameof(maxWindowLog2));
}
- nuint result = Interop.Zstd.ZSTD_DCtx_setParameter(_context, Interop.Zstd.ZstdDParameter.ZSTD_d_windowLogMax, maxWindowLog);
+ nuint result = Interop.Zstd.ZSTD_DCtx_setParameter(_context, Interop.Zstd.ZstdDParameter.ZSTD_d_windowLogMax, maxWindowLog2);
ZstandardUtils.ThrowIfError(result);
}
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs
index ed8488ad21fe4a..e01fc31a103602 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs
@@ -91,7 +91,7 @@ public ZstandardEncoder(int quality, int windowLog2)
}
if (windowLog2 != 0)
{
- SetWindowLog(_context, windowLog2, nameof(windowLog2));
+ SetWindowLog(_context, windowLog2);
}
}
catch
@@ -120,7 +120,7 @@ public ZstandardEncoder(ZstandardDictionary dictionary, int windowLog2)
if (windowLog2 != 0)
{
- SetWindowLog(_context, windowLog2, nameof(windowLog2));
+ SetWindowLog(_context, windowLog2);
}
}
catch
@@ -326,7 +326,7 @@ public static bool TryCompress(ReadOnlySpan source, Span destination
/// or is out of the valid range.
public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog2)
{
- return TryCompressCore(source, destination, out bytesWritten, quality, windowLog2, null, nameof(windowLog2));
+ return TryCompressCore(source, destination, out bytesWritten, quality, windowLog2, null);
}
/// Attempts to compress the specified data with the specified dictionary and window size.
@@ -341,10 +341,10 @@ public static bool TryCompress(ReadOnlySpan source, Span destination
public static bool TryCompress(ReadOnlySpan source, Span destination, out int bytesWritten, ZstandardDictionary dictionary, int windowLog2)
{
ArgumentNullException.ThrowIfNull(dictionary);
- return TryCompressCore(source, destination, out bytesWritten, 0, windowLog2, dictionary, nameof(windowLog2));
+ return TryCompressCore(source, destination, out bytesWritten, 0, windowLog2, dictionary);
}
- internal static bool TryCompressCore(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog, ZstandardDictionary? dictionary, string windowLogParamName = "windowLog")
+ internal static bool TryCompressCore(ReadOnlySpan source, Span destination, out int bytesWritten, int quality, int windowLog2, ZstandardDictionary? dictionary)
{
bytesWritten = 0;
@@ -363,9 +363,9 @@ internal static bool TryCompressCore(ReadOnlySpan source, Span desti
SetQuality(ctx, quality);
}
- if (windowLog != 0)
+ if (windowLog2 != 0)
{
- SetWindowLog(ctx, windowLog, windowLogParamName);
+ SetWindowLog(ctx, windowLog2);
}
unsafe
@@ -467,15 +467,15 @@ internal static void SetQuality(SafeZstdCompressHandle handle, int quality)
SetParameter(handle, Interop.Zstd.ZstdCParameter.ZSTD_c_compressionLevel, quality);
}
- internal static void SetWindowLog(SafeZstdCompressHandle handle, int windowLog, string paramName = "windowLog")
+ internal static void SetWindowLog(SafeZstdCompressHandle handle, int windowLog2)
{
- if (windowLog != 0)
+ if (windowLog2 != 0)
{
- ArgumentOutOfRangeException.ThrowIfLessThan(windowLog, ZstandardUtils.WindowLog_Min, paramName);
- ArgumentOutOfRangeException.ThrowIfGreaterThan(windowLog, ZstandardUtils.WindowLog_Max, paramName);
+ ArgumentOutOfRangeException.ThrowIfLessThan(windowLog2, ZstandardUtils.WindowLog_Min, nameof(windowLog2));
+ ArgumentOutOfRangeException.ThrowIfGreaterThan(windowLog2, ZstandardUtils.WindowLog_Max, nameof(windowLog2));
}
- SetParameter(handle, Interop.Zstd.ZstdCParameter.ZSTD_c_windowLog, windowLog);
+ SetParameter(handle, Interop.Zstd.ZstdCParameter.ZSTD_c_windowLog, windowLog2);
}
internal void SetDictionary(ZstandardDictionary dictionary)
From a9dd414dcc976c26302faea4a26f64c78d0e6ce0 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 29 Jun 2026 15:58:26 +0000
Subject: [PATCH 6/7] Fix remaining WindowLog2 parameter renames
Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
---
.../System/IO/Compression/DeflateEncoder.cs | 20 +++++++++----------
.../src/System/IO/Compression/GZipEncoder.cs | 2 +-
.../src/System/IO/Compression/ZLibEncoder.cs | 2 +-
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs
index b219775a83c886..4b036d2a56bad6 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs
@@ -55,20 +55,20 @@ public DeflateEncoder(ZLibCompressionOptions options)
/// is not in the valid range (0-9 or -1), or is not in the valid range (8-15 or -1).
/// Failed to create the instance.
public DeflateEncoder(int quality, int windowLog2)
- : this(quality, windowLog2, CompressionFormat.Deflate, nameof(windowLog2))
+ : this(quality, windowLog2, CompressionFormat.Deflate)
{
}
///
- /// Internal constructor that accepts quality, windowLog (8-15), and format.
- /// Validates both parameters and transforms windowLog to windowBits based on format.
+ /// Internal constructor that accepts quality, windowLog2 (8-15), and format.
+ /// Validates both parameters and transforms windowLog2 to windowBits based on format.
///
- internal DeflateEncoder(int quality, int windowLog, CompressionFormat format, string windowLogParamName = "windowLog")
+ internal DeflateEncoder(int quality, int windowLog2, CompressionFormat format)
{
ValidateQuality(quality);
- ValidateWindowLog(windowLog, windowLogParamName);
+ ValidateWindowLog(windowLog2);
- int windowBits = CompressionFormatHelper.ResolveWindowBits(windowLog, format);
+ int windowBits = CompressionFormatHelper.ResolveWindowBits(windowLog2, format);
int memLevel = quality == (int)ZLibNative.CompressionLevel.NoCompression
? ZLibNative.Deflate_NoCompressionMemLevel
@@ -110,12 +110,12 @@ private static void ValidateQuality(int quality)
}
}
- private static void ValidateWindowLog(int windowLog, string paramName)
+ private static void ValidateWindowLog(int windowLog2)
{
- if (windowLog != -1)
+ if (windowLog2 != -1)
{
- ArgumentOutOfRangeException.ThrowIfLessThan(windowLog, ZLibNative.MinWindowLog, paramName);
- ArgumentOutOfRangeException.ThrowIfGreaterThan(windowLog, ZLibNative.MaxWindowLog, paramName);
+ ArgumentOutOfRangeException.ThrowIfLessThan(windowLog2, ZLibNative.MinWindowLog, nameof(windowLog2));
+ ArgumentOutOfRangeException.ThrowIfGreaterThan(windowLog2, ZLibNative.MaxWindowLog, nameof(windowLog2));
}
}
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipEncoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipEncoder.cs
index 63e133ec48e934..b839dae37a03ed 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipEncoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/GZipEncoder.cs
@@ -53,7 +53,7 @@ public GZipEncoder(ZLibCompressionOptions options)
/// Failed to create the instance.
public GZipEncoder(int quality, int windowLog2)
{
- _deflateEncoder = new DeflateEncoder(quality, windowLog2, CompressionFormat.GZip, nameof(windowLog2));
+ _deflateEncoder = new DeflateEncoder(quality, windowLog2, CompressionFormat.GZip);
}
///
diff --git a/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibEncoder.cs b/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibEncoder.cs
index 23fed2fd126d93..42091b946ce526 100644
--- a/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibEncoder.cs
+++ b/src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibEncoder.cs
@@ -53,7 +53,7 @@ public ZLibEncoder(ZLibCompressionOptions options)
/// Failed to create the instance.
public ZLibEncoder(int quality, int windowLog2)
{
- _deflateEncoder = new DeflateEncoder(quality, windowLog2, CompressionFormat.ZLib, nameof(windowLog2));
+ _deflateEncoder = new DeflateEncoder(quality, windowLog2, CompressionFormat.ZLib);
}
///
From 339ecb605673cc614f04d144e95c7ee557f68549 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 7 Jul 2026 17:41:20 +0000
Subject: [PATCH 7/7] Rename test parameter maxWindowLog to maxWindowLog2 for
consistency
Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
---
.../tests/Zstandard/ZstandardEncoderDecoderTests.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardEncoderDecoderTests.cs b/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardEncoderDecoderTests.cs
index e784268bc214c2..b298e8bbbfddba 100644
--- a/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardEncoderDecoderTests.cs
+++ b/src/libraries/System.IO.Compression/tests/Zstandard/ZstandardEncoderDecoderTests.cs
@@ -586,9 +586,9 @@ public void Decoder_Ctor_DecompressionOptions_Null_ThrowsArgumentNullException()
[Theory]
[InlineData(0)]
[InlineData(10)]
- public void Decoder_Ctor_DecompressionOptions_Succeeds(int maxWindowLog)
+ public void Decoder_Ctor_DecompressionOptions_Succeeds(int maxWindowLog2)
{
- ZstandardDecompressionOptions options = new() { MaxWindowLog2 = maxWindowLog };
+ ZstandardDecompressionOptions options = new() { MaxWindowLog2 = maxWindowLog2 };
using ZstandardDecoder decoder = new(options);
byte[] testData = ZstandardTestUtils.CreateTestData(100);