Skip to content

Commit 6d91eda

Browse files
flichtenheldcron2
authored andcommitted
Fix some trivial sign-compare compiler warnings
Change-Id: I1918c43202b87f0c987bfd9155c739da7dd02632 Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20250114165206.13187-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg30455.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
1 parent 758d281 commit 6d91eda

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

src/openvpn/options.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ foreign_options_copy_dns(struct options *o, struct env_set *es)
14481448

14491449
while (server)
14501450
{
1451-
for (int i = 0; i < server->addr_count; ++i)
1451+
for (size_t i = 0; i < server->addr_count; ++i)
14521452
{
14531453
if (server->addr[i].family == AF_INET)
14541454
{

src/openvpn/socket.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3132,8 +3132,7 @@ static const struct proto_names proto_names[] = {
31323132
int
31333133
ascii2proto(const char *proto_name)
31343134
{
3135-
int i;
3136-
for (i = 0; i < SIZE(proto_names); ++i)
3135+
for (size_t i = 0; i < SIZE(proto_names); ++i)
31373136
{
31383137
if (!strcmp(proto_name, proto_names[i].short_form))
31393138
{
@@ -3146,8 +3145,7 @@ ascii2proto(const char *proto_name)
31463145
sa_family_t
31473146
ascii2af(const char *proto_name)
31483147
{
3149-
int i;
3150-
for (i = 0; i < SIZE(proto_names); ++i)
3148+
for (size_t i = 0; i < SIZE(proto_names); ++i)
31513149
{
31523150
if (!strcmp(proto_name, proto_names[i].short_form))
31533151
{
@@ -3160,8 +3158,7 @@ ascii2af(const char *proto_name)
31603158
const char *
31613159
proto2ascii(int proto, sa_family_t af, bool display_form)
31623160
{
3163-
unsigned int i;
3164-
for (i = 0; i < SIZE(proto_names); ++i)
3161+
for (size_t i = 0; i < SIZE(proto_names); ++i)
31653162
{
31663163
if (proto_names[i].proto_af == af && proto_names[i].proto == proto)
31673164
{
@@ -3183,9 +3180,8 @@ const char *
31833180
proto2ascii_all(struct gc_arena *gc)
31843181
{
31853182
struct buffer out = alloc_buf_gc(256, gc);
3186-
int i;
31873183

3188-
for (i = 0; i < SIZE(proto_names); ++i)
3184+
for (size_t i = 0; i < SIZE(proto_names); ++i)
31893185
{
31903186
if (i)
31913187
{

src/openvpn/tun.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ warn_on_use_of_common_subnets(openvpn_net_ctx_t *ctx)
669669
{
670670
struct gc_arena gc = gc_new();
671671
struct route_gateway_info rgi;
672-
const int needed = (RGI_ADDR_DEFINED|RGI_NETMASK_DEFINED);
672+
const unsigned int needed = (RGI_ADDR_DEFINED|RGI_NETMASK_DEFINED);
673673

674674
get_default_gateway(&rgi, ctx);
675675
if ((rgi.flags & needed) == needed)

0 commit comments

Comments
 (0)