From edec0c3fd0bb5f709eb8988fed2c782177274197 Mon Sep 17 00:00:00 2001
From: Tudor Bosman <tudorb@fb.com>
Date: Mon, 14 Jul 2014 13:24:27 -0700
Subject: [PATCH] Allow undefined LZ4_MAX_INPUT_SIZE

Summary:
Because the version of lz4 that ships by default with Ubuntu 13.10 doesn't
define it (but has lz4_decompress_safe, so it's usable)

Test Plan: built on Ubuntu 13.10

Reviewed By: meyering@fb.com

Subscribers: jhj, lesha, kma

FB internal diff: D1433864

@override-unit-failures
---
 folly/io/Compression.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/folly/io/Compression.cpp b/folly/io/Compression.cpp
index f4e12e62..cbfaf68c 100644
--- a/folly/io/Compression.cpp
+++ b/folly/io/Compression.cpp
@@ -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;
 }
-- 
2.34.1