From: "flichtenheld (Code Review)" Date: Mon, 20 Oct 2025 13:31:08 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <30188dd1aca239001c1f2be6e69a9554263ddbcc-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="000P+CYSx+c="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: gremlin: Avoid some conversion warnings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --000P+CYSx+c= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1286?usp=3Demail to review the following change. Change subject: gremlin: Avoid some conversion warnings ...................................................................... gremlin: Avoid some conversion warnings We know these casts are safe, so make them explicit. Change-Id: I2554b9baec6af191b0adb137e64124586dc4331c Signed-off-by: Frank Lichtenheld --- M src/openvpn/gremlin.c 1 file changed, 2 insertions(+), 11 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/86/1286/1 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) =3D=3D 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 <=3D high); - ret =3D low + (get_random() % (high - low + 1)); + ret =3D low + (int)(get_random() % (high - low + 1)); ASSERT(ret >=3D low && ret <=3D high); return ret; } @@ -195,7 +190,7 @@ { if (buf->len > 0) { - uint8_t r =3D roll(0, 255); + uint8_t r =3D (uint8_t)roll(0, 255); int method =3D roll(0, 5); switch (method) @@ -235,8 +230,4 @@ } } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - #endif /* ifdef ENABLE_DEBUG */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1286?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I2554b9baec6af191b0adb137e64124586dc4331c Gerrit-Change-Number: 1286 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --000P+CYSx+c= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

V= iew Change

gremlin: Avoid some conversion warnings
=
We know these casts are safe, so make
them explicit.

Change-I= d: I2554b9baec6af191b0adb137e64124586dc4331c
Signed-off-by: Frank Lichte= nheld <frank@...2641...>
---
M src/openvpn/gremlin.c
1 file = changed, 2 insertions(+), 11 deletions(-)

git pu=
ll ssh://gerrit.openvpn.net:29418/openvpn refs/changes/86/1286/1
di=
ff --git a/src/openvpn/gremlin.c b/src/openvpn/gremlin.c
in= dex 0e5e93f..a3dbff1 100644
--- a/src/openvpn/gremlin.c
+++ b/src/openvpn/gremlin.c
@@ -98,11 +98,6 @@=
return (get_random() % n) =3D=3D 0;
= }

-#i= f 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 <=3D high= );
- ret =3D low + (= get_random() % (high - low + 1));
+ ret =3D low + (int)(get_random() % (high - low + 1));
ASSERT(ret >=3D low && ret <=3D high);
return ret;
}
@@ -195,7 += 190,7 @@
{
if= (buf->len > 0)
{
- uint8_t r =3D roll(0= , 255);
+ = uint8_t r =3D (uint8_t)roll(0, 255);
= int method =3D roll(0, 5);

= switch (method)
@@ -235,8 +230,4 @@ }
}

-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic p= op
-#endif
-

#endif /* ifdef = ENABLE_DEBUG */

To view, visit change 1286= . To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2554b9baec6af191b0adb137e64= 124586dc4331c
Gerrit-Change-Number: 1286
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --000P+CYSx+c=--