| Message ID | 20251028183945.31901-1-gert@greenie.muc.de |
|---|---|
| State | New |
| Headers | show |
| Series | [Openvpn-devel,v2] gremlin: Avoid some conversion warnings | expand |
Your patch has been applied to the master branch.
commit 15b77d47f5a9dc78615cdafc50bbb05d5a21c3d6
Author: Frank Lichtenheld
Date: Tue Oct 28 19:39:35 2025 +0100
gremlin: Avoid some conversion warnings
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1286
Message-Id: <20251028183945.31901-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg33964.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
diff --git a/src/openvpn/gremlin.c b/src/openvpn/gremlin.c index 0e5e93f..a3dbff1 100644 --- a/src/openvpn/gremlin.c +++ b/src/openvpn/gremlin.c @@ -98,11 +98,6 @@ return (get_random() % n) == 0; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - /* * Return uniformly distributed random number between * low and high. @@ -112,7 +107,7 @@ { int ret; ASSERT(low <= high); - ret = low + (get_random() % (high - low + 1)); + ret = low + (int)(get_random() % (high - low + 1)); ASSERT(ret >= low && ret <= high); return ret; } @@ -195,7 +190,7 @@ { if (buf->len > 0) { - uint8_t r = roll(0, 255); + uint8_t r = (uint8_t)roll(0, 255); int method = roll(0, 5); switch (method) @@ -235,8 +230,4 @@ } } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - #endif /* ifdef ENABLE_DEBUG */