Merge pull request #2089 from profanity-im/cleanup

Cleanup
This commit is contained in:
Michael Vetter
2026-02-23 11:10:38 +01:00
committed by GitHub
26 changed files with 126 additions and 118 deletions

View File

@@ -376,7 +376,7 @@ _caps_by_ver(const char* const ver)
auto_gcharv gchar** features_list = g_key_file_get_string_list(cache, ver, "features", &features_len, NULL);
GSList* features = NULL;
if (features_list && features_len > 0) {
for (int i = 0; i < features_len; i++) {
for (gsize i = 0; i < features_len; i++) {
features = g_slist_append(features, features_list[i]);
}
}

View File

@@ -248,6 +248,12 @@ _iq_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* const us
return 1;
}
static void
_xmpp_stanza_release_destroy_notify(gpointer data)
{
xmpp_stanza_release((xmpp_stanza_t*)data);
}
void
iq_handlers_init(void)
{
@@ -264,7 +270,7 @@ iq_handlers_init(void)
iq_handlers_clear();
id_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)_iq_id_handler_free);
rooms_cache = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)xmpp_stanza_release);
rooms_cache = g_hash_table_new_full(g_str_hash, g_str_equal, free, _xmpp_stanza_release_destroy_notify);
}
struct iq_win_finder
@@ -302,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;
@@ -394,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);

View File

@@ -427,7 +427,7 @@ muc_rooms(void)
* Return current users nickname for the specified room
* The nickname is owned by the chat room and should not be modified or freed
*/
const char* const
const char*
muc_nick(const char* const room)
{
ChatRoom* chat_room = g_hash_table_lookup(rooms, room);

View File

@@ -93,7 +93,7 @@ GList* muc_rooms(void);
void muc_set_features(const char* const room, GSList* features);
const char* const muc_nick(const char* const room);
const char* muc_nick(const char* const room);
char* muc_password(const char* const room);
void muc_nick_change_start(const char* const room, const char* const new_nick);

View File

@@ -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);

View File

@@ -222,7 +222,7 @@ stanza_create_http_upload_request(xmpp_ctx_t* ctx, const char* const id,
auto_char char* filename_cpy = strdup(upload->filename);
// strip spaces from filename (servers don't spaces)
for (int i = 0; i < strlen(filename_cpy); i++) {
for (size_t i = 0; i < strlen(filename_cpy); i++) {
if (filename_cpy[i] == ' ') {
filename_cpy[i] = '_';
}
@@ -1863,7 +1863,7 @@ stanza_get_error_message(xmpp_stanza_t* stanza)
STANZA_NAME_UNEXPECTED_REQUEST
};
for (int i = 0; i < ARRAY_SIZE(defined_conditions); i++) {
for (size_t i = 0; i < ARRAY_SIZE(defined_conditions); i++) {
xmpp_stanza_t* cond_stanza = xmpp_stanza_get_child_by_name(error_stanza, defined_conditions[i]);
if (cond_stanza) {
char* result = strdup(xmpp_stanza_get_name(cond_stanza));