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

Gate LZ4Frame behind version check

Summary:
D4715918 broke open source builds on Ubuntu 14.04, since it has lz4-r114, but the lz4 frame API was introduced in [r123](https://github.com/lz4/lz4/blob/r123/lz4frame.h).
Put the `LZ4FrameCodec` behind a lz4 version check.
Fixes https://github.com/facebook/fbthrift/issues/209.

Reviewed By: yfeldblum

Differential Revision: D4780830

fbshipit-source-id: 19492a7e6bdd128e610c36b5778274e19eff9548
parent 136c9fba
......@@ -18,8 +18,10 @@
#if FOLLY_HAVE_LIBLZ4
#include <lz4.h>
#include <lz4frame.h>
#include <lz4hc.h>
#if LZ4_VERSION_NUMBER >= 10301
#include <lz4frame.h>
#endif
#endif
#include <glog/logging.h>
......@@ -384,6 +386,8 @@ std::unique_ptr<IOBuf> LZ4Codec::doUncompress(
return out;
}
#if LZ4_VERSION_NUMBER >= 10301
class LZ4FrameCodec final : public Codec {
public:
static std::unique_ptr<Codec> create(int level, CodecType type);
......@@ -400,7 +404,7 @@ class LZ4FrameCodec final : public Codec {
void resetDCtx();
int level_;
LZ4F_dctx* dctx_{nullptr};
LZ4F_decompressionContext_t dctx_{nullptr};
bool dirty_{false};
};
......@@ -537,6 +541,7 @@ std::unique_ptr<IOBuf> LZ4FrameCodec::doUncompress(
return queue.move();
}
#endif // LZ4_VERSION_NUMBER >= 10301
#endif // FOLLY_HAVE_LIBLZ4
#if FOLLY_HAVE_LIBSNAPPY
......@@ -1430,7 +1435,7 @@ static constexpr CodecFactory
nullptr,
#endif
#if FOLLY_HAVE_LIBLZ4
#if (FOLLY_HAVE_LIBLZ4 && LZ4_VERSION_NUMBER >= 10301)
LZ4FrameCodec::create,
#else
nullptr,
......
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