[Evolution-hackers] [PATCH] shell/e-convert-local-mail.c: Pass correct enum `e_account_find_t` to `e_account_list_find()`



Date: Wed, 2 Jan 2013 12:16:50 +0100

Clang 3.2 reports the following warning.

        $ clang --version
        Debian clang version 3.2-9 (tags/RELEASE_32/final) (based on LLVM 3.2)
        $ CC=clang ./autogen.sh
        $ make
          CC     evolution-e-convert-local-mail.o
        e-convert-local-mail.c:275:37: warning: implicit conversion from enumeration type 'enum _e_account_item_t' to different enumeration type
              'e_account_find_t' (aka 'enum _e_account_find_t') [-Wconversion]
                if (e_account_list_find (accounts, E_ACCOUNT_ID_ADDRESS, id)) {
                    ~~~~~~~~~~~~~~~~~~~            ^~~~~~~~~~~~~~~~~~~~
        1 warning generated.

This code was added in the following commit.

        commit 13f68969d8ae197b1912bb8b307df114f46a2b2b
        Author: Chenthill Palanisamy <pchenthill novell com>
        Date:   Tue Dec 7 12:48:47 2010 +0530

            Check for the existence of .Outbox folder while migrating. Make sure the dummy account is created only once. Revert couple of fixes

Looking at the enum declarations in Evolution Data Server,

        $ more libedataserver/e-account-list.h
        […]
        /* search options for the find command */
        typedef enum _e_account_find_t {
	        E_ACCOUNT_FIND_NAME,
	        E_ACCOUNT_FIND_UID,
	        E_ACCOUNT_FIND_ID_NAME,
	        E_ACCOUNT_FIND_ID_ADDRESS,
	        E_ACCOUNT_FIND_PARENT_UID
        } e_account_find_t;
        […]

and the signature of the function

        $ more libedataserver/e-account-list.c
        […]
        /**
         * e_account_list_find:
         * @account_list: an #EAccountList
         * @type: type of search
         * @key: the search key
         *
         * Perform a search of @account_list on a single key.
         *
         * @type must be set from one of the following search types:
         * E_ACCOUNT_FIND_NAME - Find an account by account name.
         * E_ACCOUNT_FIND_ID_NAME - Find an account by the owner's identity name.
         * E_ACCOUNT_FIND_ID_ADDRESS - Find an account by the owner's identity address.
         *
         * Returns: The account or %NULL if it doesn't exist.
         **/
        const EAccount *
        e_account_list_find (EAccountList *account_list,
                             e_account_find_t type,
                             const gchar *key)
        […]

using the correct enum type make warning go away.

No error is know to have originated from this.
---
 shell/e-convert-local-mail.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shell/e-convert-local-mail.c b/shell/e-convert-local-mail.c
index 6b20c5e..689492c 100644
--- a/shell/e-convert-local-mail.c
+++ b/shell/e-convert-local-mail.c
@@ -272,7 +272,7 @@ create_mbox_account (CamelSession *session)
 	e_account_set_string (account, E_ACCOUNT_NAME, "local_mbox");
 
 	accounts = e_get_account_list ();
-	if (e_account_list_find (accounts, E_ACCOUNT_ID_ADDRESS, id)) {
+	if (e_account_list_find (accounts, E_ACCOUNT_FIND_ID_ADDRESS, id)) {
 		g_object_unref (account);
 		goto exit;
 	}
-- 
1.7.10.4

Attachment: signature.asc
Description: This is a digitally signed message part



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