]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
If lzma_cputhreads() is unavailable, default the number of threads to 1.
authorTim Kientzle <kientzle@acm.org>
Sun, 8 Mar 2015 07:20:55 +0000 (23:20 -0800)
committerTim Kientzle <kientzle@acm.org>
Sun, 8 Mar 2015 07:20:55 +0000 (23:20 -0800)
libarchive/archive_write_add_filter_xz.c
libarchive/archive_write_set_format_xar.c

index 88a427dca09887a19a1fee27e5f9ba2f528bca2a..09c113620b68385d7886f7307fef672e6124fcf4 100644 (file)
@@ -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);
        }
 
index 1d06bb8976c7425f41e68866bf3f3b39babc5c52..4538befd9ebc91ce19ace1afb5cec9d3701d628b 100644 (file)
@@ -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);