From 00679da22bd6fe89778bc27ff91f4b40c11e0833 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Tue, 2 Apr 2019 19:20:52 -0700 Subject: [PATCH] [libzstd] Setting ZSTD_d_maxWindowLog to 0 means default --- lib/decompress/zstd_decompress.c | 1 + lib/zstd.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/decompress/zstd_decompress.c b/lib/decompress/zstd_decompress.c index 142923fe4..aa7f6f580 100644 --- a/lib/decompress/zstd_decompress.c +++ b/lib/decompress/zstd_decompress.c @@ -1372,6 +1372,7 @@ size_t ZSTD_DCtx_setParameter(ZSTD_DCtx* dctx, ZSTD_dParameter dParam, int value RETURN_ERROR_IF(dctx->streamStage != zdss_init, stage_wrong); switch(dParam) { case ZSTD_d_windowLogMax: + if (value == 0) value = ZSTD_WINDOWLOG_LIMIT_DEFAULT; CHECK_DBOUNDS(ZSTD_d_windowLogMax, value); dctx->maxWindowSize = ((size_t)1) << value; return 0; diff --git a/lib/zstd.h b/lib/zstd.h index ea2b9a5e4..acc535cff 100644 --- a/lib/zstd.h +++ b/lib/zstd.h @@ -852,7 +852,8 @@ typedef enum { * the streaming API will refuse to allocate memory buffer * in order to protect the host from unreasonable memory requirements. * This parameter is only useful in streaming mode, since no internal buffer is allocated in single-pass mode. - * By default, a decompression context accepts window sizes <= (1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT) */ + * By default, a decompression context accepts window sizes <= (1 << ZSTD_WINDOWLOG_LIMIT_DEFAULT). + * Special: value 0 means "use default maximum windowLog". */ /* note : additional experimental parameters are also available * within the experimental section of the API. -- 2.47.3