diff --git a/src/dbus.c b/src/dbus.c index dbb2806c4..166b0df94 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -169,7 +169,6 @@ void dbus_cb_fdn_methods(GDBusConnection *connection, GDBusMethodInvocation *invocation, gpointer user_data) { - struct dbus_method *m = bsearch(method_name, methods_fdn, G_N_ELEMENTS(methods_fdn), @@ -225,7 +224,6 @@ void dbus_cb_dunst_methods(GDBusConnection *connection, GDBusMethodInvocation *invocation, gpointer user_data) { - struct dbus_method *m = bsearch(method_name, methods_dunst, G_N_ELEMENTS(methods_dunst), @@ -236,8 +234,7 @@ void dbus_cb_dunst_methods(GDBusConnection *connection, m->method(connection, sender, parameters, invocation); } else { LOG_M("Unknown method name: '%s' (sender: '%s').", - method_name, - sender); + method_name, sender); } } @@ -450,7 +447,7 @@ static void gradient_entry(const struct gradient *grad, GVariantDict *dict, cons } char **strv = g_malloc((grad->length + 1) * sizeof(char *)); - for (int i = 0; i < grad->length; i++) { + for (size_t i = 0; i < grad->length; i++) { char buf[10]; if (color_to_string(grad->colors[i], buf)) strv[i] = g_strdup(buf); @@ -669,7 +666,7 @@ static void dbus_cb_GetCapabilities( g_variant_builder_add(builder, "s", "body-hyperlinks"); g_variant_builder_add(builder, "s", "icon-static"); - for (int i = 0; i < sizeof(stack_tag_hints)/sizeof(*stack_tag_hints); ++i) + for (size_t i = 0; i < sizeof(stack_tag_hints)/sizeof(*stack_tag_hints); ++i) g_variant_builder_add(builder, "s", stack_tag_hints[i]); // Since markup isn't a global variable anymore, look it up in the @@ -761,7 +758,7 @@ static struct notification *dbus_message_to_notification(const gchar *sender, GV * * Only accept to first one we find. */ - for (int i = 0; i < sizeof(stack_tag_hints)/sizeof(*stack_tag_hints); ++i) { + for (size_t i = 0; i < sizeof(stack_tag_hints)/sizeof(*stack_tag_hints); ++i) { if ((dict_value = g_variant_lookup_value(hints, stack_tag_hints[i], G_VARIANT_TYPE_STRING))) { n->stack_tag = g_variant_dup_string(dict_value, NULL); g_variant_unref(dict_value); @@ -862,7 +859,7 @@ static struct notification *dbus_message_to_notification(const gchar *sender, GV size_t length = g_strv_length(cols); struct gradient *grad = gradient_alloc(length); - for (int i = 0; i < length; i++) { + for (size_t i = 0; i < length; i++) { if (!string_parse_color(cols[i], &grad->colors[i])) { g_free(grad); goto end; @@ -903,7 +900,6 @@ static struct notification *dbus_message_to_notification(const gchar *sender, GV void signal_length_propertieschanged(void) { - static unsigned int last_displayed = 0; static unsigned int last_history = 0; static unsigned int last_waiting = 0; @@ -1207,7 +1203,7 @@ gboolean dbus_cb_dunst_Properties_Set(GDBusConnection *connection, static const GDBusInterfaceVTable interface_vtable_fdn = { - dbus_cb_fdn_methods + dbus_cb_fdn_methods, }; static const GDBusInterfaceVTable interface_vtable_dunst = { diff --git a/src/draw.c b/src/draw.c index 8d91f22bc..e85789c53 100644 --- a/src/draw.c +++ b/src/draw.c @@ -110,7 +110,7 @@ void gradient_pattern(struct gradient *grad) grad->colors[0].a); } else { grad->pattern = cairo_pattern_create_linear(0, 0, 1, 0); - for (int i = 0; i < grad->length; i++) { + for (size_t i = 0; i < grad->length; i++) { double offset = i / (double)(grad->length - 1); cairo_pattern_add_color_stop_rgba(grad->pattern, offset, @@ -129,7 +129,7 @@ char *gradient_to_string(const struct gradient *grad) int max = grad->length * 11 + 1; char *buf = g_malloc(max); - for (int i = 0, j = 0; i < grad->length; i++) { + for (size_t i = 0, j = 0; i < grad->length; i++) { j += g_snprintf(buf + j, max - j, "#%02x%02x%02x%02x", (int)(grad->colors[i].r * 255), (int)(grad->colors[i].g * 255), diff --git a/src/dunst.c b/src/dunst.c index bce7b980b..bc3e16ee6 100644 --- a/src/dunst.c +++ b/src/dunst.c @@ -164,7 +164,7 @@ static gboolean run(void *data) gint64 sleep = timeout_at - now; sleep = MAX(sleep, 1000); // Sleep at least 1ms - LOG_D("Sleeping for %li ms", sleep/1000); + LOG_D("Sleeping for %"G_GINT64_FORMAT" ms", sleep/1000); next_timeout_id = g_timeout_add(sleep/1000, run, NULL); } @@ -179,6 +179,8 @@ static gboolean run(void *data) gboolean pause_signal(gpointer data) { + (void)data; + dunst_status_int(S_PAUSE_LEVEL, MAX_PAUSE_LEVEL); wake_up(); @@ -187,6 +189,8 @@ gboolean pause_signal(gpointer data) gboolean unpause_signal(gpointer data) { + (void)data; + dunst_status_int(S_PAUSE_LEVEL, 0); wake_up(); @@ -195,6 +199,7 @@ gboolean unpause_signal(gpointer data) gboolean quit_signal(gpointer data) { + (void)data; g_main_loop_quit(mainloop); return G_SOURCE_CONTINUE; diff --git a/src/icon-lookup.c b/src/icon-lookup.c index 5cae69de8..7156ca8c6 100644 --- a/src/icon-lookup.c +++ b/src/icon-lookup.c @@ -168,7 +168,7 @@ void get_theme_path(void) { add_paths_from_env(theme_path, "XDG_DATA_DIRS", "icons", "/usr/local/share/:/usr/share/"); g_ptr_array_add(theme_path, g_strdup("/usr/share/pixmaps")); - for (int i = 0; i < theme_path->len; i++) { + for (size_t i = 0; i < theme_path->len; i++) { LOG_D("Theme locations: %s", (char*)theme_path->pdata[i]); } } @@ -179,7 +179,7 @@ int load_icon_theme(char *name) { get_theme_path(); } - for (int i = 0; i < theme_path->len; i++) { + for (size_t i = 0; i < theme_path->len; i++) { int theme_index = load_icon_theme_from_dir(theme_path->pdata[i], name); if (theme_index != -1) return theme_index; diff --git a/src/icon.c b/src/icon.c index 3c1aa1e08..2ce2ec5ec 100644 --- a/src/icon.c +++ b/src/icon.c @@ -268,6 +268,12 @@ char *get_path_from_icon_name(const char *iconname, int size) return path; } +static void icon_destroy(guchar *pixels, gpointer data) +{ + (void)data; + g_free(pixels); +} + GdkPixbuf *icon_get_for_data(GVariant *data, char **id, double dpi_scale, int min_size, int max_size) { ASSERT_OR_RET(data, NULL); @@ -351,7 +357,7 @@ GdkPixbuf *icon_get_for_data(GVariant *data, char **id, double dpi_scale, int mi width, height, rowstride, - (GdkPixbufDestroyNotify) g_free, + icon_destroy, data_pb); if (!pixbuf) { /* Dear user, I'm sorry, I'd like to give you a more specific diff --git a/src/log.c b/src/log.c index 76eca65ad..2aeb127ac 100644 --- a/src/log.c +++ b/src/log.c @@ -74,6 +74,8 @@ static void dunst_log_handler( const gchar *message, gpointer testing) { + (void)log_domain; + if (testing) log_level = G_LOG_LEVEL_ERROR; diff --git a/src/markup.c b/src/markup.c index cdb612087..89de3d896 100644 --- a/src/markup.c +++ b/src/markup.c @@ -273,7 +273,7 @@ static bool markup_is_entity(const char *str) return (cur == end); } else { const char *supported_tags[] = {"&", "<", ">", """, "'"}; - for (int i = 0; i < sizeof(supported_tags)/sizeof(*supported_tags); i++) { + for (size_t i = 0; i < sizeof(supported_tags)/sizeof(*supported_tags); i++) { if (g_str_has_prefix(str, supported_tags[i])) return true; } diff --git a/src/menu.c b/src/menu.c index 8d4241404..4bc97eaf3 100644 --- a/src/menu.c +++ b/src/menu.c @@ -169,7 +169,7 @@ char *notification_dmenu_string(struct notification *n) void invoke_action(const char *action) { struct notification *invoked = NULL; - uint id; + gint id; char *data_start, *data_comma, *data_end; @@ -273,7 +273,8 @@ char *invoke_dmenu(const char *dmenu_input) g_error_free(err); } else { size_t wlen = strlen(dmenu_input); - if (write(dunst_to_dmenu, dmenu_input, wlen) != wlen) { + ssize_t n = write(dunst_to_dmenu, dmenu_input, wlen); + if (n < 0 || (size_t)n != wlen) { LOG_W("Cannot feed dmenu with input: %s", strerror(errno)); } close(dunst_to_dmenu); @@ -368,6 +369,8 @@ static gboolean context_menu_result_dispatch(gpointer user_data) static gpointer context_menu_thread(gpointer data) { + (void)data; + char *dmenu_input = NULL; char *dmenu_output; diff --git a/src/notification.c b/src/notification.c index a504ba2a2..6a0d4fe40 100644 --- a/src/notification.c +++ b/src/notification.c @@ -61,9 +61,9 @@ void notification_print(const struct notification *n) printf("\ticon_id: '%s'\n", STR_NN(n->icon_id)); printf("\tdesktop_entry: '%s'\n", n->desktop_entry ? n->desktop_entry : ""); printf("\tcategory: %s\n", STR_NN(n->category)); - printf("\ttimeout: %ld\n", n->timeout/1000); - printf("\tstart: %ld\n", n->start); - printf("\ttimestamp: %ld\n", n->timestamp); + printf("\ttimeout: %"G_GINT64_FORMAT"\n", n->timeout/1000); + printf("\tstart: %"G_GINT64_FORMAT"\n", n->start); + printf("\ttimestamp: %"G_GINT64_FORMAT"\n", n->timestamp); printf("\turgency: %s\n", notification_urgency_to_string(n->urgency)); printf("\ttransient: %d\n", n->transient); printf("\tformatted: '%s'\n", STR_NN(n->msg)); @@ -148,8 +148,8 @@ void notification_run_script(struct notification *n) // Set environment variables gchar *n_id_str = g_strdup_printf("%i", n->id); gchar *n_progress_str = g_strdup_printf("%i", n->progress); - gchar *n_timeout_str = g_strdup_printf("%li", n->timeout/1000); - gchar *n_timestamp_str = g_strdup_printf("%li", n->timestamp / 1000); + gchar *n_timeout_str = g_strdup_printf("%"G_GINT64_FORMAT, n->timeout/1000); + gchar *n_timestamp_str = g_strdup_printf("%"G_GINT64_FORMAT, n->timestamp / 1000); safe_setenv("DUNST_APP_NAME", appname); safe_setenv("DUNST_SUMMARY", summary); safe_setenv("DUNST_BODY", body); @@ -230,6 +230,8 @@ int notification_cmp(const struct notification *a, const struct notification *b) /* see notification.h */ int notification_cmp_data(const void *va, const void *vb, void *data) { + (void)data; + struct notification *a = (struct notification *) va; struct notification *b = (struct notification *) vb; @@ -725,15 +727,14 @@ void notification_update_text_to_render(struct notification *n) char *new_buf; if (hours > 0) { - new_buf = - g_strdup_printf("%s (%ldh %ldm %lds old)", buf, hours, - minutes, seconds); + new_buf = g_strdup_printf("%s (%"G_GINT64_FORMAT"h %"G_GINT64_FORMAT"m %"G_GINT64_FORMAT"s old)", + buf, hours, minutes, seconds); } else if (minutes > 0) { - new_buf = - g_strdup_printf("%s (%ldm %lds old)", buf, minutes, - seconds); + new_buf = g_strdup_printf("%s (%"G_GINT64_FORMAT"m %"G_GINT64_FORMAT"s old)", + buf, minutes, seconds); } else { - new_buf = g_strdup_printf("%s (%lds old)", buf, seconds); + new_buf = g_strdup_printf("%s (%"G_GINT64_FORMAT"s old)", + buf, seconds); } g_free(buf); diff --git a/src/notification.h b/src/notification.h index bbec684ed..7d2f0d68a 100644 --- a/src/notification.h +++ b/src/notification.h @@ -47,7 +47,7 @@ struct notification_colors { struct notification { NotificationPrivate *priv; - int id; + gint id; char *dbus_client; bool dbus_valid; diff --git a/src/option_parser.c b/src/option_parser.c index 7ee656a57..519eec05f 100644 --- a/src/option_parser.c +++ b/src/option_parser.c @@ -297,7 +297,7 @@ int get_setting_id(const char *key, const char *section) { if (!match_section) { LOG_D("not matching section %s", section); } - for (int i = 0; i < G_N_ELEMENTS(allowed_settings); i++) { + for (size_t i = 0; i < G_N_ELEMENTS(allowed_settings); i++) { if (strcmp(allowed_settings[i].name, key) == 0) { bool is_rule = allowed_settings[i].rule_offset > 0; @@ -489,7 +489,7 @@ void set_defaults(void) { LOG_D("Initializing settings"); settings = (struct settings) {0}; - for (int i = 0; i < G_N_ELEMENTS(allowed_settings); i++) { + for (size_t i = 0; i < G_N_ELEMENTS(allowed_settings); i++) { // FIXME Rule settings can only have a default if they have an // working entry in the settings struct as well. Make an // alternative way of setting defaults for rules. diff --git a/src/queues.c b/src/queues.c index ac537e023..055c94212 100644 --- a/src/queues.c +++ b/src/queues.c @@ -222,7 +222,7 @@ int queues_notification_insert(struct notification *n) static bool queues_stack_duplicate(struct notification *new) { GQueue *allqueues[] = { displayed, waiting }; - for (int i = 0; i < sizeof(allqueues)/sizeof(GQueue*); i++) { + for (size_t i = 0; i < sizeof(allqueues)/sizeof(GQueue*); i++) { for (GList *iter = g_queue_peek_head_link(allqueues[i]); iter; iter = iter->next) { struct notification *old = iter->data; @@ -263,7 +263,7 @@ static bool queues_stack_duplicate(struct notification *new) static bool queues_stack_by_tag(struct notification *new) { GQueue *allqueues[] = { displayed, waiting }; - for (int i = 0; i < sizeof(allqueues)/sizeof(GQueue*); i++) { + for (size_t i = 0; i < sizeof(allqueues)/sizeof(GQueue*); i++) { for (GList *iter = g_queue_peek_head_link(allqueues[i]); iter; iter = iter->next) { struct notification *old = iter->data; @@ -293,7 +293,7 @@ static bool queues_stack_by_tag(struct notification *new) bool queues_notification_replace_id(struct notification *new) { GQueue *allqueues[] = { displayed, waiting }; - for (int i = 0; i < sizeof(allqueues)/sizeof(GQueue*); i++) { + for (size_t i = 0; i < sizeof(allqueues)/sizeof(GQueue*); i++) { for (GList *iter = g_queue_peek_head_link(allqueues[i]); iter; iter = iter->next) { @@ -316,12 +316,12 @@ bool queues_notification_replace_id(struct notification *new) } /* see queues.h */ -void queues_notification_close_id(int id, enum reason reason) +void queues_notification_close_id(gint id, enum reason reason) { struct notification *target = NULL; GQueue *allqueues[] = { displayed, waiting }; - for (int i = 0; i < sizeof(allqueues)/sizeof(GQueue*); i++) { + for (size_t i = 0; i < sizeof(allqueues)/sizeof(GQueue*); i++) { for (GList *iter = g_queue_peek_head_link(allqueues[i]); iter; iter = iter->next) { struct notification *n = iter->data; @@ -348,10 +348,16 @@ void queues_notification_close(struct notification *n, enum reason reason) queues_notification_close_id(n->id, reason); } +static void queues_destroy_notification(struct notification *n, gpointer user_data) +{ + (void)user_data; + notification_unref(n); +} + /* see queues.h */ void queues_history_clear(void) { - g_queue_foreach(history, (GFunc)notification_unref, NULL); + g_queue_foreach(history, (GFunc)queues_destroy_notification, NULL); g_queue_clear(history); } @@ -368,7 +374,7 @@ void queues_history_pop(void) } /* see queues.h */ -void queues_history_pop_by_id(unsigned int id) +void queues_history_pop_by_id(gint id) { struct notification *n = NULL; @@ -399,7 +405,8 @@ void queues_history_pop_by_id(unsigned int id) void queues_history_push(struct notification *n) { if (!n->history_ignore) { - if (settings.history_length > 0 && history->length >= settings.history_length) { + guint maxlen = settings.history_length; + if (settings.history_length > 0 && history->length >= maxlen) { struct notification *to_free = g_queue_pop_head(history); notification_unref(to_free); } @@ -423,7 +430,7 @@ void queues_history_push_all(void) } /* see queues.h */ -void queues_history_remove_by_id(unsigned int id) { +void queues_history_remove_by_id(gint id) { struct notification *n = NULL; if (g_queue_is_empty(history)) @@ -600,12 +607,12 @@ gint64 queues_get_next_datachange(gint64 time) /* see queues.h */ -struct notification* queues_get_by_id(int id) +struct notification* queues_get_by_id(gint id) { assert(id > 0); GQueue *recqueues[] = { displayed, waiting, history }; - for (int i = 0; i < sizeof(recqueues)/sizeof(GQueue*); i++) { + for (size_t i = 0; i < sizeof(recqueues)/sizeof(GQueue*); i++) { for (GList *iter = g_queue_peek_head_link(recqueues[i]); iter; iter = iter->next) { struct notification *cur = iter->data; @@ -620,7 +627,7 @@ struct notification* queues_get_by_id(int id) void queues_reapply_all_rules(void) { GQueue *recqueues[] = { displayed, waiting, history }; - for (int i = 0; i < sizeof(recqueues)/sizeof(GQueue*); i++) { + for (size_t i = 0; i < sizeof(recqueues)/sizeof(GQueue*); i++) { for (GList *iter = g_queue_peek_head_link(recqueues[i]); iter; iter = iter->next) { struct notification *cur = iter->data; diff --git a/src/queues.h b/src/queues.h index 55e85baf0..0572fadde 100644 --- a/src/queues.h +++ b/src/queues.h @@ -97,7 +97,7 @@ bool queues_notification_replace_id(struct notification *new); * @post Call wake_up() to synchronize the queues with the UI * (which closes the notification on screen) */ -void queues_notification_close_id(int id, enum reason reason); +void queues_notification_close_id(gint id, enum reason reason); /** * Close the given notification. \see queues_notification_close_id(). @@ -122,7 +122,7 @@ void queues_history_pop(void); * Pushes the latest notification found in the history buffer identified by * it's assigned id */ -void queues_history_pop_by_id(unsigned int id); +void queues_history_pop_by_id(gint id); /** * Push a single notification to history @@ -138,9 +138,9 @@ void queues_history_push(struct notification *n); void queues_history_push_all(void); /** - * Removes an notification identified by the given id from the history + * Removes an notification identified by the given id from the history */ -void queues_history_remove_by_id(unsigned int id); +void queues_history_remove_by_id(gint id); /** * Move inserted notifications from waiting queue to displayed queue @@ -177,7 +177,7 @@ gint64 queues_get_next_datachange(gint64 time); * * @return the `id` notification or NULL */ -struct notification* queues_get_by_id(int id); +struct notification* queues_get_by_id(gint id); /** * Reapply all rules to the queue (used when reloading configs) diff --git a/src/rules.c b/src/rules.c index 4e41251ec..111b5bcc2 100644 --- a/src/rules.c +++ b/src/rules.c @@ -150,12 +150,12 @@ void rule_print(const struct rule *r) if (r->msg_urgency != URG_NONE) printf("\tmsg_urgency: '%s'\n", notification_urgency_to_string(r->msg_urgency)); if (r->stack_tag != NULL) printf("\tstack_tag: '%s'\n", r->stack_tag); if (r->desktop_entry != NULL) printf("\tdesktop_entry: '%s'\n", r->desktop_entry); - if (r->match_dbus_timeout != -1) printf("\tmatch_dbus_timeout: %ld\n", r->match_dbus_timeout); + if (r->match_dbus_timeout != -1) printf("\tmatch_dbus_timeout: %"G_GINT64_FORMAT"\n", r->match_dbus_timeout); if (r->match_transient != -1) printf("\tmatch_transient: %d\n", r->match_transient); // modifiers - if (r->timeout != -1) printf("\ttimeout: %ld\n", r->timeout); - if (r->override_dbus_timeout != -1) printf("\toverride_dbus_timeout: %ld\n", r->override_dbus_timeout); + if (r->timeout != -1) printf("\ttimeout: %"G_GINT64_FORMAT"\n", r->timeout); + if (r->override_dbus_timeout != -1) printf("\toverride_dbus_timeout: %"G_GINT64_FORMAT"\n", r->override_dbus_timeout); if (r->markup != -1) printf("\tmarkup: %d\n", r->markup); if (r->action_name != NULL) printf("\taction_name: '%s'\n", r->action_name); if (r->urgency != URG_NONE) printf("\turgency: '%s'\n", notification_urgency_to_string(r->urgency)); diff --git a/src/settings.c b/src/settings.c index 6b83fe053..7a7598703 100644 --- a/src/settings.c +++ b/src/settings.c @@ -115,7 +115,7 @@ static GPtrArray* get_conf_files(void) { GPtrArray *config_locations = get_xdg_conf_basedirs(); GPtrArray *config_files = g_ptr_array_new_full(3, g_free); char *dunstrc_location = NULL; - for (int i = 0; i < config_locations->len; i++) { + for (size_t i = 0; i < config_locations->len; i++) { dunstrc_location = g_build_filename(config_locations->pdata[i], "dunstrc", NULL); LOG_D("Trying config location: %s", dunstrc_location); diff --git a/src/wayland/foreign_toplevel.c b/src/wayland/foreign_toplevel.c index 4080d58aa..c6ad3ec71 100644 --- a/src/wayland/foreign_toplevel.c +++ b/src/wayland/foreign_toplevel.c @@ -13,7 +13,8 @@ struct wl_list toplevel_list; static void copy_state(struct toplevel_state *current, - struct toplevel_state *pending) { + struct toplevel_state *pending) +{ if (!(pending->state & TOPLEVEL_STATE_INVALID)) { current->state = pending->state; } @@ -25,7 +26,10 @@ static uint32_t global_id = 0; static void toplevel_handle_output_enter(void *data, struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel, - struct wl_output *wl_output) { + struct wl_output *wl_output) +{ + (void)zwlr_toplevel; + struct toplevel_v1 *toplevel = data; struct toplevel_output *toplevel_output = calloc(1, sizeof(struct toplevel_output)); struct dunst_output *dunst_output = wl_output_get_user_data(wl_output); @@ -36,7 +40,10 @@ static void toplevel_handle_output_enter(void *data, static void toplevel_handle_output_leave(void *data, struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel, - struct wl_output *wl_output) { + struct wl_output *wl_output) +{ + (void)zwlr_toplevel; + struct toplevel_v1 *toplevel = data; struct dunst_output *output = wl_output_get_user_data(wl_output); @@ -63,13 +70,18 @@ static uint32_t array_to_state(struct wl_array *array) { static void toplevel_handle_state(void *data, struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel, - struct wl_array *state) { + struct wl_array *state) +{ + (void)zwlr_toplevel; + struct toplevel_v1 *toplevel = data; toplevel->pending.state = array_to_state(state); } static void toplevel_handle_done(void *data, - struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel) { + struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel) +{ + (void)zwlr_toplevel; struct toplevel_v1 *toplevel = data; bool was_fullscreen = wl_have_fullscreen_window(); @@ -82,7 +94,8 @@ static void toplevel_handle_done(void *data, } static void toplevel_handle_closed(void *data, - struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel) { + struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel) +{ struct toplevel_v1 *toplevel = data; wl_list_remove(&toplevel->link); @@ -95,13 +108,21 @@ static void toplevel_handle_closed(void *data, } static void toplevel_handle_title(void *data, - struct zwlr_foreign_toplevel_handle_v1 *zwlr_foreign_toplevel_handle_v1, - const char *title) { + struct zwlr_foreign_toplevel_handle_v1 *zwlr_foreign_toplevel, + const char *title) +{ + (void)data; + (void)zwlr_foreign_toplevel; + (void)title; } static void toplevel_handle_app_id(void *data, - struct zwlr_foreign_toplevel_handle_v1 *zwlr_foreign_toplevel_handle_v1, - const char *title) { + struct zwlr_foreign_toplevel_handle_v1 *zwlr_foreign_toplevel, + const char *title) +{ + (void)data; + (void)zwlr_foreign_toplevel; + (void)title; } static const struct zwlr_foreign_toplevel_handle_v1_listener toplevel_impl = { @@ -116,7 +137,11 @@ static const struct zwlr_foreign_toplevel_handle_v1_listener toplevel_impl = { static void toplevel_manager_handle_toplevel(void *data, struct zwlr_foreign_toplevel_manager_v1 *toplevel_manager, - struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel) { + struct zwlr_foreign_toplevel_handle_v1 *zwlr_toplevel) +{ + (void)data; + (void)toplevel_manager; + struct toplevel_v1 *toplevel = calloc(1, sizeof(struct toplevel_v1)); if (!toplevel) { fprintf(stderr, "Failed to allocate memory for toplevel\n"); @@ -133,7 +158,9 @@ static void toplevel_manager_handle_toplevel(void *data, } static void toplevel_manager_handle_finished(void *data, - struct zwlr_foreign_toplevel_manager_v1 *toplevel_manager) { + struct zwlr_foreign_toplevel_manager_v1 *toplevel_manager) +{ + (void)data; zwlr_foreign_toplevel_manager_v1_destroy(toplevel_manager); } diff --git a/src/wayland/wl.c b/src/wayland/wl.c index ec6133e4b..8bd38583b 100644 --- a/src/wayland/wl.c +++ b/src/wayland/wl.c @@ -696,7 +696,7 @@ double wl_get_scale(void) { // return the largest scale struct dunst_output *output; wl_list_for_each(output, &ctx.outputs, link) { - scale = MAX(output->scale, scale); + scale = MAX((int)output->scale, scale); } } if (scale <= 0) diff --git a/src/x11/screen.c b/src/x11/screen.c index 4dc5157ac..dc7a6e0ca 100644 --- a/src/x11/screen.c +++ b/src/x11/screen.c @@ -290,7 +290,7 @@ bool window_is_fullscreen(Window window) XSetErrorHandler(NULL); if (result == Success) { - for(int i = 0; i < n_items; i++) { + for(size_t i = 0; i < n_items; i++) { Atom atom = ((Atom*) prop_to_return)[i]; if (!atom) continue; diff --git a/src/x11/x.c b/src/x11/x.c index 440751914..892fafe45 100644 --- a/src/x11/x.c +++ b/src/x11/x.c @@ -368,6 +368,7 @@ gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, gpointer } /* Explicitly fallthrough. Other PropertyNotify events, e.g. catching * _NET_WM get handled in the Focus(In|Out) section */ + /* fall through */ case ConfigureNotify: case FocusIn: case FocusOut: diff --git a/test/dbus.c b/test/dbus.c index 98b8fe03b..4e921cb66 100644 --- a/test/dbus.c +++ b/test/dbus.c @@ -770,7 +770,7 @@ TEST test_dbus_notify_colors(void) ASSERTm("Invalid color strings should not change the gradient struct", n->colors.highlight->length == settings.colors_norm.highlight->length); - for (int i = 0; i < settings.colors_norm.highlight->length; i++) + for (size_t i = 0; i < settings.colors_norm.highlight->length; i++) ASSERTm("Invalid color strings should not change the gradient struct", COLOR_SAME(n->colors.highlight->colors[i], settings.colors_norm.highlight->colors[i])); @@ -812,7 +812,7 @@ TEST test_hint_transient(void) ASSERT(dbus_notification_fire(n_dbus, &id)); ASSERT(id != 0); - snprintf(msg, sizeof(msg), "In round %ld", i); + snprintf(msg, sizeof(msg), "In round %zu", i); ASSERT_EQm(msg, queues_length_waiting(), len+1); n = queues_debug_find_notification_by_id(id); @@ -857,12 +857,12 @@ TEST test_hint_progress(void) ASSERT(dbus_notification_fire(n_dbus, &id)); ASSERT(id != 0); - snprintf(msg, sizeof(msg), "In round %ld", i); + snprintf(msg, sizeof(msg), "In round %zu", i); ASSERT_EQm(msg, queues_length_waiting(), len+1); n = queues_debug_find_notification_by_id(id); - snprintf(msg, sizeof(msg), "In round %ld progress should be %i, but is %i", i, n->progress, values[i]); + snprintf(msg, sizeof(msg), "In round %zu progress should be %i, but is %i", i, n->progress, values[i]); ASSERT_EQm(msg, values[i], n->progress); } @@ -1004,7 +1004,7 @@ TEST test_hint_urgency(void) n = queues_debug_find_notification_by_id(id); - snprintf(msg, sizeof(msg), "In round %ld", i); + snprintf(msg, sizeof(msg), "In round %zu", i); ASSERT_EQm(msg, values[i], n->urgency); queues_notification_close_id(id, REASON_UNDEF); @@ -1221,7 +1221,7 @@ TEST test_close_and_signal(void) TEST test_get_fdn_daemon_info(void) { - unsigned int pid_is; + guint pid_is; pid_t pid_should; char *name, *vendor; GDBusConnection *conn; @@ -1231,7 +1231,7 @@ TEST test_get_fdn_daemon_info(void) ASSERT(dbus_get_fdn_daemon_info(conn, &pid_is, &name, &vendor)); - ASSERT_EQ_FMT(pid_should, pid_is, "%d"); + ASSERT_EQ_FMT(pid_should, (pid_t)pid_is, "%d"); ASSERT_STR_EQ("dunst", name); ASSERT_STR_EQ("knopwob", vendor); diff --git a/test/notification.c b/test/notification.c index 58a551958..7f0330164 100644 --- a/test/notification.c +++ b/test/notification.c @@ -239,7 +239,7 @@ TEST test_notification_maxlength(void) " 0123456789" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz"; - for (int i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) n->appname[i] = sigma[rand() % (sizeof(sigma) - 1)]; notification_format_message(n); diff --git a/test/option_parser.c b/test/option_parser.c index f2113a7bd..a8d1a18cf 100644 --- a/test/option_parser.c +++ b/test/option_parser.c @@ -140,8 +140,8 @@ TEST test_string_to_int(void) s.type = TYPE_INT; static char buf[50]; - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERTm(buf, set_from_string(&val, s, inputs[i])); ASSERT_EQm(buf, val, results[i]); } @@ -167,8 +167,8 @@ TEST test_string_to_int_invalid(void) s.name = "test_int"; static char buf[50]; - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERT_FALSEm(buf, set_from_string(&val, s, inputs[i])); } ASSERT_EQm("Value should not be changed for invalid ints", val, -123); @@ -200,8 +200,8 @@ TEST test_string_to_double(void) s.type = TYPE_DOUBLE; static char buf[50]; - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERTm(buf, set_from_string(&val, s, inputs[i])); ASSERT_EQm(buf, val, results[i]); } @@ -226,8 +226,8 @@ TEST test_string_to_double_invalid(void) s.name = "test_double"; static char buf[50]; - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERT_FALSEm(buf, set_from_string(&val, s, inputs[i])); } ASSERT_EQm("Value should not be changed for invalid doubles", val, -100.0); @@ -264,10 +264,10 @@ TEST test_string_to_boolean(void) ARRAY_SAME_LENGTH(inputs, results); static char buf[50]; - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERTm(buf, set_from_string(&val, s, inputs[i])); - sprintf(buf, "Failed in round %i. %i should be %i", i, val, results[i]); + sprintf(buf, "Failed in round %zu. %i should be %i", i, val, results[i]); ASSERT_EQm(buf, val, results[i]); } PASS(); @@ -292,9 +292,8 @@ TEST test_string_to_boolean_invalid(void) }; static char buf[50]; - - for (int i = 0; i < G_N_ELEMENTS(invalid_inputs); i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(invalid_inputs); i++) { + sprintf(buf, "Failed in round %zu", i); bool success = set_from_string(&val, s, invalid_inputs[i]); ASSERT_FALSEm(buf, success); } @@ -315,8 +314,8 @@ TEST test_string_to_enum(void) static char buf[50]; // do not go until last element, since it's ENUM_END (all 0) - for (int i = 0; i < G_N_ELEMENTS(ellipsize_enum_data)-1; i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(ellipsize_enum_data)-1; i++) { + sprintf(buf, "Failed in round %zu", i); ASSERTm(buf, set_from_string(&val, s, ellipsize_enum_data[i].string)); ASSERT_EQm(buf, val, ellipsize_enum_data[i].enum_value); } @@ -344,8 +343,8 @@ TEST test_string_to_enum_invalid(void) static char buf[50]; - for (int i = 0; i < G_N_ELEMENTS(invalid_inputs); i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(invalid_inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERT_FALSEm(buf, set_from_string(&val, s, invalid_inputs[i])); } ASSERT_EQm("Enum should not change from invalid values", val, -123); @@ -384,12 +383,12 @@ TEST test_string_to_list(void) }; static char buf[100]; - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERTm(buf, set_from_string(s.value, s, inputs[i])); ASSERT_EQm(buf, get_list_len(val), get_list_len(results[i])); - for (int j = 0; val[j] != MOUSE_ACTION_END; j++) { - sprintf(buf, "Failed in round %i, element %i. Is %i, should be %i", i, j, val[j], results[i][j]); + for (size_t j = 0; val[j] != MOUSE_ACTION_END; j++) { + sprintf(buf, "Failed in round %zu, element %zu. Is %i, should be %i", i, j, val[j], results[i][j]); ASSERT_EQm(buf, val[j], results[i][j]); } } @@ -426,9 +425,8 @@ TEST test_string_to_list_invalid(void) }; static char buf[256]; - - for (int i = 0; i < G_N_ELEMENTS(invalid_inputs); i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(invalid_inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERT_FALSEm(buf, set_from_string(&val, s, invalid_inputs[i])); } sprintf(buf,"List should not change from invalid values. Expected length %i, got %i", len, get_list_len(val)); @@ -466,10 +464,10 @@ TEST test_string_to_time(void) ARRAY_SAME_LENGTH(inputs, results); static char buf[50]; - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERTm(buf, set_from_string(&val, s, inputs[i])); - sprintf(buf, "Failed in round %i. %li should be %i", i, val, results[i]); + sprintf(buf, "Failed in round %zu. %"G_GINT64_FORMAT" should be %i", i, val, results[i]); ASSERT_EQm(buf, val, results[i]); } PASS(); @@ -496,8 +494,8 @@ TEST test_string_to_time_invalid(void) }; static char buf[50]; - for (int i = 0; i < G_N_ELEMENTS(invalid_inputs); i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(invalid_inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERT_FALSEm(buf, set_from_string(&val, s, invalid_inputs[i])); } ASSERT_EQm("Time should not change from invalid values", val, 1234); @@ -555,12 +553,12 @@ TEST test_string_to_path(void) ARRAY_SAME_LENGTH(inputs, results2); static char buf[256]; - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERTm(buf, set_from_string(&val, s, inputs[i])); - sprintf(buf, "Failed in round %i. %s should be %s", i, val, results[i]); + sprintf(buf, "Failed in round %zu. %s should be %s", i, val, results[i]); ASSERTm(buf, STR_EQ(val, results[i])); - for (int j = 0; results2[i][j] != NULL; j++) { + for (size_t j = 0; results2[i][j] != NULL; j++) { ASSERT_STR_EQ(results2[i][j], val2[j]); } } @@ -605,12 +603,12 @@ TEST test_string_to_sepcolor(void) static char buf[100]; char buf1[10], buf2[10]; - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i. Expected %i, got %i", i, results[i].type, val.type); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu. Expected %i, got %i", i, results[i].type, val.type); ASSERTm(buf, set_from_string(&val, s, inputs[i])); ASSERT_EQm(buf, results[i].type, val.type); - sprintf(buf, "Failed in round %i. Expected %s, got %s", i, + sprintf(buf, "Failed in round %zu. Expected %s, got %s", i, color_to_string(results[i].color, buf1), color_to_string(val.color, buf2)); ASSERTm(buf, (!COLOR_VALID(val.color) && !COLOR_VALID(results[i].color)) || COLOR_SAME(results[i].color, val.color)); } @@ -639,8 +637,8 @@ TEST test_string_to_sepcolor_invalid(void) }; static char buf[50]; - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i.", i); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERT_FALSEm(buf, set_from_string(&val, s, inputs[i])); } @@ -680,8 +678,8 @@ TEST test_string_to_color(void) static char buf[100]; char buf1[10], buf2[10]; - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i. Expected %s, got %s", i, + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu. Expected %s, got %s", i, color_to_string(results[i], buf1), color_to_string(val, buf2)); ASSERTm(buf, set_from_string(&val, s, inputs[i])); ASSERTm(buf, COLOR_SAME(results[i], val)); @@ -718,8 +716,8 @@ TEST test_string_to_color_invalid(void) }; static char buf[50]; - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i.", i); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERT_FALSEm(buf, set_from_string(&val, s, inputs[i])); } @@ -764,15 +762,14 @@ TEST test_string_to_gradient(void) ARRAY_SAME_LENGTH(inputs, results); static char buf[100]; - - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERTm(buf, set_from_string(&grad, s, inputs[i])); char *t1 = gradient_to_string(results[i]); char *t2 = gradient_to_string(grad); - sprintf(buf, "Failed in round %i. Expected %s, got %s", i, t1, t2); + sprintf(buf, "Failed in round %zu. Expected %s, got %s", i, t1, t2); g_free(t1); g_free(t2); @@ -780,14 +777,14 @@ TEST test_string_to_gradient(void) ASSERTm(buf, grad != NULL); ASSERTm(buf, grad->length == results[i]->length); - for (int k = 0; k < grad->length; k++) + for (size_t k = 0; k < grad->length; k++) ASSERTm(buf, COLOR_SAME(grad->colors[k], results[i]->colors[k])); gradient_release(grad); grad = NULL; } - for (int i = 0; i < G_N_ELEMENTS(results); i++) + for (size_t i = 0; i < G_N_ELEMENTS(results); i++) gradient_release(results[i]); PASS(); @@ -832,12 +829,12 @@ TEST test_string_to_length(void) ARRAY_SAME_LENGTH(inputs, results); static char buf[500]; - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i.", i); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu.", i); ASSERTm(buf, set_from_string(&val, s, inputs[i])); - sprintf(buf, "Failed in round %i. Expected min to be %i, got %i", i, results[i].min, val.min); + sprintf(buf, "Failed in round %zu. Expected min to be %i, got %i", i, results[i].min, val.min); ASSERT_EQm(buf, results[i].min, val.min); - sprintf(buf, "Failed in round %i. Expected max to be %i, got %i", i, results[i].max, val.max); + sprintf(buf, "Failed in round %zu. Expected max to be %i, got %i", i, results[i].max, val.max); ASSERT_EQm(buf, results[i].max, val.max); } @@ -870,8 +867,8 @@ TEST test_string_to_length_invalid(void) }; static char buf[50]; - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i.", i); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERT_FALSEm(buf, set_from_string(&val, s, inputs[i])); } @@ -893,8 +890,8 @@ TEST test_string_to_corners(void) static char buf[50]; // do not go until last element, since it's ENUM_END (all 0) - for (int i = 0; i < G_N_ELEMENTS(ellipsize_enum_data)-1; i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(ellipsize_enum_data)-1; i++) { + sprintf(buf, "Failed in round %zu", i); ASSERTm(buf, set_from_string(&corners, s, corners_enum_data[i].string)); ASSERT_EQm(buf, corners, corners_enum_data[i].enum_value); } @@ -920,8 +917,8 @@ TEST test_string_to_corners(void) ARRAY_SAME_LENGTH(inputs, results); - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERTm(buf, set_from_string(&corners, s, inputs[i])); ASSERT_EQm(buf, corners, results[i]); } @@ -950,8 +947,8 @@ TEST test_string_to_corners_invalid(void) }; static char buf[50]; - for (int i = 0; i < G_N_ELEMENTS(invalid_inputs); i++) { - sprintf(buf, "Failed in round %i", i); + for (size_t i = 0; i < G_N_ELEMENTS(invalid_inputs); i++) { + sprintf(buf, "Failed in round %zu", i); bool success = set_from_string(&corners, s, invalid_inputs[i]); ASSERT_FALSEm(buf, success); } @@ -985,12 +982,12 @@ TEST test_string_to_maybe_int(void) }; static char buf[500]; - for (int i = 0; i < G_N_ELEMENTS(inputs); i++) { - sprintf(buf, "Failed in round %i.", i); + for (size_t i = 0; i < G_N_ELEMENTS(inputs); i++) { + sprintf(buf, "Failed in round %zu", i); ASSERTm(buf, set_from_string(&val, s, inputs[i])); - sprintf(buf, "Failed in round %i. Expected val to be %s, got %s", i, results[i].s, val); + sprintf(buf, "Failed in round %zu. Expected val to be %s, got %s", i, results[i].s, val); ASSERTm(buf, STR_EQ(val, results[i].s)); - sprintf(buf, "Failed in round %i. Expected intval to be %i, got %i", i, results[i].i, intval); + sprintf(buf, "Failed in round %zu. Expected intval to be %i, got %i", i, results[i].i, intval); ASSERT_EQm(buf, results[i].i, intval); } diff --git a/test/queues.c b/test/queues.c index 5bcbe89fd..0402486c0 100644 --- a/test/queues.c +++ b/test/queues.c @@ -7,12 +7,12 @@ #include "queues.h" #include "helpers.h" -struct notification *queues_debug_find_notification_by_id(int id) +struct notification *queues_debug_find_notification_by_id(gint id) { assert(id > 0); GQueue *allqueues[] = { displayed, waiting, history }; - for (int i = 0; i < sizeof(allqueues)/sizeof(GQueue*); i++) { + for (size_t i = 0; i < sizeof(allqueues)/sizeof(GQueue*); i++) { for (GList *iter = g_queue_peek_head_link(allqueues[i]); iter; iter = iter->next) { struct notification *cur = iter->data; @@ -326,7 +326,7 @@ TEST test_queue_history_overfull(void) struct notification *n; - for (int i = 0; i < 10; i++) { + for (size_t i = 0; i < 10; i++) { char name[] = { 'n', '0'+i, '\0' }; // n n = test_notification(name, -1); queues_notification_insert(n); @@ -357,14 +357,14 @@ TEST test_queue_history_pushall(void) struct notification *n; - for (int i = 0; i < 10; i++) { + for (size_t i = 0; i < 10; i++) { char name[] = { 'n', '0'+i, '\0' }; // n n = test_notification(name, -1); queues_notification_insert(n); } queues_update(STATUS_NORMAL, time_monotonic_now()); - for (int i = 0; i < 10; i++) { + for (size_t i = 0; i < 10; i++) { char name[] = { '2', 'n', '0'+i, '\0' }; // 2n n = test_notification(name, -1); queues_notification_insert(n); @@ -393,7 +393,7 @@ TEST test_queue_history_remove_by_id(void) struct notification *n1 = NULL; - for (int i = 0; i < 5; i++) { + for (size_t i = 0; i < 5; i++) { char name[] = { 'n', '0'+i, '\0' }; // n n = test_notification(name, -1); queues_notification_insert(n); @@ -408,8 +408,8 @@ TEST test_queue_history_remove_by_id(void) queues_history_remove_by_id(n->id); queues_history_remove_by_id(n1->id); - QUEUE_LEN_ALL(0, 0, 3); - + QUEUE_LEN_ALL(0, 0, 3); + QUEUE_NOT_CONTAINS(HIST, n); QUEUE_NOT_CONTAINS(HIST, n1); @@ -1014,7 +1014,7 @@ TEST test_queues_timeout_before_paused(void) TEST test_queue_find_by_id(void) { struct notification *n; - int id; + gint id; queues_init(); n = test_notification("n", 0); @@ -1112,7 +1112,7 @@ TEST test_queue_no_sort_and_pause(void) "n4", }; - for (int i = 0; i < g_queue_get_length(QUEUE_DISP); i++) { + for (size_t i = 0; i < g_queue_get_length(QUEUE_DISP); i++) { struct notification *notif = g_queue_peek_nth(QUEUE_DISP, i); ASSERTm("Notifications are not in the right order", STR_EQ(notif->summary, order[i])); @@ -1142,7 +1142,7 @@ SUITE(suite_queues) RUN_TEST(test_queue_insert_id_replacement); RUN_TEST(test_queue_insert_id_valid_newid); RUN_TEST(test_queue_length); - + RUN_TEST(test_queue_notification_close); RUN_TEST(test_queue_notification_close_histignore); RUN_TEST(test_queue_notification_skip_display); diff --git a/test/setting.c b/test/setting.c index 9b3425fdb..06e178125 100644 --- a/test/setting.c +++ b/test/setting.c @@ -65,7 +65,7 @@ TEST test_dunstrc_defaults(void) { ASSERT_EQ(s_default.corner_radius, s_dunstrc.corner_radius); char message[500]; - for (int i = 0; i < G_N_ELEMENTS(allowed_settings); i++) { + for (size_t i = 0; i < G_N_ELEMENTS(allowed_settings); i++) { if (!allowed_settings[i].value) { continue; // it's a rule, that's harder to test }