[evolution: 1/11] Fix compiler warnings in e-util.



commit a6c9a55391c484038a98f0326798949c52621c50
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon May 25 13:42:03 2009 -0400

    Fix compiler warnings in e-util.
---
 art/broken-image-16.xpm                    |    2 +-
 art/broken-image-24.xpm                    |    2 +-
 e-util/e-bit-array.h                       |    3 +-
 e-util/e-error.c                           |   56 +++++++++++++++-------------
 e-util/e-html-utils.c                      |    2 +-
 e-util/e-non-intrusive-error-dialog.h      |    8 ++--
 e-util/e-text-event-processor-emacs-like.c |    2 -
 e-util/e-text-event-processor-types.h      |    6 +-
 e-util/e-text-event-processor.c            |    3 -
 e-util/e-util-labels.c                     |   18 ++++++---
 e-util/e-util-labels.h                     |    9 +---
 e-util/gconf-bridge.c                      |    5 --
 12 files changed, 56 insertions(+), 60 deletions(-)

diff --git a/art/broken-image-16.xpm b/art/broken-image-16.xpm
index e96ee1a..b20b942 100644
--- a/art/broken-image-16.xpm
+++ b/art/broken-image-16.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * broken_image_16_xpm[] = {
+static const gchar *broken_image_16_xpm[] = {
 "16 16 42 1",
 " 	c None",
 ".	c #000000",
diff --git a/art/broken-image-24.xpm b/art/broken-image-24.xpm
index ba6cc68..e6c3127 100644
--- a/art/broken-image-24.xpm
+++ b/art/broken-image-24.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-static char * broken_image_24_xpm[] = {
+static const gchar *broken_image_24_xpm[] = {
 "24 24 142 2",
 "  	c None",
 ". 	c #000000",
diff --git a/e-util/e-bit-array.h b/e-util/e-bit-array.h
index ea8ed89..4504f5a 100644
--- a/e-util/e-bit-array.h
+++ b/e-util/e-bit-array.h
@@ -66,7 +66,7 @@ void       e_bit_array_clear               (EBitArray    *selection);
 gint       e_bit_array_selected_count      (EBitArray    *selection);
 void       e_bit_array_select_all          (EBitArray    *selection);
 void       e_bit_array_invert_selection    (EBitArray    *selection);
-int        e_bit_array_bit_count           (EBitArray    *selection);
+gint       e_bit_array_bit_count           (EBitArray    *selection);
 void       e_bit_array_change_one_row      (EBitArray    *selection,
 					    int           row,
 					    gboolean      grow);
@@ -91,7 +91,6 @@ void       e_bit_array_delete_single_mode  (EBitArray    *esm,
 void       e_bit_array_move_row            (EBitArray    *esm,
 					    int           old_row,
 					    int           new_row);
-gint       e_bit_array_bit_count           (EBitArray    *esm);
 
 gboolean   e_bit_array_cross_and           (EBitArray    *esm);
 gboolean   e_bit_array_cross_or            (EBitArray    *esm);
diff --git a/e-util/e-error.c b/e-util/e-error.c
index 7c1248b..23e52bc 100644
--- a/e-util/e-error.c
+++ b/e-util/e-error.c
@@ -41,27 +41,27 @@
 
 struct _e_error_button {
 	struct _e_error_button *next;
-	char *stock;
-	char *label;
-	int response;
+	const gchar *stock;
+	const gchar *label;
+	gint response;
 };
 
 struct _e_error {
 	guint32 flags;
-	char *id;
-	int type;
-	int default_response;
-	char *title;
-	char *primary;
-	char *secondary;
-	char *help_uri;
+	const gchar *id;
+	gint type;
+	gint default_response;
+	const gchar *title;
+	const gchar *primary;
+	const gchar *secondary;
+	const gchar *help_uri;
 	gboolean scroll;
 	struct _e_error_button *buttons;
 };
 
 struct _e_error_table {
-	char *domain;
-	char *translation_domain;
+	const gchar *domain;
+	const gchar *translation_domain;
 	GHashTable *errors;
 };
 
@@ -84,8 +84,8 @@ static struct _e_error default_errors[] = {
 /* ********************************************************************** */
 
 static struct {
-	char *name;
-	int id;
+	const gchar *name;
+	gint id;
 } response_map[] = {
 	{ "GTK_RESPONSE_REJECT", GTK_RESPONSE_REJECT },
 	{ "GTK_RESPONSE_ACCEPT", GTK_RESPONSE_ACCEPT },
@@ -111,9 +111,9 @@ map_response(const char *name)
 }
 
 static struct {
-	const char *name;
-	const char *icon;
-	const char *title;
+	const gchar *name;
+	const gchar *icon;
+	const gchar *title;
 } type_map[] = {
 	{ "info", GTK_STOCK_DIALOG_INFO, N_("Evolution Information") },
 	{ "warning", GTK_STOCK_DIALOG_WARNING, N_("Evolution Warning") },
@@ -184,7 +184,7 @@ ee_load(const char *path)
 		table = g_malloc0(sizeof(*table));
 		table->domain = g_strdup(tmp);
 		table->errors = g_hash_table_new(g_str_hash, g_str_equal);
-		g_hash_table_insert(error_table, table->domain, table);
+		g_hash_table_insert(error_table, (gpointer) table->domain, table);
 
 		tmp2 = (char *)xmlGetProp(root, (const unsigned char *)"translation-domain");
 		if (tmp2) {
@@ -263,16 +263,20 @@ ee_load(const char *path)
 					}
 				} else if (!strcmp((char *)scan->name, "button")) {
 					struct _e_error_button *b;
+					gchar *label = NULL;
+					gchar *stock = NULL;
 
 					b = g_malloc0(sizeof(*b));
 					tmp = (char *)xmlGetProp(scan, (const unsigned char *)"stock");
 					if (tmp) {
-						b->stock = g_strdup(tmp);
+						stock = g_strdup(tmp);
+						b->stock = stock;
 						xmlFree(tmp);
 					}
 					tmp = (char *)xmlGetProp(scan, (const unsigned char *)"label");
 					if (tmp) {
-						b->label = g_strdup(dgettext(table->translation_domain, tmp));
+						label = g_strdup(dgettext(table->translation_domain, tmp));
+						b->label = label;
 						xmlFree(tmp);
 					}
 					tmp = (char *)xmlGetProp(scan, (const unsigned char *)"response");
@@ -281,10 +285,10 @@ ee_load(const char *path)
 						xmlFree(tmp);
 					}
 
-					if (b->stock == NULL && b->label == NULL) {
+					if (stock == NULL && label == NULL) {
 						g_warning("Error file '%s': missing button details in error '%s'", path, e->id);
-						g_free(b->stock);
-						g_free(b->label);
+						g_free(stock);
+						g_free(label);
 						g_free(b);
 					} else {
 						lastbutton->next = b;
@@ -293,7 +297,7 @@ ee_load(const char *path)
 				}
 			}
 
-			g_hash_table_insert(table->errors, e->id, e);
+			g_hash_table_insert(table->errors, (gpointer) e->id, e);
 		}
 	}
 
@@ -319,8 +323,8 @@ ee_load_tables(void)
 	table->domain = "builtin";
 	table->errors = g_hash_table_new(g_str_hash, g_str_equal);
 	for (i=0;i<sizeof(default_errors)/sizeof(default_errors[0]);i++)
-		g_hash_table_insert(table->errors, default_errors[i].id, &default_errors[i]);
-	g_hash_table_insert(error_table, table->domain, table);
+		g_hash_table_insert(table->errors, (gpointer) default_errors[i].id, &default_errors[i]);
+	g_hash_table_insert(error_table, (gpointer) table->domain, table);
 
 	/* look for installed error tables */
 	base = g_build_filename (EVOLUTION_PRIVDATADIR, "errors", NULL);
diff --git a/e-util/e-html-utils.c b/e-util/e-html-utils.c
index d634f5f..4cdb0ee 100644
--- a/e-util/e-html-utils.c
+++ b/e-util/e-html-utils.c
@@ -246,7 +246,7 @@ e_text_to_html_full (const char *input, unsigned int flags, guint32 color)
 					colored = TRUE;
 				}
 			} else if (colored) {
-				gchar *no_font = "</FONT>";
+				const gchar *no_font = "</FONT>";
 
 				out = check_size (&buffer, &buffer_size, out, 9);
 				out += sprintf (out, "%s", no_font);
diff --git a/e-util/e-non-intrusive-error-dialog.h b/e-util/e-non-intrusive-error-dialog.h
index e801d47..827e17f 100644
--- a/e-util/e-non-intrusive-error-dialog.h
+++ b/e-util/e-non-intrusive-error-dialog.h
@@ -31,10 +31,10 @@
 G_BEGIN_DECLS
 
 struct _log_data {
-        int level;
-        char *key;
-        char *text;
-        char *stock_id;
+        gint level;
+        const gchar *key;
+        const gchar *text;
+        const gchar *stock_id;
         GdkPixbuf *pbuf;
 } ldata [] = {
         { E_LOG_ERROR, N_("Error"), N_("Errors"), GTK_STOCK_DIALOG_ERROR },
diff --git a/e-util/e-text-event-processor-emacs-like.c b/e-util/e-text-event-processor-emacs-like.c
index 60da48d..4b99d89 100644
--- a/e-util/e-text-event-processor-emacs-like.c
+++ b/e-util/e-text-event-processor-emacs-like.c
@@ -29,8 +29,6 @@
 #include "e-text-event-processor-emacs-like.h"
 #include "e-util.h"
 
-static void e_text_event_processor_emacs_like_init		(ETextEventProcessorEmacsLike		 *card);
-static void e_text_event_processor_emacs_like_class_init	(ETextEventProcessorEmacsLikeClass	 *klass);
 static gint e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event);
 
 G_DEFINE_TYPE (ETextEventProcessorEmacsLike, e_text_event_processor_emacs_like, E_TEXT_EVENT_PROCESSOR_TYPE)
diff --git a/e-util/e-text-event-processor-types.h b/e-util/e-text-event-processor-types.h
index 9caf2ab..c4c0efa 100644
--- a/e-util/e-text-event-processor-types.h
+++ b/e-util/e-text-event-processor-types.h
@@ -83,8 +83,8 @@ typedef enum {
 typedef struct {
 	ETextEventProcessorCommandPosition position;
 	ETextEventProcessorCommandAction action;
-	int value;
-	char *string;
+	gint value;
+	const gchar *string;
 	guint32 time;
 } ETextEventProcessorCommand;
 
@@ -102,7 +102,7 @@ typedef struct {
 	guint state;
 	guint keyval;
 	gint length;
-	gchar *string;
+	const gchar *string;
 } ETextEventProcessorEventKey;
 
 typedef struct {
diff --git a/e-util/e-text-event-processor.c b/e-util/e-text-event-processor.c
index b515f33..48100de 100644
--- a/e-util/e-text-event-processor.c
+++ b/e-util/e-text-event-processor.c
@@ -27,9 +27,6 @@
 #include "e-text-event-processor.h"
 #include "e-util.h"
 
-static void e_text_event_processor_init		(ETextEventProcessor		 *card);
-static void e_text_event_processor_class_init	(ETextEventProcessorClass	 *klass);
-
 static void e_text_event_processor_set_property (GObject *object,
 						 guint prop_id,
 						 const GValue *value,
diff --git a/e-util/e-util-labels.c b/e-util/e-util-labels.c
index 85984da..a7d5913 100644
--- a/e-util/e-util-labels.c
+++ b/e-util/e-util-labels.c
@@ -34,8 +34,14 @@
 #include "e-dialog-utils.h"
 #include "filter/filter-option.h"
 
-/* Note, the first element of each EUtilLabel must NOT be translated */
-EUtilLabel label_defaults[LABEL_DEFAULTS_NUM] = {
+typedef struct {
+	const gchar *tag;
+	const gchar *name;
+	const gchar *colour;
+} DefaultLabel;
+
+/* Note, the first element of each DefaultLabel must NOT be translated */
+DefaultLabel label_defaults[] = {
 	{ "$Labelimportant", N_("I_mportant"), "#EF2929" },  /* red */
 	{ "$Labelwork",      N_("_Work"),      "#F57900" },  /* orange */
 	{ "$Labelpersonal",  N_("_Personal"),  "#4E9A06" },  /* green */
@@ -84,7 +90,7 @@ e_util_labels_parse (GConfClient *client)
 		label = g_new (EUtilLabel, 1);
 
 		/* Needed for Backward Compatibility */
-		if (num < LABEL_DEFAULTS_NUM) {
+		if (num < G_N_ELEMENTS (label_defaults)) {
 			label->name = g_strdup ((buf && *buf) ? buf : _(label_defaults[num].name));
 			label->tag = g_strdup (label_defaults[num].tag);
 			num++;
@@ -106,7 +112,7 @@ e_util_labels_parse (GConfClient *client)
 	if (head)
 		g_slist_free (head);
 
-	while (num < LABEL_DEFAULTS_NUM) {
+	while (num < G_N_ELEMENTS (label_defaults)) {
 		/* complete the list with defaults */
 		label = g_new (EUtilLabel, 1);
 		label->tag = g_strdup (label_defaults[num].tag);
@@ -452,7 +458,7 @@ e_util_labels_is_system (const char *tag)
 	if (!tag)
 		return FALSE;
 
-	for (i = 0; i < LABEL_DEFAULTS_NUM; i++) {
+	for (i = 0; i < G_N_ELEMENTS (label_defaults); i++) {
 		if (strcmp (tag, label_defaults[i].tag) == 0)
 			return TRUE;
 	}
@@ -474,7 +480,7 @@ e_util_labels_get_new_tag (const char *old_tag)
 	if (!old_tag)
 		return NULL;
 
-	for (i = 0; i < LABEL_DEFAULTS_NUM; i++) {
+	for (i = 0; i < G_N_ELEMENTS (label_defaults); i++) {
 		/* default labels have same name as those old, only with prefix "$Label" */
 		if (!strcmp (old_tag, label_defaults[i].tag + 6))
 			return label_defaults[i].tag;
diff --git a/e-util/e-util-labels.h b/e-util/e-util-labels.h
index 26520ff..ee06ccc 100644
--- a/e-util/e-util-labels.h
+++ b/e-util/e-util-labels.h
@@ -27,16 +27,13 @@ struct _GtkWindow;
 struct _GConfClient;
 
 typedef struct {
-	char *tag;
-	char *name;
-	char *colour;
+	gchar *tag;
+	gchar *name;
+	gchar *colour;
 } EUtilLabel;
 
 #define E_UTIL_LABELS_GCONF_KEY "/apps/evolution/mail/labels"
 
-#define LABEL_DEFAULTS_NUM 5
-extern EUtilLabel label_defaults[LABEL_DEFAULTS_NUM];
-
 GSList *    e_util_labels_parse         (struct _GConfClient *client);
 void        e_util_labels_free          (GSList *labels);
 
diff --git a/e-util/gconf-bridge.c b/e-util/gconf-bridge.c
index 81fe08e..ff880a1 100644
--- a/e-util/gconf-bridge.c
+++ b/e-util/gconf-bridge.c
@@ -107,11 +107,6 @@ typedef union {
 static void
 unbind (Binding *binding);
 
-#if !HAVE_DECL_GCONF_VALUE_COMPARE /* Not in headers in GConf < 2.13 */
-int gconf_value_compare (const GConfValue *value_a,
-                         const GConfValue *value_b);
-#endif
-
 static GConfBridge *bridge = NULL; /* Global GConfBridge object */
 
 /* Free up all resources allocated by the GConfBridge. Called on exit. */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]