unzip: Add support for Enhanced Deflated compression method#1236
Open
CrossVR wants to merge 6 commits into
Open
unzip: Add support for Enhanced Deflated compression method#1236CrossVR wants to merge 6 commits into
CrossVR wants to merge 6 commits into
Conversation
CrossVR
commented
May 12, 2026
| const unsigned short dext[32] = { /* Distance codes 0..31 extra */ | ||
| 128, 128, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, | ||
| 133, 133, 134, 134, 135, 135, 136, 136, 137, 137, 138, 138, | ||
| 139, 139, 140, 140, 141, 141, wbits > 15 ? 142 : 64, wbits > 15 ? 142 : 64}; |
Author
There was a problem hiding this comment.
I could make these static again so they don't get copied onto the stack, but I'll have to either duplicate the tables or add some extra logic below to override these table entries at runtime.
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.
This PR adds decompression support for the Enhanced Deflated compression method, also known under the PKZip trademark "Deflate64". This is most often encountered when dealing with zip files that were compressed using Windows Explorer or WinZip.
My main motivation for this PR is to make it less painful to implement support for this compression method by supporting it through the standard zlib API and to lower the maintenance burden of having to maintain a separate
infback9implementation.This PR does not add support for this compression method for any other formats than zip files and is only supported in zlib through raw inflate API calls by passing in -16 as the window size or by passing a window size of 16 to the
infbackAPI.I know that historically support for this format has been rejected, but I think it's worth revisiting some of the arguments mentioned in zlib's FAQ:
The compression method is proprietary
PKZip has their own implementation under an unregistered trademark, I could not find any patent on this variation of deflate. I don't think there's any issue as long as we don't use any trademarks.
The compression improvements are too small
It is indeed not worth implementing compression support, but I believe the compatibility improvements are substantial enough to warrant the changes to the inflate code.