Fix Issue 2138 - Allow more than 65535 files in Zip archives #2914
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.
The limit of 65536 files in an archive was bypassed by adding support for reading and writing the Zip64 flavour of Zip archives, which has two extra blocks before the end of central directory record (eocd), namely the zip64 eocd and zip64 eocd locator.
Other than that, all is the same, files over 4 GB still aren't supported, but with the current implementation of zip creating the complete archive in memory it wouldn't make much sense anyway. I have, however, changed the index used in the reader from int to uint, because IMO it unnecessarily limited the archives to 2 GB.
To test the code, I have written a small utility - https://github.com/fgda/d-stuff/blob/default/ziptest.d -
and tried it in both 32- and 64-bit on win64 with dmd together with 7-zip and Cygwin/zip, to test reading and writing. So far, with success.
This is my first pull request, be gentle. :)
Bugzilla: https://issues.dlang.org/show_bug.cgi?id=2138