fix gcc9 warnings

This commit is contained in:
wdlkmpx 2021-01-15 16:09:04 +08:00
parent 7caa9ae8b4
commit 26d4fb47c6
1 changed files with 8 additions and 9 deletions

View File

@ -52,7 +52,7 @@ int USE_XDG = 0;
/// BEGIN: TIMEOUT MANAGEMENT /// BEGIN: TIMEOUT MANAGEMENT
static gint search_off_timeout (void); static gboolean search_off_timeout ();
static guint g_search_off_timeout_id = 0; static guint g_search_off_timeout_id = 0;
static void remove_search_off_timeout (void) static void remove_search_off_timeout (void)
@ -186,9 +186,9 @@ static void on_compline_runwithterm (GtkCompletionLine *cl)
} }
} else { } else {
if (config_get_string ("Terminal", &term)) { if (config_get_string ("Terminal", &term)) {
strncpy (cmd, term, sizeof (cmd)); strncpy (cmd, term, sizeof (cmd) - 1);
} else { } else {
strncpy (cmd, "xterm", sizeof (cmd)); strncpy (cmd, "xterm", sizeof (cmd) - 1);
} }
} }
@ -197,12 +197,12 @@ static void on_compline_runwithterm (GtkCompletionLine *cl)
g_free (entry_text); g_free (entry_text);
} }
static gint search_off_timeout (void) static gboolean search_off_timeout ()
{ {
set_info_text_color (wlabel, "Run program:", W_TEXT_STYLE_NORMAL); set_info_text_color (wlabel, "Run program:", W_TEXT_STYLE_NORMAL);
gtk_widget_hide (wlabel_search); gtk_widget_hide (wlabel_search);
g_search_off_timeout_id = 0; g_search_off_timeout_id = 0;
return FALSE; return G_SOURCE_REMOVE;
} }
static void static void
@ -246,12 +246,11 @@ on_search_letter(GtkCompletionLine *cl, GtkWidget *label)
gtk_label_set_text (GTK_LABEL(label), cl->hist_word); gtk_label_set_text (GTK_LABEL(label), cl->hist_word);
} }
static gint static gboolean search_fail_timeout (gpointer user_data)
search_fail_timeout(void)
{ {
set_info_text_color (wlabel, "Search:", W_TEXT_STYLE_NOTUNIQUE); set_info_text_color (wlabel, "Search:", W_TEXT_STYLE_NOTUNIQUE);
g_search_off_timeout_id = 0; g_search_off_timeout_id = 0;
return FALSE; return G_SOURCE_REMOVE;
} }
static void static void
@ -494,7 +493,7 @@ static void on_compline_activated (GtkCompletionLine *cl)
g_free (selected_term_prog); g_free (selected_term_prog);
g_free (TermExec); g_free (TermExec);
} else { } else {
strncpy (cmd, entry_text, sizeof (cmd)); strncpy (cmd, entry_text, sizeof (cmd) - 1);
} }
g_free (entry_text); g_free (entry_text);