Hash map for ZipArchive class
|Reported by:||dreammaster||Owned by:||sev-|
I'd to submit some changes I've made to the unzip.cpp file class, to add a hash map of the file list, for peer review before committing it. The current sequential file search (done in unzLocateFile) is particularly problematic for the Broken Sword 2.5 engine, since the main Zip file is 700Mb in size, and each call to the method can take a second to run even on a fast computer. Not only that, but for a typical file access, the method gets called three times: Once in a call the engine makes to see if the file exists (this could have been re-factored) A second time when an ArchiveMemberPtr is created to the file And finally a third time when the member is accessed to actually read the contents of the file.
I've wrapped my changes in several '#ifdef ZIP_HASH' blocks, so the old behavior could still be used if there's ever any need to disable it.
Ticket imported from: #3048388. Ticket imported from: patches/1306.