[evolution-mapi] Address some of the clang compiler warnings



commit 23e6415c065b67558cc92c638001f260a94721d0
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jun 7 11:59:28 2016 +0200

    Address some of the clang compiler warnings

 configure.ac                                   |    8 +++++++-
 src/addressbook/e-book-backend-mapi-contacts.c |   17 +++++++++--------
 src/addressbook/e-book-backend-mapi-gal.c      |   17 +++++++++--------
 src/calendar/e-cal-backend-mapi.c              |    4 ++--
 src/libexchangemapi/e-mapi-connection.c        |    8 +++++---
 5 files changed, 32 insertions(+), 22 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 615d66b..42cffb6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,6 +59,7 @@ dnl ***********************
 dnl Compiler Warning Flags
 dnl ***********************
 proposed_warning_flags=
+append_warning_flags=
 
 if test "x$enable_maintainer_mode" = "xyes" ; then
        proposed_warning_flags="-Wall -Wextra -Wdeprecated-declarations"
@@ -66,6 +67,10 @@ else
        proposed_warning_flags="-Wno-deprecated-declarations"
 fi
 
+if test "$CC" = "clang" ; then
+       append_warning_flags="-Wno-parentheses-equality -Wno-format-nonliteral"
+fi
+
 AS_COMPILER_FLAGS(WARNING_FLAGS,
        "$proposed_warning_flags
        -Wno-missing-field-initializers
@@ -76,7 +81,8 @@ AS_COMPILER_FLAGS(WARNING_FLAGS,
        -Wformat -Wformat-nonliteral -Wformat-security -Winit-self
        -Wmissing-declarations -Wmissing-include-dirs
        -Wmissing-noreturn -Wnested-externs -Wpointer-arith
-       -Wundef -Wwrite-strings")
+       -Wundef -Wwrite-strings
+       $append_warning_flags")
 AC_SUBST(WARNING_FLAGS)
 
 dnl Other useful compiler warnings for test builds only.
diff --git a/src/addressbook/e-book-backend-mapi-contacts.c b/src/addressbook/e-book-backend-mapi-contacts.c
index aa216b0..d1eda50 100644
--- a/src/addressbook/e-book-backend-mapi-contacts.c
+++ b/src/addressbook/e-book-backend-mapi-contacts.c
@@ -859,16 +859,17 @@ ebbm_contacts_get_status_message (EBookBackendMAPI *ebma, gint index, gint total
        if (index <= 0)
                return NULL;
 
-       return g_strdup_printf (
-               total <= 0 ?
+       if (total <= 0)
+               return g_strdup_printf (
                        /* Translators : This is used to cache the downloaded contacts from a server.
                           %d is an index of the contact. */
-                       _("Caching contact %d") :
-                       /* Translators : This is used to cache the downloaded contacts from a server.
-                          The first %d is an index of the contact,
-                          the second %d is total count of conacts on the server. */
-                       _("Caching contact %d/%d"),
-               index, total);
+                       _("Caching contact %d"), index);
+
+       return g_strdup_printf (
+               /* Translators : This is used to cache the downloaded contacts from a server.
+                  The first %d is an index of the contact,
+                  the second %d is total count of conacts on the server. */
+               _("Caching contact %d/%d"), index, total);
 }
 
 static void
diff --git a/src/addressbook/e-book-backend-mapi-gal.c b/src/addressbook/e-book-backend-mapi-gal.c
index e78fc65..26c183b 100644
--- a/src/addressbook/e-book-backend-mapi-gal.c
+++ b/src/addressbook/e-book-backend-mapi-gal.c
@@ -146,16 +146,17 @@ ebbm_gal_get_status_message (EBookBackendMAPI *ebma, gint index, gint total)
        if (index <= 0)
                return NULL;
 
-       return g_strdup_printf (
-               total <= 0 ?
+       if (total <= 0)
+               return g_strdup_printf (
                        /* Translators : This is used to cache the downloaded contacts from GAL.
                           %d is an index of the GAL entry. */
-                       _("Caching GAL contact %d") :
-                       /* Translators : This is used to cache the downloaded contacts from GAL.
-                          The first %d is an index of the GAL entry,
-                          the second %d is total count of entries in GAL. */
-                       _("Caching GAL contact %d/%d"),
-               index, total);
+                       _("Caching GAL contact %d"), index);
+
+       return g_strdup_printf (
+               /* Translators : This is used to cache the downloaded contacts from GAL.
+                  The first %d is an index of the GAL entry,
+                  the second %d is total count of entries in GAL. */
+               _("Caching GAL contact %d/%d"), index, total);
 }
 
 static void
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index af74904..7fce4fd 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -965,7 +965,7 @@ ecbm_get_object_list (ECalBackend *backend, EDataCal *cal, GCancellable *cancell
 
        g_mutex_lock (&priv->mutex);
 
-       if (!strcmp (sexp, "#t"))
+       if (g_str_equal (sexp, "#t"))
                search_needed = FALSE;
 
        cbsexp = e_cal_backend_sexp_new (sexp);
@@ -2514,7 +2514,7 @@ ecbm_start_view (ECalBackend *backend, EDataCalView *view)
        }
 
        sexp = e_cal_backend_sexp_text (cbsexp);
-       if (!sexp || !strcmp (sexp, "#t"))
+       if (!sexp || g_str_equal (sexp, "#t"))
                search_needed = FALSE;
 
        prunning_by_time = e_cal_backend_sexp_evaluate_occur_times (cbsexp, &occur_start, &occur_end);
diff --git a/src/libexchangemapi/e-mapi-connection.c b/src/libexchangemapi/e-mapi-connection.c
index cfdc569..29e5723 100644
--- a/src/libexchangemapi/e-mapi-connection.c
+++ b/src/libexchangemapi/e-mapi-connection.c
@@ -120,6 +120,7 @@ make_mapi_error (GError **perror, const gchar *context, enum MAPISTATUS mapi_sta
        const gchar *error_msg = NULL, *status_name;
        gchar *to_free = NULL;
        GQuark error_domain;
+       gint error_code;
        GError *error;
 
        if (!perror)
@@ -166,19 +167,20 @@ make_mapi_error (GError **perror, const gchar *context, enum MAPISTATUS mapi_sta
        g_return_if_fail (error_msg != NULL);
 
        error_domain = E_MAPI_ERROR;
+       error_code = mapi_status;
 
        if (mapi_status == MAPI_E_USER_CANCEL) {
                error_domain = G_IO_ERROR;
-               mapi_status = G_IO_ERROR_CANCELLED;
+               error_code = G_IO_ERROR_CANCELLED;
        }
 
        if (context && *context) {
                /* Translators: The first '%s' is replaced with an error context,
                   aka where the error occurred, the second '%s' is replaced with
                   the error message. */
-               error = g_error_new (error_domain, mapi_status, C_("EXCHANGEMAPI_ERROR", "%s: %s"), context, 
error_msg);
+               error = g_error_new (error_domain, error_code, C_("EXCHANGEMAPI_ERROR", "%s: %s"), context, 
error_msg);
        } else {
-               error = g_error_new_literal (error_domain, mapi_status, error_msg);
+               error = g_error_new_literal (error_domain, error_code, error_msg);
        }
 
        g_free (to_free);


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