From: Richard Russon Date: Thu, 16 Aug 2018 23:53:24 +0000 (+0100) Subject: boolify params X-Git-Tag: 2019-10-25~693^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=beb73ca4276285697e11abea2f4821f56f481520;p=neomutt boolify params --- diff --git a/conn/ssl.c b/conn/ssl.c index 7ac9fdf99..0276f21bf 100644 --- a/conn/ssl.c +++ b/conn/ssl.c @@ -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; } /** diff --git a/mailbox.c b/mailbox.c index 90f82244a..38feba5a2 100644 --- 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); diff --git a/mutt_thread.c b/mutt_thread.c index 72a75562e..025c32cea 100644 --- a/mutt_thread.c +++ b/mutt_thread.c @@ -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 { diff --git a/mutt_thread.h b/mutt_thread.h index a3e475113..efe658611 100644 --- a/mutt_thread.h +++ b/mutt_thread.h @@ -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 ce4db9ffc..b0ba7cdb9 100644 --- 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 diff --git a/sidebar.c b/sidebar.c index 0539d347d..94a7b4a34 100644 --- 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; diff --git a/sidebar.h b/sidebar.h index 47c3bdc8a..159d13b41 100644 --- 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);