From: Richard Russon Date: Fri, 26 Apr 2019 22:58:21 +0000 (+0100) Subject: test scalars against zero X-Git-Tag: 2019-10-25~234^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=255ad433f36d0498c3f9caf40d5dbe7d3feb86fb;p=neomutt test scalars against zero - test int/size_t against `0` - test char against `'\0'` - test enum against 'zero' symbol --- diff --git a/browser.c b/browser.c index 8cff125c4..eb14ed7a1 100644 --- a/browser.c +++ b/browser.c @@ -529,7 +529,7 @@ static const char *folder_format_str(char *buf, size_t buflen, size_t col, int c else mutt_format_s(buf, buflen, prec, ""); } - else if (!folder->ff->msg_count) + else if (folder->ff->msg_count == 0) optional = 0; break; @@ -549,7 +549,7 @@ static const char *folder_format_str(char *buf, size_t buflen, size_t col, int c else mutt_format_s(buf, buflen, prec, ""); } - else if (!folder->ff->msg_unread) + else if (folder->ff->msg_unread == 0) optional = 0; break; diff --git a/conn/ssl_gnutls.c b/conn/ssl_gnutls.c index 3000d35fa..d936e2f75 100644 --- a/conn/ssl_gnutls.c +++ b/conn/ssl_gnutls.c @@ -786,7 +786,7 @@ static int tls_check_certificate(struct Connection *conn) if (savedcert) { - if (!preauthrc) + if (preauthrc == 0) return 1; else break; diff --git a/email/parse.c b/email/parse.c index 369f5dad7..3794ae5a4 100644 --- a/email/parse.c +++ b/email/parse.c @@ -951,7 +951,7 @@ char *mutt_rfc822_read_line(FILE *fp, char *line, size_t *linelen) } const size_t len = mutt_str_strlen(buf); - if (!len) + if (len == 0) return line; buf += len - 1; diff --git a/imap/imap.c b/imap/imap.c index c153d1f69..a3f9eff9c 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -1563,7 +1563,7 @@ int imap_fast_trash(struct Mailbox *m, char *dest) do { rc = imap_exec_msgset(m, "UID COPY", dest_mdata->munge_name, MUTT_TRASH, false, false); - if (!rc) + if (rc == 0) { mutt_debug(LL_DEBUG1, "No messages to trash\n"); rc = -1; diff --git a/imap/message.c b/imap/message.c index cf8da0e9c..025d9c520 100644 --- a/imap/message.c +++ b/imap/message.c @@ -667,7 +667,7 @@ static void set_changed_flag(struct Mailbox *m, struct Email *e, int local_chang * flags have changed, so we can set a reopen flag in * cmd_parse_fetch(). We don't want to count a local modification * to the header flag as a "change". */ - if ((old_hd_flag == new_hd_flag) && local_changes) + if ((old_hd_flag == new_hd_flag) && (local_changes != 0)) return; if (new_hd_flag == h_flag) @@ -677,7 +677,7 @@ static void set_changed_flag(struct Mailbox *m, struct Email *e, int local_chang *server_changes = true; /* Local changes have priority */ - if (!local_changes) + if (local_changes == 0) mutt_set_flag(m, e, flag_name, new_hd_flag); } @@ -1606,7 +1606,7 @@ int imap_copy_messages(struct Mailbox *m, struct EmailList *el, char *dest, bool } rc = imap_exec_msgset(m, "UID COPY", mmbox, MUTT_TAG, false, false); - if (!rc) + if (rc == 0) { mutt_debug(LL_DEBUG1, "No messages tagged\n"); rc = -1; @@ -1808,7 +1808,7 @@ char *imap_set_flags(struct Mailbox *m, struct Email *e, char *s, bool *server_c /* this message is now definitively *not* changed (mutt_set_flag * marks things changed as a side-effect) */ - if (!local_changes) + if (local_changes == 0) e->changed = false; m->changed &= !readonly; m->readonly = readonly; diff --git a/imap/util.c b/imap/util.c index ad6756e0e..61aac421d 100644 --- a/imap/util.c +++ b/imap/util.c @@ -589,7 +589,7 @@ int imap_parse_path(const char *path, struct ConnAccount *account, char *mailbox static unsigned short ImapsPort = 0; struct servent *service = NULL; - if (!ImapPort) + if (ImapPort == 0) { service = getservbyname("imap", "tcp"); if (service) @@ -598,7 +598,7 @@ int imap_parse_path(const char *path, struct ConnAccount *account, char *mailbox ImapPort = IMAP_PORT; mutt_debug(LL_DEBUG3, "Using default IMAP port %d\n", ImapPort); } - if (!ImapsPort) + if (ImapsPort == 0) { service = getservbyname("imaps", "tcp"); if (service) diff --git a/index.c b/index.c index 427561c89..f0f525739 100644 --- a/index.c +++ b/index.c @@ -519,7 +519,7 @@ static void update_index_unthreaded(struct Context *ctx, int check, int oldcount int padding = mx_msg_padding_size(ctx->mailbox); for (int i = (check == MUTT_REOPENED) ? 0 : oldcount; i < ctx->mailbox->msg_count; i++) { - if (!i) + if (i == 0) { ctx->mailbox->vcount = 0; ctx->vsize = 0; diff --git a/init.c b/init.c index a22e01d24..2549459b0 100644 --- a/init.c +++ b/init.c @@ -2655,7 +2655,7 @@ int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags return -1; char ch; - char qc = 0; /* quote char */ + char qc = '\0'; /* quote char */ char *pc = NULL; mutt_buffer_reset(dest); @@ -2663,7 +2663,7 @@ int mutt_extract_token(struct Buffer *dest, struct Buffer *tok, TokenFlags flags SKIPWS(tok->dptr); while ((ch = *tok->dptr)) { - if (!qc) + if (qc == '\0') { if ((IS_SPACE(ch) && !(flags & MUTT_TOKEN_SPACE)) || ((ch == '#') && !(flags & MUTT_TOKEN_COMMENT)) || diff --git a/monitor.c b/monitor.c index 7340498de..b5a8f4059 100644 --- a/monitor.c +++ b/monitor.c @@ -309,7 +309,7 @@ static int monitor_resolve(struct MonitorInfo *info, struct Mailbox *m) return RESOLVERES_FAIL_NOMAILBOX; } - if (!info->magic) + if (info->magic == MUTT_UNKNOWN) { return RESOLVERES_FAIL_NOMAGIC; } diff --git a/mutt/charset.c b/mutt/charset.c index 4d04b1e53..43980133b 100644 --- a/mutt/charset.c +++ b/mutt/charset.c @@ -613,7 +613,7 @@ size_t mutt_ch_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char *ob1 = ob; size_t obl1 = obl; iconv(cd, (ICONV_CONST char **) &ib1, &ibl1, &ob1, &obl1); - if (!ibl1) + if (ibl1 == 0) { ib++; ibl--; diff --git a/mx.c b/mx.c index 263b88d66..99df66c67 100644 --- a/mx.c +++ b/mx.c @@ -300,7 +300,7 @@ struct Context *mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags) return ctx; } - if (!m->magic) + if (m->magic == MUTT_UNKNOWN) { m->magic = mx_path_probe(m->path, NULL); m->mx_ops = mx_get_ops(m->magic); diff --git a/ncrypt/crypt.c b/ncrypt/crypt.c index 90daf50d8..6a359255f 100644 --- a/ncrypt/crypt.c +++ b/ncrypt/crypt.c @@ -544,7 +544,7 @@ SecurityFlags mutt_is_application_pgp(struct Body *m) t |= PGP_KEY; } - if (!t) + if (t == SEC_NO_FLAGS) t |= PGP_ENCRYPT; /* not necessarily correct, but... */ } @@ -1138,7 +1138,7 @@ int mutt_signed_handler(struct Body *a, struct State *s) { crypt_fetch_signatures(&signatures, a->next, &sigcnt); - if (sigcnt) + if (sigcnt != 0) { char tempfile[PATH_MAX]; mutt_mktemp(tempfile, sizeof(tempfile)); @@ -1195,7 +1195,7 @@ int mutt_signed_handler(struct Body *a, struct State *s) rc = mutt_body_handler(a, s); - if (s->flags & MUTT_DISPLAY && sigcnt) + if ((s->flags & MUTT_DISPLAY) && (sigcnt != 0)) state_attach_puts(_("\n[-- End of signed data --]\n"), s); return rc; diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index d339986c5..aa4a38ad1 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -717,7 +717,7 @@ static gpgme_ctx_t create_gpgme_context(bool for_smime) gpgme_ctx_t ctx; err = gpgme_new(&ctx); - if (err) + if (err != 0) { mutt_error(_("error creating gpgme context: %s"), gpgme_strerror(err)); mutt_exit(1); @@ -726,7 +726,7 @@ static gpgme_ctx_t create_gpgme_context(bool for_smime) if (for_smime) { err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_CMS); - if (err) + if (err != 0) { mutt_error(_("error enabling CMS protocol: %s"), gpgme_strerror(err)); mutt_exit(1); @@ -750,7 +750,7 @@ static gpgme_data_t create_gpgme_data(void) gpgme_data_t data; err = gpgme_data_new(&data); - if (err) + if (err != 0) { mutt_error(_("error creating gpgme data object: %s"), gpgme_strerror(err)); mutt_exit(1); @@ -851,7 +851,7 @@ static gpgme_data_t body_to_data_object(struct Body *a, bool convert) err = gpgme_data_new_from_file(&data, tempfile, 1); } unlink(tempfile); - if (err) + if (err != 0) { mutt_error(_("error allocating data object: %s"), gpgme_strerror(err)); return NULL; @@ -873,7 +873,7 @@ static gpgme_data_t file_to_data_object(FILE *fp, long offset, size_t length) gpgme_data_t data; err = gpgme_data_new_from_filepart(&data, NULL, fp, offset, length); - if (err) + if (err != 0) { mutt_error(_("error allocating data object: %s"), gpgme_strerror(err)); return NULL; @@ -896,7 +896,7 @@ static int data_object_to_stream(gpgme_data_t data, FILE *fp) ssize_t nread; err = ((gpgme_data_seek(data, 0, SEEK_SET) == -1) ? gpgme_error_from_errno(errno) : 0); - if (err) + if (err != 0) { mutt_error(_("error rewinding data object: %s"), gpgme_strerror(err)); return -1; @@ -952,7 +952,7 @@ static char *data_object_to_tempfile(gpgme_data_t data, FILE **fp_ret) } err = ((gpgme_data_seek(data, 0, SEEK_SET) == -1) ? gpgme_error_from_errno(errno) : 0); - if (!err) + if (err == 0) { char buf[4096]; @@ -1077,14 +1077,14 @@ static gpgme_key_t *create_recipient_set(const char *keylist, bool use_smime) buf[i - 1] = '\0'; err = gpgme_get_key(context, buf, &key, 0); - if (!err) + if (err == 0) key->uids->validity = GPGME_VALIDITY_FULL; buf[i - 1] = '!'; } else err = gpgme_get_key(context, buf, &key, 0); mutt_mem_realloc(&rset, sizeof(*rset) * (rset_n + 1)); - if (!err) + if (err == 0) rset[rset_n++] = key; else { @@ -1127,7 +1127,7 @@ static int set_signer(gpgme_ctx_t ctx, bool for_smime) listctx = create_gpgme_context(for_smime); err = gpgme_op_keylist_start(listctx, signid, 1); - if (!err) + if (err == 0) err = gpgme_op_keylist_next(listctx, &key); if (err) { @@ -1136,7 +1136,7 @@ static int set_signer(gpgme_ctx_t ctx, bool for_smime) return -1; } err = gpgme_op_keylist_next(listctx, &key2); - if (!err) + if (err == 0) { gpgme_key_unref(key); gpgme_key_unref(key2); @@ -1221,7 +1221,7 @@ static char *encrypt_gpgme_object(gpgme_data_t plaintext, char *keylist, if (C_CryptUsePka) { err = set_pka_sig_notation(ctx); - if (err) + if (err != 0) goto cleanup; } @@ -1243,7 +1243,7 @@ static char *encrypt_gpgme_object(gpgme_data_t plaintext, char *keylist, } redraw_if_needed(ctx); - if (err) + if (err != 0) { mutt_error(_("error encrypting data: %s"), gpgme_strerror(err)); goto cleanup; @@ -1358,7 +1358,7 @@ static struct Body *sign_message(struct Body *a, bool use_smime) if (C_CryptUsePka) { err = set_pka_sig_notation(ctx); - if (err) + if (err != 0) { gpgme_data_release(signature); gpgme_data_release(message); @@ -1370,7 +1370,7 @@ static struct Body *sign_message(struct Body *a, bool use_smime) err = gpgme_op_sign(ctx, message, signature, GPGME_SIG_MODE_DETACH); redraw_if_needed(ctx); gpgme_data_release(message); - if (err) + if (err != 0) { gpgme_data_release(signature); gpgme_release(ctx); @@ -1892,7 +1892,7 @@ static int show_one_sig_status(gpgme_ctx_t ctx, int idx, struct State *s) if (gpg_err_code(sig->status) != GPG_ERR_NO_PUBKEY) { err = gpgme_get_key(ctx, fpr, &key, 0); /* secret key? */ - if (!err) + if (err == 0) { if (!signature_key) signature_key = key; @@ -1910,7 +1910,7 @@ static int show_one_sig_status(gpgme_ctx_t ctx, int idx, struct State *s) if (!s || !s->fp_out || !(s->flags & MUTT_DISPLAY)) ; /* No state information so no way to print anything. */ - else if (err) + else if (err != 0) { char buf[1024]; snprintf(buf, sizeof(buf), _("Error getting key information for KeyID %s: %s\n"), @@ -1987,7 +1987,7 @@ static int verify_one(struct Body *sigbdy, struct State *s, const char *tempfile gpgme_data_set_encoding(signature, GPGME_DATA_ENCODING_BASE64); err = gpgme_data_new_from_file(&message, tempfile, 1); - if (err) + if (err != 0) { gpgme_data_release(signature); mutt_error(_("error allocating data object: %s"), gpgme_strerror(err)); @@ -2004,7 +2004,7 @@ static int verify_one(struct Body *sigbdy, struct State *s, const char *tempfile gpgme_data_release(signature); redraw_if_needed(ctx); - if (err) + if (err != 0) { char buf[200]; @@ -2039,7 +2039,7 @@ static int verify_one(struct Body *sigbdy, struct State *s, const char *tempfile } } - if (!badsig) + if (badsig == 0) { gpgme_verify_result_t result; gpgme_sig_notation_t notation; @@ -2169,7 +2169,7 @@ restart: else err = gpgme_op_decrypt(ctx, ciphertext, plaintext); gpgme_data_release(ciphertext); - if (err) + if (err != 0) { if (is_smime && !maybe_signed && (gpg_err_code(err) == GPG_ERR_NO_DATA)) { @@ -2550,10 +2550,10 @@ static int pgp_gpgme_extract_keys(gpgme_data_t keydata, FILE **fp) { err = gpgme_op_keylist_start(tmpctx, NULL, 0); } - while (!err) + while (err == 0) { err = gpgme_op_keylist_next(tmpctx, &key); - if (err) + if (err != 0) break; uid = key->uids; subkey = key->subkeys; @@ -2746,7 +2746,7 @@ void pgp_gpgme_invoke_import(const char *fname) } err = gpgme_op_import(ctx, keydata); - if (err) + if (err != 0) { mutt_error(_("Error extracting key: %s"), gpgme_strerror(err)); goto leave; @@ -2803,7 +2803,7 @@ void pgp_gpgme_invoke_import(const char *fname) * would be helpful. */ for (st = impres->imports; st; st = st->next) { - if (!st->result) + if (st->result == 0) continue; printf("key %s import failed: %s\n", NONULL(st->fpr), gpgme_strerror(st->result)); } @@ -2983,7 +2983,7 @@ int pgp_gpgme_application_handler(struct Body *m, struct State *s) } redraw_if_needed(ctx); - if (err) + if (err != 0) { char errbuf[200]; @@ -3809,7 +3809,7 @@ static const char *parse_dn_part(struct DnArray *array, const char *str) if (!*s) return NULL; /* error */ n = s - str; - if (!n) + if (n == 0) return NULL; /* empty key */ array->key = mutt_mem_malloc(n + 1); p = array->key; @@ -3823,7 +3823,7 @@ static const char *parse_dn_part(struct DnArray *array, const char *str) for (s = str; isxdigit(*s); s++) s++; n = s - str; - if (!n || (n & 1)) + if ((n == 0) || (n & 1)) return NULL; /* empty or odd number of digits */ n /= 2; p = mutt_mem_malloc(n + 1); @@ -4096,7 +4096,7 @@ static void print_key_info(gpgme_key_t key, FILE *fp) gpgme_user_id_t uid = NULL; static int max_header_width = 0; - if (!max_header_width) + if (max_header_width == 0) { for (int i = 0; i < KIP_MAX; i++) { @@ -4120,7 +4120,7 @@ static void print_key_info(gpgme_key_t key, FILE *fp) s = uid->uid; /* L10N: DOTFILL */ - if (!idx) + if (idx == 0) fprintf(fp, "%*s", KeyInfoPadding[KIP_NAME], _(KeyInfoPrompts[KIP_NAME])); else fprintf(fp, "%*s", KeyInfoPadding[KIP_AKA], _(KeyInfoPrompts[KIP_AKA])); @@ -4366,9 +4366,9 @@ static void verify_key(struct CryptKeyInfo *key) err = gpgme_op_keylist_start(listctx, s, 0); gpgme_key_unref(k); k = NULL; - if (!err) + if (err == 0) err = gpgme_op_keylist_next(listctx, &k); - if (err) + if (err != 0) { fprintf(fp, _("Error finding issuer key: %s\n"), gpgme_strerror(err)); goto leave; @@ -4494,7 +4494,7 @@ static struct CryptKeyInfo *get_candidates(struct ListHead *hints, SecurityFlags if (np->data && *np->data) n++; } - if (!n) + if (n == 0) goto no_pgphints; char **patarr = mutt_mem_calloc(n + 1, sizeof(*patarr)); @@ -4509,7 +4509,7 @@ static struct CryptKeyInfo *get_candidates(struct ListHead *hints, SecurityFlags for (n = 0; patarr[n]; n++) FREE(&patarr[n]); FREE(&patarr); - if (err) + if (err != 0) { mutt_error(_("gpgme_op_keylist_start failed: %s"), gpgme_strerror(err)); gpgme_release(ctx); @@ -4517,7 +4517,7 @@ static struct CryptKeyInfo *get_candidates(struct ListHead *hints, SecurityFlags return NULL; } - while (!(err = gpgme_op_keylist_next(ctx, &key))) + while ((err = gpgme_op_keylist_next(ctx, &key)) == 0) { KeyFlags flags = KEYFLAG_NO_FLAGS; @@ -4560,7 +4560,7 @@ static struct CryptKeyInfo *get_candidates(struct ListHead *hints, SecurityFlags /* and now look for x509 certificates */ gpgme_set_protocol(ctx, GPGME_PROTOCOL_CMS); err = gpgme_op_keylist_start(ctx, pattern, 0); - if (err) + if (err != 0) { mutt_error(_("gpgme_op_keylist_start failed: %s"), gpgme_strerror(err)); gpgme_release(ctx); @@ -4568,7 +4568,7 @@ static struct CryptKeyInfo *get_candidates(struct ListHead *hints, SecurityFlags return NULL; } - while (!(err = gpgme_op_keylist_next(ctx, &key))) + while ((err = gpgme_op_keylist_next(ctx, &key)) == 0) { KeyFlags flags = KEYFLAG_ISX509; diff --git a/ncrypt/gnupgparse.c b/ncrypt/gnupgparse.c index 58352fa49..a8214ac40 100644 --- a/ncrypt/gnupgparse.c +++ b/ncrypt/gnupgparse.c @@ -103,7 +103,7 @@ static void fix_uid(char *uid) char *ob = buf; size_t obl = n; iconv(cd, (ICONV_CONST char **) &ib, &ibl, &ob, &obl); - if (!ibl) + if (ibl == 0) { if (ob - buf < n) { diff --git a/ncrypt/smime.c b/ncrypt/smime.c index eb2653031..11cdf8266 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -1137,7 +1137,7 @@ static int smime_handle_cert_email(char *certificate, char *mailbox, bool copy, mutt_any_key_to_continue(_("Error: unable to create OpenSSL subprocess")); rc = 1; } - else if (!rc) + else if (rc == 0) rc = 1; else rc = 0; @@ -1626,7 +1626,7 @@ struct Body *smime_class_build_smime_entity(struct Body *a, char *certlist) if (empty) { /* fatal error while trying to encrypt message */ - if (!err) + if (err == 0) mutt_any_key_to_continue(_("No output from OpenSSL...")); mutt_file_unlink(tempfile); return NULL; diff --git a/nntp/newsrc.c b/nntp/newsrc.c index 2ca41ebc8..34caa93d4 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -1368,7 +1368,7 @@ void nntp_mailbox(struct Mailbox *m, char *buf, size_t buflen) for (unsigned int j = 0; j < m->msg_count; j++) if (!m->emails[j]->read && !m->emails[j]->deleted) unread++; - if (!unread) + if (unread == 0) continue; } mutt_str_strfcpy(buf, mdata->group, buflen); diff --git a/nntp/nntp.c b/nntp/nntp.c index 70e5a9ce7..ff72a76b4 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -439,7 +439,7 @@ static int nntp_attempt_features(struct NntpAccountData *adata) cont = (chunk >= (buflen - off)) ? 1 : 0; off += strlen(adata->overview_fmt + off); - if (!cont) + if (cont == 0) { char *colon = NULL; diff --git a/pager.c b/pager.c index 20ceaeb4c..b3bb98a28 100644 --- a/pager.c +++ b/pager.c @@ -297,7 +297,7 @@ static void resolve_color(struct Line *line_info, int n, int cnt, int m; struct Syntax *matching_chunk = NULL; - if (!cnt) + if (cnt == 0) last_color = -1; /* force attrset() */ if (line_info[n].continuation) @@ -1746,7 +1746,7 @@ static int display_line(FILE *fp, LOFF_T *last_pos, struct Line **line_info, * with a single long word shouldn't be smartwrapped * either. So just disable smart_wrap if it would wrap at the * beginning of the line. */ - if (!ch) + if (ch == 0) buf_ptr = buf + cnt; else cnt = ch + 1; diff --git a/pattern.c b/pattern.c index b7f94c9c0..8ea43f1a1 100644 --- a/pattern.c +++ b/pattern.c @@ -943,7 +943,7 @@ static int eat_range_by_regex(struct Pattern *pat, struct Buffer *s, int kind, if (!pspec->ready) { regerr = regcomp(&pspec->cooked, pspec->raw, REG_EXTENDED); - if (regerr) + if (regerr != 0) return report_regerror(regerr, &pspec->cooked, err); pspec->ready = 1; } @@ -951,7 +951,7 @@ static int eat_range_by_regex(struct Pattern *pat, struct Buffer *s, int kind, /* Match the pattern buffer against the compiled regex. * No match means syntax error. */ regerr = regexec(&pspec->cooked, s->dptr, RANGE_RX_GROUPS, pmatch, 0); - if (regerr) + if (regerr != 0) return report_regerror(regerr, &pspec->cooked, err); if (!is_context_available(s, pmatch, kind, err)) @@ -1328,7 +1328,7 @@ static /* const */ char *find_matching_paren(/* const */ char *s) else if (*s == ')') { level--; - if (!level) + if (level == 0) break; } } diff --git a/pop/pop_auth.c b/pop/pop_auth.c index 0b410ada7..e78fa363d 100644 --- a/pop/pop_auth.c +++ b/pop/pop_auth.c @@ -514,7 +514,7 @@ int pop_authenticate(struct PopAccountData *adata) case POP_A_SOCKET: return -1; case POP_A_UNAVAIL: - if (!attempts) + if (attempts == 0) mutt_error(_("No authenticators available")); } diff --git a/pop/pop_lib.c b/pop/pop_lib.c index 2099ac7e9..c494da723 100644 --- a/pop/pop_lib.c +++ b/pop/pop_lib.c @@ -241,9 +241,9 @@ static int pop_capabilities(struct PopAccountData *adata, int mode) if (!adata->expire) msg = _("Unable to leave messages on server"); - if (!adata->cmd_top) + if (adata->cmd_top == 0) msg = _("Command TOP is not supported by server"); - if (!adata->cmd_uidl) + if (adata->cmd_uidl == 0) msg = _("Command UIDL is not supported by server"); if (msg && adata->cmd_capa) { diff --git a/recvcmd.c b/recvcmd.c index 1f09f34ea..da4250db3 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -271,7 +271,7 @@ void mutt_attach_bounce(struct Mailbox *m, FILE *fp, struct AttachCtx *actx, str } } - if (!ret) + if (ret == 0) mutt_message(ngettext("Message bounced", "Messages bounced", p)); else mutt_error(ngettext("Error bouncing message", "Error bouncing messages", p)); diff --git a/rfc1524.c b/rfc1524.c index 568b90db0..63f320d79 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -471,7 +471,7 @@ bool rfc1524_mailcap_lookup(struct Body *a, char *type, if (*curr) curr++; - if (!x) + if (x == 0) continue; path[x] = '\0'; diff --git a/sendlib.c b/sendlib.c index 306a85de0..4f56c9a10 100644 --- a/sendlib.c +++ b/sendlib.c @@ -262,7 +262,7 @@ static void b64_flush(struct B64Context *bctx, FILE *fp_out) char encoded[11]; size_t ret; - if (!bctx->size) + if (bctx->size == 0) return; if (bctx->linelen >= 72) @@ -833,7 +833,7 @@ static size_t convert_file_to(FILE *fp, const char *fromcode, int ncodes, } } - if (!ret) + if (ret == 0) { /* Find best score */ ret = (size_t)(-1); @@ -852,7 +852,7 @@ static size_t convert_file_to(FILE *fp, const char *fromcode, int ncodes, { *tocode = i; ret = score[i]; - if (!ret) + if (ret == 0) break; } } @@ -3312,7 +3312,7 @@ int mutt_write_fcc(const char *path, struct Email *e, const char *msgid, if (fclose(fp_tmp) != 0) rc = -1; /* if there was an error, leave the temp version */ - if (!rc) + if (rc == 0) unlink(tempfile); } else diff --git a/smtp.c b/smtp.c index 8fc474cc4..c7a93d7e0 100644 --- a/smtp.c +++ b/smtp.c @@ -334,14 +334,14 @@ static int smtp_fill_account(struct ConnAccount *account) if (url->scheme == U_SMTPS) account->flags |= MUTT_ACCT_SSL; - if (!account->port) + if (account->port == 0) { if (account->flags & MUTT_ACCT_SSL) account->port = SMTPS_PORT; else { static unsigned short SmtpPort = 0; - if (!SmtpPort) + if (SmtpPort == 0) { struct servent *service = getservbyname("smtp", "tcp"); if (service) diff --git a/status.c b/status.c index 5be7d4440..914072685 100644 --- a/status.c +++ b/status.c @@ -247,7 +247,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, count); } - else if (!count) + else if (count == 0) optional = 0; break; } @@ -311,7 +311,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, read); } - else if (!read) + else if (read == 0) optional = 0; break; }