Commit 39afdc0b authored by Nick Terrell's avatar Nick Terrell Committed by Facebook Github Bot

zstd-1.4.0 compatibility

Summary:
In zstd-1.4.0 we've renamed one function used by folly. Add compatibility
macros to work with both function names.

Reviewed By: Cyan4973

Differential Revision: D14941863

fbshipit-source-id: deaf63b28ac8e4c3e6f6c0c192ed2d0e452ddca7
parent 10d27fea
...@@ -39,6 +39,13 @@ namespace io { ...@@ -39,6 +39,13 @@ namespace io {
namespace zstd { namespace zstd {
namespace { namespace {
// Compatibility helpers for zstd versions < 1.4.0
#if ZSTD_VERSION_NUMBER < 10400
#define ZSTD_CCtxParams_setParameter ZSTD_CCtxParam_setParameter
#endif
// Compatibility helpers for zstd versions < 1.3.8. // Compatibility helpers for zstd versions < 1.3.8.
#if ZSTD_VERSION_NUMBER < 10308 #if ZSTD_VERSION_NUMBER < 10308
...@@ -278,7 +285,7 @@ Options::Options(int level) : params_(ZSTD_createCCtxParams()), level_(level) { ...@@ -278,7 +285,7 @@ Options::Options(int level) : params_(ZSTD_createCCtxParams()), level_(level) {
} }
void Options::set(ZSTD_cParameter param, unsigned value) { void Options::set(ZSTD_cParameter param, unsigned value) {
zstdThrowIfError(ZSTD_CCtxParam_setParameter(params_.get(), param, value)); zstdThrowIfError(ZSTD_CCtxParams_setParameter(params_.get(), param, value));
if (param == ZSTD_c_compressionLevel) { if (param == ZSTD_c_compressionLevel) {
level_ = static_cast<int>(value); level_ = static_cast<int>(value);
} }
......
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