Eric Biggers [Tue, 24 Dec 2013 06:58:06 +0000 (00:58 -0600)]
lookup_table_insert(): Grow table when capacity reached
This avoids slow hash list searches when the lookup table was initially
allocated very small due to opening a WIM containing few streams, but
more entries were added later (e.g. with wimlib_reference_resources()).
Eric Biggers [Tue, 24 Dec 2013 01:39:14 +0000 (19:39 -0600)]
wimlib_overwrite(): Don't force full rebuild of packed WIM
Version 3584 WIMs may contain both packed and unpacked streams, no there's
no need to force a full rebuild if WIMLIB_WRITE_FLAG_NO_PACK_STREAMS is
required.
At the same time, a full rebuild is in general required if the default
compression type or chunk size has been changed.
Eric Biggers [Sun, 8 Dec 2013 06:07:37 +0000 (00:07 -0600)]
Merge LZX compressor updates
- Use a suffix array-based match-finder (construction code borrowed from
libdivsufsort). Ideal for this case because compression in WIM chunks
does not use a sliding window.
- Disable block splitting by default (no efficient and effective
algorithm is available yet)
Eric Biggers [Sat, 7 Dec 2013 00:40:57 +0000 (18:40 -0600)]
xml.c: Fix writing <WINDOWS> element
A positive return value of xmlTextWriterEndElement would be incorrectly
passed up the call chain, causing an unexpected error when writing the
XML data.
Eric Biggers [Wed, 13 Nov 2013 02:48:43 +0000 (20:48 -0600)]
Add ADS entry workaround
Some versions of Microsoft's WIM software (the boot driver(s) in WinPE
3.0, for example) contain a bug where they assume the first alternate
data stream (ADS) entry of a dentry with a nonzero ADS count specifies
the unnamed stream, even if it has a name and the unnamed stream is
already specified in the hash field of the dentry itself.
wimlib now works around this behavior by carefully emulating the behavior
of (most versions of) ImageX/WIMGAPI, which move the unnamed stream
reference into the alternate stream entries whenever there are named data
streams, even though there is already a field in the dentry itself for
the unnamed stream reference, which then goes to waste.
Eric Biggers [Sun, 3 Nov 2013 05:01:23 +0000 (00:01 -0500)]
write.c: Fix two minor bugs in error paths
- Ensure that overwrite_wim_inplace() restores the original header if it
is unable to complete successfully.
- If overwrite_wim_inplace() fails after having set
WIM_HDR_FLAG_WRITE_IN_PROGRESS in the physical file's header, attempt
to clear it.
According to C99 6.5.6.8, calculating a pointer that points before the
allocated object has undefined behavior. However, this was done by
lzx_decode_match() and xpress_decode_match() if they received a match
pointing before the end of the window (invalid match offset). This
commit fixes this check to be fully defined.
This change likely has no visible effect in actual builds, e.g. with gcc.
Eric Biggers [Sat, 12 Oct 2013 00:11:41 +0000 (19:11 -0500)]
lzx-decompress.c: Fix alignment bug
The pretree decode table was not declared to be 16 byte aligned, as
expected by make_huffman_decode_table().
This bug had no effect if the compiler aligned this table on a 16 byte
boundary anyway, but if not it caused a segmentation fault on x86 platforms
where the SSE2 instructions were available, since in that case stores
requiring 16 byte alignment are used to fill in table entries.