Open
Rename compression WindowLog APIs to WindowLog2#129977
Conversation
Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Rename WindowLog properties to WindowLog2 in compression options
Rename compression WindowLog APIs to WindowLog2
Jun 29, 2026
rzikm
reviewed
Jun 29, 2026
Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
Contributor
Author
Contributor
|
Tagging subscribers to this area: @karelz, @dotnet/area-system-io-compression |
rzikm
reviewed
Jun 29, 2026
Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
Contributor
Author
Contributor
There was a problem hiding this comment.
Pull request overview
Renames the WindowLog / MaxWindowLog public-facing compression option members and related parameter names to *WindowLog2 / *MaxWindowLog2 to make the base-2 logarithm semantics explicit and consistent across Brotli, zlib/deflate/gzip, and Zstandard APIs.
Changes:
- Renames public option properties and related helpers/constants to
*WindowLog2(and Zstd decompressionMaxWindowLog2), including ref assembly updates. - Updates encoder/decoder constructors, parameter validation (
ArgumentOutOfRangeException.ParamName), and call sites to use the new parameter names. - Updates tests and user-facing error text to match the new naming.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.IO.Compression/tests/Zstandard/ZstandardEncoderDecoderTests.cs | Updates Zstd encoder/decoder tests for renamed ctor parameters and messages. |
| src/libraries/System.IO.Compression/tests/Zstandard/ZstandardCompressionOptionsTests.cs | Updates Zstd options tests to WindowLog2 / MaxWindowLog2. |
| src/libraries/System.IO.Compression/tests/ZLibEncoderDecoderTestBase.cs | Aligns shared zlib test base to expect windowLog2 param name. |
| src/libraries/System.IO.Compression/tests/ZLibCompressionOptionsUnitTests.cs | Renames zlib options tests for WindowLog2 and *WindowLog2 statics. |
| src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs | Renames Zstd encoder ctors/overloads and validation to windowLog2. |
| src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecompressionOptions.cs | Renames and validates decompression option MaxWindowLog2. |
| src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs | Renames Zstd decoder ctors/validation to maxWindowLog2. |
| src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardCompressionOptions.cs | Renames Zstd compression option WindowLog2 and related statics/docs. |
| src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/Zstandard.PlatformNotSupported.cs | Updates platform stub members/ctors to *WindowLog2 naming. |
| src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibStream.cs | Uses ZLibCompressionOptions.WindowLog2 when resolving window bits. |
| src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibEncoder.cs | Renames zlib encoder ctor/overload parameter to windowLog2. |
| src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibCompressionOptions.cs | Renames zlib options property/fields/statics to *WindowLog2. |
| src/libraries/System.IO.Compression/src/System/IO/Compression/GZipStream.cs | Uses ZLibCompressionOptions.WindowLog2 when resolving window bits. |
| src/libraries/System.IO.Compression/src/System/IO/Compression/GZipEncoder.cs | Renames gzip encoder ctor/overload parameter to windowLog2. |
| src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs | Uses ZLibCompressionOptions.WindowLog2 when resolving window bits. |
| src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs | Renames deflate encoder ctors/overloads and validation to windowLog2. |
| src/libraries/System.IO.Compression/src/Resources/Strings.resx | Updates the Zstd “window too large” guidance text to maxWindowLog2. |
| src/libraries/System.IO.Compression/ref/System.IO.Compression.cs | Updates public ref surface for renamed members/parameters (*WindowLog2). |
| src/libraries/System.IO.Compression.Brotli/tests/CompressionStreamUnitTests.Brotli.cs | Updates Brotli options tests to WindowLog2. |
| src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliStream.Compress.cs | Uses BrotliCompressionOptions.WindowLog2 when configuring encoder. |
| src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliCompressionOptions.cs | Renames Brotli options property/field to WindowLog2. |
| src/libraries/System.IO.Compression.Brotli/ref/System.IO.Compression.Brotli.cs | Updates Brotli ref surface to expose WindowLog2. |
| src/libraries/Common/tests/System/IO/Compression/EncoderDecoderTestBase.cs | Aligns shared encoder/decoder test expectations to windowLog2 naming. |
| src/libraries/Common/tests/System/IO/Compression/CompressionStreamUnitTestBase.cs | Updates shared stream roundtrip test name and option property to WindowLog2. |
Comment on lines
28
to
+32
| 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) { } |
Comment on lines
589
to
592
| public void Decoder_Ctor_DecompressionOptions_Succeeds(int maxWindowLog) | ||
| { | ||
| ZstandardDecompressionOptions options = new() { MaxWindowLog = maxWindowLog }; | ||
| ZstandardDecompressionOptions options = new() { MaxWindowLog2 = maxWindowLog }; | ||
| using ZstandardDecoder decoder = new(options); |
MihaZupan
approved these changes
Jun 29, 2026
iremyux
approved these changes
Jun 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on a feedback from #128456 (comment)
Renames compression option APIs that exposed
WindowLogso the public surface consistently usesWindowLog2for base-2 log values, including the matching Zstandard decompression propertyMaxWindowLog2.API surface
BrotliCompressionOptions.WindowLog→WindowLog2ZLibCompressionOptions.WindowLog→WindowLog2ZstandardCompressionOptions.WindowLog→WindowLog2ZstandardDecompressionOptions.MaxWindowLog→MaxWindowLog2DefaultWindowLog*,MinWindowLog*,MaxWindowLog*→*WindowLog2windowLog/maxWindowLog→windowLog2/maxWindowLog2Implementation updates
ArgumentOutOfRangeException.ParamNamevalues match the renamed public parameters.Compatibility
Example
Validation
System.IO.CompressionandSystem.IO.Compression.BrotliSystem.IO.Compression.TestsSystem.IO.Compression.Brotli.Tests