]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
xz: Move the setting of "check" in coder_set_compression_settings()
authorLasse Collin <lasse.collin@tukaani.org>
Sun, 12 May 2024 14:14:43 +0000 (17:14 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Mon, 13 May 2024 12:41:05 +0000 (15:41 +0300)
It's more logical to do it in the beginning instead of in the middle
of the filter chain handling.

Fixes: d6af7f347077b22403133239592e478931307759
src/xz/coder.c

index 0bc8b4ffd3c6d99dd3da27ba5bea3745c6d784bc..33cdfedc2d0490aa8148378e6873ee4fb33fc722 100644 (file)
@@ -290,6 +290,15 @@ coder_set_compression_settings(void)
        assert(opt_format != FORMAT_LZIP);
 #endif
 
+       // The default check type is CRC64, but fallback to CRC32
+       // if CRC64 isn't supported by the copy of liblzma we are
+       // using. CRC32 is always supported.
+       if (check_default) {
+               check = LZMA_CHECK_CRC64;
+               if (!lzma_check_is_supported(check))
+                       check = LZMA_CHECK_CRC32;
+       }
+
 #ifdef HAVE_ENCODERS
        if (opt_block_list != NULL) {
                // args.c ensures these.
@@ -332,15 +341,6 @@ coder_set_compression_settings(void)
        }
 #endif
 
-       // The default check type is CRC64, but fallback to CRC32
-       // if CRC64 isn't supported by the copy of liblzma we are
-       // using. CRC32 is always supported.
-       if (check_default) {
-               check = LZMA_CHECK_CRC64;
-               if (!lzma_check_is_supported(check))
-                       check = LZMA_CHECK_CRC32;
-       }
-
        // Options for LZMA1 or LZMA2 in case we are using a preset.
        static lzma_options_lzma opt_lzma;