Repository navigation
Zip miniz reader - #3868
Merged
Merged
Zip miniz reader#3868
Conversation
kuba--/zip is only used by ZipArchive for read-only access, and its reader is a thin layer over miniz's mz_zip_reader_* API. Call miniz directly instead, which removes about 4k lines of bundled third-party code and the local patches the wrapper needed. Entry names are fetched with mz_zip_reader_get_filename into a 64 KiB buffer, because mz_zip_archive_file_stat truncates m_filename to 512 bytes. Directories are still recognised by their trailing slash rather than the DOS attribute that miniz also honours. Archives that cannot be opened now raise an exception instead of being silently treated as empty. Also update the bundled miniz to the current master amalgamation (347653fb1b, after the 3.1.2 release), which carries fixes for the EOCD scan and zip64 header validation of malformed archives. The official amalgamation is split into miniz.h and miniz.c, so compile the implementation from its own translation unit and drop the MINIZ_HEADER_FILE_ONLY arrangement. Update the license entry to match.
ZipArchive::load used to copy the whole archive into a MemoryDataStream before handing it to miniz. Pass an Ogre DataStream to mz_zip_reader_init through its read callback instead: loading then only reads the central directory, and entry data is read on demand by open(). Embedded archives still wrap their existing buffer, so their bytes are not copied again on load. This avoids keeping a second full copy of every zip resource pack in memory and makes opening an archive proportional to its central directory rather than to its size.
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.
fixes #2400