]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Load Dictionaries as X1 Tables
authorW. Felix Handte <w@felixhandte.com>
Fri, 16 Nov 2018 23:28:53 +0000 (15:28 -0800)
committerW. Felix Handte <w@felixhandte.com>
Tue, 18 Dec 2018 21:36:39 +0000 (13:36 -0800)
lib/decompress/zstd_decompress.c

index 510ce3c65b961634852a3e61b69264eac27ef60e..62ba86aa40dde4d33d97b85891277ddd17bfb93c 100644 (file)
@@ -954,9 +954,16 @@ ZSTD_loadDEntropy(ZSTD_entropyDTables_t* entropy,
     ZSTD_STATIC_ASSERT(sizeof(entropy->LLTable) + sizeof(entropy->OFTable) + sizeof(entropy->MLTable) >= HUF_DECOMPRESS_WORKSPACE_SIZE);
     {   void* const workspace = &entropy->LLTable;   /* use fse tables as temporary workspace; implies fse tables are grouped together */
         size_t const workspaceSize = sizeof(entropy->LLTable) + sizeof(entropy->OFTable) + sizeof(entropy->MLTable);
+#ifdef HUF_DECOMPRESS_MINIMAL
+        /* in minimal huffman, we always use X1 variants */
+        size_t const hSize = HUF_readDTableX1_wksp(entropy->hufTable,
+                                                dictPtr, dictEnd - dictPtr,
+                                                workspace, workspaceSize);
+#else
         size_t const hSize = HUF_readDTableX2_wksp(entropy->hufTable,
                                                 dictPtr, dictEnd - dictPtr,
                                                 workspace, workspaceSize);
+#endif
         if (HUF_isError(hSize)) return ERROR(dictionary_corrupted);
         dictPtr += hSize;
     }