changeset 15814:1c8f1dc50685

Enable DEBUG_CFLAGS in libgnt and fix up a number of compile warnings and errors this showed up
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 18 Mar 2007 17:28:21 +0000
parents 71b017348c39
children 0d9dc0f1597a
files console/libgnt/Makefile.am console/libgnt/gnt.h console/libgnt/gntbindable.c console/libgnt/gntbox.c console/libgnt/gntbutton.c console/libgnt/gntcheckbox.c console/libgnt/gntclipboard.c console/libgnt/gntcolors.h console/libgnt/gntcombobox.c console/libgnt/gntcombobox.h console/libgnt/gntentry.c console/libgnt/gntkeys.c console/libgnt/gntkeys.h console/libgnt/gntlabel.c console/libgnt/gntline.c console/libgnt/gntmain.c console/libgnt/gntmenu.c console/libgnt/gntmenuitem.c console/libgnt/gntmenuitemcheck.c console/libgnt/gntstyle.c console/libgnt/gntstyle.h console/libgnt/gnttextview.c console/libgnt/gnttextview.h console/libgnt/gnttree.c console/libgnt/gnttree.h console/libgnt/gntwidget.c console/libgnt/gntwindow.c console/libgnt/gntwindow.h console/libgnt/gntwm.c
diffstat 29 files changed, 46 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/console/libgnt/Makefile.am	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/Makefile.am	Sun Mar 18 17:28:21 2007 +0000
@@ -61,7 +61,8 @@
 	gntmarshal.c
 
 gntmarshal.c: genmarshal gntmarshal.h
-	cat genmarshal | glib-genmarshal --prefix=gnt_closure_marshal --body > $@
+	echo "#include \"gntmarshal.h\"" > $@
+	cat genmarshal | glib-genmarshal --prefix=gnt_closure_marshal --body >> $@
 
 gntmarshal.h: genmarshal
 	cat genmarshal | glib-genmarshal --prefix=gnt_closure_marshal --header > $@
@@ -78,4 +79,5 @@
 
 AM_CPPFLAGS = \
 	$(GLIB_CFLAGS) \
-	$(GNT_CFLAGS)
+	$(GNT_CFLAGS) \
+	$(DEBUG_CFLAGS)
--- a/console/libgnt/gnt.h	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gnt.h	Sun Mar 18 17:28:21 2007 +0000
@@ -4,11 +4,11 @@
 #include "gntcolors.h"
 #include "gntkeys.h"
 
-void gnt_init();
+void gnt_init(void);
 
-void gnt_main();
+void gnt_main(void);
 
-gboolean gnt_ascii_only();
+gboolean gnt_ascii_only(void);
 
 void gnt_screen_occupy(GntWidget *widget);
 
@@ -32,10 +32,10 @@
 
 gboolean gnt_screen_menu_show(gpointer menu);
 
-void gnt_quit();
+void gnt_quit(void);
 
-GntClipboard *gnt_get_clipboard();
+GntClipboard *gnt_get_clipboard(void);
 
-gchar *gnt_get_clipboard_string();
+gchar *gnt_get_clipboard_string(void);
 
 void gnt_set_clipboard_string(gchar *);
--- a/console/libgnt/gntbindable.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntbindable.c	Sun Mar 18 17:28:21 2007 +0000
@@ -77,6 +77,7 @@
 			sizeof(GntBindable),
 			0,						/* n_preallocs		*/
 			NULL,					/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(G_TYPE_OBJECT,
--- a/console/libgnt/gntbox.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntbox.c	Sun Mar 18 17:28:21 2007 +0000
@@ -535,6 +535,7 @@
 			sizeof(GntBox),
 			0,						/* n_preallocs		*/
 			gnt_box_init,			/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(GNT_TYPE_WIDGET,
--- a/console/libgnt/gntbutton.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntbutton.c	Sun Mar 18 17:28:21 2007 +0000
@@ -112,6 +112,7 @@
 			sizeof(GntButton),
 			0,						/* n_preallocs		*/
 			gnt_button_init,			/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(GNT_TYPE_WIDGET,
--- a/console/libgnt/gntcheckbox.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntcheckbox.c	Sun Mar 18 17:28:21 2007 +0000
@@ -117,6 +117,7 @@
 			sizeof(GntCheckBox),
 			0,						/* n_preallocs		*/
 			gnt_check_box_init,			/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(GNT_TYPE_BUTTON,
--- a/console/libgnt/gntclipboard.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntclipboard.c	Sun Mar 18 17:28:21 2007 +0000
@@ -23,7 +23,6 @@
 
 }
 
-static GObjectClass *parent_class = NULL;
 /******************************************************************************
  * GntClipboard API
  *****************************************************************************/
@@ -63,6 +62,7 @@
 			sizeof(GntClipboard),
 			0,						/* n_preallocs		*/
 			gnt_clipboard_init,		/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(G_TYPE_OBJECT,
--- a/console/libgnt/gntcolors.h	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntcolors.h	Sun Mar 18 17:28:21 2007 +0000
@@ -33,9 +33,9 @@
 };
 
 /* populate some default colors */
-void gnt_init_colors();
+void gnt_init_colors(void);
 
-void gnt_uninit_colors();
+void gnt_uninit_colors(void);
 
 #if GLIB_CHECK_VERSION(2,6,0)
 void gnt_colors_parse(GKeyFile *kfile);
--- a/console/libgnt/gntcombobox.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntcombobox.c	Sun Mar 18 17:28:21 2007 +0000
@@ -273,6 +273,7 @@
 			sizeof(GntComboBox),
 			0,						/* n_preallocs		*/
 			gnt_combo_box_init,			/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(GNT_TYPE_WIDGET,
--- a/console/libgnt/gntcombobox.h	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntcombobox.h	Sun Mar 18 17:28:21 2007 +0000
@@ -44,7 +44,7 @@
 
 GType gnt_combo_box_get_gtype(void);
 
-GntWidget *gnt_combo_box_new();
+GntWidget *gnt_combo_box_new(void);
 
 void gnt_combo_box_add_data(GntComboBox *box, gpointer key, const char *text);
 
--- a/console/libgnt/gntentry.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntentry.c	Sun Mar 18 17:28:21 2007 +0000
@@ -746,6 +746,7 @@
 			sizeof(GntEntry),
 			0,						/* n_preallocs		*/
 			gnt_entry_init,			/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(GNT_TYPE_WIDGET,
--- a/console/libgnt/gntkeys.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntkeys.c	Sun Mar 18 17:28:21 2007 +0000
@@ -234,6 +234,7 @@
 }
 
 /* this is purely for debugging purposes. */
+void gnt_keys_print_combinations(void);
 void gnt_keys_print_combinations()
 {
 	g_printerr("--------\n");
--- a/console/libgnt/gntkeys.h	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntkeys.h	Sun Mar 18 17:28:21 2007 +0000
@@ -79,7 +79,7 @@
 /**
  * This will do stuff with the terminal settings and stuff.
  */
-void gnt_init_keys();
+void gnt_init_keys(void);
 void gnt_keys_refine(char *text);
 const char *gnt_key_translate(const char *name);
 
--- a/console/libgnt/gntlabel.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntlabel.c	Sun Mar 18 17:28:21 2007 +0000
@@ -80,6 +80,7 @@
 			sizeof(GntLabel),
 			0,						/* n_preallocs		*/
 			gnt_label_init,			/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(GNT_TYPE_WIDGET,
--- a/console/libgnt/gntline.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntline.c	Sun Mar 18 17:28:21 2007 +0000
@@ -83,6 +83,7 @@
 			sizeof(GntLine),
 			0,						/* n_preallocs		*/
 			gnt_line_init,			/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(GNT_TYPE_WIDGET,
--- a/console/libgnt/gntmain.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntmain.c	Sun Mar 18 17:28:21 2007 +0000
@@ -44,7 +44,7 @@
 static gboolean ascii_only;
 static gboolean mouse_enabled;
 
-static void setup_io();
+static void setup_io(void);
 
 static gboolean refresh_screen();
 
--- a/console/libgnt/gntmenu.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntmenu.c	Sun Mar 18 17:28:21 2007 +0000
@@ -278,6 +278,7 @@
 			sizeof(GntMenu),
 			0,						/* n_preallocs		*/
 			gnt_menu_init,			/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(GNT_TYPE_TREE,
--- a/console/libgnt/gntmenuitem.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntmenuitem.c	Sun Mar 18 17:28:21 2007 +0000
@@ -48,6 +48,7 @@
 			sizeof(GntMenuItem),
 			0,						/* n_preallocs		*/
 			gnt_menuitem_init,			/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(G_TYPE_OBJECT,
--- a/console/libgnt/gntmenuitemcheck.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntmenuitemcheck.c	Sun Mar 18 17:28:21 2007 +0000
@@ -36,6 +36,7 @@
 			sizeof(GntMenuItemCheck),
 			0,						/* n_preallocs		*/
 			gnt_menuitem_check_init,			/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(GNT_TYPE_MENUITEM,
--- a/console/libgnt/gntstyle.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntstyle.c	Sun Mar 18 17:28:21 2007 +0000
@@ -84,7 +84,7 @@
 static char *
 parse_key(const char *key)
 {
-	return gnt_key_translate(key);
+	return (char *)gnt_key_translate(key);
 }
 
 void gnt_style_read_actions(GType type, GntBindableClass *klass)
--- a/console/libgnt/gntstyle.h	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntstyle.h	Sun Mar 18 17:28:21 2007 +0000
@@ -21,7 +21,7 @@
 
 void gnt_style_read_actions(GType type, GntBindableClass *klass);
 
-void gnt_init_styles();
+void gnt_init_styles(void);
 
-void gnt_uninit_styles();
+void gnt_uninit_styles(void);
 
--- a/console/libgnt/gnttextview.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gnttextview.c	Sun Mar 18 17:28:21 2007 +0000
@@ -236,7 +236,7 @@
 	gchar *start = c;
 	gchar *end = c;
 	gchar *t, *endsize;
-	while (t = g_utf8_prev_char(start)) {
+	while ((t = g_utf8_prev_char(start))) {
 		if (!g_ascii_isspace(*t)) {
 			if (start == view->string->str)
 				break;
@@ -244,7 +244,7 @@
 		} else
 			break;
 	}
-	while (t = g_utf8_next_char(end)) {
+	while ((t = g_utf8_next_char(end))) {
 		if (!g_ascii_isspace(*t))
 			end = t;
 		else
@@ -290,7 +290,7 @@
 					select_start = 0;
 					select_end = 0;
 					gnt_widget_draw(widget);
-					return;
+					return TRUE;
 				}
 			} else {
 				gchar *endsize = g_utf8_next_char(select_end); /* End at the correct byte */
@@ -421,6 +421,7 @@
 			sizeof(GntTextView),
 			0,						/* n_preallocs		*/
 			gnt_text_view_init,			/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(GNT_TYPE_WIDGET,
--- a/console/libgnt/gnttextview.h	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gnttextview.h	Sun Mar 18 17:28:21 2007 +0000
@@ -57,7 +57,7 @@
 
 /* XXX: For now, don't set a textview to have any border.
  *      If you want borders real bad, put it in a box. */
-GntWidget *gnt_text_view_new();
+GntWidget *gnt_text_view_new(void);
 
 /* scroll > 0 means scroll up, < 0 means scroll down, == 0 means scroll to the end */
 void gnt_text_view_scroll(GntTextView *view, int scroll);
--- a/console/libgnt/gnttree.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gnttree.c	Sun Mar 18 17:28:21 2007 +0000
@@ -859,6 +859,7 @@
 			sizeof(GntTree),
 			0,						/* n_preallocs		*/
 			gnt_tree_init,			/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(GNT_TYPE_WIDGET,
--- a/console/libgnt/gnttree.h	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gnttree.h	Sun Mar 18 17:28:21 2007 +0000
@@ -75,7 +75,7 @@
 
 GType gnt_tree_get_gtype(void);
 
-GntWidget *gnt_tree_new();      /* A tree with just one column */
+GntWidget *gnt_tree_new(void);      /* A tree with just one column */
 
 GntWidget *gnt_tree_new_with_columns(int columns);
 
--- a/console/libgnt/gntwidget.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntwidget.c	Sun Mar 18 17:28:21 2007 +0000
@@ -265,6 +265,7 @@
 			sizeof(GntWidget),
 			0,						/* n_preallocs		*/
 			gnt_widget_init,					/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(GNT_TYPE_BINDABLE,
--- a/console/libgnt/gntwindow.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntwindow.c	Sun Mar 18 17:28:21 2007 +0000
@@ -79,6 +79,7 @@
 			sizeof(GntWindow),
 			0,						/* n_preallocs		*/
 			gnt_window_init,			/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(GNT_TYPE_BOX,
--- a/console/libgnt/gntwindow.h	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntwindow.h	Sun Mar 18 17:28:21 2007 +0000
@@ -45,7 +45,7 @@
 #define gnt_vwindow_new(homo) gnt_window_box_new(homo, TRUE)
 #define gnt_hwindow_new(homo) gnt_window_box_new(homo, FALSE)
 
-GntWidget *gnt_window_new();
+GntWidget *gnt_window_new(void);
 
 GntWidget *gnt_window_box_new(gboolean homo, gboolean vert);
 
--- a/console/libgnt/gntwm.c	Sat Mar 17 17:55:22 2007 +0000
+++ b/console/libgnt/gntwm.c	Sun Mar 18 17:28:21 2007 +0000
@@ -8,6 +8,7 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
 
 #include "gntwm.h"
 #include "gntstyle.h"
@@ -337,7 +338,7 @@
 		n = GPOINTER_TO_INT(list->data);
 	else
 		n = 0;
-	
+
 	w = wm->ordered->data;
 
 	if ((l = g_list_nth(wm->list, n)) != NULL)
@@ -358,7 +359,6 @@
 	GntWM *wm = GNT_WM(bindable);
 	GntWidget *window;
 	GntNode *node;
-	int w, h;
 
 	if (!wm->ordered)
 		return TRUE;
@@ -373,6 +373,7 @@
 		copy_win(window, node);
 		update_screen(wm);
 	}
+	return TRUE;
 }
 
 static gboolean
@@ -1036,6 +1037,7 @@
 			sizeof(GntWM),
 			0,						/* n_preallocs		*/
 			gnt_wm_init,			/* instance_init	*/
+			NULL					/* value_table		*/
 		};
 
 		type = g_type_register_static(GNT_TYPE_BINDABLE,
@@ -1369,7 +1371,7 @@
 write_gdi(gpointer key, gpointer value, gpointer data)
 {
 	GntPosition *p = value;
-	fprintf(data, ".%s = %d;%d\n", key, p->x, p->y);
+	fprintf(data, ".%s = %d;%d\n", (char *)key, p->x, p->y);
 }
 
 static gboolean