From 01d40d80d3bf212f951a5dd8131e7858a96d529d Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 13 Dec 2016 11:36:15 +0000 Subject: [PATCH] Stop using deprecated LZ4 functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ../cstp.c:865:3: warning: ‘LZ4_compress_limitedOutput’ is deprecated: use LZ4_compress_default() instead [-Wdeprecated-declarations] ret = LZ4_compress_default((void*)this->data, (void*)vpninfo->deflate_pkt->data, ^~~ Signed-off-by: David Woodhouse --- configure.ac | 14 ++++++++++++++ cstp.c | 7 +++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 202cc9cb..5bdbe479 100644 --- a/configure.ac +++ b/configure.ac @@ -591,6 +591,20 @@ PKG_CHECK_MODULES([LIBLZ4], [liblz4], [ AC_SUBST(LIBLZ4_PC, liblz4) AC_DEFINE([HAVE_LZ4], [], [LZ4 was found]) lz4_pkg=yes + oldLIBS="$LIBS" + LIBS="$LIBS $LIBLZ4_LIBS" + oldCFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $LIBLZ4_CFLAGS" + AC_MSG_CHECKING([for LZ4_compress_default()]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + #include ],[ + LZ4_compress_default("", (char *)0, 0, 0);])], + [AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_LZ4_COMPRESS_DEFAULT], [], [From LZ4 r129]) + ], + [AC_MSG_RESULT(no)]) + LIBS="$oldLIBS" + CFLAGS="$oldCFLAGS" ], [ AC_MSG_WARN([[ diff --git a/cstp.c b/cstp.c index d2fd4a62..2fd7a62e 100644 --- a/cstp.c +++ b/cstp.c @@ -30,6 +30,9 @@ #include #ifdef HAVE_LZ4 #include +#ifndef HAVE_LZ4_COMPRESS_DEFAULT +#define LZ4_compress_default LZ4_compress_limitedOutput +#endif #endif #if defined(__linux__) @@ -859,8 +862,8 @@ int compress_packet(struct openconnect_info *vpninfo, int compr_type, struct pkt if (this->len < 40) return -EFBIG; - ret = LZ4_compress_limitedOutput((void*)this->data, (void*)vpninfo->deflate_pkt->data, this->len, - this->len); + ret = LZ4_compress_default((void*)this->data, (void*)vpninfo->deflate_pkt->data, + this->len, this->len); if (ret <= 0) { if (ret == 0) ret = -EFBIG; -- 2.49.0