Eric Biggers [Wed, 5 Nov 2014 01:25:55 +0000 (19:25 -0600)]
Fix for rewriting uncompressed resources when exporting from solid WIM
The changes from commit 1ba2a3422b ("Workaround for WOF incompatibility")
are resulting in excessive, expensive decompressions when exporting small
incompressible files from solid blocks. For now, add an optimization for
single chunk resources which prevents this common case from triggering
the degenerate behavior.
Eric Biggers [Sun, 26 Oct 2014 23:47:12 +0000 (18:47 -0500)]
Remove "memory exhausted" error messages
Calling code checks for NULL returns anyway, and in the case of
allocating chunk compressors there is a fallback so there shouldn't
be an error message.
Eric Biggers [Tue, 14 Oct 2014 02:26:40 +0000 (21:26 -0500)]
wimboot.c: Dynamically size extents and drive_info arrays
I figured a limit of 8 partitions is good enough, but for some reason
Windows returns 4 times as many partitions as there actually are.
Whatever, just remove the fixed limit.
It isn't necessary to check for permission to modify a WIM for in-memory
operations such as wimlib_add_image(), wimlib_update_image(), and
wimlib_delete_image(). It is only when the user attempts to modify an
on-disk WIM file using wimlib_overwrite() --- or when the user explicitly
opens an on-disk WIM file for write access --- that write permissions
need to be checked.
This change prevents the library from getting in the way of "unusual" use
cases, such as making last-minute changes to a WIM before extracting it
even when the underlying file is located on read-only media, which
otherwise are fully supported by the existing code.
Also part of this change is the removal of can_delete_from_wim(). This
function did a lot of work (decompressing each metadata resource) that
usually turns out to be a waste of time. And it turns out that it really
needs to be called for any 'wimlib_update_command', including "add" and
"rename", because both "add" and "rename" can cause files to be deleted
(specifically, replaced). But this is gone too far. Instead, just get
rid of can_delete_from_wim() completely: it's not needed if we retain
0-reference streams when not recalculating reference counts as part of
wimlib_write() anyway.
Eric Biggers [Sun, 28 Sep 2014 03:55:57 +0000 (22:55 -0500)]
Workaround for WOF incompatibility
If a stream has compressed_size == uncompressed_size, WOF assumes it's
uncompressed. As a workaround, we need to re-write the stream as uncompressed
if this ever happens.
This requires adjusting the DONE_WITH_FILE messages to be fired after writing
each stream, not after reading each stream.
We also need to loosen the check for whether the input stream is in a solid
block or not.
Finally, this commit also makes the DONE_WITH_FILE messages work in more cases
--- when appending to a WIM, and when the file hashes are already known.
Eric Biggers [Sat, 6 Sep 2014 06:08:03 +0000 (01:08 -0500)]
lzx-decompress.c: Don't allow using offsets of 0
This can happen if an uncompressed block is present, since then the match
offset LRU queue is filled directly from the input buffer. Too-large
offsets were already checked later, but offsets of 0 would cause
uninitialized memory to remain in the output buffer.
Eric Biggers [Sun, 17 Aug 2014 16:18:47 +0000 (11:18 -0500)]
win32_apply.c: Adjust short name behavior
- Try to enable short names on the volume if it seems to be necessary to set
short names.
- Without WIMLIB_EXTRACT_FLAG_STRICT_SHORT_NAMES, still warn about how many
short names could not be set.
Eric Biggers [Thu, 14 Aug 2014 04:04:58 +0000 (23:04 -0500)]
More lz_hash_chains, lz_binary_trees performance improvements
- Use a multiplicative hash function. In practice it's as good as the
CRC32-based hash function previously used, but it's faster to compute
and requires no static data.
- Use slightly different logic that avoids the need to special-case the
extension of matches from 'nice_len' to 'max_len'.
- Faster skip_positions() by avoiding unnecessary calculations.
- Fast match length extension on x86 using unaligned word accesses and
trailing zero count.