It is possible for a file table to contain multiple entries for
the same file, each with a different volume. This is valid,
and means that the file can be extracted from multiple .cab
files.
However, sometimes the header can report a file as existing
in multiple volumes despite it not actually being present in
all of them. The previous policy when encountering
duplicate entries was to just overwrite, which effectively
resulted in us keeping the last encountered entry, which
would be for the highest volume id. However, when an
erroneous entry mentioned above was encountered,
extraction would fail.
This commit makes it so we now keep the entry with the
lowest volume id, and discard the rest.
It is not uncommon for an InstallShield cab to have file
entries with a size of 0; this commit makes sure that trying to
extract such a file won't result in a warning, and won't
cause a crash when calling dumpArchive() on the containing
cabinet file.
zlib is used when available and falls back on gzio.
This allows performance improvements as our CRC32 and gzio
implementations are slower than base zlib.
As zlib is available when libpng is present, this is sensible to
benefit from it.