aboutsummaryrefslogtreecommitdiff
path: root/src/xz
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2010-01-31 19:52:38 +0200
committerLasse Collin <lasse.collin@tukaani.org>2010-01-31 19:52:38 +0200
commit34eb5e201d62f7f46bbe6fe97cfe08cb31b3b88c (patch)
treebf7fce65fe57e28743fd62a0ed3dd951176b7e82 /src/xz
parentImprove displaying of the memory usage limit. (diff)
downloadxz-34eb5e201d62f7f46bbe6fe97cfe08cb31b3b88c.tar.xz
Select the default integrity check type at runtime.
Previously it was set statically to CRC64 or CRC32 depending on options passed to the configure script.
Diffstat (limited to 'src/xz')
-rw-r--r--src/xz/coder.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/xz/coder.c b/src/xz/coder.c
index e6ed3e55..cd5da299 100644
--- a/src/xz/coder.c
+++ b/src/xz/coder.c
@@ -56,17 +56,17 @@ static bool preset_default = true;
static bool preset_extreme = false;
/// Integrity check type
-#ifdef HAVE_CHECK_CRC64
-static lzma_check check = LZMA_CHECK_CRC64;
-#else
-static lzma_check check = LZMA_CHECK_CRC32;
-#endif
+static lzma_check check;
+
+/// This becomes false if the --check=CHECK option is used.
+static bool check_default = true;
extern void
coder_set_check(lzma_check new_check)
{
check = new_check;
+ check_default = false;
return;
}
@@ -265,6 +265,15 @@ coder_set_compression_settings(void)
opt_threads = thread_limit;
*/
+ if (check_default) {
+ // 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.
+ check = LZMA_CHECK_CRC64;
+ if (!lzma_check_is_supported(check))
+ check = LZMA_CHECK_CRC32;
+ }
+
return;
}