]> granicus.if.org Git - neomutt/commitdiff
boolify variables/parameters
authorRichard Russon <rich@flatcap.org>
Sat, 27 Apr 2019 01:29:59 +0000 (02:29 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 29 Apr 2019 22:47:16 +0000 (23:47 +0100)
hcache/hcache.c
imap/imap.c
muttlib.c
ncrypt/crypt_gpgme.c
ncrypt/pgp.c
ncrypt/smime.c
pattern.c
rfc1524.c

index b19215b68a9a0b4262db057a241533847cc6aa1e..0dd3b020f40e55cfb894d881e85e9889b2c71e02 100644 (file)
@@ -193,7 +193,7 @@ static const char *hcache_per_folder(const char *path, const char *folder, hcach
 
   int plen = mutt_str_strlen(path);
   int rc = stat(path, &sb);
-  int slash = (path[plen - 1] == '/');
+  bool slash = (path[plen - 1] == '/');
 
   if (((rc == 0) && !S_ISDIR(sb.st_mode)) || ((rc == -1) && !slash))
   {
index a3f9eff9c0077cc046bc957b13c2932fe1f40468..5358117f1ca54bb27e301f8d696289e50a472eef 100644 (file)
@@ -338,7 +338,7 @@ static int sync_helper(struct Mailbox *m, AclFlags right, int flag, const char *
  *
  * Count the number of patterns that can be done by the server (are full-text).
  */
-static int do_search(const struct PatternHead *search, int allpats)
+static int do_search(const struct PatternHead *search, bool allpats)
 {
   int rc = 0;
   const struct Pattern *pat = NULL;
@@ -357,7 +357,7 @@ static int do_search(const struct PatternHead *search, int allpats)
         rc++;
         break;
       default:
-        if (pat->child && do_search(pat->child, 1))
+        if (pat->child && do_search(pat->child, true))
           rc++;
     }
 
@@ -384,7 +384,7 @@ static int compile_search(struct Mailbox *m, const struct PatternHead *pat, stru
 {
   struct Pattern *firstpat = SLIST_FIRST(pat);
 
-  if (do_search(pat, 0) == 0)
+  if (do_search(pat, false) == 0)
     return 0;
 
   if (firstpat->not)
@@ -394,14 +394,14 @@ static int compile_search(struct Mailbox *m, const struct PatternHead *pat, stru
   {
     int clauses;
 
-    clauses = do_search(firstpat->child, 1);
+    clauses = do_search(firstpat->child, true);
     if (clauses > 0)
     {
       mutt_buffer_addch(buf, '(');
 
       while (clauses)
       {
-        if (do_search(firstpat->child, 0))
+        if (do_search(firstpat->child, false))
         {
           if ((firstpat->op == MUTT_PAT_OR) && (clauses > 1))
             mutt_buffer_addstr(buf, "OR ");
@@ -1358,7 +1358,7 @@ int imap_search(struct Mailbox *m, const struct PatternHead *pat)
   for (int i = 0; i < m->msg_count; i++)
     m->emails[i]->matched = false;
 
-  if (do_search(pat, 1) == 0)
+  if (do_search(pat, true) == 0)
     return 0;
 
   mutt_buffer_init(&buf);
index 4a4df4ccd8077c253d0e1bb390c5d9bd4ad282bb..98dea42c5d0f524676a8a39810b3ef82d73bc3f5 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -354,7 +354,7 @@ void mutt_buffer_expand_path_regex(struct Buffer *buf, bool regex)
  */
 void mutt_buffer_expand_path(struct Buffer *buf)
 {
-  mutt_buffer_expand_path_regex(buf, 0);
+  mutt_buffer_expand_path_regex(buf, false);
 }
 
 /**
index aa4a38ad1b79187e8cee173e78f9bba808c1f209..3e6c690f06a4f3b9df68204d5c7f0d9340754504 100644 (file)
@@ -766,7 +766,7 @@ static gpgme_data_t create_gpgme_data(void)
  *
  * Return true if the OpenPGP engine's version is at least VERSION.
  */
-static int have_gpg_version(const char *version)
+static bool have_gpg_version(const char *version)
 {
   static char *engine_version;
 
@@ -1559,12 +1559,12 @@ static int show_sig_summary(unsigned long sum, gpgme_ctx_t ctx, gpgme_key_t key,
   if (!key)
     return 1;
 
-  int severe = 0;
+  bool severe = false;
 
   if ((sum & GPGME_SIGSUM_KEY_REVOKED))
   {
     state_puts(_("Warning: One of the keys has been revoked\n"), s);
-    severe = 1;
+    severe = true;
   }
 
   if ((sum & GPGME_SIGSUM_KEY_EXPIRED))
@@ -1612,13 +1612,13 @@ static int show_sig_summary(unsigned long sum, gpgme_ctx_t ctx, gpgme_key_t key,
   if ((sum & GPGME_SIGSUM_CRL_MISSING))
   {
     state_puts(_("The CRL is not available\n"), s);
-    severe = 1;
+    severe = true;
   }
 
   if ((sum & GPGME_SIGSUM_CRL_TOO_OLD))
   {
     state_puts(_("Available CRL is too old\n"), s);
-    severe = 1;
+    severe = true;
   }
 
   if ((sum & GPGME_SIGSUM_BAD_POLICY))
@@ -2025,12 +2025,12 @@ static int verify_one(struct Body *sigbdy, struct State *s, const char *tempfile
     verify_result = gpgme_op_verify_result(ctx);
     if (verify_result && verify_result->signatures)
     {
-      int anybad = 0;
+      bool anybad = false;
       int res;
       for (int idx = 0; (res = show_one_sig_status(ctx, idx, s)) != -1; idx++)
       {
         if (res == 1)
-          anybad = 1;
+          anybad = true;
         else if (res == 2)
           anywarn = 2;
       }
@@ -2485,7 +2485,7 @@ static int pgp_gpgme_extract_keys(gpgme_data_t keydata, FILE **fp)
   /* Before gpgme 1.9.0 and gpg 2.1.14 there was no side-effect free
    * way to view key data in GPGME, so we import the key into a
    * temporary keyring if we detect an older system.  */
-  int legacy_api;
+  bool legacy_api;
   char tmpdir[PATH_MAX];
   gpgme_ctx_t tmpctx;
   gpgme_error_t err;
@@ -2496,14 +2496,14 @@ static int pgp_gpgme_extract_keys(gpgme_data_t keydata, FILE **fp)
   const char *shortid = NULL;
   size_t len;
   char date[256];
-  int more;
+  bool more;
   int rc = -1;
   time_t tt;
 
 #if GPGME_VERSION_NUMBER >= 0x010900 /* gpgme >= 1.9.0 */
   legacy_api = !have_gpg_version("2.1.14");
 #else /* gpgme < 1.9.0 */
-  legacy_api = 1;
+  legacy_api = true;
 #endif
 
   tmpctx = create_gpgme_context(false);
@@ -2557,7 +2557,7 @@ static int pgp_gpgme_extract_keys(gpgme_data_t keydata, FILE **fp)
       break;
     uid = key->uids;
     subkey = key->subkeys;
-    more = 0;
+    more = false;
     while (subkey)
     {
       shortid = subkey->keyid;
@@ -2578,7 +2578,7 @@ static int pgp_gpgme_extract_keys(gpgme_data_t keydata, FILE **fp)
                 subkey->length, shortid, date);
       }
       subkey = subkey->next;
-      more = 1;
+      more = true;
     }
     gpgme_key_unref(key);
   }
index 05810f6e8f901445f57591f85af0d0e369aa636b..c0041b9e8eae67a3a899252cc658c1b01e8bf2d8 100644 (file)
@@ -1537,7 +1537,7 @@ struct Body *pgp_class_encrypt_message(struct Body *a, char *keylist, bool sign)
   FILE *fp_pgp_in = NULL, *fp_tmp = NULL;
   struct Body *t = NULL;
   int err = 0;
-  int empty = 0;
+  bool empty = false;
   pid_t pid;
 
   mutt_mktemp(tempfile, sizeof(tempfile));
@@ -1595,7 +1595,7 @@ struct Body *pgp_class_encrypt_message(struct Body *a, char *keylist, bool sign)
   mutt_file_fclose(&fp_pgp_in);
 
   if (mutt_wait_filter(pid) && C_PgpCheckExit)
-    empty = 1;
+    empty = true;
 
   unlink(pgpinfile);
 
index 11cdf82669cf333d25e3755bf64570140243f23e..730347313142f665410b7534c0970aa84f3ecb57 100644 (file)
@@ -781,10 +781,10 @@ static struct SmimeKey *smime_get_key_by_addr(char *mailbox, KeyFlags abilities,
   struct SmimeKey *trusted_match = NULL;
   struct SmimeKey *valid_match = NULL;
   struct SmimeKey *return_key = NULL;
-  int multi_trusted_matches = 0;
 
   if (!mailbox)
     return NULL;
+  bool multi_trusted_matches = false;
 
   results = smime_get_candidates(mailbox, public);
   for (result = results; result; result = result->next)
@@ -804,7 +804,7 @@ static struct SmimeKey *smime_get_key_by_addr(char *mailbox, KeyFlags abilities,
       {
         if (trusted_match && (mutt_str_strcasecmp(match->hash, trusted_match->hash) != 0))
         {
-          multi_trusted_matches = 1;
+          multi_trusted_matches = true;
         }
         trusted_match = match;
       }
index 8ea43f1a1450d9b5a028ac67fdee0edf2da22b2d..c75fccd8758fe7a3f6df376e5c5bbb950a8286a9 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -643,7 +643,7 @@ static bool eval_date_minmax(struct Pattern *pat, const char *s, struct Buffer *
     const char *pc = s;
 
     bool have_min = false;
-    int until_now = false;
+    bool until_now = false;
     if (isdigit((unsigned char) *pc))
     {
       /* minimum date specified */
index 63f320d79a3e4c01f575c6188591619a777677bb..ee574ba292cfc61c33b63b603650926540d529b9 100644 (file)
--- a/rfc1524.c
+++ b/rfc1524.c
@@ -509,7 +509,7 @@ bool rfc1524_mailcap_lookup(struct Body *a, char *type,
 int rfc1524_expand_filename(const char *nametemplate, const char *oldfile,
                             char *newfile, size_t nflen)
 {
-  int i, j, k, ps;
+  int i, j, k;
   char *s = NULL;
   bool lmatch = false, rmatch = false;
   char left[PATH_MAX];
@@ -540,12 +540,12 @@ int rfc1524_expand_filename(const char *nametemplate, const char *oldfile,
      * (if there is one).  */
 
     lmatch = true;
-    ps = 0;
+    bool ps = false;
     for (i = 0; nametemplate[i]; i++)
     {
       if ((nametemplate[i] == '%') && (nametemplate[i + 1] == 's'))
       {
-        ps = 1;
+        ps = true;
         break;
       }