From: "flichtenheld (Code Review)" Date: Tue, 14 Jan 2025 13:14:17 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="B+2PlXg0qe8="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Fix some trivial sign-compare compiler warnings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --B+2PlXg0qe8= 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/+/865?usp=3Demail to review the following change. Change subject: Fix some trivial sign-compare compiler warnings ...................................................................... Fix some trivial sign-compare compiler warnings Change-Id: I1918c43202b87f0c987bfd9155c739da7dd02632 Signed-off-by: Frank Lichtenheld --- M src/openvpn/options.c M src/openvpn/socket.c M src/openvpn/tun.c 3 files changed, 6 insertions(+), 10 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/65/865/1 diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 1113663..b594b09 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -1448,7 +1448,7 @@ while (server) { - for (int i =3D 0; i < server->addr_count; ++i) + for (size_t i =3D 0; i < server->addr_count; ++i) { if (server->addr[i].family =3D=3D AF_INET) { diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 234d590..4aeb613 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -3131,8 +3131,7 @@ int ascii2proto(const char *proto_name) { - int i; - for (i =3D 0; i < SIZE(proto_names); ++i) + for (size_t i =3D 0; i < SIZE(proto_names); ++i) { if (!strcmp(proto_name, proto_names[i].short_form)) { @@ -3145,8 +3144,7 @@ sa_family_t ascii2af(const char *proto_name) { - int i; - for (i =3D 0; i < SIZE(proto_names); ++i) + for (size_t i =3D 0; i < SIZE(proto_names); ++i) { if (!strcmp(proto_name, proto_names[i].short_form)) { @@ -3159,8 +3157,7 @@ const char * proto2ascii(int proto, sa_family_t af, bool display_form) { - unsigned int i; - for (i =3D 0; i < SIZE(proto_names); ++i) + for (size_t i =3D 0; i < SIZE(proto_names); ++i) { if (proto_names[i].proto_af =3D=3D af && proto_names[i].proto =3D= =3D proto) { @@ -3182,9 +3179,8 @@ proto2ascii_all(struct gc_arena *gc) { struct buffer out =3D alloc_buf_gc(256, gc); - int i; - for (i =3D 0; i < SIZE(proto_names); ++i) + for (size_t i =3D 0; i < SIZE(proto_names); ++i) { if (i) { diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 3f2ec4a..22706f3 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -631,7 +631,7 @@ { struct gc_arena gc =3D gc_new(); struct route_gateway_info rgi; - const int needed =3D (RGI_ADDR_DEFINED|RGI_NETMASK_DEFINED); + const unsigned int needed =3D (RGI_ADDR_DEFINED|RGI_NETMASK_DEFINED); get_default_gateway(&rgi, ctx); if ((rgi.flags & needed) =3D=3D needed) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/865?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I1918c43202b87f0c987bfd9155c739da7dd02632 Gerrit-Change-Number: 865 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-MessageType: newchange --B+2PlXg0qe8= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

Vi= ew Change

Fix some trivial sign-compare compiler warnings

Change= -Id: I1918c43202b87f0c987bfd9155c739da7dd02632
Signed-off-by: Frank Lich= tenheld <frank@...2641...>
---
M src/openvpn/options.c
M src= /openvpn/socket.c
M src/openvpn/tun.c
3 files changed, 6 insertions(+= ), 10 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvp=
n refs/changes/65/865/1
diff --git a/src/openvpn/options.c b/src/op=
envpn/options.c
index 1113663..b594b09 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c<= /span>
@@ -1448,7 +1448,7 @@

= while (server)
{
- for (int i =3D 0; i < server->addr_count; += +i)
+ for (siz= e_t i =3D 0; i < server->addr_count; ++i)
{<= /span>
if (server->addr[i].family =3D=3D AF_INET)<= /span>
{
diff --git a/src/openvpn/soc= ket.c b/src/openvpn/socket.c
index 234d590..4aeb613 100644<= /span>
--- a/src/openvpn/socket.c
+++ b/src/openvp= n/socket.c
@@ -3131,8 +3131,7 @@
int
ascii2proto(const char *proto_name)
{- int i;
- for (i =3D 0; i < SIZE(proto_names= ); ++i)
+ for (siz= e_t i =3D 0; i < SIZE(proto_names); ++i)
{ if (!strcmp(proto_name, proto_names[i].short_form))=
{
@@ -3145,8 +3144,7 @@
= sa_family_t
ascii2af(const char *proto_name)
{

- int i;
- for (i =3D 0; i < S= IZE(proto_names); ++i)
- unsigned int i;
- for (i =3D 0; i < SIZE(proto_names); ++i)
+ for (size_t i =3D = 0; i < SIZE(proto_names); ++i)
{
= if (proto_names[i].proto_af =3D=3D af && proto_names[i].prot= o =3D=3D proto)
{
@@ -3182,9 +3179= ,8 @@
proto2ascii_all(struct gc_arena *gc)
{

struct buffer out =3D alloc_buf_gc(256, gc);
- int i;
=
- for (i =3D 0; i = < SIZE(proto_names); ++i)
+ for (size_t i =3D 0; i < SIZE(proto_names); ++i)
= {
if (i)
{

diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
<= span>index 3f2ec4a..22706f3 100644
--- a/src/openvpn/tun.c<= /span>
+++ b/src/openvpn/tun.c
@@ -631,7 +631,7 @@=
{
struct gc_arena gc =3D gc_new();
struct route_gateway_info rgi;
- const int needed =3D (RGI_ADDR_DEFINED|RGI= _NETMASK_DEFINED);
+ = const unsigned int needed =3D (RGI_ADDR_DEFINED|RGI_NETMASK_DEFINED);

get_default_gateway(&rgi, ctx);
if ((rgi.flags & needed) =3D=3D needed)

To view, visit change 865. To unsubscribe, or for help w= riting mail filters, visit s= ettings.

=
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1918c43202b87f0c987bfd9155c= 739da7dd02632
Gerrit-Change-Number: 865
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...>
Gerrit-MessageType: newchange
--B+2PlXg0qe8=--