From 256e46435f5e8760312e630bb5a2bbbfab21cd21 Mon Sep 17 00:00:00 2001 From: Tino Reichardt Date: Fri, 29 May 2020 15:06:05 +0200 Subject: [PATCH] Fix #131 --- CPP/7zip/Compress/ZstdEncoder.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CPP/7zip/Compress/ZstdEncoder.cpp b/CPP/7zip/Compress/ZstdEncoder.cpp index 5e9494f5d..30ce0e4ff 100644 --- a/CPP/7zip/Compress/ZstdEncoder.cpp +++ b/CPP/7zip/Compress/ZstdEncoder.cpp @@ -114,12 +114,17 @@ STDMETHODIMP CEncoder::SetCoderProperties(const PROPID * propIDs, const PROPVARI /* like --long in zstd cli program */ _Long = 1; if (v == 0) { - // m0=zstd:long:tlen=x + // m0=zstd:long:tlen=x -> long=default _WindowLog = 27; - } else if (v < 10) { - _WindowLog = 10; + } else if (v < ZSTD_WINDOWLOG_MIN) { + // m0=zstd:long=9 -> long=10 + _WindowLog = ZSTD_WINDOWLOG_MIN; } else if (v > ZSTD_WINDOWLOG_MAX) { + // m0=zstd:long=33 -> long=max _WindowLog = ZSTD_WINDOWLOG_MAX; + } else { + // m0=zstd:long=15 -> long=value + _WindowLog = v; } break; }