/* if we still have data in our read buffer, copy it into buf */
if (sasldata->blen > sasldata->bpos)
{
- olen = (sasldata->blen - sasldata->bpos > count) ? count :
- sasldata->blen - sasldata->bpos;
+ olen = ((sasldata->blen - sasldata->bpos) > count) ?
+ count :
+ sasldata->blen - sasldata->bpos;
memcpy(buf, sasldata->buf + sasldata->bpos, olen);
sasldata->bpos += olen;
}
} while (sasldata->blen == 0);
- olen = (sasldata->blen - sasldata->bpos > count) ? count :
- sasldata->blen - sasldata->bpos;
+ olen = ((sasldata->blen - sasldata->bpos) > count) ?
+ count :
+ sasldata->blen - sasldata->bpos;
memcpy(buf, sasldata->buf, olen);
sasldata->bpos += olen;
return -1;
if ((dest->magic == MUTT_MBOX) || (dest->magic == MUTT_MMDF))
chflags |= CH_FROM | CH_FORCE_FROM;
- chflags |= (dest->magic == MUTT_MAILDIR ? CH_NOSTATUS : CH_UPDATE);
+ chflags |= ((dest->magic == MUTT_MAILDIR) ? CH_NOSTATUS : CH_UPDATE);
rc = mutt_copy_message_fp(msg->fp, fp_in, e, cmflags, chflags);
if (mx_msg_commit(dest, msg) != 0)
rc = -1;
char *pc = mutt_mem_malloc(mutt_str_strlen(prompt) + 3);
sprintf(pc, "%s: ", prompt);
- mutt_unget_event(ch.op ? 0 : ch.ch, ch.op ? ch.op : 0);
+ if (ch.op == OP_NULL)
+ mutt_unget_event(ch.ch, 0);
+ else
+ mutt_unget_event(0, ch.op);
mutt_buffer_increase_size(fname, 1024);
if (mutt_get_field_full(pc, fname->data, fname->dsize,
}
break;
case 'w':
- be_barf_file(*p ? p : path, buf, buflen);
+ be_barf_file((p[0] != '\0') ? p : path, buf, buflen);
break;
case 'x':
abort = true;
mutt_str_strcat(tmp, sizeof(tmp), "\n");
if (buflen == bufmax)
mutt_mem_realloc(&buf, sizeof(char *) * (bufmax += 25));
- buf[buflen++] = mutt_str_strdup(tmp[1] == '~' ? tmp + 1 : tmp);
+ buf[buflen++] = mutt_str_strdup((tmp[1] == '~') ? tmp + 1 : tmp);
}
tmp[0] = '\0';
const size_t nn = try_block(d, n, fromcode, tocode, encoder, wlen);
if ((nn == 0) && (((col + *wlen) <= (ENCWORD_LEN_MAX + 1)) || (n <= 1)))
break;
- n = (nn ? nn : n) - 1;
+ n = ((nn != 0) ? nn : n) - 1;
assert(n > 0);
if (utf8)
while ((n > 1) && CONTINUATION_BYTE(d[n]))
/* inspect the last character we read so we can tell if we got the
* entire line. */
- const int last = linelen ? line[linelen - 1] : 0;
+ const int last = (linelen != 0) ? line[linelen - 1] : 0;
/* chop trailing whitespace if we got the full line */
if (last == '\n')
serial_restore_char(&(*a)->personal, d, off, convert);
serial_restore_char(&(*a)->mailbox, d, off, false);
serial_restore_int(&g, d, off);
- (*a)->group = g ? true : false;
+ (*a)->group = (g != 0) ? true : false;
a = &(*a)->next;
counter--;
}
if (!(search_buf && *search_buf) || ((op != OP_SEARCH_NEXT) && (op != OP_SEARCH_OPPOSITE)))
{
- mutt_str_strfcpy(buf, search_buf && *search_buf ? search_buf : "", sizeof(buf));
+ mutt_str_strfcpy(buf, search_buf && (search_buf[0] != '\0') ? search_buf : "",
+ sizeof(buf));
if ((mutt_get_field(((op == OP_SEARCH) || (op == OP_SEARCH_NEXT)) ?
_("Search for: ") :
_("Reverse search for: "),
}
else
{
- mutt_unget_event(ch.op ? 0 : ch.ch, ch.op ? ch.op : 0);
+ if (ch.op == OP_NULL)
+ mutt_unget_event(ch.ch, 0);
+ else
+ mutt_unget_event(0, ch.op);
return -1;
}
}
}
struct LogLine *ll = mutt_mem_calloc(1, sizeof(*ll));
- ll->time = stamp ? stamp : time(NULL);
+ ll->time = (stamp != 0) ? stamp : time(NULL);
ll->file = file;
ll->line = line;
ll->function = function;
*/
static char_cmp get_char_cmp(enum CaseSensitivity cs)
{
- return cs == CASE_IGNORE ? char_cmp_lower : char_cmp_identity;
+ return (cs == CASE_IGNORE) ? char_cmp_lower : char_cmp_identity;
}
/**
#ifdef USE_NNTP
if (a1->type == MUTT_ACCT_TYPE_NNTP)
- return (a1->flags & MUTT_ACCT_USER) && a1->user[0] ? false : true;
+ return (a1->flags & MUTT_ACCT_USER) && (a1->user[0] != '\0') ? false : true;
#endif
const char *user = NONULL(Username);
{
if (depth)
{
- myarrow = arrow + (depth - start_depth - (start_depth ? 0 : 1)) * width;
+ myarrow = arrow + (depth - start_depth - ((start_depth != 0) ? 0 : 1)) * width;
if (depth && (start_depth == depth))
myarrow[0] = nextdisp ? MUTT_TREE_LTEE : corner;
else if (parent->message && !C_HideLimited)
/* try to consume as many columns as we can, if we don't have
* memory for that, use as much memory as possible */
if (wlen + (pad * pl) + len > buflen)
- pad = (buflen > wlen + len) ? ((buflen - wlen - len) / pl) : 0;
+ pad = (buflen > (wlen + len)) ? ((buflen - wlen - len) / pl) : 0;
else
{
/* Add pre-spacing to make multi-column pad characters and
}
}
- return (*buf != '\0') ? 0 : -1;
+ return (buf[0] != '\0') ? 0 : -1;
}
/**
{
off = mutt_str_strlen(certfile);
snprintf(certfile + off, sizeof(certfile) - off, "%s%s/%s",
- off ? " " : "", NONULL(C_SmimeCertificates), cert_start);
+ (off != 0) ? " " : "", NONULL(C_SmimeCertificates), cert_start);
}
if (cert_end)
*cert_end++ = ' ';
while (true)
{
- if (buflen - off < 1024)
+ if ((buflen - off) < 1024)
{
buflen *= 2;
mutt_mem_realloc(&adata->overview_fmt, buflen);
null_rx = false;
STAILQ_FOREACH(color_line, head, entries)
{
- if (!color_line->stop_matching && (regexec(&color_line->regex, buf + offset, 1, pmatch,
- (offset ? REG_NOTBOL : 0)) == 0))
+ if (!color_line->stop_matching &&
+ (regexec(&color_line->regex, buf + offset, 1, pmatch,
+ ((offset != 0) ? REG_NOTBOL : 0)) == 0))
{
if (pmatch[0].rm_eo != pmatch[0].rm_so)
{
STAILQ_FOREACH(color_line, &ColorAttachList, entries)
{
if (regexec(&color_line->regex, buf + offset, 1, pmatch,
- (offset ? REG_NOTBOL : 0)) == 0)
+ ((offset != 0) ? REG_NOTBOL : 0)) == 0)
{
if (pmatch[0].rm_eo != pmatch[0].rm_so)
{
*/
static void set_pattern_cache_value(int *cache_entry, int value)
{
- *cache_entry = value ? 2 : 1;
+ *cache_entry = (value != 0) ? 2 : 1;
}
/**
if (!*LastSearch || ((op != OP_SEARCH_NEXT) && (op != OP_SEARCH_OPPOSITE)))
{
char buf[256];
- mutt_str_strfcpy(buf, *LastSearch ? LastSearch : "", sizeof(buf));
+ mutt_str_strfcpy(buf, (LastSearch[0] != '\0') ? LastSearch : "", sizeof(buf));
if ((mutt_get_field(((op == OP_SEARCH) || (op == OP_SEARCH_NEXT)) ?
_("Search for: ") :
_("Reverse search for: "),
struct EmailList el = STAILQ_HEAD_INITIALIZER(el);
el_add_email(&el, e_cur);
- ci_send_message(flags, e_tmp, *tmpbody ? tmpbody : NULL, NULL, &el);
+ ci_send_message(flags, e_tmp, (tmpbody[0] != '\0') ? tmpbody : NULL, NULL, &el);
el_free(&el);
}
struct ListNode *np = NULL;
STAILQ_FOREACH(np, chain, entries)
{
- mutt_buffer_addstr(cmd, i ? "," : " -l ");
+ mutt_buffer_addstr(cmd, (i != 0) ? "," : " -l ");
mutt_buffer_quote_filename(cd_quoted, (char *) np->data, true);
mutt_buffer_addstr(cmd, mutt_b2s(cd_quoted));
i = 1;
const char *ib = bufi;
char *ob = bufu;
size_t obl = sizeof(bufu);
- n = iconv(cd1, (ICONV_CONST char **) (ibl ? &ib : 0), &ibl, &ob, &obl);
+ n = iconv(cd1, (ICONV_CONST char **) ((ibl != 0) ? &ib : 0), &ibl, &ob, &obl);
/* assert(n == (size_t)(-1) || !n); */
if ((n == (size_t)(-1)) && (((errno != EINVAL) && (errno != E2BIG)) || (ib == bufi)))
{
if (tag && *tag && (fprintf(fp, "%s%s: ", NONULL(pfx), tag) < 0))
return -1;
- col = mutt_str_strlen(tag) + ((tag && *tag) ? 2 : 0) + mutt_str_strlen(pfx);
+ col = mutt_str_strlen(tag) + ((tag && (tag[0] != '\0')) ? 2 : 0) + mutt_str_strlen(pfx);
while (p && *p)
{