[balsa/gtk3] Build with clang (ver. LLVM 3.4)



commit 03e3f644e2385bf3f266d17fa13c7a1b2386645a
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Feb 15 16:09:29 2015 -0500

    Build with clang (ver. LLVM 3.4)
    
        * libbalsa/files.c: remove unused assignment (detected by cppcheck)
        * libbalsa/imap/auth-cram.c: fix possible writing behind buffer end
        * libbalsa/imap/imap-commands.c: remove check for a value >= 0 for an
        unsigned value
        * libbalsa/imap/imap-handle.c, libbalsa/mailbox_imap.c: add empty
        'if' body
        * libbalsa/mailbox_imap.c, libbalsa/send.c, libbalsa/smtp-server.c:
        fix enum mismatch
        * libbalsa/mailbox_mbox.c: don't assign a signed value to an unsigned
        * libbalsa/message.h, libbalsa/mailbox_mh.c: introduce proper
        "invalid" flag (clang optimises the current solution away,
        as it can never be true)

 ChangeLog                     |   17 +++++++++++++++++
 libbalsa/files.c              |    2 +-
 libbalsa/imap/auth-cram.c     |    2 +-
 libbalsa/imap/imap-commands.c |    2 +-
 libbalsa/imap/imap-handle.c   |    2 +-
 libbalsa/mailbox_imap.c       |    6 +++---
 libbalsa/mailbox_mbox.c       |    2 +-
 libbalsa/mailbox_mh.c         |   13 ++++++-------
 libbalsa/message.h            |    3 ++-
 libbalsa/send.c               |    2 +-
 libbalsa/smtp-server.c        |    6 +++---
 11 files changed, 37 insertions(+), 20 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d860490..8bc673c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2015-02-15  Albrecht Dreß
+
+       Build with clang (ver. LLVM 3.4)
+
+       * libbalsa/files.c: remove unused assignment (detected by cppcheck)
+       * libbalsa/imap/auth-cram.c: fix possible writing behind buffer end
+       * libbalsa/imap/imap-commands.c: remove check for a value >= 0 for an
+       unsigned value
+       * libbalsa/imap/imap-handle.c, libbalsa/mailbox_imap.c: add empty
+       'if' body
+       * libbalsa/mailbox_imap.c, libbalsa/send.c, libbalsa/smtp-server.c:
+       fix enum mismatch
+       * libbalsa/mailbox_mbox.c: don't assign a signed value to an unsigned
+       * libbalsa/message.h, libbalsa/mailbox_mh.c: introduce proper
+       "invalid" flag (clang optimises the current solution away,
+       as it can never be true)
+
 2015-02-11  Peter Bloomfield  <pbloomfield bellsouth net>
 
        Port BalsaMessage from GtkNotebook to GtkStack
diff --git a/libbalsa/files.c b/libbalsa/files.c
index 06fd1b0..9774348 100644
--- a/libbalsa/files.c
+++ b/libbalsa/files.c
@@ -141,7 +141,7 @@ libbalsa_icon_finder(GtkWidget         * widget,
     GtkIconTheme *icon_theme;
 
     if (!gtk_icon_size_lookup(size, &width, &height))
-        width = height = 16;
+        width = 16;
 
     if (mime_type)
         content_type = mime_type;
diff --git a/libbalsa/imap/auth-cram.c b/libbalsa/imap/auth-cram.c
index 593ca2c..dc7d91b 100644
--- a/libbalsa/imap/auth-cram.c
+++ b/libbalsa/imap/auth-cram.c
@@ -115,7 +115,7 @@ imap_auth_cram(ImapMboxHandle* handle)
    */
   
   lit_conv_to_base64(ibuf, obuf, strlen (obuf), sizeof(ibuf)-2);
-  strncat (ibuf, "\r\n", sizeof (ibuf));
+  strncat (ibuf, "\r\n", sizeof (ibuf) - 1);
   imap_handle_write(handle, ibuf, strlen(ibuf));
   imap_handle_flush(handle);
   g_free(user); g_free(pass); /* FIXME: clean passwd first */
diff --git a/libbalsa/imap/imap-commands.c b/libbalsa/imap/imap-commands.c
index 25b1ef0..24e7ec9 100644
--- a/libbalsa/imap/imap-commands.c
+++ b/libbalsa/imap/imap-commands.c
@@ -140,7 +140,7 @@ imap_mbox_handle_can_do(ImapMboxHandle* handle, ImapCapability cap)
   if(!handle->has_capabilities)
     imap_check_capability(handle);
 
-  if(cap>=0 && cap<IMCAP_MAX)
+  if(cap<IMCAP_MAX)
     return handle->capabilities[cap];
   else return 0;
 }
diff --git a/libbalsa/imap/imap-handle.c b/libbalsa/imap/imap-handle.c
index f636818..b148ca8 100644
--- a/libbalsa/imap/imap-handle.c
+++ b/libbalsa/imap/imap-handle.c
@@ -3259,7 +3259,7 @@ imap_get_address(struct siobuf* sio)
   
   for(i=0; i<4; i++) {
     addr[i] = imap_get_nstring(sio);
-    if( (c=sio_getc(sio)) != ' '); /* error if i < 3 but do nothing */
+    if( (c=sio_getc(sio)) != ' ') {} /* error if i < 3 but do nothing */
   }
 
   if (addr[0] && (p = strchr(addr[0], '\r'))) {
diff --git a/libbalsa/mailbox_imap.c b/libbalsa/mailbox_imap.c
index dc921bb..6176e6d 100644
--- a/libbalsa/mailbox_imap.c
+++ b/libbalsa/mailbox_imap.c
@@ -1727,9 +1727,9 @@ libbalsa_mailbox_imap_noop(LibBalsaMailboxImap* mimap)
     g_return_if_fail(mimap != NULL);
 
     if (mimap->handle) /* we do not attempt to reconnect here */
-       if (imap_mbox_handle_noop(mimap->handle) != IMR_OK)
+       if (imap_mbox_handle_noop(mimap->handle) != IMR_OK) {
            /* FIXME: report error... */
-           ;
+       }
 }
 
 void
@@ -3155,7 +3155,7 @@ libbalsa_mailbox_imap_can_do(LibBalsaMailbox* mbox,
 static ImapSortKey
 lbmi_get_imap_sort_key(LibBalsaMailbox *mbox)
 {
-    ImapSortKey key = LB_MBOX_FROM_COL;
+    ImapSortKey key = (ImapSortKey) LB_MBOX_FROM_COL;
 
     switch (mbox->view->sort_field) {
     default:
diff --git a/libbalsa/mailbox_mbox.c b/libbalsa/mailbox_mbox.c
index 06296a7..b59b98d 100644
--- a/libbalsa/mailbox_mbox.c
+++ b/libbalsa/mailbox_mbox.c
@@ -1513,7 +1513,7 @@ libbalsa_mailbox_mbox_sync(LibBalsaMailbox * mailbox, gboolean expunge)
     temp_stream = g_mime_stream_fs_new(i);
 
     for (i = first; i < messages; i++) {
-       guint status_len, x_status_len;
+       gint status_len, x_status_len;
 
        msg_info = message_info_from_msgno(mbox, i + 1);
        if (expunge && (msg_info->local_info.flags & LIBBALSA_MESSAGE_FLAG_DELETED))
diff --git a/libbalsa/mailbox_mh.c b/libbalsa/mailbox_mh.c
index 66cd304..6e8bd3a 100644
--- a/libbalsa/mailbox_mh.c
+++ b/libbalsa/mailbox_mh.c
@@ -300,7 +300,6 @@ lbm_mh_remove_files(LibBalsaMailboxLocal *mailbox)
     LIBBALSA_MAILBOX_LOCAL_CLASS(parent_class)->remove_files(mailbox);
 }
 
-#define INVALID_FLAG ((unsigned) -1)
 
 static LibBalsaMailboxLocalMessageInfo *
 lbm_mh_get_info(LibBalsaMailboxLocal * local, guint msgno)
@@ -309,7 +308,7 @@ lbm_mh_get_info(LibBalsaMailboxLocal * local, guint msgno)
 
     msg_info = lbm_mh_message_info_from_msgno(LIBBALSA_MAILBOX_MH(local),
                                              msgno);
-    if (msg_info->local_info.flags == INVALID_FLAG)
+    if (msg_info->local_info.flags == LIBBALSA_MESSAGE_FLAG_INVALID)
         msg_info->local_info.flags = msg_info->orig_flags;
 
     return &msg_info->local_info;
@@ -370,7 +369,7 @@ lbm_mh_parse_mailbox(LibBalsaMailboxMh * mh, gboolean add_msg_info)
                                    GINT_TO_POINTER(fileno));
            if (!msg_info) {
                msg_info = g_new0(struct message_info, 1);
-               msg_info->local_info.flags = INVALID_FLAG;
+               msg_info->local_info.flags = LIBBALSA_MESSAGE_FLAG_INVALID;
                g_hash_table_insert(mh->messages_info,
                                    GINT_TO_POINTER(fileno), msg_info);
                g_ptr_array_add(mh->msgno_2_msg_info, msg_info);
@@ -754,7 +753,7 @@ static void
 lbm_mh_flag_line(struct message_info *msg_info, LibBalsaMessageFlag flag,
                 struct line_info *li)
 {
-    if (msg_info->local_info.flags == INVALID_FLAG)
+    if (msg_info->local_info.flags == LIBBALSA_MESSAGE_FLAG_INVALID)
        msg_info->local_info.flags = msg_info->orig_flags;
     if (!(msg_info->local_info.flags & flag))
        return;
@@ -827,7 +826,7 @@ libbalsa_mailbox_mh_sync(LibBalsaMailbox * mailbox, gboolean expunge)
     msgno = 1;
     while (msgno <= mh->msgno_2_msg_info->len) {
        msg_info = lbm_mh_message_info_from_msgno(mh, msgno);
-       if (msg_info->local_info.flags == INVALID_FLAG)
+       if (msg_info->local_info.flags == LIBBALSA_MESSAGE_FLAG_INVALID)
            msg_info->local_info.flags = msg_info->orig_flags;
        if (mailbox->state == LB_MAILBOX_STATE_CLOSING)
            msg_info->local_info.flags &= ~LIBBALSA_MESSAGE_FLAG_RECENT;
@@ -869,9 +868,9 @@ libbalsa_mailbox_mh_sync(LibBalsaMailbox * mailbox, gboolean expunge)
                new_file = g_build_filename(path, tmp, NULL);
                g_free(tmp);
 
-               if (libbalsa_safe_rename(old_file, new_file) == -1)
+               if (libbalsa_safe_rename(old_file, new_file) == -1) {
                    /* FIXME: report error ... */
-                   ;
+               }
 
                g_free(old_file);
                g_free(new_file);
diff --git a/libbalsa/message.h b/libbalsa/message.h
index 805f955..8a69c12 100644
--- a/libbalsa/message.h
+++ b/libbalsa/message.h
@@ -59,7 +59,8 @@ enum _LibBalsaMessageFlag {
     LIBBALSA_MESSAGE_FLAG_REPLIED = 1 << 2,
     LIBBALSA_MESSAGE_FLAG_FLAGGED = 1 << 3,
     LIBBALSA_MESSAGE_FLAG_RECENT  = 1 << 4,
-    LIBBALSA_MESSAGE_FLAG_SELECTED= 1 << 5     /* pseudo flag */
+    LIBBALSA_MESSAGE_FLAG_SELECTED= 1 << 5,    /* pseudo flag */
+    LIBBALSA_MESSAGE_FLAG_INVALID = 1 << 6     /* pseudo flag */
 };
 
 #define LIBBALSA_MESSAGE_FLAGS_REAL \
diff --git a/libbalsa/send.c b/libbalsa/send.c
index 9a1fb0f..93b36fb 100644
--- a/libbalsa/send.c
+++ b/libbalsa/send.c
@@ -670,7 +670,7 @@ lbs_process_queue(LibBalsaMailbox * outbox, LibBalsaFccboxFinder finder,
     g_free(host_with_port);
 
     /* Tell libESMTP how to use the SMTP STARTTLS extension.  */
-    smtp_starttls_enable (session, server->tls_mode);
+    smtp_starttls_enable (session, (enum starttls_option) server->tls_mode);
 
     /* Now tell libESMTP it can use the SMTP AUTH extension.  */
     smtp_auth_set_context(session,
diff --git a/libbalsa/smtp-server.c b/libbalsa/smtp-server.c
index 252fd39..44e3a63 100644
--- a/libbalsa/smtp-server.c
+++ b/libbalsa/smtp-server.c
@@ -443,13 +443,13 @@ smtp_server_response(GtkDialog * dialog, gint response,
 #if HAVE_SMTP_TLS_CLIENT_CERTIFICATE
         switch (gtk_combo_box_get_active(GTK_COMBO_BOX(sdi->tlsm))) {
         case 0:
-            server->tls_mode = Starttls_DISABLED;
+            server->tls_mode = LIBBALSA_TLS_DISABLED;
             break;
         case 1:
-            server->tls_mode = Starttls_ENABLED;
+            server->tls_mode = LIBBALSA_TLS_ENABLED;
             break;
         case 2:
-            server->tls_mode = Starttls_REQUIRED;
+            server->tls_mode = LIBBALSA_TLS_REQUIRED;
             break;
         default:
             break;


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