From: "cron2 (Code Review)" Date: Wed, 15 Jan 2025 14:33:10 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <3853e8478d0b24010e4250d3c1aba2c110165382-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="tHH/GXfgpr0="; 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: flichtenheld Cc: plaisthos , openvpn-devel --tHH/GXfgpr0= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/86= 5?usp=3Demail ) Change subject: Fix some trivial sign-compare compiler warnings ...................................................................... Fix some trivial sign-compare compiler warnings Change-Id: I1918c43202b87f0c987bfd9155c739da7dd02632 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Message-Id: <20250114165206.13187-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30= 455.html Signed-off-by: Gert Doering --- M src/openvpn/options.c M src/openvpn/socket.c M src/openvpn/tun.c 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/openvpn/options.c b/src/openvpn/options.c index eb0d9b5..3ef4d78 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 f9f2a3b..7765372 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -3132,8 +3132,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)) { @@ -3146,8 +3145,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)) { @@ -3160,8 +3158,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) { @@ -3183,9 +3180,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 7fbd6c3..33830fc 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -669,7 +669,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: 4 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --tHH/GXfgpr0= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

Fix some trivial sign-compare compiler warning=
s

Change-Id: I1918c43202b87f0c987bfd9155c739da7dd02632
Signed-off= -by: Frank Lichtenheld <frank@...2641...>
Acked-by: Gert Doering &= lt;gert@...1296...>
Message-Id: <20250114165206.13187-1-gert@...1711...= 96...>
URL: https://www.mail-archive.com/openvpn-devel@...1357...= rge.net/msg30455.html
Signed-off-by: Gert Doering <gert@...1296...>= ;
---
M src/openvpn/options.c
M src/openvpn/socket.c
M src/open= vpn/tun.c
3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index eb0d9b5..3ef4d78 100644
--- a/src/openvpn/options.= c
+++ b/src/openvpn/options.c
@@ -1448,7 +1= 448,7 @@

while (server)
{
- for= (int i =3D 0; i < server->addr_count; ++i)
+ for (size_t i =3D 0; i < server-&g= t;addr_count; ++i)
{
= if (server->addr[i].family =3D=3D AF_INET)
= {
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c<= /span>
index f9f2a3b..7765372 100644
--- a/src/ope= nvpn/socket.c
+++ b/src/openvpn/socket.c
@@= -3132,8 +3132,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(prot= o_names); ++i)
{
if (!strcmp(= proto_name, proto_names[i].short_form))
{@@ -3146,8 +3145,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))
= {
@@ -3160,8 +3158,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].pr= oto_af =3D=3D af && proto_names[i].proto =3D=3D proto)
{

@@ -3183,9 +3180,8 @@
proto= 2ascii_all(struct gc_arena *gc)
{
str= uct 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/s= rc/openvpn/tun.c b/src/openvpn/tun.c
index 7fbd6c3..33830fc= 100644
--- a/src/openvpn/tun.c
+++ b/src/o= penvpn/tun.c
@@ -669,7 +669,7 @@
{<= br> 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 neede= d =3D (RGI_ADDR_DEFINED|RGI_NETMASK_DEFINED);

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

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

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1918c43202b87f0c987bfd9155c= 739da7dd02632
Gerrit-Change-Number: 865
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--tHH/GXfgpr0=--