From 180ce9f4fde4f87150b69e0cf40873226dbb9455 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sun, 28 Jan 2024 19:33:45 -0800 Subject: Change various types to the correct signedness to avoid warnings. Also cast the check of "inet_addr" to guint32. The POSIX declaration of this function returns in_addr_t which is the same as uint32_t. Windows does not define this type and instead uses unsigned long. --- plugins/fishlim/fish.c | 3 ++- plugins/fishlim/tests/tests.c | 2 +- src/common/dbus/dbus-client.c | 2 +- src/common/modes.c | 2 +- src/common/outbound.c | 2 +- src/common/url.c | 2 +- src/common/util.c | 2 +- src/fe-gtk/xtext.c | 3 ++- 8 files changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/fishlim/fish.c b/plugins/fishlim/fish.c index 7fe7e287..0b24ed48 100644 --- a/plugins/fishlim/fish.c +++ b/plugins/fishlim/fish.c @@ -145,7 +145,8 @@ void fish_deinit(void) */ char *fish_base64_encode(const char *message, size_t message_len) { BF_LONG left = 0, right = 0; - int i, j; + int i; + size_t j; char *encoded = NULL; char *end = NULL; char *msg = NULL; diff --git a/plugins/fishlim/tests/tests.c b/plugins/fishlim/tests/tests.c index 12b10d1d..553816d3 100644 --- a/plugins/fishlim/tests/tests.c +++ b/plugins/fishlim/tests/tests.c @@ -36,7 +36,7 @@ static void random_string(char *out, size_t len) { GRand *rand = NULL; - int i = 0; + size_t i = 0; rand = g_rand_new(); for (i = 0; i < len; ++i) { diff --git a/src/common/dbus/dbus-client.c b/src/common/dbus/dbus-client.c index 8b40dd24..e70a49a9 100644 --- a/src/common/dbus/dbus-client.c +++ b/src/common/dbus/dbus-client.c @@ -67,7 +67,7 @@ hexchat_remote (void) gboolean hexchat_running; GError *error = NULL; char *command = NULL; - int i; + guint i; /* if there is nothing to do, return now. */ if (!arg_existing || !(arg_url || arg_urls || arg_command)) { diff --git a/src/common/modes.c b/src/common/modes.c index d8fd75aa..1ff309bd 100644 --- a/src/common/modes.c +++ b/src/common/modes.c @@ -680,7 +680,7 @@ handle_mode (server * serv, char *word[], char *word_eol[], int len; size_t arg; size_t i, num_args; - int num_modes; + size_t num_modes; size_t offset = 3; int all_modes_have_args = FALSE; int using_front_tab = FALSE; diff --git a/src/common/outbound.c b/src/common/outbound.c index c82e23bd..b8153502 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -468,7 +468,7 @@ create_mask (session * sess, char *mask, char *mode, char *typestr, int deop) type = prefs.hex_irc_ban_type; buf[0] = 0; - if (inet_addr (fullhost) != -1) /* "fullhost" is really a IP number */ + if (inet_addr (fullhost) != (guint32) -1) /* "fullhost" is really a IP number */ { lastdot = strrchr (fullhost, '.'); if (!lastdot) diff --git a/src/common/url.c b/src/common/url.c index 6a1d09e8..ae85ae44 100644 --- a/src/common/url.c +++ b/src/common/url.c @@ -331,7 +331,7 @@ url_check_line (char *buf) GRegex *re(void); GMatchInfo *gmi; char *po = buf; - int i; + size_t i; /* Skip over message prefix */ if (*po == ':') diff --git a/src/common/util.c b/src/common/util.c index f06074fc..bd920cae 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -988,7 +988,7 @@ void country_search (char *pattern, void *ud, void (*print)(void *, char *, ...)) { const domain_t *dom; - int i; + size_t i; for (i = 0; i < sizeof (domain) / sizeof (domain_t); i++) { diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c index 08a5110a..be978f22 100644 --- a/src/fe-gtk/xtext.c +++ b/src/fe-gtk/xtext.c @@ -170,7 +170,8 @@ xtext_pango_attr (PangoAttribute *attr) static void xtext_pango_init (GtkXText *xtext) { - int i, j; + size_t i; + int j; char buf[2] = "\000"; if (attr_lists[0]) -- cgit 1.4.1