]> granicus.if.org Git - neomutt/commitdiff
boolify params
authorRichard Russon <rich@flatcap.org>
Thu, 16 Aug 2018 23:53:24 +0000 (00:53 +0100)
committerRichard Russon <rich@flatcap.org>
Fri, 17 Aug 2018 01:55:41 +0000 (02:55 +0100)
conn/ssl.c
mailbox.c
mutt_thread.c
mutt_thread.h
send.c
sidebar.c
sidebar.h

index 7ac9fdf994f3f9664f73e89338388a52cffc0e4b..0276f21bf54f1620cda1331d0a1c146df7ca0e75 100644 (file)
@@ -905,10 +905,10 @@ out:
 /**
  * check_certificate_by_digest - Validate a certificate by its digest
  * @param peercert Certificate
- * @retval 1 Certificate is valid
- * @retval 0 Error
+ * @retval true  Certificate is valid
+ * @retval false Error
  */
-static int check_certificate_by_digest(X509 *peercert)
+static bool check_certificate_by_digest(X509 *peercert)
 {
   return check_certificate_expiration(peercert, false) && check_certificate_file(peercert);
 }
@@ -937,7 +937,7 @@ static int ssl_cache_trusted_cert(X509 *c)
  * @retval true  User selected 'skip'
  * @retval false Otherwise
  */
-static int interactive_check_cert(X509 *cert, int idx, size_t len, SSL *ssl, bool allow_always)
+static bool interactive_check_cert(X509 *cert, int idx, size_t len, SSL *ssl, bool allow_always)
 {
   static const int part[] = {
     NID_commonName,             /* CN */
@@ -1106,9 +1106,9 @@ static int interactive_check_cert(X509 *cert, int idx, size_t len, SSL *ssl, boo
  * @retval true  Certificate is valid
  * @retval false Error, or Certificate is invalid
  *
- * called for each certificate in the chain sent by the peer, starting from the
- * root; returning 1 means that the given certificate is trusted, returning 0
- * immediately aborts the SSL connection
+ * Called for each certificate in the chain sent by the peer, starting from the
+ * root; returning true means that the given certificate is trusted, returning
+ * false immediately aborts the SSL connection
  */
 static int ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
 {
@@ -1118,19 +1118,19 @@ static int ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
   int pos;
   X509 *cert = NULL;
   SSL *ssl = NULL;
-  int skip_mode;
+  bool skip_mode;
 
   ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
   if (!ssl)
   {
     mutt_debug(1, "failed to retrieve SSL structure from X509_STORE_CTX\n");
-    return 0;
+    return false;
   }
   host = SSL_get_ex_data(ssl, HostExDataIndex);
   if (!host)
   {
     mutt_debug(1, "failed to retrieve hostname from SSL structure\n");
-    return 0;
+    return false;
   }
 
   /* This is true when a previous entry in the certificate chain did
@@ -1166,7 +1166,7 @@ static int ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
           compare_certificates(cert, last_cert, last_cert_md, last_cert_mdlen))
       {
         mutt_debug(2, "ignoring duplicate skipped certificate.\n");
-        return 1;
+        return true;
       }
     }
 
@@ -1182,7 +1182,7 @@ static int ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
   {
     mutt_debug(2, "using cached certificate\n");
     SSL_set_ex_data(ssl, SkipModeExDataIndex, NULL);
-    return 1;
+    return true;
   }
 
   /* check hostname only for the leaf certificate */
@@ -1206,7 +1206,7 @@ static int ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
     {
       mutt_debug(2, "digest check passed\n");
       SSL_set_ex_data(ssl, SkipModeExDataIndex, NULL);
-      return 1;
+      return true;
     }
 
     /* log verification error */
@@ -1218,7 +1218,7 @@ static int ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
     return interactive_check_cert(cert, pos, len, ssl, true);
   }
 
-  return 1;
+  return true;
 }
 
 /**
index 90f82244ab7c341473f471604cd03eed9f210e8a..38feba5a2c427b3e8a657ea8bb5cd6e66f242a00 100644 (file)
--- a/mailbox.c
+++ b/mailbox.c
@@ -689,7 +689,7 @@ int mutt_parse_mailboxes(struct Buffer *path, struct Buffer *s,
     STAILQ_INSERT_TAIL(&AllMailboxes, mn, entries);
 
 #ifdef USE_SIDEBAR
-    mutt_sb_notify_mailbox(b, 1);
+    mutt_sb_notify_mailbox(b, true);
 #endif
   }
   return 0;
@@ -748,7 +748,7 @@ int mutt_parse_unmailboxes(struct Buffer *path, struct Buffer *s,
           (mutt_str_strcasecmp(buf, np->b->desc) == 0))
       {
 #ifdef USE_SIDEBAR
-        mutt_sb_notify_mailbox(np->b, 0);
+        mutt_sb_notify_mailbox(np->b, false);
 #endif
         STAILQ_REMOVE(&AllMailboxes, np, MailboxNode, entries);
         mailbox_free(&np->b);
index 72a75562e9f7d913b950029934de05de39fc29d8..025c32cea53aec4191829cc5afa0fd5053946a61 100644 (file)
@@ -1029,11 +1029,11 @@ void mutt_sort_threads(struct Context *ctx, bool init)
 /**
  * mutt_aside_thread - Find the next/previous (sub)thread
  * @param hdr        Search from this message
- * @param dir        Direction to search: 'true' forwards, 'false' backwards
+ * @param forwards   Direction to search: 'true' forwards, 'false' backwards
  * @param subthreads Search subthreads: 'true' subthread, 'false' not
  * @retval num Index into the virtual email table
  */
-int mutt_aside_thread(struct Header *hdr, short dir, short subthreads)
+int mutt_aside_thread(struct Header *hdr, bool forwards, bool subthreads)
 {
   struct MuttThread *cur = NULL;
   struct Header *tmp = NULL;
@@ -1053,7 +1053,7 @@ int mutt_aside_thread(struct Header *hdr, short dir, short subthreads)
   }
   else
   {
-    if ((dir != 0) ^ ((Sort & SORT_REVERSE) != 0))
+    if (forwards ^ ((Sort & SORT_REVERSE) != 0))
     {
       while (!cur->next && cur->parent)
         cur = cur->parent;
@@ -1065,7 +1065,7 @@ int mutt_aside_thread(struct Header *hdr, short dir, short subthreads)
     }
   }
 
-  if ((dir != 0) ^ ((Sort & SORT_REVERSE) != 0))
+  if (forwards ^ ((Sort & SORT_REVERSE) != 0))
   {
     do
     {
index a3e4751130bde9c74e34a79601d8c2f784c2739f..efe6586117b5241d31313e4230b944d678d4daf2 100644 (file)
@@ -48,11 +48,11 @@ extern bool ThreadReceived;
 #define MUTT_THREAD_NEXT_UNREAD (1 << 4)
 #define MUTT_THREAD_FLAGGED     (1 << 5)
 
-int mutt_aside_thread(struct Header *hdr, short dir, short subthreads);
-#define mutt_next_thread(x)        mutt_aside_thread(x, 1, 0)
-#define mutt_previous_thread(x)    mutt_aside_thread(x, 0, 0)
-#define mutt_next_subthread(x)     mutt_aside_thread(x, 1, 1)
-#define mutt_previous_subthread(x) mutt_aside_thread(x, 0, 1)
+int mutt_aside_thread(struct Header *hdr, bool forwards, bool subthreads);
+#define mutt_next_thread(x)        mutt_aside_thread(x, true,  false)
+#define mutt_previous_thread(x)    mutt_aside_thread(x, false, false)
+#define mutt_next_subthread(x)     mutt_aside_thread(x, true,  true)
+#define mutt_previous_subthread(x) mutt_aside_thread(x, false, true)
 
 int mutt_traverse_thread(struct Context *ctx, struct Header *cur, int flag);
 #define mutt_collapse_thread(x, y)         mutt_traverse_thread(x, y, MUTT_THREAD_COLLAPSE)
diff --git a/send.c b/send.c
index ce4db9ffcfa25dc25e1026f92282cfe10cf42e5a..b0ba7cdb946a38e0cbb144ce7c99b44496b50a9a 100644 (file)
--- a/send.c
+++ b/send.c
@@ -189,7 +189,7 @@ struct Address *mutt_remove_xrefs(struct Address *a, struct Address *b)
  *                   one in the list
  * @retval ptr Head of the remaining Address List
  */
-static struct Address *remove_user(struct Address *a, int leave_only)
+static struct Address *remove_user(struct Address *a, bool leave_only)
 {
   struct Address *top = NULL, *last = NULL;
 
@@ -1154,7 +1154,7 @@ void mutt_set_followup_to(struct Envelope *e)
     }
 
     /* remove ourselves from the mail-followup-to header */
-    e->mail_followup_to = remove_user(e->mail_followup_to, 0);
+    e->mail_followup_to = remove_user(e->mail_followup_to, false);
 
     /* If we are not subscribed to any of the lists in question,
      * re-add ourselves to the mail-followup-to header.  The
index 0539d347d2a777ab0e39b4e82baef4a2cb223e8f..94a7b4a34771ca1c42f95bb8cbde6a73ef6ebf84 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -992,7 +992,7 @@ void mutt_sb_draw(void)
     struct MailboxNode *np = NULL;
     STAILQ_FOREACH(np, &AllMailboxes, entries)
     {
-      mutt_sb_notify_mailbox(np->b, 1);
+      mutt_sb_notify_mailbox(np->b, true);
     }
   }
 
@@ -1138,7 +1138,7 @@ void mutt_sb_set_open_mailbox(void)
  *
  * Before a deletion, check that our pointers won't be invalidated.
  */
-void mutt_sb_notify_mailbox(struct Mailbox *b, int created)
+void mutt_sb_notify_mailbox(struct Mailbox *b, bool created)
 {
   if (!b)
     return;
index 47c3bdc8a259830bc27e29c279a2958b899ef47e..159d13b4191bc952f9e81f3556a45aaef6b6b70b 100644 (file)
--- a/sidebar.h
+++ b/sidebar.h
@@ -45,7 +45,7 @@ extern short SidebarSortMethod;
 void mutt_sb_change_mailbox(int op);
 void mutt_sb_draw(void);
 const char *mutt_sb_get_highlight(void);
-void mutt_sb_notify_mailbox(struct Mailbox *b, int created);
+void mutt_sb_notify_mailbox(struct Mailbox *b, bool created);
 void mutt_sb_set_mailbox_stats(const struct Context *ctx);
 void mutt_sb_set_open_mailbox(void);
 void mutt_sb_toggle_virtual(void);