From: Tim Kientzle Date: Sun, 8 Mar 2015 07:20:55 +0000 (-0800) Subject: If lzma_cputhreads() is unavailable, default the number of threads to 1. X-Git-Tag: v3.1.900a~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e15bb10b45e3255ad0f9be5f5745d0118edab3c;p=thirdparty%2Flibarchive.git If lzma_cputhreads() is unavailable, default the number of threads to 1. --- diff --git a/libarchive/archive_write_add_filter_xz.c b/libarchive/archive_write_add_filter_xz.c index 88a427dca..09c113620 100644 --- a/libarchive/archive_write_add_filter_xz.c +++ b/libarchive/archive_write_add_filter_xz.c @@ -397,8 +397,13 @@ archive_compressor_xz_options(struct archive_write_filter *f, data->threads = 1; return (ARCHIVE_WARN); } - if (data->threads == 0) + if (data->threads == 0) { +#ifdef HAVE_LZMA_STREAM_ENCODER_MT data->threads = lzma_cputhreads(); +#else + data->threads = 1; +#endif + } return (ARCHIVE_OK); } diff --git a/libarchive/archive_write_set_format_xar.c b/libarchive/archive_write_set_format_xar.c index 1d06bb897..4538befd9 100644 --- a/libarchive/archive_write_set_format_xar.c +++ b/libarchive/archive_write_set_format_xar.c @@ -507,8 +507,13 @@ xar_options(struct archive_write *a, const char *key, const char *value) value); return (ARCHIVE_FAILED); } - if (xar->opt_threads == 0) + if (xar->opt_threads == 0) { +#ifdef HAVE_LZMA_STREAM_ENCODER_MT xar->opt_threads = lzma_cputhreads(); +#else + xar->opt_threads = 1; +#endif + } } /* Note: The "warn" return is just to inform the options @@ -2876,6 +2881,8 @@ compression_init_encoder_xz(struct archive *a, lzma_mt mt_options; #endif + (void)threads; /* UNUSED (if multi-threaded LZMA library not avail) */ + if (lastrm->valid) compression_end(a, lastrm); strm = calloc(1, sizeof(*strm) + sizeof(*lzmafilters) * 2);