From 1120170ef7cf8edee1f601dc56446b4e74201ef8 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Thu, 19 Feb 2026 13:00:41 +0100 Subject: [PATCH] cleanup: Adapt type and cast to get ride of warnings --- src/ui/inputwin.c | 2 +- src/ui/window.c | 10 +++++----- src/xmpp/iq.c | 4 ++-- src/xmpp/session.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index 40200c48..33f275a1 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -366,7 +366,7 @@ _inp_write(char* line, int offset) if (line[i] == '\n') { c = retc; ch_len = wctomb(retc, L'\u23ce'); /* return symbol */ - if (ch_len == -1) { /* not representable */ + if (ch_len == (size_t)-1) { /* not representable */ retc[0] = '\\'; ch_len = 1; } diff --git a/src/ui/window.c b/src/ui/window.c index 5dbab52a..d11120eb 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -1871,7 +1871,7 @@ _win_print_wrapped(WINDOW* win, const char* const message, size_t indent, int pa curr_ch++; continue; } - int offset = 0; + size_t offset = 0; while (offset < ch_len) { word[wordi++] = curr_ch[offset++]; } @@ -1880,7 +1880,7 @@ _win_print_wrapped(WINDOW* win, const char* const message, size_t indent, int pa word[wordi] = '\0'; wordlen = utf8_display_len(word); - int curx = getcurx(win); + size_t curx = (size_t)getcurx(win); int cury; size_t maxx = getmaxx(win); @@ -1892,7 +1892,7 @@ _win_print_wrapped(WINDOW* win, const char* const message, size_t indent, int pa if (wordlen > linelen) { gchar* word_ch = g_utf8_offset_to_pointer(word, 0); while (*word_ch != '\0') { - curx = getcurx(win); + curx = (size_t)getcurx(win); cury = getcury(win); gboolean firstline = cury == starty; @@ -1913,7 +1913,7 @@ _win_print_wrapped(WINDOW* win, const char* const message, size_t indent, int pa // newline and print word } else { waddch(win, '\n'); - curx = getcurx(win); + curx = (size_t)getcurx(win); cury = getcury(win); gboolean firstline = cury == starty; @@ -1928,7 +1928,7 @@ _win_print_wrapped(WINDOW* win, const char* const message, size_t indent, int pa // no wrap required } else { - curx = getcurx(win); + curx = (size_t)getcurx(win); cury = getcury(win); gboolean firstline = cury == starty; diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index c2296748..4c333062 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -308,7 +308,7 @@ _free_late_delivery_userdata(LateDeliveryUserdata* d) void iq_handlers_remove_win(ProfWin* window) { - log_debug("Remove window %p of type %d", window, window ? window->type : -1); + log_debug("Remove window %p of type %d", window, window ? window->type : (win_type_t)-1); if (!window) return; GSList *cur = late_delivery_windows, *next; @@ -400,7 +400,7 @@ iq_autoping_check(void) } gdouble elapsed = g_timer_elapsed(autoping_time, NULL); - unsigned long seconds_elapsed = elapsed * 1.0; + gint seconds_elapsed = elapsed * 1.0; gint timeout = prefs_get_autoping_timeout(); if (timeout > 0 && seconds_elapsed >= timeout) { cons_show("Autoping response timed out after %u seconds.", timeout); diff --git a/src/xmpp/session.c b/src/xmpp/session.c index 86990ce8..ebd49fef 100644 --- a/src/xmpp/session.c +++ b/src/xmpp/session.c @@ -424,8 +424,8 @@ session_check_autoaway(void) gboolean check = prefs_get_boolean(PREF_AUTOAWAY_CHECK); gint away_time = prefs_get_autoaway_time(); gint xa_time = prefs_get_autoxa_time(); - int away_time_ms = away_time * 60000; - int xa_time_ms = xa_time * 60000; + unsigned long away_time_ms = away_time * 60000; + unsigned long xa_time_ms = xa_time * 60000; const char* account = session_get_account_name(); resource_presence_t curr_presence = accounts_get_last_presence(account);