]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
[libzstd] Setting ZSTD_d_maxWindowLog to 0 means default
authorNick Terrell <terrelln@fb.com>
Wed, 3 Apr 2019 02:20:52 +0000 (19:20 -0700)
committerNick Terrell <terrelln@fb.com>
Wed, 3 Apr 2019 02:20:52 +0000 (19:20 -0700)
lib/decompress/zstd_decompress.c
lib/zstd.h

index 142923fe4bc83e35575b7f4ea7fe552fe87ff409..aa7f6f58042d7609575fb3344102760bddadedab 100644 (file)
@@ -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;
index ea2b9a5e4907d952db7f7d1c67eb1c1042c87ebb..acc535cff54d1b3ff8380b7ace3d7c5b30030069 100644 (file)
@@ -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.