Blame SOURCES/f310c0868634a1dbacdcdcb2dbce9501a8a87868.patch

840239
From f310c0868634a1dbacdcdcb2dbce9501a8a87868 Mon Sep 17 00:00:00 2001
840239
From: Mark Adler <madler@alumni.caltech.edu>
840239
Date: Sun, 24 Jan 2021 21:39:26 -0800
840239
Subject: [PATCH] Fix usage of x2nmodp() when compiling for no threads.
840239
840239
---
840239
 pigz.c | 8 ++++++--
840239
 1 file changed, 6 insertions(+), 2 deletions(-)
840239
840239
diff --git a/pigz.c b/pigz.c
840239
index e5a094a..7430e1e 100644
840239
--- a/pigz.c
840239
+++ b/pigz.c
840239
@@ -545,7 +545,9 @@ local struct {
840239
     int procs;              // maximum number of compression threads (>= 1)
840239
     int setdict;            // true to initialize dictionary in each thread
840239
     size_t block;           // uncompressed input size per thread (>= 32K)
840239
+#ifndef NOTHREAD
840239
     crc_t shift;            // pre-calculated CRC-32 shift for length block
840239
+#endif
840239
 
840239
     // saved gzip/zip header data for decompression, testing, and listing
840239
     time_t stamp;           // time stamp from gzip header
840239
@@ -4286,13 +4288,13 @@ local void defaults(void) {
840239
     //  blocksplittingmax = 15
840239
     ZopfliInitOptions(&g.zopts);
840239
 #endif
840239
+    g.block = 131072UL;             // 128K
840239
 #ifdef NOTHREAD
840239
     g.procs = 1;
840239
 #else
840239
     g.procs = nprocs(8);
840239
-#endif
840239
-    g.block = 131072UL;             // 128K
840239
     g.shift = x2nmodp(g.block, 3);
840239
+#endif
840239
     g.rsync = 0;                    // don't do rsync blocking
840239
     g.setdict = 1;                  // initialize dictionary each thread
840239
     g.verbosity = 1;                // normal message level
840239
@@ -4480,7 +4482,9 @@ local int option(char *arg) {
840239
         if (get == 1) {
840239
             n = num(arg);
840239
             g.block = n << 10;                  // chunk size
840239
+#ifndef NOTHREAD
840239
             g.shift = x2nmodp(g.block, 3);
840239
+#endif
840239
             if (g.block < DICT)
840239
                 throw(EINVAL, "block size too small (must be >= 32K)");
840239
             if (n != g.block >> 10 ||