Allow undefined LZ4_MAX_INPUT_SIZE
[folly.git] / folly / io / Compression.cpp
index f4e12e6297175f1725c5bf32a4a67834e42c4308..cbfaf68c8eb39b5014a05ed49cc87e8362d5ed47 100644 (file)
@@ -217,6 +217,13 @@ bool LZ4Codec::doNeedsUncompressedLength() const {
   return !encodeSize();
 }
 
+// The value comes from lz4.h in lz4-r117, but older versions of lz4 don't
+// define LZ4_MAX_INPUT_SIZE (even though the max size is the same), so do it
+// here.
+#ifndef LZ4_MAX_INPUT_SIZE
+# define LZ4_MAX_INPUT_SIZE 0x7E000000
+#endif
+
 uint64_t LZ4Codec::doMaxUncompressedLength() const {
   return LZ4_MAX_INPUT_SIZE;
 }