Commit 5b2c689c authored by Nick Terrell's avatar Nick Terrell Committed by Facebook Github Bot

Fix support for zstd-1.3.[23]

Summary:
* One function needed renaming
* One bug needed to be worked around (content size defaulting to 0)

Reviewed By: yfeldblum

Differential Revision: D8264565

fbshipit-source-id: 1abe5fb79b525108e64857dc28d5582372fcc165
parent 4a20bbed
...@@ -232,7 +232,12 @@ Options::Options(int level) : params_(ZSTD_createCCtxParams()) { ...@@ -232,7 +232,12 @@ Options::Options(int level) : params_(ZSTD_createCCtxParams()) {
if (params_ == nullptr) { if (params_ == nullptr) {
throw std::bad_alloc{}; throw std::bad_alloc{};
} }
#if ZSTD_VERSION_NUMBER >= 10304
zstdThrowIfError(ZSTD_CCtxParams_init(params_.get(), level)); zstdThrowIfError(ZSTD_CCtxParams_init(params_.get(), level));
#else
zstdThrowIfError(ZSTD_initCCtxParams(params_.get(), level));
set(ZSTD_p_contentSizeFlag, 1);
#endif
} }
void Options::set(ZSTD_cParameter param, unsigned value) { void Options::set(ZSTD_cParameter param, unsigned value) {
......
...@@ -1376,7 +1376,6 @@ TEST(ZstdTest, CustomOptions) { ...@@ -1376,7 +1376,6 @@ TEST(ZstdTest, CustomOptions) {
auto test = [](const DataHolder& dh, unsigned contentSizeFlag) { auto test = [](const DataHolder& dh, unsigned contentSizeFlag) {
unsigned const wlog = 23; unsigned const wlog = 23;
zstd::Options options(1); zstd::Options options(1);
options.set(ZSTD_p_nbWorkers, 3);
options.set(ZSTD_p_contentSizeFlag, contentSizeFlag); options.set(ZSTD_p_contentSizeFlag, contentSizeFlag);
options.set(ZSTD_p_checksumFlag, 1); options.set(ZSTD_p_checksumFlag, 1);
options.set(ZSTD_p_windowLog, wlog); options.set(ZSTD_p_windowLog, wlog);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment