[evolution/gnome-2-28] Bug #596160 - Compiler warnings about _MailComponentPrivate.quit_state



commit 95f768c36c23d14e3a445e4d854149dc0ae54902
Author: Yan Li <yan i li intel com>
Date:   Thu Sep 24 15:51:45 2009 +0800

    Bug #596160 - Compiler warnings about _MailComponentPrivate.quit_state
    
    Magic number `-1' is used for quit_state (a enum) as the initial
    state. This is confusing and triggers compiler warning since `-1' is
    signed while enum is unsigned.
    
    This patch attached fixed it by adding a new state: MC_QUIT_NOT_START
    which is used as the initial state.

 mail/mail-component.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 4e19002..63d6de8 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -132,7 +132,7 @@ struct _MailComponentPrivate {
 	GMutex *lock;
 
 	/* states/data used during shutdown */
-	enum { MC_QUIT_START, MC_QUIT_SYNC, MC_QUIT_THREADS } quit_state;
+	enum { MC_QUIT_NOT_START, MC_QUIT_START, MC_QUIT_SYNC, MC_QUIT_THREADS } quit_state;
 	gint quit_count;
 	gint quit_expunge;	/* expunge on quit this time around? */
 
@@ -667,7 +667,7 @@ view_changed_cb(EMFolderView *emfv, EComponentView *component_view)
 
 	v = g_object_get_data((GObject *)component_view, "view-changed-timeout");
 
-	if (mc->priv->quit_state != -1) {
+	if (mc->priv->quit_state != MC_QUIT_NOT_START) {
 		if (v) {
 			g_source_remove(GPOINTER_TO_INT(v));
 			g_object_set_data((GObject *)component_view, "view-changed-timeout", NULL);
@@ -881,7 +881,7 @@ impl_quit(PortableServer_Servant servant, CORBA_Environment *ev)
 {
 	MailComponent *mc = MAIL_COMPONENT(bonobo_object_from_servant(servant));
 
-	if (mc->priv->quit_state == -1)
+	if (mc->priv->quit_state == MC_QUIT_NOT_START)
 		mc->priv->quit_state = MC_QUIT_START;
 
 	mail_config_prune_proxies ();
@@ -1303,7 +1303,7 @@ mail_component_init (MailComponent *component)
 	component->priv = priv;
 
 	priv->lock = g_mutex_new();
-	priv->quit_state = -1;
+	priv->quit_state = MC_QUIT_NOT_START;
 
 	/* FIXME This is used as both a filename and URI path throughout
 	 *       the mail code.  Need to clean this up; maybe provide a



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