]> granicus.if.org Git - neomutt/commitdiff
test int functions against 0
authorRichard Russon <rich@flatcap.org>
Wed, 28 Mar 2018 19:16:13 +0000 (20:16 +0100)
committerRichard Russon <rich@flatcap.org>
Wed, 28 Mar 2018 19:16:13 +0000 (20:16 +0100)
20 files changed:
browser.c
color.c
commands.c
conn/getdomain.c
conn/ssl.c
conn/ssl_gnutls.c
copy.c
enter.c
history.c
imap/browse.c
imap/command.c
imap/imap.c
imap/message.c
main.c
mutt/rfc2047.c
mx.c
ncrypt/crypt.c
ncrypt/crypt_gpgme.c
status.c
thread.c

index c8f38b4accc9d4c89e7dd6290f75e2ed3bc8b2e5..17eb750f41e1b5c95da60d827a28caee570286db 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -1201,7 +1201,7 @@ void mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfi
     {
       init_state(&state, NULL);
       state.imap_browse = true;
-      if (!imap_browse(f, &state))
+      if (imap_browse(f, &state) == 0)
       {
         mutt_str_strfcpy(LastDir, state.folder, sizeof(LastDir));
         browser_sort(&state);
@@ -1609,7 +1609,7 @@ void mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfi
           break;
         }
 
-        if (!imap_mailbox_create(LastDir))
+        if (imap_mailbox_create(LastDir) == 0)
         {
           /* TODO: find a way to detect if the new folder would appear in
            *   this window, and insert it without starting over. */
@@ -1669,7 +1669,7 @@ void mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numfi
           snprintf(msg, sizeof(msg), _("Really delete mailbox \"%s\"?"), mx.mbox);
           if (mutt_yesorno(msg, MUTT_NO) == MUTT_YES)
           {
-            if (!imap_delete_mailbox(Context, &mx))
+            if (imap_delete_mailbox(Context, &mx) == 0)
             {
               /* free the mailbox from the browser */
               FREE(&((state.entry)[nentry].name));
diff --git a/color.c b/color.c
index 71a7b57477aeefab252b9db8b6da0dd678c5f4fb..c4fdca841c2c3ef72446af4e32da95e46a76253b 100644 (file)
--- a/color.c
+++ b/color.c
@@ -727,7 +727,7 @@ static int parse_object(struct Buffer *buf, struct Buffer *s, int *o, int *ql,
 
     *o = MT_COLOR_QUOTED;
   }
-  else if (!mutt_str_strcasecmp(buf->data, "compose"))
+  else if (mutt_str_strcasecmp(buf->data, "compose") == 0)
   {
     if (!MoreArgs(s))
     {
index b8158eda1d669813ede5094725f50712b17b555f..9a5d83917c2da9ebee802fa5e68f1586db2ea9b9 100644 (file)
@@ -197,7 +197,7 @@ int mutt_display_message(struct Header *cur)
     {
       if (cur->security & GOODSIGN)
       {
-        if (!crypt_smime_verify_sender(cur))
+        if (crypt_smime_verify_sender(cur) == 0)
           mutt_message(_("S/MIME signature successfully verified."));
         else
           mutt_error(_("S/MIME certificate owner does not match sender."));
index c4729033ddb150f5fb40d0da32d14004826daa6e..40f416c9b49baa1ca41f2f397728d0104e546f9c 100644 (file)
@@ -49,7 +49,7 @@ int getdnsdomainname(char *d, size_t len)
 
 #if defined(HAVE_GETADDRINFO) || defined(HAVE_GETADDRINFO_A)
   char node[STRING];
-  if (gethostname(node, sizeof(node)))
+  if (gethostname(node, sizeof(node)) != 0)
     return rc;
 
   struct addrinfo hints;
index 6ceb4f9707547c3c337e73b226a95c4a3410930a..f6d8abcaf401c9659583978a4aa1f4434c333d6d 100644 (file)
@@ -1184,7 +1184,7 @@ static int ssl_verify_callback(int preverify_ok, X509_STORE_CTX *ctx)
   buf[0] = 0;
   if (pos == 0 && SslVerifyHost != MUTT_NO)
   {
-    if (!check_host(cert, host, buf, sizeof(buf)))
+    if (check_host(cert, host, buf, sizeof(buf)) == 0)
     {
       mutt_error(_("Certificate host check failed: %s"), buf);
       /* we disallow (a)ccept always in the prompt, because it will have no effect
index b39f8c7dce6a3db77ad83dbfaf9010ed29d73713..2a02e0f33950a061c74251ee927e4483fc107d19 100644 (file)
@@ -572,7 +572,7 @@ static int tls_check_one_certificate(const gnutls_datum_t *certdata,
   gnutls_datum_t pemdata;
   int row, done, ret;
 
-  if (!tls_check_preauth(certdata, certstat, hostname, idx, &certerr, &savedcert))
+  if (tls_check_preauth(certdata, certstat, hostname, idx, &certerr, &savedcert) == 0)
     return 1;
 
   /* skip signers if insecure algorithm was used */
@@ -1196,7 +1196,7 @@ static int tls_negotiate(struct Connection *conn)
     goto fail;
   }
 
-  if (!tls_check_certificate(conn))
+  if (tls_check_certificate(conn) == 0)
     goto fail;
 
   /* set Security Strength Factor (SSF) for SASL */
diff --git a/copy.c b/copy.c
index d1b8cb604542013f6bc81759e8c466fbbbc45223..5602c09bb054d5a50dc2e3beae7eb53946e1e4bc 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -172,7 +172,7 @@ int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end,
       {
         if (flags & CH_DECODE)
         {
-          if (!address_header_decode(&this_one))
+          if (address_header_decode(&this_one) == 0)
             mutt_rfc2047_decode(&this_one);
           this_one_len = mutt_str_strlen(this_one);
 
@@ -289,7 +289,7 @@ int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end,
   {
     if (flags & CH_DECODE)
     {
-      if (!address_header_decode(&this_one))
+      if (address_header_decode(&this_one) == 0)
         mutt_rfc2047_decode(&this_one);
       this_one_len = mutt_str_strlen(this_one);
     }
diff --git a/enter.c b/enter.c
index 269a3ffddf55300208a861f879930e5f630a0619..bcf639ac8440e52c364c31279206da2ff344b203 100644 (file)
--- a/enter.c
+++ b/enter.c
@@ -489,7 +489,7 @@ int mutt_enter_string_full(char *buf, size_t buflen, int col, int flags, int mul
               rc = 1;
               goto bye;
             }
-            if (!mutt_complete(buf, buflen))
+            if (mutt_complete(buf, buflen) == 0)
             {
               templen = state->lastchar - i;
               mutt_mem_realloc(&tempbuf, templen * sizeof(wchar_t));
@@ -609,7 +609,7 @@ int mutt_enter_string_full(char *buf, size_t buflen, int col, int flags, int mul
               goto bye;
             }
 
-            if (!mutt_complete(buf, buflen))
+            if (mutt_complete(buf, buflen) == 0)
             {
               templen = state->lastchar;
               mutt_mem_realloc(&tempbuf, templen * sizeof(wchar_t));
index 0c275f0bef4c23f259cb8ebb86aaea707ae5c48a..4d88d55be53f8ee72d1b3ea12e20ee2b24cc6504 100644 (file)
--- a/history.c
+++ b/history.c
@@ -387,7 +387,7 @@ static void remove_history_dups(enum HistoryClass hclass, const char *str)
   source = dest = 0;
   while (source < h->last)
   {
-    if (!mutt_str_strcmp(h->hist[source], str))
+    if (mutt_str_strcmp(h->hist[source], str) == 0)
       FREE(&h->hist[source++]);
     else
       h->hist[dest++] = h->hist[source++];
@@ -406,7 +406,7 @@ static void remove_history_dups(enum HistoryClass hclass, const char *str)
   source = dest = History;
   while (source > old_last)
   {
-    if (!mutt_str_strcmp(h->hist[source], str))
+    if (mutt_str_strcmp(h->hist[source], str) == 0)
       FREE(&h->hist[source--]);
     else
       h->hist[dest--] = h->hist[source--];
index 4b1d5bd2ac8ebd2632904949ce6948dd2eaa4fa9..bc4df448be383282bd681aabb2e755ae282fab09 100644 (file)
@@ -393,7 +393,7 @@ int imap_mailbox_create(const char *folder)
   if (mutt_get_field(_("Create mailbox: "), buf, sizeof(buf), MUTT_FILE) < 0)
     goto fail;
 
-  if (!mutt_str_strlen(buf))
+  if (mutt_str_strlen(buf) == 0)
   {
     mutt_error(_("Mailbox must have a name."));
     goto fail;
@@ -453,7 +453,7 @@ int imap_mailbox_rename(const char *mailbox)
   if (mutt_get_field(buf, newname, sizeof(newname), MUTT_FILE) < 0)
     goto fail;
 
-  if (!mutt_str_strlen(newname))
+  if (mutt_str_strlen(newname) == 0)
   {
     mutt_error(_("Mailbox must have a name."));
     goto fail;
index 3885ac8d54811213b2d957e400398c4ee9bbb6e9..0cd15feded10a80cc44d5cab83ae965859d036c5 100644 (file)
@@ -443,7 +443,7 @@ static void cmd_parse_list(struct ImapData *idata, char *s)
   /* Name */
   s = imap_next_word(s);
   /* Notes often responds with literals here. We need a real tokenizer. */
-  if (!imap_get_literal_count(s, &litlen))
+  if (imap_get_literal_count(s, &litlen) == 0)
   {
     if (imap_cmd_step(idata) != IMAP_CMD_CONTINUE)
     {
@@ -631,7 +631,7 @@ static void cmd_parse_status(struct ImapData *idata, char *s)
   mailbox = imap_next_word(s);
 
   /* We need a real tokenizer. */
-  if (!imap_get_literal_count(mailbox, &litlen))
+  if (imap_get_literal_count(mailbox, &litlen) == 0)
   {
     if (imap_cmd_step(idata) != IMAP_CMD_CONTINUE)
     {
index 1a29c58dad65ab1fa53e00fb180fd584d0c756c0..12b458a50996781362777047070363dd98306ecf 100644 (file)
@@ -46,6 +46,7 @@
 #include "conn/conn.h"
 #include "mutt.h"
 #include "imap.h"
+#include "auth.h"
 #include "bcache.h"
 #include "body.h"
 #include "buffy.h"
@@ -412,7 +413,7 @@ static int do_search(const struct Pattern *search, int allpats)
  */
 static int compile_search(struct Context *ctx, const struct Pattern *pat, struct Buffer *buf)
 {
-  if (!do_search(pat, 0))
+  if (do_search(pat, 0) == 0)
     return 0;
 
   if (pat->not)
@@ -971,7 +972,7 @@ struct ImapData *imap_conn_find(const struct Account *account, int flags)
     imap_open_connection(idata);
   if (idata->state == IMAP_CONNECTED)
   {
-    if (!imap_authenticate(idata))
+    if (imap_authenticate(idata) == IMAP_AUTH_SUCCESS)
     {
       idata->state = IMAP_AUTHENTICATED;
       FREE(&idata->capstr);
@@ -1678,7 +1679,7 @@ int imap_search(struct Context *ctx, const struct Pattern *pat)
   for (int i = 0; i < ctx->msgcount; i++)
     ctx->hdrs[i]->matched = false;
 
-  if (!do_search(pat, 1))
+  if (do_search(pat, 1) == 0)
     return 0;
 
   mutt_buffer_init(&buf);
@@ -1891,7 +1892,7 @@ int imap_fast_trash(struct Context *ctx, char *dest)
   }
 
   /* check that the save-to folder is in the same account */
-  if (!mutt_account_match(&(idata->conn->account), &(mx.account)))
+  if (mutt_account_match(&(idata->conn->account), &(mx.account)) == 0)
   {
     mutt_debug(3, "%s not same server as %s\n", dest, ctx->path);
     return 1;
index f9fa1653bc76d92651cf2697859e7a0a8b9480ce..761be2c37cd2b24590dcd44961afd612aca5d3cb 100644 (file)
@@ -1397,7 +1397,7 @@ int imap_copy_messages(struct Context *ctx, struct Header *h, char *dest, int de
   }
 
   /* check that the save-to folder is in the same account */
-  if (!mutt_account_match(&(idata->conn->account), &(mx.account)))
+  if (mutt_account_match(&(idata->conn->account), &(mx.account)) == 0)
   {
     mutt_debug(3, "%s not same server as %s\n", dest, ctx->path);
     return 1;
diff --git a/main.c b/main.c
index ddc57f7cdd063ef6708eb97d264b6bcece336f1e..db0840212d180f4f69e75065adddaf96e160ee38 100644 (file)
--- a/main.c
+++ b/main.c
@@ -954,7 +954,7 @@ int main(int argc, char *argv[], char *envp[])
   {
     if (flags & MUTT_BUFFY)
     {
-      if (!mutt_buffy_check(false))
+      if (mutt_buffy_check(false) == 0)
       {
         mutt_message(_("No mailbox with new mail."));
         goto main_curses; // TEST37: neomutt -Z (no new mail)
index 68557436827f285bc5c268d970f68e909100d209..5378769671f188be257de052d67619527142e13b 100644 (file)
@@ -512,7 +512,7 @@ static int rfc2047_encode(const char *d, size_t dlen, int col, const char *fromc
     if (icode)
       while ((t < (u + ulen)) && CONTINUATION_BYTE(*t))
         t++;
-    if (!try_block(t0, t - t0, icode, tocode, &encoder, &wlen) &&
+    if ((try_block(t0, t - t0, icode, tocode, &encoder, &wlen) == 0) &&
         ((col + (t0 - u) + wlen) <= (ENCWORD_LEN_MAX + 1)))
     {
       break;
@@ -528,7 +528,7 @@ static int rfc2047_encode(const char *d, size_t dlen, int col, const char *fromc
     if (icode)
       while (CONTINUATION_BYTE(*t))
         t--;
-    if (!try_block(t, t1 - t, icode, tocode, &encoder, &wlen) &&
+    if ((try_block(t, t1 - t, icode, tocode, &encoder, &wlen) == 0) &&
         ((1 + wlen + (u + ulen - t1)) <= (ENCWORD_LEN_MAX + 1)))
     {
       break;
diff --git a/mx.c b/mx.c
index 18213060a895086e23f603ed12c1b54dd765b832..aa394d3661ff539481345a081db1f5c0a71bfc9c 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -605,7 +605,7 @@ static int trash_append(struct Context *ctx)
 #ifdef USE_IMAP
   if (Context->magic == MUTT_IMAP && mx_is_imap(Trash))
   {
-    if (!imap_fast_trash(Context, Trash))
+    if (imap_fast_trash(Context, Trash) == 0)
       return 0;
   }
 #endif
index 77f4a8fe0cf354e6174526fbcbd08e6d30a60ded..fafd8b6054433f692e2d0890933c8e9547b9a706 100644 (file)
@@ -154,7 +154,7 @@ int mutt_protect(struct Header *msg, char *keylist)
         return -1;
       }
     }
-    else if (!mutt_str_strcasecmp("flowed", mutt_param_get(&msg->content->parameter, "format")))
+    else if (mutt_str_strcasecmp("flowed", mutt_param_get(&msg->content->parameter, "format")) == 0)
     {
       if ((query_quadoption(PgpMimeAuto,
                             _("Inline PGP can't be used with format=flowed.  "
@@ -365,7 +365,7 @@ int mutt_is_multipart_encrypted(struct Body *b)
 
 int mutt_is_valid_multipart_pgp_encrypted(struct Body *b)
 {
-  if (!mutt_is_multipart_encrypted(b))
+  if (mutt_is_multipart_encrypted(b) == 0)
     return 0;
 
   b = b->parts;
index 87e805b78d4b75ae3754bbaecbb21c99e8a40648..824d5cc998dec1e91cf2b0375a6896763f71bd9f 100644 (file)
@@ -1056,7 +1056,7 @@ static struct Body *sign_message(struct Body *a, int use_smime)
                  use_smime ? "application/pkcs7-signature" : "application/pgp-signature");
   /* Get the micalg from gpgme.  Old gpgme versions don't support this
      for S/MIME so we assume sha-1 in this case. */
-  if (!get_micalg(ctx, use_smime, buf, sizeof(buf)))
+  if (get_micalg(ctx, use_smime, buf, sizeof(buf)) == 0)
     mutt_param_set(&t->parameter, "micalg", buf);
   else if (use_smime)
     mutt_param_set(&t->parameter, "micalg", "sha1");
@@ -2026,7 +2026,7 @@ int smime_gpgme_decrypt_mime(FILE *fpin, FILE **fpout, struct Body *b, struct Bo
   size_t saved_b_length;
   int saved_b_type;
 
-  if (!mutt_is_application_smime(b))
+  if (mutt_is_application_smime(b) == 0)
     return -1;
 
   if (b->parts)
index bb5fcb46f54f5520dc55ab2597b7a7dd13219790..2ac69fb44afad92f6ad8e11afe6773c131793167 100644 (file)
--- a/status.c
+++ b/status.c
@@ -108,7 +108,7 @@ static const char *status_format_str(char *buf, size_t buflen, size_t col, int c
         snprintf(fmt, sizeof(fmt), "%%%sd", prec);
         snprintf(buf, buflen, fmt, mutt_buffy_check(false));
       }
-      else if (!mutt_buffy_check(false))
+      else if (mutt_buffy_check(false) == 0)
         optional = 0;
       break;
 
index 254a62fdc232ca68ec39c246ae01f5a545b131d6..3536317914773dc4ecf3a0ee71e9e0000191e0d1 100644 (file)
--- a/thread.c
+++ b/thread.c
@@ -634,7 +634,7 @@ struct MuttThread *mutt_sort_subthreads(struct MuttThread *thread, int init)
    * in reverse order so they're forwards
    */
   Sort ^= SORT_REVERSE;
-  if (!compare_threads(NULL, NULL))
+  if (compare_threads(NULL, NULL) == 0)
     return thread;
 
   top = thread;