Skip to content

Commit

Permalink
Stop using deprecated LZ4 functions
Browse files Browse the repository at this point in the history
../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 <dwmw2@infradead.org>
  • Loading branch information
dwmw2 committed Dec 13, 2016
1 parent b06d6cf commit 01d40d8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
14 changes: 14 additions & 0 deletions configure.ac
Expand Up @@ -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.h>],[
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([[
Expand Down
7 changes: 5 additions & 2 deletions cstp.c
Expand Up @@ -30,6 +30,9 @@
#include <stdarg.h>
#ifdef HAVE_LZ4
#include <lz4.h>
#ifndef HAVE_LZ4_COMPRESS_DEFAULT
#define LZ4_compress_default LZ4_compress_limitedOutput
#endif
#endif

#if defined(__linux__)
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 01d40d8

Please sign in to comment.