qulogic/libgnt

Fix various warnings in test programs.

2019-04-04, Elliott Sales de Andrade
bb9e4968c8aa
Parents a180d8484daa
Children 8116f04cfa87
Fix various warnings in test programs.
--- a/test/combo.c Wed Apr 03 23:09:53 2019 -0400
+++ b/test/combo.c Thu Apr 04 00:03:08 2019 -0400
@@ -12,10 +12,10 @@
button_activated(GntWidget *b, GntComboBox *combo)
{
GntWidget *w = b->parent;
+ const gchar *text = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo));
- gnt_box_add_widget(GNT_BOX(w),
- gnt_label_new(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))));
- fprintf(stderr, "%s\n", gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)));
+ gnt_box_add_widget(GNT_BOX(w), gnt_label_new(text));
+ fprintf(stderr, "%s\n", text);
gnt_box_readjust(GNT_BOX(w->parent));
}
@@ -29,7 +29,8 @@
gnt_entry_set_text(entry, value);
}
-int main()
+int
+main(void)
{
GntWidget *box, *combo, *button;
GntWidget *hbox;
--- a/test/focus.c Wed Apr 03 23:09:53 2019 -0400
+++ b/test/focus.c Thu Apr 04 00:03:08 2019 -0400
@@ -7,7 +7,7 @@
#include "gntlabel.h"
static void
-toggled(GntWidget *tree, gpointer key, gpointer null)
+toggled(GntWidget *tree, gpointer key, G_GNUC_UNUSED gpointer unused)
{
GntWidget *w = gnt_box_new(FALSE, FALSE);
@@ -18,7 +18,8 @@
gnt_widget_show(w);
}
-int main()
+int
+main(void)
{
#ifdef STANDALONE
freopen(".error", "w", stderr);
@@ -27,7 +28,6 @@
GntWidget *label = gnt_label_new("So wassup dudes and dudettes!!\u4e0a1\u6d772\u67003\u4f4e4\u67085\nSo this is, like,\nthe third line!! \\o/");
GntWidget *vbox, *hbox, *tree, *box, *button;
- WINDOW *test;
vbox = gnt_box_new(FALSE, FALSE);
hbox = gnt_box_new(FALSE, TRUE);
@@ -44,7 +44,7 @@
box = gnt_box_new(FALSE, FALSE);
tree = gnt_tree_new();
- gnt_tree_set_compare_func(GNT_TREE(tree), g_utf8_collate);
+ gnt_tree_set_compare_func(GNT_TREE(tree), (GCompareFunc)g_utf8_collate);
gnt_widget_set_name(tree, "tree");
gnt_box_add_widget(GNT_BOX(box), tree);
gnt_box_add_widget(GNT_BOX(hbox), box);
--- a/test/keys.c Wed Apr 03 23:09:53 2019 -0400
+++ b/test/keys.c Thu Apr 04 00:03:08 2019 -0400
@@ -5,7 +5,7 @@
#include <gntlabel.h>
static gboolean
-print_keycode(GntEntry *entry, const char *text, gpointer null)
+print_keycode(GntEntry *entry, const char *text, G_GNUC_UNUSED gpointer unused)
{
char *s = g_strdup_printf("%s ", text);
gnt_entry_set_text(entry, s);
@@ -34,7 +34,8 @@
return TRUE;
}
-int main()
+int
+main(void)
{
GntWidget *window, *entry;
--- a/test/menu.c Wed Apr 03 23:09:53 2019 -0400
+++ b/test/menu.c Thu Apr 04 00:03:08 2019 -0400
@@ -5,7 +5,8 @@
#include "gntmenuitem.h"
#include "gntwindow.h"
-void dothis(GntMenuItem *item, gpointer null)
+void
+dothis(G_GNUC_UNUSED GntMenuItem *item, G_GNUC_UNUSED gpointer unused)
{
GntWidget *w = gnt_vbox_new(FALSE);
gnt_box_set_toplevel(GNT_BOX(w), TRUE);
@@ -14,13 +15,14 @@
gnt_widget_show(w);
}
-int main()
+int
+main(void)
{
freopen(".error", "w", stderr);
gnt_init();
GntWidget *menu = gnt_menu_new(GNT_MENU_TOPLEVEL);
- GObject *item = gnt_menuitem_new("File");
+ GntMenuItem *item = gnt_menuitem_new("File");
gnt_menu_add_item(GNT_MENU(menu), GNT_MENU_ITEM(item));
--- a/test/multiwin.c Wed Apr 03 23:09:53 2019 -0400
+++ b/test/multiwin.c Thu Apr 04 00:03:08 2019 -0400
@@ -6,12 +6,14 @@
#include "gnttree.h"
#include "gntbox.h"
-gboolean show(GntWidget *w)
+gboolean
+show(G_GNUC_UNUSED GntWidget *w)
{
return FALSE;
}
-int main()
+int
+main(void)
{
#ifdef STANDALONE
freopen(".error", "w", stderr);
--- a/test/tv.c Wed Apr 03 23:09:53 2019 -0400
+++ b/test/tv.c Thu Apr 04 00:03:08 2019 -0400
@@ -53,13 +53,14 @@
}
static void
-completion_cb(GntEntry *entry, const char *start, const char *end)
+completion_cb(GntEntry *entry, const char *start, G_GNUC_UNUSED const char *end)
{
if (start == entry->start)
gnt_widget_key_pressed(GNT_WIDGET(entry), ": ");
}
-int main()
+int
+main(void)
{
GntWidget *hbox, *entry, *view;
--- a/test/wm.c Wed Apr 03 23:09:53 2019 -0400
+++ b/test/wm.c Thu Apr 04 00:03:08 2019 -0400
@@ -6,7 +6,7 @@
#include <gntlabel.h>
static gboolean
-key_pressed(GntEntry *entry, const char *text, gpointer null)
+key_pressed(GntEntry *entry, const char *text, G_GNUC_UNUSED gpointer unused)
{
if (*text != '\r')
return FALSE;
@@ -20,9 +20,11 @@
handle = g_module_open(cmd, G_MODULE_BIND_LOCAL);
if (handle && g_module_symbol(handle, "main", (gpointer)&func))
{
- char *argv[] = {cmd, NULL};
+ char **argv = g_new0(char*, 2);
+ argv[0] = g_strdup(cmd);
gnt_entry_clear(entry);
func(1, argv);
+ g_strfreev(argv);
}
else
{
@@ -39,7 +41,8 @@
return TRUE;
}
-int main()
+int
+main(void)
{
GntWidget *window, *entry;