Skip to contentSkip to conversation

replace deprecated LZ4 function

PATCH In review Christian Hesse 3 participants 4 messages Dec 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 replace deprecated LZ4 function

From: Christian Hesse <[email protected]...>

The LZ4 function LZ4_compress_limitedOutput() is deprecated, compiler gives warning:

warning: ‘LZ4_compress_limitedOutput’ is deprecated: use LZ4_compress_default() instead

So replace the function.

---
 src/openvpn/comp-lz4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/comp-lz4.c +1 -1
index 6b7c49b..90feaa5 100644
@@ -87,7 +87,7 @@ do_lz4_compress(struct buffer *buf,
             return false;
         }
 
-        zlen = LZ4_compress_limitedOutput((const char *)BPTR(buf), (char *)BPTR(work), BLEN(buf), zlen_max );
+        zlen = LZ4_compress_default((const char *)BPTR(buf), (char *)BPTR(work), BLEN(buf), zlen_max );
 
         if (zlen <= 0)
         {
Signature · 1 line
2.11.0
#1 lore raw
Quoted 2 lines · Christian Hesse

-        zlen = LZ4_compress_limitedOutput((const char *)BPTR(buf), (char *)BPTR(work), BLEN(buf), zlen_max ); +        zlen = LZ4_compress_default((const char *)BPTR(buf), (char *)BPTR(work), BLEN(buf), zlen_max );

You might want to do that conditionally. Some platforms might still be using versions of liblz4 older than r129, where LZ4_compress_default() was introduced.

http://git.infradead.org/users/dwmw2/openconnect.git/commitdiff/01d40d8

Signature · 1 line
dwmw2
#2 lore raw

PATCH 1/1 replace deprecated LZ4 function

From: Christian Hesse <[email protected]...>

The LZ4 function LZ4_compress_limitedOutput() is deprecated, compiler gives warning:

warning: ‘LZ4_compress_limitedOutput’ is deprecated: use LZ4_compress_default() instead

The new function LZ4_compress_default() appeared in r129 (1.7.0), so replace the function there.

---
 src/openvpn/comp-lz4.c | 4 ++++
 1 file changed, 4 insertions(+)
src/openvpn/comp-lz4.c +4 -0
index 6b7c49b..a6ce4f7 100644
@@ -87,7 +87,11 @@ do_lz4_compress(struct buffer *buf,
             return false;
         }
 
+#if defined LZ4_VERSION_NUMBER && LZ4_VERSION_NUMBER >= 10700
+        zlen = LZ4_compress_default((const char *)BPTR(buf), (char *)BPTR(work), BLEN(buf), zlen_max );
+#else
         zlen = LZ4_compress_limitedOutput((const char *)BPTR(buf), (char *)BPTR(work), BLEN(buf), zlen_max );
+#endif
 
         if (zlen <= 0)
         {
Signature · 1 line
2.11.0
#3 lore raw
Quoted 23 lines · Christian Hesse

From: Christian Hesse <[email protected]...>

The LZ4 function LZ4_compress_limitedOutput() is deprecated, compiler gives warning:

warning: ‘LZ4_compress_limitedOutput’ is deprecated: use LZ4_compress_default() instead

The new function LZ4_compress_default() appeared in r129 (1.7.0), so replace the function there.

---
 src/openvpn/comp-lz4.c | 4 ++++
 1 file changed, 4 insertions(+)
src/openvpn/comp-lz4.c +0 -0
index 6b7c49b..a6ce4f7 100644
@@ -87,7 +87,11 @@ do_lz4_compress(struct buffer *buf,
             return false;

src/openvpn/comp-lz4.c do_lz4_compress(struct buffer *buf, · line 97

Quoted 10 lines
src/openvpn/comp-lz4.c +4 -0
         }
 
+#if defined LZ4_VERSION_NUMBER && LZ4_VERSION_NUMBER >= 10700
+        zlen = LZ4_compress_default((const char *)BPTR(buf), (char *)BPTR(work), BLEN(buf), zlen_max );
+#else
         zlen = LZ4_compress_limitedOutput((const char *)BPTR(buf), (char *)BPTR(work), BLEN(buf), zlen_max );
+#endif
 
         if (zlen <= 0)
         {

This makes sense. But I think we should do this in relation to an update of the compat-lz4 library we also ship in OpenVPN. I'm running some tests now, and will submit a new mail thread which includes this patch together with the compat-lz4.[ch] update.

This will be handled post v2.4.0 release, so we don't rush the testing of the LZ4 support and inadvertently break anything.

Signature · 4 lines
kind regards,

David Sommerseth
OpenVPN Technologies, Inc