]> wimlib.net Git - wimlib/commitdiff
Various cleanups
authorEric Biggers <ebiggers3@gmail.com>
Tue, 17 Feb 2015 03:13:51 +0000 (21:13 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 17 Feb 2015 05:45:19 +0000 (23:45 -0600)
README
doc/man1/wimlib-imagex-capture.1
include/wimlib.h
include/wimlib/header.h
include/wimlib/lzx_common.h
include/wimlib/wim.h
src/lzx_common.c
src/lzx_compress.c
src/solid.c

diff --git a/README b/README
index e54be618ef8c0711c8d14acf1cea2aa0f404410d..f69e07eef563abf03f638d8fddc4bc5b409e2ebd 100644 (file)
--- a/README
+++ b/README
@@ -65,17 +65,12 @@ commands and their syntax.  For additional documentation:
                                 COMPRESSION RATIO
 
 wimlib (and wimlib-imagex) can create XPRESS, LZX, or LZMS compressed WIM files.
-wimlib includes its own compression codecs and does not use the compression API
-available on some versions of Windows.
-
-I have gradually been improving the compression codecs in wimlib.  For all three
-codecs, they now usually outperform and outcompress the equivalent Microsoft
-implementations.  Although results will vary depending on the data being
-compressed, in the table below I present the results for a common use case:
-compressing an x86 Windows PE image.  Each row displays the compression type,
-the size of the resulting WIM file in bytes, and how many seconds it took to
-create the file.  When applicable, the results with the equivalent Microsoft
-implementation in WIMGAPI is included.
+wimlib's compression codecs usually outperform and outcompress their Microsoft
+equivalents.  Although results will vary depending on the data being compressed,
+the table below shows results for a common use case: creating an x86 Windows PE
+image ("boot.wim").  Each row shows the compression type, the size of the
+resulting WIM file in bytes, and the time it took to create the file.  When
+possible, the results with the Microsoft equivalent are included.
 
   =============================================================================
   | Compression            ||  wimlib (v1.8.0)       |  WIMGAPI (Windows 8.1) |
index 98ff26b142b7bb709e0a475530643533293e758f..767991ababf93a05230957039a7df63a8f05893f 100644 (file)
@@ -246,8 +246,8 @@ Compatibility-wise, the first version of Microsoft's WIMGAPI to support solid
 WIM files was released with Windows 8, and the first version of DISM to do so
 was released with Windows 8.1.
 .IP ""
-If you want to create an "ESD" file, then use this option.  An (unencrypted)
-"ESD" file is a solid WIM file.
+If you want to create an "ESD file", then use this option.  An (unencrypted)
+"ESD file" is a solid WIM file.
 .IP ""
 By default, this option has an effect equivalent to DISM's option
 \fB/compress:recovery\fR.  The options for wimlib-imagex are different because
@@ -258,14 +258,13 @@ compression, as these are two different things.
 Like \fB--chunk-size\fR, but set the chunk size used in solid resources.  The
 default, assuming LZMS compression, is 64MiB (67108864); this requires about
 640MiB of memory per thread.  This option only has an effect when \fB--solid\fR
-is also specified.  For maximum compatibility with the Microsoft implementation,
-do not use this option.
+is also specified.  Note: Microsoft's implementation is not compatible with LZMS
+chunk sizes larger than 64MiB.
 .TP
 \fB--solid-compress\fR=\fITYPE\fR[:\fILEVEL\fR]
 Like \fB--compress\fR, but set the compression type used in solid resources.
 The default is LZMS compression.  This option only has an effect when
-\fB--solid\fR is also specified.  For maximum compatibility with the Microsoft
-implementation, do not use this option.
+\fB--solid\fR is also specified.
 .TP
 \fB--threads\fR=\fINUM_THREADS\fR
 Number of threads to use for compressing data.  Default: autodetect (number of
index 70b1781facef4367a17b4390eba73830314f6ac9..9b629d66f40e8571df0fbe9fababd577cc3b915a 100644 (file)
@@ -2218,7 +2218,7 @@ typedef int (*wimlib_iterate_lookup_table_callback_t)(const struct wimlib_resour
 #define WIMLIB_WRITE_FLAG_RETAIN_GUID                  0x00000800
 
 /**
- * When writing streams in the resulting WIM file, combine multiple streams into
+ * When writing streams to the resulting WIM file, combine multiple streams into
  * a single compressed resource instead of compressing them independently.  This
  * is also known as creating a "solid archive".  This tends to produce a better
  * compression ratio at the cost of much slower random access.
@@ -2240,7 +2240,7 @@ typedef int (*wimlib_iterate_lookup_table_callback_t)(const struct wimlib_resour
  * the WIM's main compression type and chunk size; you can have a WIM that
  * nominally uses LZX compression and 32768 byte chunks but actually contains
  * LZMS-compressed solid resources, for example.  However, if including solid
- * blocks, I suggest that you set the WIM's main compression type to LZMS as
+ * resources, I suggest that you set the WIM's main compression type to LZMS as
  * well, either by creating the WIM with
  * ::wimlib_create_new_wim(::WIMLIB_COMPRESSION_TYPE_LZMS, ...) or by calling
  * ::wimlib_set_output_compression_type(..., ::WIMLIB_COMPRESSION_TYPE_LZMS).
index 35eb72c728ff75c8c4c06a16569961c254487f40..6c522fa2622ffd14299e90de0a3c72c9b62ae87c 100644 (file)
@@ -19,8 +19,8 @@
 /* Version number used for WIMs that allow multiple streams combined into one
  * resource ("solid resources", marked by WIM_RESHDR_FLAG_SOLID) and also a new
  * compression format (LZMS).  This version is new as of Windows 8 WIMGAPI.
- * Although it is used by Windows 8 web downloader, it is not yet properly
- * documented by Microsoft.  */
+ * Although it is used by Windows 8 web downloader, it is not yet documented by
+ * Microsoft.  */
 #define WIM_VERSION_SOLID 0xe00
 
 /* Note: there is another WIM version from Vista pre-releases, but it is not
index 78c92ec18bf58c91cda6d21770d6b7dc2100e819..ed9d0bbeeebdabc350e06382a4bdac07f4d2ee3b 100644 (file)
@@ -21,7 +21,7 @@
 
 extern const u32 lzx_offset_slot_base[LZX_MAX_OFFSET_SLOTS + 1];
 
-extern const u8 lzx_extra_offset_bits[LZX_MAX_OFFSET_SLOTS + 1];
+extern const u8 lzx_extra_offset_bits[LZX_MAX_OFFSET_SLOTS];
 
 /*
  * Return the offset slot for the specified match offset.
index 544ce18025e66eb8fb1259d08fc7ab2d0cbeb057..5bc20a6b0e6823b39cefff0588400d7dff926c47 100644 (file)
@@ -94,7 +94,7 @@ struct WIMStruct {
         * decompressor can be used for all data --- and that decompressor will
         * be cached here.  However, if we do encounter any data with a
         * different compression type or chunk size (this is possible in solid
-        * blocks), then this cached decompressor will be replaced with a new
+        * resources), then this cached decompressor will be replaced with a new
         * one.
         */
        struct wimlib_decompressor *decompressor;
index 3cc6981b186926ebef22bd63633153a6eb80a217..1baeebe7469ed2fb585d53e7c8dd3e761bb1faa3 100644 (file)
@@ -57,7 +57,7 @@ const u32 lzx_offset_slot_base[LZX_MAX_OFFSET_SLOTS + 1] = {
 
 /* Mapping: offset slot => how many extra bits must be read and added to the
  * corresponding offset slot base to decode the match offset.  */
-const u8 lzx_extra_offset_bits[LZX_MAX_OFFSET_SLOTS + 1] = {
+const u8 lzx_extra_offset_bits[LZX_MAX_OFFSET_SLOTS] = {
        0 , 0 , 0 , 0 , 1 ,
        1 , 2 , 2 , 3 , 3 ,
        4 , 4 , 5 , 5 , 6 ,
@@ -68,7 +68,6 @@ const u8 lzx_extra_offset_bits[LZX_MAX_OFFSET_SLOTS + 1] = {
        16, 17, 17, 17, 17,
        17, 17, 17, 17, 17,
        17, 17, 17, 17, 17,
-       17
 };
 
 /* Round the specified buffer size up to the next valid LZX window size, and
index 1506b8842ca567533e1fafea263edaaac89fe8ff..28a2656fb45852006f529d3df2f686c67fd6bbd2 100644 (file)
 
 /*
  * LZX_BIT_COST is a scaling factor that represents the cost to output one bit.
- * THis makes it possible to consider fractional bit costs.
+ * This makes it possible to consider fractional bit costs.
  *
  * Note: this is only useful as a statistical trick for when the true costs are
  * unknown.  In reality, each token in LZX requires a whole number of bits to
 /*
  * LZX_HASH2_ORDER is the log base 2 of the number of entries in the hash table
  * for finding length 2 matches.  This can be as high as 16 (in which case the
- * hash function is trivial), but using a smaller hash table actually speeds up
+ * hash function is trivial), but using a smaller hash table speeds up
  * compression due to reduced cache pressure.
  */
 #define LZX_HASH2_ORDER                12
@@ -1624,13 +1624,11 @@ lzx_compress_near_optimal(struct lzx_compressor *c,
                                max_len = in_end - in_next;
                                nice_len = min(max_len, nice_len);
 
-                               /* This extra check is needed to ensure that
-                                * reading the next 3 bytes when looking for a
-                                * length 2 match is valid.  In addition, we
-                                * cannot allow ourselves to find a length 2
-                                * match of the very last two bytes with the
-                                * very first two bytes, since such a match has
-                                * an offset too large to be represented.  */
+                               /* This extra check is needed to ensure that we
+                                * never output a length 2 match of the very
+                                * last two bytes with the very first two bytes,
+                                * since such a match has an offset too large to
+                                * be represented.  */
                                if (unlikely(max_len < 3)) {
                                        in_next++;
                                        cache_ptr->length = 0;
index 94901d0f319922263d149b2a55874a7e4b8a6e8a..01f22a5b19f92b21b156b8ecb3b0a721d8e873eb 100644 (file)
@@ -227,7 +227,7 @@ sort_stream_list_for_solid_compression(struct list_head *stream_list)
                ret = for_image(wims[i], WIMLIB_ALL_IMAGES,
                                image_fill_in_solid_sort_names);
                if (ret)
-                       goto out_free_lookup_table;
+                       goto out;
                deselect_current_wim_image(wims[i]);
        }
 
@@ -236,9 +236,9 @@ sort_stream_list_for_solid_compression(struct list_head *stream_list)
                                        write_streams_list),
                               cmp_streams_by_solid_sort_name);
 
+out:
        list_for_each_entry(lte, stream_list, write_streams_list)
                FREE(lte->solid_sort_name);
-out_free_lookup_table:
        FREE(lookup_table.table);
        return ret;
 }