From: Richard Russon Date: Mon, 1 Apr 2019 16:50:25 +0000 (+0100) Subject: add parentheses around logic-with-spaces X-Git-Tag: 2019-10-25~280^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3ea6c7e42c5952c32f981bda2db50f681ae64c86;p=neomutt add parentheses around logic-with-spaces --- diff --git a/color.c b/color.c index 02fccce26..0fc46f74e 100644 --- a/color.c +++ b/color.c @@ -509,7 +509,7 @@ static int parse_color_name(const char *s, uint32_t *col, int *attr, bool is_fg, { s += 1; *col = strtoul(s, &eptr, 16); - if (!*s || *eptr || (*col == COLOR_UNSET && !OptNoCurses && has_colors())) + if (!*s || *eptr || ((*col == COLOR_UNSET) && !OptNoCurses && has_colors())) { snprintf(err->data, err->dsize, _("%s: color not supported by term"), s); return -1; diff --git a/copy.c b/copy.c index 8883e54f6..174d997fe 100644 --- a/copy.c +++ b/copy.c @@ -760,7 +760,7 @@ int mutt_copy_message_fp(FILE *fp_out, FILE *fp_in, struct Email *e, fputs(prefix, fp_out); - while ((c = fgetc(fp_in)) != EOF && bytes--) + while (((c = fgetc(fp_in)) != EOF) && bytes--) { fputc(c, fp_out); if (c == '\n') diff --git a/curs_lib.c b/curs_lib.c index 533eb7655..241b63c5a 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -833,7 +833,7 @@ int mutt_multi_choice(const char *prompt, const char *letters) SETCOLOR(MT_COLOR_PROMPT); addnstr(prompt, cur - prompt); - if (isalnum(cur[1]) && cur[2] == ')') + if (isalnum(cur[1]) && (cur[2] == ')')) { // we have a single letter within parentheses SETCOLOR(MT_COLOR_OPTIONS); diff --git a/edit.c b/edit.c index ab16cdb23..4dcdb7e4f 100644 --- a/edit.c +++ b/edit.c @@ -427,7 +427,7 @@ int mutt_builtin_editor(const char *path, struct Email *msg, struct Email *cur) { /* remove trailing whitespace from the line */ p = tmp + mutt_str_strlen(tmp) - 1; - while (p >= tmp && ISSPACE(*p)) + while ((p >= tmp) && ISSPACE(*p)) *p-- = '\0'; p = tmp + 2; diff --git a/email/parse.c b/email/parse.c index 7d85dcc22..6ca51cab8 100644 --- a/email/parse.c +++ b/email/parse.c @@ -113,7 +113,7 @@ static void parse_parameters(struct ParameterList *param, const char *s) { i = p - s; /* remove whitespace from the end of the attribute name */ - while (i > 0 && mutt_str_is_email_wsp(s[i - 1])) + while ((i > 0) && mutt_str_is_email_wsp(s[i - 1])) i--; /* the check for the missing parameter token is here so that we can skip diff --git a/enter.c b/enter.c index 7873d5d50..feae1ec8e 100644 --- a/enter.c +++ b/enter.c @@ -358,7 +358,7 @@ int mutt_enter_string_full(char *buf, size_t buflen, int col, else { state->curpos++; - while (state->curpos < state->lastchar && + while ((state->curpos < state->lastchar) && COMB_CHAR(state->wbuf[state->curpos])) { state->curpos++; diff --git a/handler.c b/handler.c index 7295dc497..36372f772 100644 --- a/handler.c +++ b/handler.c @@ -177,7 +177,7 @@ static void decode_xbit(struct State *s, long len, bool istext, iconv_t cd) int c; char bufi[BUFI_SIZE]; size_t l = 0; - while ((c = fgetc(s->fp_in)) != EOF && len--) + while (((c = fgetc(s->fp_in)) != EOF) && len--) { if ((c == '\r') && len) { @@ -332,7 +332,7 @@ static void decode_quoted(struct State *s, long len, bool istext, iconv_t cd) /* chop trailing whitespace if we got the full line */ if (last == '\n') { - while (linelen > 0 && ISSPACE(line[linelen - 1])) + while ((linelen > 0) && ISSPACE(line[linelen - 1])) linelen--; line[linelen] = '\0'; } @@ -672,7 +672,7 @@ static int text_plain_handler(struct Body *b, struct State *s) if ((mutt_str_strcmp(buf, "-- ") != 0) && C_TextFlowed) { l = mutt_str_strlen(buf); - while (l > 0 && buf[l - 1] == ' ') + while ((l > 0) && (buf[l - 1] == ' ')) buf[--l] = '\0'; } if (s->prefix) diff --git a/imap/auth_sasl.c b/imap/auth_sasl.c index 1af176d5f..49d446ca8 100644 --- a/imap/auth_sasl.c +++ b/imap/auth_sasl.c @@ -147,7 +147,7 @@ enum ImapAuthRes imap_auth_sasl(struct ImapAccountData *adata, const char *metho irc = IMAP_CMD_CONTINUE; /* looping protocol */ - while (rc == SASL_CONTINUE || olen > 0) + while ((rc == SASL_CONTINUE) || (olen > 0)) { do irc = imap_cmd_step(adata); diff --git a/imap/command.c b/imap/command.c index 9f9373d1f..4f6b6c074 100644 --- a/imap/command.c +++ b/imap/command.c @@ -440,7 +440,7 @@ static void cmd_parse_fetch(struct ImapAccountData *adata, char *s) return; } s++; - while (*s && *s != ')') + while (*s && (*s != ')')) s++; if (*s == ')') s++; @@ -479,7 +479,7 @@ static void cmd_parse_fetch(struct ImapAccountData *adata, char *s) return; } s++; - while (*s && *s != ')') + while (*s && (*s != ')')) s++; if (*s == ')') s++; @@ -751,7 +751,7 @@ static void cmd_parse_search(struct ImapAccountData *adata, const char *s) mutt_debug(LL_DEBUG2, "Handling SEARCH\n"); - while ((s = imap_next_word((char *) s)) && *s != '\0') + while ((s = imap_next_word((char *) s)) && (*s != '\0')) { if (mutt_str_atoui(s, &uid) < 0) continue; @@ -827,7 +827,7 @@ static void cmd_parse_status(struct ImapAccountData *adata, char *s) mutt_debug(LL_DEBUG1, "Error parsing STATUS\n"); return; } - while (*s && *s != ')') + while (*s && (*s != ')')) { value = imap_next_word(s); @@ -906,7 +906,7 @@ static void cmd_parse_enabled(struct ImapAccountData *adata, const char *s) { mutt_debug(LL_DEBUG2, "Handling ENABLED\n"); - while ((s = imap_next_word((char *) s)) && *s != '\0') + while ((s = imap_next_word((char *) s)) && (*s != '\0')) { if (mutt_str_startswith(s, "UTF8=ACCEPT", CASE_IGNORE) || mutt_str_startswith(s, "UTF8=ONLY", CASE_IGNORE)) diff --git a/imap/imap.c b/imap/imap.c index 3f73a66df..939222a68 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -120,7 +120,7 @@ static char *get_flags(struct ListHead *hflags, char *s) } /* update caller's flags handle */ - while (*s && *s != ')') + while (*s && (*s != ')')) { s++; SKIPWS(s); @@ -493,7 +493,7 @@ static size_t longest_common_prefix(char *dest, const char *src, size_t start, s { size_t pos = start; - while (pos < dlen && dest[pos] && dest[pos] == src[pos]) + while ((pos < dlen) && dest[pos] && (dest[pos] == src[pos])) pos++; dest[pos] = '\0'; @@ -2343,7 +2343,7 @@ static int imap_tags_edit(struct Mailbox *m, const char *tags, char *buf, size_t } /* Skip duplicate space */ - while (*checker == ' ' && *(checker + 1) == ' ') + while ((*checker == ' ') && (*(checker + 1) == ' ')) checker++; /* copy char to new and go the next one */ diff --git a/imap/message.c b/imap/message.c index 57e455176..b393e84da 100644 --- a/imap/message.c +++ b/imap/message.c @@ -246,7 +246,7 @@ static char *msg_parse_flags(struct ImapHeader *h, char *s) edata->old = false; /* start parsing */ - while (*s && *s != ')') + while (*s && (*s != ')')) { if ((plen = mutt_str_startswith(s, "\\deleted", CASE_IGNORE))) { @@ -283,7 +283,7 @@ static char *msg_parse_flags(struct ImapHeader *h, char *s) char *flag_word = s; bool is_system_keyword = mutt_str_startswith(s, "\\", CASE_IGNORE); - while (*s && !ISSPACE(*s) && *s != ')') + while (*s && !ISSPACE(*s) && (*s != ')')) s++; ctmp = *s; @@ -395,7 +395,7 @@ static int msg_parse_fetch(struct ImapHeader *h, char *s) return -1; } s++; - while (*s && *s != ')') + while (*s && (*s != ')')) s++; if (*s == ')') s++; diff --git a/imap/util.c b/imap/util.c index 8bbc431d1..c9b1b9e4c 100644 --- a/imap/util.c +++ b/imap/util.c @@ -786,7 +786,7 @@ char *imap_fix_path(char server_delim, const char *mailbox, char *path, size_t p int i = 0; char delim = server_delim; - while (mailbox && *mailbox && i < plen - 1) + while (mailbox && *mailbox && (i < plen - 1)) { if ((C_ImapDelimChars && strchr(C_ImapDelimChars, *mailbox)) || (delim && (*mailbox == delim))) @@ -796,7 +796,7 @@ char *imap_fix_path(char server_delim, const char *mailbox, char *path, size_t p delim = *mailbox; while (*mailbox && ((C_ImapDelimChars && strchr(C_ImapDelimChars, *mailbox)) || - (delim && *mailbox == delim))) + (delim && (*mailbox == delim)))) { mailbox++; } @@ -1103,7 +1103,7 @@ int imap_wait_keepalive(pid_t pid) sigaction(SIGALRM, &act, &oldalrm); alarm(C_ImapKeepalive); - while (waitpid(pid, &rc, 0) < 0 && errno == EINTR) + while ((waitpid(pid, &rc, 0) < 0) && (errno == EINTR)) { alarm(0); /* cancel a possibly pending alarm */ imap_keepalive(); diff --git a/menu.c b/menu.c index 6ac39c9a0..b0e9fdcd4 100644 --- a/menu.c +++ b/menu.c @@ -158,7 +158,7 @@ static void print_enriched_string(int index, int attr, unsigned char *s, bool do SETCOLOR(MT_COLOR_TREE); #endif - while (*s && *s < MUTT_TREE_MAX) + while (*s && (*s < MUTT_TREE_MAX)) { switch (*s) { @@ -1190,7 +1190,7 @@ static int menu_search(struct Menu *menu, int op) search_next: if (wrap) mutt_message(_("Search wrapped to top")); - while (rc >= 0 && rc < menu->max) + while ((rc >= 0) && (rc < menu->max)) { if (menu->menu_search(menu, &re, rc) == 0) { diff --git a/mutt/history.c b/mutt/history.c index f42333d1f..179c7de7e 100644 --- a/mutt/history.c +++ b/mutt/history.c @@ -114,7 +114,7 @@ static int OldSize = 0; */ static struct History *get_history(enum HistoryClass hclass) { - if (hclass >= HC_MAX || C_History == 0) + if ((hclass >= HC_MAX) || (C_History == 0)) return NULL; struct History *hist = &Histories[hclass]; diff --git a/mutt/string.c b/mutt/string.c index 1c64585e0..30c3df820 100644 --- a/mutt/string.c +++ b/mutt/string.c @@ -978,7 +978,7 @@ int mutt_str_word_casecmp(const char *a, const char *b) bool mutt_str_is_ascii(const char *p, size_t len) { const char *s = p; - while (s && (unsigned int) (s - p) < len) + while (s && ((unsigned int) (s - p) < len)) { if ((*s & 0x80) != 0) return false; diff --git a/mutt_thread.c b/mutt_thread.c index 29bbfb943..4b75f6dba 100644 --- a/mutt_thread.c +++ b/mutt_thread.c @@ -441,7 +441,7 @@ static void make_subject_list(struct ListHead *subjects, struct MuttThread *cur, mutt_list_insert_after(subjects, np, env->real_subj); } - while (!cur->next && cur != start) + while (!cur->next && (cur != start)) { cur = cur->parent; } @@ -579,7 +579,7 @@ static void pseudo_threads(struct Context *ctx) } } - while (!tmp->next && tmp != cur) + while (!tmp->next && (tmp != cur)) { tmp = tmp->parent; } @@ -891,7 +891,7 @@ void mutt_sort_threads(struct Context *ctx, bool init) while (!tmp->message) tmp = tmp->child; tmp->check_subject = true; - while (!tmp->next && tmp != thread) + while (!tmp->next && (tmp != thread)) tmp = tmp->parent; if (tmp != thread) tmp = tmp->next; diff --git a/muttlib.c b/muttlib.c index 18cd509a1..a1f17d285 100644 --- a/muttlib.c +++ b/muttlib.c @@ -836,7 +836,7 @@ void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const c { /* Scan backwards for backslashes */ off = n; - while (off > 0 && src[off - 2] == '\\') + while ((off > 0) && (src[off - 2] == '\\')) off--; } @@ -904,7 +904,7 @@ void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const c if (n > 0) { buf[n] = '\0'; - while ((n > 0) && (buf[n - 1] == '\n' || buf[n - 1] == '\r')) + while ((n > 0) && ((buf[n - 1] == '\n') || (buf[n - 1] == '\r'))) buf[--n] = '\0'; mutt_debug(5, "fmtpipe < %s\n", buf); @@ -953,7 +953,7 @@ void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const c } } - while (*src && wlen < buflen) + while (*src && (wlen < buflen)) { if (*src == '%') { @@ -1014,8 +1014,8 @@ void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const c /* eat the format string */ cp = prefix; count = 0; - while (count < sizeof(prefix) && (isdigit((unsigned char) *src) || - *src == '.' || *src == '-' || *src == '=')) + while ((count < sizeof(prefix)) && (isdigit((unsigned char) *src) || (*src == '.') || + (*src == '-') || (*src == '='))) { *cp++ = *src++; count++; @@ -1227,7 +1227,7 @@ void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const c bool tolower = false; bool nodots = false; - while (ch == '_' || ch == ':') + while ((ch == '_') || (ch == ':')) { if (ch == '_') tolower = true; diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index afede861d..b659eeabb 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -776,7 +776,7 @@ static int have_gpg_version(const char *version) ctx = create_gpgme_context(false); engineinfo = gpgme_ctx_get_engine_info(ctx); - while (engineinfo && engineinfo->protocol != GPGME_PROTOCOL_OpenPGP) + while (engineinfo && (engineinfo->protocol != GPGME_PROTOCOL_OpenPGP)) engineinfo = engineinfo->next; if (!engineinfo) { @@ -2473,7 +2473,7 @@ static int pgp_gpgme_extract_keys(gpgme_data_t keydata, FILE **fp) } engineinfo = gpgme_ctx_get_engine_info(tmpctx); - while (engineinfo && engineinfo->protocol != GPGME_PROTOCOL_OpenPGP) + while (engineinfo && (engineinfo->protocol != GPGME_PROTOCOL_OpenPGP)) engineinfo = engineinfo->next; if (!engineinfo) { @@ -3435,7 +3435,7 @@ static const char *crypt_format_str(char *buf, size_t buflen, size_t col, int co } len = buflen - 1; - while (len > 0 && *cp != ']') + while ((len > 0) && (*cp != ']')) { if (*cp == '%') { diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index 0705bb8eb..2f67a448a 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -540,7 +540,7 @@ int pgp_class_application_handler(struct Body *m, struct State *s) } fputs(buf, fp_tmp); - while (bytes > 0 && fgets(buf, sizeof(buf) - 1, s->fp_in)) + while ((bytes > 0) && fgets(buf, sizeof(buf) - 1, s->fp_in)) { offset = ftello(s->fp_in); bytes -= (offset - last_pos); /* don't rely on mutt_str_strlen(buf) */ diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index dda304c78..cfc839209 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -274,7 +274,7 @@ static const char *pgp_entry_fmt(char *buf, size_t buflen, size_t col, int cols, } len = buflen - 1; - while (len > 0 && *cp != ']') + while ((len > 0) && (*cp != ']')) { if (*cp == '%') { diff --git a/nntp/nntp.c b/nntp/nntp.c index 83e4c7afd..3f51f86e6 100644 --- a/nntp/nntp.c +++ b/nntp/nntp.c @@ -663,7 +663,7 @@ static int nntp_auth(struct NntpAccountData *adata) snprintf(buf, sizeof(buf), "AUTHINFO SASL %s", method); /* looping protocol */ - while (rc == SASL_CONTINUE || (rc == SASL_OK && client_len)) + while ((rc == SASL_CONTINUE) || ((rc == SASL_OK) && client_len)) { /* send out client response */ if (client_len) diff --git a/pager.c b/pager.c index b80ac79ea..6df0df280 100644 --- a/pager.c +++ b/pager.c @@ -231,7 +231,7 @@ static int check_sig(const char *s, struct Line *info, int n) { int count = 0; - while (n > 0 && count <= NUM_SIG_LINES) + while ((n > 0) && (count <= NUM_SIG_LINES)) { if (info[n].type != MT_COLOR_SIGNATURE) break; @@ -332,7 +332,7 @@ static void resolve_color(struct Line *line_info, int n, int cnt, { def_color = class->color; - while (class && class->length > cnt) + while (class && (class->length > cnt)) { def_color = class->color; class = class->up; @@ -994,9 +994,9 @@ static void resolve_types(char *buf, char *raw, struct Line *line_info, int n, i = n + 1; line_info[n].type = MT_COLOR_SIGNATURE; - while (i < last && check_sig(buf, line_info, i - 1) == 0 && - (line_info[i].type == MT_COLOR_NORMAL || line_info[i].type == MT_COLOR_QUOTED || - line_info[i].type == MT_COLOR_HEADER)) + while ((i < last) && (check_sig(buf, line_info, i - 1) == 0) && + ((line_info[i].type == MT_COLOR_NORMAL) || (line_info[i].type == MT_COLOR_QUOTED) || + (line_info[i].type == MT_COLOR_HEADER))) { /* oops... */ if (line_info[i].chunks) @@ -1181,7 +1181,7 @@ static void resolve_types(char *buf, char *raw, struct Line *line_info, int n, */ static bool is_ansi(unsigned char *buf) { - while ((*buf != '\0') && (isdigit(*buf) || *buf == ';')) + while ((*buf != '\0') && (isdigit(*buf) || (*buf == ';'))) buf++; return *buf == 'm'; } @@ -1197,7 +1197,7 @@ static int grok_ansi(unsigned char *buf, int pos, struct AnsiAttr *a) { int x = pos; - while (isdigit(buf[x]) || buf[x] == ';') + while (isdigit(buf[x]) || (buf[x] == ';')) x++; /* Character Attributes */ @@ -1268,7 +1268,7 @@ static int grok_ansi(unsigned char *buf, int pos, struct AnsiAttr *a) } else { - while (pos < x && buf[pos] != ';') + while ((pos < x) && (buf[pos] != ';')) pos++; pos++; } @@ -1388,10 +1388,11 @@ static int format_line(struct Line **line_info, int n, unsigned char *buf, for (ch = 0, vch = 0; ch < cnt; ch += k, vch += k) { /* Handle ANSI sequences */ - while (cnt - ch >= 2 && buf[ch] == '\033' && buf[ch + 1] == '[' && is_ansi(buf + ch + 2)) + while ((cnt - ch >= 2) && (buf[ch] == '\033') && (buf[ch + 1] == '[') && + is_ansi(buf + ch + 2)) ch = grok_ansi(buf, ch + 2, pa) + 1; - while (cnt - ch >= 2 && buf[ch] == '\033' && buf[ch + 1] == ']' && + while ((cnt - ch >= 2) && (buf[ch] == '\033') && (buf[ch + 1] == ']') && ((check_attachment_marker((char *) buf + ch) == 0) || (check_protected_header_marker((char *) buf + ch) == 0))) { @@ -1737,7 +1738,7 @@ static int display_line(FILE *fp, LOFF_T *last_pos, struct Line **line_info, { buf_ptr = buf + ch; /* skip trailing blanks */ - while (ch && (buf[ch] == ' ' || buf[ch] == '\t' || buf[ch] == '\r')) + while (ch && ((buf[ch] == ' ') || (buf[ch] == '\t') || (buf[ch] == '\r'))) ch--; /* A very long word with leading spaces causes infinite * wrapping when MUTT_PAGER_NSKIP is set. A folded header @@ -1752,7 +1753,7 @@ static int display_line(FILE *fp, LOFF_T *last_pos, struct Line **line_info, if (!(flags & MUTT_PAGER_NSKIP)) { /* skip leading blanks on the next line too */ - while (*buf_ptr == ' ' || *buf_ptr == '\t') + while ((*buf_ptr == ' ') || (*buf_ptr == '\t')) buf_ptr++; } } @@ -1834,7 +1835,7 @@ out: */ static int up_n_lines(int nlines, struct Line *info, int cur, bool hiding) { - while (cur > 0 && nlines > 0) + while ((cur > 0) && (nlines > 0)) { cur--; if (!hiding || (info[cur].type != MT_COLOR_QUOTED)) @@ -2106,8 +2107,8 @@ static void pager_custom_redraw(struct Menu *pager_menu) rd->lines = 0; rd->force_redraw = false; - while (rd->lines < rd->pager_window->rows && - rd->line_info[rd->curline].offset <= rd->sb.st_size - 1) + while ((rd->lines < rd->pager_window->rows) && + (rd->line_info[rd->curline].offset <= rd->sb.st_size - 1)) { if (display_line(rd->fp, &rd->last_pos, &rd->line_info, rd->curline, &rd->last_line, &rd->max_line, @@ -2850,7 +2851,7 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P /* Skip all the email headers */ if (ISHEADER(rd.line_info[new_topline].type)) { - while ((new_topline < rd.last_line || + while (((new_topline < rd.last_line) || (0 == (dretval = display_line( rd.fp, &rd.last_pos, &rd.line_info, new_topline, &rd.last_line, &rd.max_line, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP), @@ -2864,13 +2865,13 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P break; } - while (((new_topline + C_SkipQuotedOffset) < rd.last_line || + while ((((new_topline + C_SkipQuotedOffset) < rd.last_line) || (0 == (dretval = display_line( rd.fp, &rd.last_pos, &rd.line_info, new_topline, &rd.last_line, &rd.max_line, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP), &rd.quote_list, &rd.q_level, &rd.force_redraw, &rd.search_re, rd.pager_window)))) && - rd.line_info[new_topline + C_SkipQuotedOffset].type != MT_COLOR_QUOTED) + (rd.line_info[new_topline + C_SkipQuotedOffset].type != MT_COLOR_QUOTED)) { new_topline++; } @@ -2881,13 +2882,13 @@ int mutt_pager(const char *banner, const char *fname, PagerFlags flags, struct P break; } - while (((new_topline + C_SkipQuotedOffset) < rd.last_line || + while ((((new_topline + C_SkipQuotedOffset) < rd.last_line) || (0 == (dretval = display_line( rd.fp, &rd.last_pos, &rd.line_info, new_topline, &rd.last_line, &rd.max_line, MUTT_TYPES | (flags & MUTT_PAGER_NOWRAP), &rd.quote_list, &rd.q_level, &rd.force_redraw, &rd.search_re, rd.pager_window)))) && - rd.line_info[new_topline + C_SkipQuotedOffset].type == MT_COLOR_QUOTED) + (rd.line_info[new_topline + C_SkipQuotedOffset].type == MT_COLOR_QUOTED)) { new_topline++; } diff --git a/pattern.c b/pattern.c index 12bdf9140..f0cea4445 100644 --- a/pattern.c +++ b/pattern.c @@ -2214,7 +2214,7 @@ static void quote_simple(const char *str, char *buf, size_t buflen) int i = 0; buf[i++] = '"'; - while (*str && i < buflen - 3) + while (*str && (i < buflen - 3)) { if ((*str == '\\') || (*str == '"')) buf[i++] = '\\'; diff --git a/recvcmd.c b/recvcmd.c index adf4ee7b5..46cd0ec32 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -344,7 +344,7 @@ static int is_parent(short i, struct AttachCtx *actx, struct Body *cur) { short level = actx->idx[i]->level; - while ((++i < actx->idxlen) && actx->idx[i]->level > level) + while ((++i < actx->idxlen) && (actx->idx[i]->level > level)) { if (actx->idx[i]->content == cur) return true; diff --git a/rfc1524.c b/rfc1524.c index 54f644235..428faa0d2 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -82,7 +82,7 @@ int rfc1524_expand_command(struct Body *a, const char *filename, if (C_MailcapSanitize) mutt_file_sanitize_filename(type2, false); - while (x < clen - 1 && command[x] && y < sizeof(buf) - 1) + while ((x < clen - 1) && command[x] && (y < sizeof(buf) - 1)) { if (command[x] == '\\') { @@ -100,7 +100,7 @@ int rfc1524_expand_command(struct Body *a, const char *filename, int z = 0; x++; - while (command[x] && command[x] != '}' && z < sizeof(param) - 1) + while (command[x] && (command[x] != '}') && (z < sizeof(param) - 1)) param[z++] = command[x++]; param[z] = '\0'; @@ -457,7 +457,7 @@ bool rfc1524_mailcap_lookup(struct Body *a, char *type, while (!found && *curr) { int x = 0; - while (*curr && *curr != ':' && x < sizeof(path) - 1) + while (*curr && (*curr != ':') && (x < sizeof(path) - 1)) { path[x++] = *curr; curr++; diff --git a/rfc3676.c b/rfc3676.c index c646eb197..82d9ae866 100644 --- a/rfc3676.c +++ b/rfc3676.c @@ -69,7 +69,7 @@ static int get_quote_level(const char *line) int quoted = 0; char *p = (char *) line; - while (p && *p == '>') + while (p && (*p == '>')) { quoted++; p++; diff --git a/sendlib.c b/sendlib.c index 1e02a0a0a..14b00d5c1 100644 --- a/sendlib.c +++ b/sendlib.c @@ -1849,7 +1849,7 @@ static int print_val(FILE *fp, const char *pfx, const char *value, if ((chflags & CH_DISPLAY) && ((*(value + 1) == ' ') || (*(value + 1) == '\t'))) { value++; - while (*value && (*value == ' ' || *value == '\t')) + while (*value && ((*value == ' ') || (*value == '\t'))) value++; if (fputc('\t', fp) == EOF) return -1; @@ -1921,7 +1921,7 @@ static int fold_one_header(FILE *fp, const char *tag, const char *value, if (display && fold) { char *pc = buf; - while (*pc && (*pc == ' ' || *pc == '\t')) + while (*pc && ((*pc == ' ') || (*pc == '\t'))) { pc++; col--; @@ -1943,7 +1943,7 @@ static int fold_one_header(FILE *fp, const char *tag, const char *value, * XXX this covers ASCII space only, for display we probably * want something like iswspace() here */ const char *sp = next; - while (*sp && (*sp == ' ' || *sp == '\t')) + while (*sp && ((*sp == ' ') || (*sp == '\t'))) sp++; if (*sp == '\n') { @@ -2071,7 +2071,7 @@ static int write_one_header(FILE *fp, int pfxw, int max, int wraplen, const char /* skip over any leading whitespace (WSP, as defined in RFC5322) * NOTE: mutt_str_skip_email_wsp() does the wrong thing here. * See tickets 3609 and 3716. */ - while (*t == ' ' || *t == '\t') + while ((*t == ' ') || (*t == '\t')) t++; valbuf = mutt_str_substr_dup(t, end); diff --git a/state.c b/state.c index 185755753..899b5085f 100644 --- a/state.c +++ b/state.c @@ -108,7 +108,7 @@ int state_putws(const wchar_t *ws, struct State *s) { const wchar_t *p = ws; - while (p && *p != L'\0') + while (p && (*p != L'\0')) { if (state_putwc(*p, s) < 0) return -1;