From: Nick Terrell Date: Wed, 3 Apr 2019 02:20:52 +0000 (-0700) Subject: [libzstd] Setting ZSTD_d_maxWindowLog to 0 means default X-Git-Tag: v1.4.0^2~16^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00679da22bd6fe89778bc27ff91f4b40c11e0833;p=thirdparty%2Fzstd.git [libzstd] Setting ZSTD_d_maxWindowLog to 0 means default --- 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.