[evolution-data-server] Fix compiler warnings in libedataserver.



commit a5f6d4bb5a4096f3d24efac3dd6c572ad30a5ed5
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon May 25 01:43:36 2009 -0400

    Fix compiler warnings in libedataserver.
---
 calendar/tests/ecal/test-ecal.c                    |   28 ++++----
 configure.ac                                       |    4 +-
 .../reference/camel/tmpl/camel-folder-summary.sgml |    1 +
 .../libedataserverui/tmpl/e-categories-dialog.sgml |    2 +-
 libedataserver/e-account.c                         |    6 +-
 libedataserver/e-categories.c                      |   79 +++++---------------
 libedataserver/e-iconv.c                           |    8 +-
 libedataserver/e-iterator.c                        |    3 -
 libedataserver/e-list-iterator.c                   |    3 -
 libedataserver/e-list.c                            |    2 -
 libedataserver/e-memory.c                          |    2 +-
 libedataserver/e-memory.h                          |    2 +-
 libedataserver/e-proxy.c                           |    2 +-
 libedataserver/e-sexp.c                            |   16 ++--
 libedataserver/e-sexp.h                            |    2 +-
 libedataserver/test-source-list.c                  |    2 +-
 16 files changed, 57 insertions(+), 105 deletions(-)

diff --git a/calendar/tests/ecal/test-ecal.c b/calendar/tests/ecal/test-ecal.c
index 8c0f6a2..b108cfb 100644
--- a/calendar/tests/ecal/test-ecal.c
+++ b/calendar/tests/ecal/test-ecal.c
@@ -31,7 +31,7 @@
 
 /* start_testing_scaffold */
 #define mu_assert(message, test) do { if (!(test)) return message; else { tests_passed++; return NULL;}} while (0)
-#define mu_run_test(test) do { char *message = test; tests_run++; \
+#define mu_run_test(test) do { const char *message = test; tests_run++; \
                                 if (message) { cl_printf (client, "***Error***\n%s\n", message); break;} } while (0)
 
 static int tests_run = 0;
@@ -141,7 +141,7 @@ client_destroy_cb (gpointer data, GObject *object)
 		g_main_loop_quit (loop);
 }
 
-static char *
+static const char *
 test_object_creation (ECal *client,  char **uid)
 {
 	ECalComponent *comp, *comp_retrieved;
@@ -217,7 +217,7 @@ test_object_creation (ECal *client,  char **uid)
 	return NULL;
 }
 
-static char *
+static const char *
 test_object_modification (ECal *client, char *uid)
 {
 	const char *summary = "This summary was modified";
@@ -299,7 +299,7 @@ test_object_removal (ECal *client)
 }
 #endif
 
-static char *
+static const char *
 test_get_alarms_in_range (ECal *client)
 {
 	GSList *alarms;
@@ -320,7 +320,7 @@ test_get_alarms_in_range (ECal *client)
 	return NULL;
 }
 
-static char *
+static const char *
 test_set_uri (ECal *client, const gchar *uri)
 {
 	/* The uri is set as part of create_client call. This method merely
@@ -337,7 +337,7 @@ test_set_uri (ECal *client, const gchar *uri)
 	return NULL;
 }
 
-static char *
+static const char *
 test_cal_loaded (ECal *client)
 {
 	/* Test one loaded calendar and another that is not loaded. */
@@ -348,7 +348,7 @@ test_cal_loaded (ECal *client)
 	return NULL;
 }
 
-static char *
+static const char *
 test_get_source (ECal *client, const gchar *expected)
 {
 	ESource *source;
@@ -367,7 +367,7 @@ test_get_source (ECal *client, const gchar *expected)
 	return NULL;
 }
 
-static char *
+static const char *
 test_query (ECal *client, const char *query, int expected)
 {
 	/* This uses pre-loaded data. Hence its results are valid only
@@ -443,7 +443,7 @@ test_e_cal_remove (ECal *ecal, const char *uri)
 }
 #endif
 
-static char *
+static const char *
 test_new_system_calendar(void)
 {
 	ECal *cal;
@@ -460,7 +460,7 @@ test_new_system_calendar(void)
 	return NULL;
 }
 
-static char *
+static const char *
 test_new_system_tasks(void)
 {
 	ECal *cal;
@@ -477,7 +477,7 @@ test_new_system_tasks(void)
 	return NULL;
 }
 
-static char *
+static const char *
 test_new_system_memos(void)
 {
 	ECal *cal;
@@ -580,7 +580,7 @@ ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=OPT-PARTICIPANT;PARTSTAT=NEEDS-ACTION;\
 LAST-MODIFIED:20040213T055647Z\
 END:VEVENT"
 
-static char *
+static const char *
 test_get_object (ECal *client)
 {
 	const char *uid = "20040213T055519Z-15802-500-1-3 testcal";
@@ -620,7 +620,7 @@ test_timezones (ECal *client)
 	return NULL;
 }
 
-static char *
+static const char *
 all_tests(ECal *client, const gchar *uri)
 {
 	char *uid;
@@ -663,7 +663,7 @@ all_tests(ECal *client, const gchar *uri)
 static void
 create_client (ECal **client, const gchar *uri, ECalSourceType type, gboolean only_if_exists)
 {
-	char *results;
+	const char *results;
 	ECalView *query;
 	char *cal_uri;
 	GError *error = NULL;
diff --git a/configure.ac b/configure.ac
index 1fc3d22..8027814 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,8 +166,8 @@ AC_SUBST(WARNING_FLAGS)
 # Other useful compiler warnings for test builds only.
 # These may produce warnings we have no control over.
 #
-#»······-Wmissing-format-attribute
-#»······-Wshadow
+#	Wmissing-format-attribute
+#	Wshadow
 
 CFLAGS="$CFLAGS $WARNING_FLAGS"
 
diff --git a/docs/reference/camel/tmpl/camel-folder-summary.sgml b/docs/reference/camel/tmpl/camel-folder-summary.sgml
index bbc6637..dfd57e2 100644
--- a/docs/reference/camel/tmpl/camel-folder-summary.sgml
+++ b/docs/reference/camel/tmpl/camel-folder-summary.sgml
@@ -86,6 +86,7 @@ CamelFolderSummary
 @user_tags: 
 @content: 
 @headers: 
+ preview: 
 
 <!-- ##### STRUCT CamelFolderMetaSummary ##### -->
 <para>
diff --git a/docs/reference/libedataserverui/tmpl/e-categories-dialog.sgml b/docs/reference/libedataserverui/tmpl/e-categories-dialog.sgml
index ce1bec0..ac5090f 100644
--- a/docs/reference/libedataserverui/tmpl/e-categories-dialog.sgml
+++ b/docs/reference/libedataserverui/tmpl/e-categories-dialog.sgml
@@ -28,7 +28,7 @@ ECategoriesDialog
 
 </para>
 
- initial_category_list: 
+ categories: 
 @Returns: 
 
 
diff --git a/libedataserver/e-account.c b/libedataserver/e-account.c
index 56d089e..c37d525 100644
--- a/libedataserver/e-account.c
+++ b/libedataserver/e-account.c
@@ -282,7 +282,7 @@ str_to_receipt_policy (const xmlChar *str)
 static xmlChar*
 receipt_policy_to_str (EAccountReceiptPolicy val)
 {
-	char *ret = NULL;
+	const char *ret = NULL;
 
 	switch (val) {
 	case E_ACCOUNT_RECEIPT_NEVER:
@@ -807,7 +807,7 @@ static GHashTable *ea_system_table;
 static guint32 ea_perms;
 
 static struct _option_info {
-	char *key;
+	const char *key;
 	guint32 perms;
 } ea_option_list[] = {
 	{ "imap_use_lsub", 1<<EAP_IMAP_SUBSCRIBED },
@@ -859,7 +859,7 @@ ea_setting_setup (void)
 
 	ea_option_table = g_hash_table_new(g_str_hash, g_str_equal);
 	for (i=0;i<sizeof(ea_option_list)/sizeof(ea_option_list[0]);i++)
-		g_hash_table_insert(ea_option_table, ea_option_list[i].key, &ea_option_list[i]);
+		g_hash_table_insert(ea_option_table, (gpointer) ea_option_list[i].key, &ea_option_list[i]);
 
 	gconf_client_add_dir(gconf, LOCK_BASE, GCONF_CLIENT_PRELOAD_NONE, NULL);
 
diff --git a/libedataserver/e-categories.c b/libedataserver/e-categories.c
index 459fa17..7494a73 100644
--- a/libedataserver/e-categories.c
+++ b/libedataserver/e-categories.c
@@ -31,15 +31,17 @@
 #include "libedataserver-private.h"
 
 typedef struct {
-	char *category;
-	char *icon_file;
-	#ifndef EDS_DISABLE_DEPRECATED
-	char *color;
-	#endif
+	gchar *category;
+	gchar *icon_file;
 	gboolean searchable;
 } CategoryInfo;
 
-static CategoryInfo default_categories[] = {
+typedef struct {
+	const gchar *category;
+	const gchar *icon_file;
+} DefaultCategory;
+
+static DefaultCategory default_categories[] = {
 	{ N_("Anniversary") },
 	{ N_("Birthday"), "category_birthday_16.png" },
 	{ N_("Business"), "category_business_16.png" },
@@ -81,6 +83,8 @@ typedef struct {
 
 static GType e_changed_listener_get_type (void);
 
+G_DEFINE_TYPE (EChangedListener, e_changed_listener, G_TYPE_OBJECT)
+
 enum {
 	CHANGED,
 	LAST_SIGNAL
@@ -102,12 +106,10 @@ e_changed_listener_class_init (EChangedListenerClass *klass)
 }
 
 static void
-e_changed_listener_init (EChangedListener *changed)
+e_changed_listener_init (EChangedListener *listener)
 {
 }
 
-G_DEFINE_TYPE (EChangedListener, e_changed_listener, G_TYPE_OBJECT)
-
 /* ------------------------------------------------------------------------- */
 
 static gboolean initialized = FALSE;
@@ -129,9 +131,6 @@ free_category_info (CategoryInfo *cat_info)
 {
 	g_free (cat_info->category);
 	g_free (cat_info->icon_file);
-	#ifndef EDS_DISABLE_DEPRECATED
-	g_free (cat_info->color);
-	#endif
 	g_free (cat_info);
 }
 
@@ -183,12 +182,6 @@ hash_to_xml_string (gpointer key, gpointer value, gpointer user_data)
 		g_string_append_printf (
 			string, " icon=\"%s\"", cat_info->icon_file);
 
-	#ifndef EDS_DISABLE_DEPRECATED
-	if (cat_info->color != NULL)
-		g_string_append_printf (
-			string, " color=\"%s\"", cat_info->color);
-	#endif
-
 	g_string_append_printf (
 		string, " searchable=\"%d\"", cat_info->searchable);
 
@@ -395,21 +388,17 @@ exit:
 static void
 load_default_categories (void)
 {
-	CategoryInfo *cat_info = default_categories;
+	DefaultCategory *cat_info = default_categories;
+	gchar *icon_file = NULL;
 
 	/* Note: All default categories are searchable. */
 	while (cat_info->category != NULL) {
 		if (cat_info->icon_file != NULL)
-			cat_info->icon_file = g_build_filename (E_DATA_SERVER_IMAGESDIR, cat_info->icon_file, NULL);
+			icon_file = g_build_filename (E_DATA_SERVER_IMAGESDIR, cat_info->icon_file, NULL);
 		e_categories_add (
 			gettext (cat_info->category),
-			#ifndef EDS_DISABLE_DEPRECATED
-			cat_info->color,
-			#else
-			NULL,
-			#endif
-			cat_info->icon_file, TRUE);
-		g_free (cat_info->icon_file);
+			NULL, icon_file, TRUE);
+		g_free (icon_file);
 		cat_info++;
 	}
 }
@@ -528,9 +517,6 @@ e_categories_add (const char *category, const char *unused, const char *icon_fil
 	/* add the new category */
 	cat_info = g_new0 (CategoryInfo, 1);
 	cat_info->category = g_strdup (category);
-#ifndef EDS_DISABLE_DEPRECATED
-	cat_info->color = g_strdup (unused);
-#endif
 	cat_info->icon_file = g_strdup (icon_file);
 	cat_info->searchable = searchable;
 
@@ -584,27 +570,14 @@ e_categories_exist (const char *category)
  * e_categories_get_color_for:
  * @category: category to retrieve the color for.
  *
- * Gets the color associated with the given category.
- *
- * Return value: a string representation of the color.
+ * Returns: %NULL, always
  *
  * DEPRECATED!
  */
 const char *
 e_categories_get_color_for (const char *category)
 {
-	CategoryInfo *cat_info;
-
-	g_return_val_if_fail (category != NULL, NULL);
-
-	if (!initialized)
-		initialize_categories ();
-
-	cat_info = g_hash_table_lookup (categories_table, category);
-	if (cat_info == NULL)
-		return NULL;
-
-	return cat_info->color;
+	return NULL;
 }
 
 /**
@@ -612,27 +585,13 @@ e_categories_get_color_for (const char *category)
  * @category: category to set the color for.
  * @color: X color.
  *
- * Sets the color associated with the given category.
+ * This function does nothing.
  *
  * DEPRECATED!
  */
 void
 e_categories_set_color_for (const char *category, const char *color)
 {
-	CategoryInfo *cat_info;
-
-	g_return_if_fail (category != NULL);
-
-	if (!initialized)
-		initialize_categories ();
-
-	cat_info = g_hash_table_lookup (categories_table, category);
-	g_return_if_fail (cat_info != NULL);
-
-	g_free (cat_info->color);
-	cat_info->color = g_strdup (color);
-	changed = TRUE;
-	save_categories ();
 }
 #endif /* EDS_DISABLE_DEPRECATED */
 
diff --git a/libedataserver/e-iconv.c b/libedataserver/e-iconv.c
index 74c156a..9eb3cdd 100644
--- a/libedataserver/e-iconv.c
+++ b/libedataserver/e-iconv.c
@@ -97,8 +97,8 @@ static char *locale_charset = NULL;
 static char *locale_lang = NULL;
 
 static const struct {
-	char *charset;
-	char *iconv_name;
+	const char *charset;
+	const char *iconv_name;
 } known_iconv_charsets[] = {
 	/* charset name (lowercase!), iconv-friendly name (sometimes case sensitive) */
 	{ "utf-8",           "UTF-8"      },
@@ -584,8 +584,8 @@ e_iconv_locale_language (void)
  * e_iconv_charset_name() so that we don't have to keep track of all
  * the aliases too. */
 static const struct {
-	char *charset;
-	char *lang;
+	const char *charset;
+	const char *lang;
 } cjkr_lang_map[] = {
 	{ "Big5",        "zh" },
 	{ "BIG5HKSCS",   "zh" },
diff --git a/libedataserver/e-iterator.c b/libedataserver/e-iterator.c
index b164dda..0c35f59 100644
--- a/libedataserver/e-iterator.c
+++ b/libedataserver/e-iterator.c
@@ -10,9 +10,6 @@
 
 #include "e-iterator.h"
 
-static void e_iterator_init (EIterator *card);
-static void e_iterator_class_init (EIteratorClass *klass);
-
 enum {
 	INVALIDATE,
 	LAST_SIGNAL
diff --git a/libedataserver/e-list-iterator.c b/libedataserver/e-list-iterator.c
index 005a6d5..3f162ff 100644
--- a/libedataserver/e-list-iterator.c
+++ b/libedataserver/e-list-iterator.c
@@ -12,9 +12,6 @@
 #include "e-list.h"
 
 
-static void        e_list_iterator_init       (EListIterator *list);
-static void        e_list_iterator_class_init (EListIteratorClass *klass);
-
 static void        e_list_iterator_invalidate (EIterator *iterator);
 static gboolean    e_list_iterator_is_valid   (EIterator *iterator);
 static void        e_list_iterator_set        (EIterator  *iterator,
diff --git a/libedataserver/e-list.c b/libedataserver/e-list.c
index 88ae729..a1970df 100644
--- a/libedataserver/e-list.c
+++ b/libedataserver/e-list.c
@@ -11,8 +11,6 @@
 #include "e-list.h"
 #include "e-list-iterator.h"
 
-static void e_list_init (EList *list);
-static void e_list_class_init (EListClass *klass);
 static void e_list_dispose (GObject *object);
 
 G_DEFINE_TYPE (EList, e_list, G_TYPE_OBJECT)
diff --git a/libedataserver/e-memory.c b/libedataserver/e-memory.c
index e841117..15f9179 100644
--- a/libedataserver/e-memory.c
+++ b/libedataserver/e-memory.c
@@ -792,7 +792,7 @@ e_strv_pack(struct _EStrv *strv)
  *
  * Return value:
  **/
-char *
+const char *
 e_strv_get(struct _EStrv *strv, int index)
 {
 	struct _e_strvunpacked *s;
diff --git a/libedataserver/e-memory.h b/libedataserver/e-memory.h
index c967e86..2737486 100644
--- a/libedataserver/e-memory.h
+++ b/libedataserver/e-memory.h
@@ -63,7 +63,7 @@ EStrv *e_strv_set_ref(EStrv *strv, int index, char *str);
 EStrv *e_strv_set_ref_free(EStrv *strv, int index, char *str);
 EStrv *e_strv_set(EStrv *strv, int index, const char *str);
 EStrv *e_strv_pack(EStrv *strv);
-char *e_strv_get(EStrv *strv, int index);
+const char *e_strv_get(EStrv *strv, int index);
 void e_strv_destroy(EStrv *strv);
 
 /* poolv's are similar to strv's, but they store common strings */
diff --git a/libedataserver/e-proxy.c b/libedataserver/e-proxy.c
index 86a96f6..03f1c81 100644
--- a/libedataserver/e-proxy.c
+++ b/libedataserver/e-proxy.c
@@ -587,7 +587,7 @@ ep_set_proxy (GConfClient *client,
 
 	old_type = priv->type;
 	priv->type = gconf_client_get_int (client, KEY_GCONF_EVO_PROXY_TYPE, NULL);
-	if (priv->type < PROXY_TYPE_SYSTEM || priv->type > PROXY_TYPE_AUTO_URL)
+	if (priv->type > PROXY_TYPE_AUTO_URL)
 		priv->type = PROXY_TYPE_SYSTEM;
 	changed = priv->type != old_type;
 
diff --git a/libedataserver/e-sexp.c b/libedataserver/e-sexp.c
index 97d7eba..21cf9c5 100644
--- a/libedataserver/e-sexp.c
+++ b/libedataserver/e-sexp.c
@@ -148,7 +148,7 @@ static const GScannerConfig scanner_config =
 
 /* jumps back to the caller of f->failenv, only to be called from inside a callback */
 void
-e_sexp_fatal_error(struct _ESExp *f, char *why, ...)
+e_sexp_fatal_error(struct _ESExp *f, const char *why, ...)
 {
 	va_list args;
 
@@ -245,14 +245,14 @@ term_eval_and(struct _ESExp *f, int argc, struct _ESExpTerm **argv, void *data)
 	int type=-1;
 	int bool = TRUE;
 	int i;
-	char *oper;
+	const char *oper;
 
 	r(printf("( and\n"));
 
 	r = e_sexp_result_new(f, ESEXP_RES_UNDEFINED);
 
 	oper = "AND";
-	f->operators = g_slist_prepend (f->operators, oper);
+	f->operators = g_slist_prepend (f->operators, (gpointer) oper);
 
 	for (i=0;bool && i<argc;i++) {
 		r1 = e_sexp_term_eval(f, argv[i]);
@@ -308,12 +308,12 @@ term_eval_or(struct _ESExp *f, int argc, struct _ESExpTerm **argv, void *data)
 	int type = -1;
 	int bool = FALSE;
 	int i;
-	char *oper;
+	const char *oper;
 
 	r(printf("(or \n"));
 
 	oper = "OR";
-	f->operators = g_slist_prepend (f->operators, oper);
+	f->operators = g_slist_prepend (f->operators, (gpointer) oper);
 
 	r = e_sexp_result_new(f, ESEXP_RES_UNDEFINED);
 
@@ -1065,7 +1065,7 @@ e_sexp_class_init (ESExpClass *klass)
 
 /* 'builtin' functions */
 static const struct {
-	char *name;
+	const char *name;
 	ESExpFunc *func;
 	int type;		/* set to 1 if a function can perform shortcut evaluation, or
 				   doesn't execute everything, 0 otherwise */
@@ -1126,9 +1126,9 @@ e_sexp_init (ESExp *s)
 	/* load in builtin symbols? */
 	for(i=0;i<sizeof(symbols)/sizeof(symbols[0]);i++) {
 		if (symbols[i].type == 1) {
-			e_sexp_add_ifunction(s, 0, symbols[i].name, (ESExpIFunc *)symbols[i].func, (void *)&symbols[i]);
+			e_sexp_add_ifunction(s, 0, (char *) symbols[i].name, (ESExpIFunc *)symbols[i].func, (void *)&symbols[i]);
 		} else {
-			e_sexp_add_function(s, 0, symbols[i].name, symbols[i].func, (void *)&symbols[i]);
+			e_sexp_add_function(s, 0, (char *) symbols[i].name, symbols[i].func, (void *)&symbols[i]);
 		}
 	}
 
diff --git a/libedataserver/e-sexp.h b/libedataserver/e-sexp.h
index d804fc5..22d6c7f 100644
--- a/libedataserver/e-sexp.h
+++ b/libedataserver/e-sexp.h
@@ -169,7 +169,7 @@ void		e_sexp_encode_bool	(GString *s, gboolean state);
 void		e_sexp_encode_string	(GString *s, const char *string);
 
 /* only to be called from inside a callback to signal a fatal execution error */
-void		e_sexp_fatal_error	(struct _ESExp *f, char *why, ...);
+void		e_sexp_fatal_error	(struct _ESExp *f, const char *why, ...) G_GNUC_NORETURN;
 
 /* return the error string */
 const char     *e_sexp_error		(struct _ESExp *f);
diff --git a/libedataserver/test-source-list.c b/libedataserver/test-source-list.c
index 870a236..e6600a2 100644
--- a/libedataserver/test-source-list.c
+++ b/libedataserver/test-source-list.c
@@ -38,7 +38,7 @@ static int idle_dump_id = 0;
 
 static gboolean listen = FALSE;
 static gboolean dump = FALSE;
-static char *key_arg = "/apps/evolution/test/source_list";
+static char *key_arg = (char *) "/apps/evolution/test/source_list";
 static char *source_arg = NULL;
 static char *group_arg = NULL;
 static char *add_group_arg = NULL;



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