[Openvpn-devel,v1] lzo: Fix conversion warning

Message ID 20251008170149.10301-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v1] lzo: Fix conversion warning | expand

Commit Message

Gert Doering Oct. 8, 2025, 5:01 p.m. UTC
From: Frank Lichtenheld <frank@lichtenheld.com>

We already have an assert ensuring the value is sane,
so just add the cast.

Change-Id: I4a5c46f321709c83a4a921366630fb8e02834701
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1260
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1260
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>

Comments

Gert Doering Oct. 9, 2025, 2:48 p.m. UTC | #1
Trivial and straightforward enough.  BB happy, did not explicitly test more.

Your patch has been applied to the master branch.

commit abb9770f099e5d387f15800a5244c911cf747557
Author: Frank Lichtenheld
Date:   Wed Oct 8 19:01:44 2025 +0200

     lzo: Fix conversion warning

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1260
     Message-Id: <20251008170149.10301-1-gert@greenie.muc.de>
     URL: https://sourceforge.net/p/openvpn/mailman/message/59244106/
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/lzo.c b/src/openvpn/lzo.c
index 8daaec0..8307b59 100644
--- a/src/openvpn/lzo.c
+++ b/src/openvpn/lzo.c
@@ -72,11 +72,6 @@ 
     *header = NO_COMPRESS_BYTE;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wconversion"
-#endif
-
 static void
 lzo_decompress(struct buffer *buf, struct buffer work, struct compress_context *compctx,
                const struct frame *frame)
@@ -107,7 +102,7 @@ 
         }
 
         ASSERT(buf_safe(&work, zlen));
-        work.len = zlen;
+        work.len = (int)zlen;
 
         dmsg(D_COMP, "LZO decompress %d -> %d", buf->len, work.len);
         compctx->pre_decompress += buf->len;
@@ -126,10 +121,6 @@ 
     }
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 const struct compress_alg lzo_alg = { "lzo", lzo_compress_init, lzo_compress_uninit, lzo_compress,
                                       lzo_decompress };
 #endif /* ENABLE_LZO */