From db777d6b97ec08fdbf461679acf46a9d8ffab62a Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Thu, 17 Nov 2016 13:18:48 -0800 Subject: [PATCH] Replace deprecated LZ4 functions Summary: Replace deprecated functions with their functionally equivalent counterparts. See https://github.com/lz4/lz4/blob/dev/lib/lz4.c#L1405 and https://github.com/lz4/lz4/blob/dev/lib/lz4hc.c#L634 Reviewed By: Cyan4973 Differential Revision: D4194834 fbshipit-source-id: aa4f934c46fe764fcec8ea29221e3882da2b5cdf --- folly/io/Compression.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/folly/io/Compression.cpp b/folly/io/Compression.cpp index 9e86c4c0..c7c4c8f8 100644 --- a/folly/io/Compression.cpp +++ b/folly/io/Compression.cpp @@ -260,13 +260,18 @@ std::unique_ptr LZ4Codec::doCompress(const IOBuf* data) { int n; if (highCompression_) { - n = LZ4_compressHC(reinterpret_cast(data->data()), - reinterpret_cast(out->writableTail()), - data->length()); + n = LZ4_compress_HC( + reinterpret_cast(data->data()), + reinterpret_cast(out->writableTail()), + data->length(), + out->tailroom(), + 0); } else { - n = LZ4_compress(reinterpret_cast(data->data()), - reinterpret_cast(out->writableTail()), - data->length()); + n = LZ4_compress_default( + reinterpret_cast(data->data()), + reinterpret_cast(out->writableTail()), + data->length(), + out->tailroom()); } CHECK_GE(n, 0); -- 2.34.1