]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
more accurate default maximum window size
authorYann Collet <cyan@fb.com>
Sat, 29 Oct 2016 10:56:45 +0000 (03:56 -0700)
committerYann Collet <cyan@fb.com>
Sat, 29 Oct 2016 10:56:45 +0000 (03:56 -0700)
lib/decompress/zstd_decompress.c

index 15f98989ad7e40808dc70e5d47eff9e46ead8a56..4c47930cd4f5b5a28a5c9db1884ba4148398cdd0 100644 (file)
@@ -34,7 +34,7 @@
 *  Frames requiring more memory will be rejected.
 */
 #ifndef ZSTD_MAXWINDOWSIZE_DEFAULT
-#  define ZSTD_MAXWINDOWSIZE_DEFAULT (257 << 20)   /* 257 MB */
+#  define ZSTD_MAXWINDOWSIZE_DEFAULT ((1 << ZSTD_WINDOWLOG_MAX) + 1)   /* defined within zstd.h */
 #endif
 
 
@@ -111,7 +111,7 @@ struct ZSTD_DCtx_s
     BYTE headerBuffer[ZSTD_FRAMEHEADERSIZE_MAX];
 };  /* typedef'd to ZSTD_DCtx within "zstd.h" */
 
-size_t ZSTD_sizeof_DCtx (const ZSTD_DCtx* dctx) { if (dctx==NULL) return 0; return sizeof(ZSTD_DCtx); }  /* support sizeof on NULL */
+size_t ZSTD_sizeof_DCtx (const ZSTD_DCtx* dctx) { return (dctx==NULL) ? 0 : sizeof(ZSTD_DCtx); }
 
 size_t ZSTD_estimateDCtxSize(void) { return sizeof(ZSTD_DCtx); }