ensure new ZSTD_strategy starts at value 1
diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c
index f5ac75a..1df1a48 100644
--- a/lib/compress/zstd_compress.c
+++ b/lib/compress/zstd_compress.c
@@ -2753,23 +2753,26 @@
}
+/* ZSTD_selectBlockCompressor() :
+ * assumption : strat is a valid strategy */
typedef void (*ZSTD_blockCompressor) (ZSTD_CCtx* ctx, const void* src, size_t srcSize);
-
static ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, int extDict)
{
static const ZSTD_blockCompressor blockCompressor[2][(unsigned)ZSTD_btultra+1] = {
- { NULL,
+ { ZSTD_compressBlock_fast /* default for 0 */,
ZSTD_compressBlock_fast, ZSTD_compressBlock_doubleFast, ZSTD_compressBlock_greedy,
ZSTD_compressBlock_lazy, ZSTD_compressBlock_lazy2, ZSTD_compressBlock_btlazy2,
ZSTD_compressBlock_btopt, ZSTD_compressBlock_btultra },
- { NULL,
+ { ZSTD_compressBlock_fast_extDict /* default for 0 */,
ZSTD_compressBlock_fast_extDict, ZSTD_compressBlock_doubleFast_extDict, ZSTD_compressBlock_greedy_extDict,
ZSTD_compressBlock_lazy_extDict,ZSTD_compressBlock_lazy2_extDict, ZSTD_compressBlock_btlazy2_extDict,
ZSTD_compressBlock_btopt_extDict, ZSTD_compressBlock_btultra_extDict }
};
ZSTD_STATIC_ASSERT((unsigned)ZSTD_fast == 1);
+ assert((U32)strat >= (U32)ZSTD_fast);
+ assert((U32)strat <= (U32)ZSTD_btultra);
- return blockCompressor[extDict][(U32)strat];
+ return blockCompressor[extDict!=0][(U32)strat];
}
diff --git a/lib/compress/zstdmt_compress.h b/lib/compress/zstdmt_compress.h
index 8b0ca82..d36914d 100644
--- a/lib/compress/zstdmt_compress.h
+++ b/lib/compress/zstdmt_compress.h
@@ -15,13 +15,15 @@
#endif
-/* Note : All prototypes defined in this file must be considered experimental.
- * There is no guarantee of API continuity on any of these prototypes */
+/* Note : All prototypes defined in this file are labelled experimental.
+ * No guarantee of API continuity is provided on any of them.
+ * In fact, the expectation is that these prototypes will be replaced
+ * by ZSTD_compress_generic() API in the near future */
/* === Dependencies === */
-#include <stddef.h> /* size_t */
+#include <stddef.h> /* size_t */
#define ZSTD_STATIC_LINKING_ONLY /* ZSTD_parameters */
-#include "zstd.h" /* ZSTD_inBuffer, ZSTD_outBuffer, ZSTDLIB_API */
+#include "zstd.h" /* ZSTD_inBuffer, ZSTD_outBuffer, ZSTDLIB_API */
/* === Memory management === */
@@ -32,7 +34,6 @@
ZSTDLIB_API size_t ZSTDMT_freeCCtx(ZSTDMT_CCtx* mtctx);
ZSTDLIB_API size_t ZSTDMT_sizeof_CCtx(ZSTDMT_CCtx* mtctx);
-ZSTDLIB_API size_t ZSTDMT_estimateCCtxSize(ZSTD_compressionParameters cParams, unsigned nbThreads); /* not ready yet */
/* === Simple buffer-to-butter one-pass function === */
@@ -87,7 +88,7 @@
/*! ZSTDMT_compressStream_generic() :
* Combines ZSTDMT_compressStream() with ZSTDMT_flushStream() or ZSTDMT_endStream()
- * depending on flush directive
+ * depending on flush directive.
* @return : minimum amount of data still to be flushed
* 0 if fully flushed
* or an error code */