[balsa: 1/2] minor coding style improvements




commit 11917e8579550c7b7fe3a112bcf4929b70b07334
Author: Albrecht Dreß <albrecht dress netcologne de>
Date:   Wed Jan 26 21:14:00 2022 +0100

    minor coding style improvements
    
    Remove redundant conditional checks; do not initialise variables with
    values which are never used; clarify precedence of '&' and '?' operators
    (all detected by cppcheck).
    
    Signed-off-by: Albrecht Dreß <albrecht dress netcologne de>

 libbalsa/html.c      | 2 +-
 libbalsa/misc.c      | 2 +-
 src/balsa-message.c  | 4 ++--
 src/print-gtk.c      | 2 +-
 src/sendmsg-window.c | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/libbalsa/html.c b/libbalsa/html.c
index 546b744a4..bb34ef817 100644
--- a/libbalsa/html.c
+++ b/libbalsa/html.c
@@ -150,7 +150,7 @@ html2text(gchar ** text, gsize len)
     if (err != NULL) {
         libbalsa_information(LIBBALSA_INFORMATION_ERROR,
                              _("Could not convert HTML part to text: %s"),
-                             err ? err->message : _("Unknown error"));
+                             err->message);
         g_error_free(err);
     }
 }
diff --git a/libbalsa/misc.c b/libbalsa/misc.c
index 3474a2169..3b529c6c9 100644
--- a/libbalsa/misc.c
+++ b/libbalsa/misc.c
@@ -507,7 +507,7 @@ libbalsa_text_attr_string(const gchar * string)
     gboolean has_esc = FALSE;
     gboolean has_hi_bit = FALSE;
     gboolean has_hi_ctrl = FALSE;
-    gboolean is_utf8 = TRUE;
+    gboolean is_utf8;
 
     lb_text_attr(string, -1, &has_esc, &has_hi_bit, &has_hi_ctrl);
     is_utf8 = g_utf8_validate(string, -1, NULL);
diff --git a/src/balsa-message.c b/src/balsa-message.c
index 77262d551..d6b70834a 100644
--- a/src/balsa-message.c
+++ b/src/balsa-message.c
@@ -2932,7 +2932,7 @@ libbalsa_msg_try_mp_signed(LibBalsaMessage * message, LibBalsaMessageBody *body,
             _("The message sent by %s with subject “%s” contains a %s "
               "signed part, but this crypto protocol is not available."),
             chk_crypto->sender, chk_crypto->subject,
-            signres & LIBBALSA_PROTECT_RFC3156 ? _("PGP") : _("S/MIME"));
+            (signres & LIBBALSA_PROTECT_RFC3156) ? _("PGP") : _("S/MIME"));
        return;
     }
 
@@ -2942,7 +2942,7 @@ libbalsa_msg_try_mp_signed(LibBalsaMessage * message, LibBalsaMessageBody *body,
        body->parts->next->sig_info = NULL;
     }
     if (!libbalsa_body_check_signature(body,
-                                      signres & LIBBALSA_PROTECT_RFC3156 ?
+                                      (signres & LIBBALSA_PROTECT_RFC3156) ?
                                       GPGME_PROTOCOL_OpenPGP : GPGME_PROTOCOL_CMS))
        return;
 
diff --git a/src/print-gtk.c b/src/print-gtk.c
index 9e6602941..4629c3bd6 100644
--- a/src/print-gtk.c
+++ b/src/print-gtk.c
@@ -206,7 +206,7 @@ static GList *
 scan_body(GList *bpo_list, GtkPrintContext * context, BalsaPrintSetup * psetup,
          LibBalsaMessageBody * body, gboolean no_first_sep)
 {
-    gboolean add_signature = FALSE;
+    gboolean add_signature;
     gboolean have_crypto_frame;
        gboolean is_mp_signed;
     while (body) {
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index b60d08ce6..b021187e9 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -5211,7 +5211,7 @@ check_suggest_encryption(BalsaSendmsg * bsmsg)
         return TRUE;
 
     /* collect all to and cc recipients */
-    protocol = bsmsg->gpg_mode & LIBBALSA_PROTECT_SMIMEV3 ?
+    protocol = (bsmsg->gpg_mode & LIBBALSA_PROTECT_SMIMEV3) ?
        GPGME_PROTOCOL_CMS : GPGME_PROTOCOL_OpenPGP;
 
     ia_list = libbalsa_address_view_get_list(bsmsg->recipient_view, "To:");


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