From: Richard Russon Date: Sun, 2 Sep 2018 22:22:11 +0000 (+0100) Subject: tidy upstream changes X-Git-Tag: 2019-10-25~670 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=10fcdf49768fbb611b91f9c4aa3df8fae6257330;p=neomutt tidy upstream changes --- diff --git a/compress.c b/compress.c index 02e8cce71..8dfd8f3d8 100644 --- a/compress.c +++ b/compress.c @@ -893,7 +893,9 @@ int mutt_comp_valid_command(const char *cmd) } /** - * comp_msg_padding_size - Returns the padding between messages. + * comp_msg_padding_size - Bytes of padding between messages - Implements MxOps::msg_padding_size + * @param ctx Mailbox + * @retval num Number of bytes of padding */ static int comp_msg_padding_size(struct Context *ctx) { diff --git a/curs_main.c b/curs_main.c index f531463b0..07a6da303 100644 --- a/curs_main.c +++ b/curs_main.c @@ -1767,7 +1767,7 @@ int mutt_index_menu(void) CHECK_ATTACH; CHECK_MSGCOUNT; CHECK_VISIBLE; - ci_send_message (SEND_TO_SENDER, NULL, NULL, Context, tag ? NULL : CURHDR); + ci_send_message(SEND_TO_SENDER, NULL, NULL, Context, tag ? NULL : CURHDR); menu->redraw = REDRAW_FULL; break; diff --git a/mbox/mbox.c b/mbox/mbox.c index fadc93e83..71a6e3d36 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -604,11 +604,21 @@ static int mbox_msg_open_new(struct Context *ctx, struct Message *msg, struct He return 0; } +/** + * mbox_msg_padding_size - Bytes of padding between messages - Implements MxOps::msg_padding_size + * @param ctx Mailbox + * @retval 1 Always + */ static int mbox_msg_padding_size(struct Context *ctx) { return 1; } +/** + * mmdf_msg_padding_size - Bytes of padding between messages - Implements MxOps::msg_padding_size + * @param ctx Mailbox + * @retval 10 Always + */ static int mmdf_msg_padding_size(struct Context *ctx) { return 10; diff --git a/mutt/buffer.c b/mutt/buffer.c index 3cb89c210..c0f10bf5d 100644 --- a/mutt/buffer.c +++ b/mutt/buffer.c @@ -255,14 +255,21 @@ struct Buffer *mutt_buffer_alloc(size_t size) return b; } -/* Increases the allocated size of the buffer */ +/** + * mutt_buffer_increase_size - Increase the allocated size of a buffer + * @param buf Buffer to change + * @param new_size New size + */ void mutt_buffer_increase_size(struct Buffer *buf, size_t new_size) { - if (new_size > buf->dsize) - { - size_t offset = buf->dptr - buf->data; - buf->dsize = new_size; - mutt_mem_realloc(&buf->data, buf->dsize); - buf->dptr = buf->data + offset; - } + if (!buf) + return; + + if (new_size <= buf->dsize) + return; + + size_t offset = buf->dptr - buf->data; + buf->dsize = new_size; + mutt_mem_realloc(&buf->data, buf->dsize); + buf->dptr = buf->data + offset; } diff --git a/mutt/file.c b/mutt/file.c index 0a12eb558..b6a7900da 100644 --- a/mutt/file.c +++ b/mutt/file.c @@ -347,8 +347,7 @@ int mutt_file_safe_rename(const char *src, const char *target) { link_errno = errno; - /* - * It is historically documented that link can return -1 if NFS + /* It is historically documented that link can return -1 if NFS * dies after creating the link. In that case, we are supposed * to use stat to check if the link was created. * @@ -361,7 +360,7 @@ int mutt_file_safe_rename(const char *src, const char *target) if ((lstat(src, &ssb) == 0) && (lstat(target, &tsb) == 0) && (compare_stat(&ssb, &tsb) == 0)) { - mutt_debug(1, "link (%s, %s) reported failure: %s (%d) but actually succeded\n", + mutt_debug(1, "link (%s, %s) reported failure: %s (%d) but actually succeeded\n", src, target, strerror(errno), errno); goto success; } @@ -404,12 +403,11 @@ int mutt_file_safe_rename(const char *src, const char *target) return -1; } - /* - * Remove the compare_stat() check, because it causes problems with maildir on - * filesystems that don't properly support hard links, such as - * sshfs. The filesystem creates the link, but the resulting file - * is given a different inode number by the sshfs layer. This - * results in an infinite loop creating links. + /* Remove the compare_stat() check, because it causes problems with maildir + * on filesystems that don't properly support hard links, such as sshfs. The + * filesystem creates the link, but the resulting file is given a different + * inode number by the sshfs layer. This results in an infinite loop + * creating links. */ #if 0 /* Stat both links and check if they are equal. */ diff --git a/mx.c b/mx.c index 27709877c..b6e17c655 100644 --- a/mx.c +++ b/mx.c @@ -403,7 +403,7 @@ static int sync_mailbox(struct Context *ctx, int *index_hint) if ((rc != 0) && !ctx->quiet) { /* L10N: Displayed if a mailbox sync fails */ - mutt_error(_("Unable to write %s!"), ctx->path); + mutt_error(_("Unable to write %s"), ctx->path); } return rc; @@ -1273,7 +1273,7 @@ int mx_check_empty(const char *path) { bool passive = ImapPassive; ImapPassive = false; - int rv = imap_status(path, 0); + int rv = imap_status(path, false); ImapPassive = passive; return (rv <= 0); } @@ -1510,8 +1510,10 @@ int mx_path_parent(char *buf, size_t buflen) return 0; } -/* mx_msg_padding_size: Returns the padding size between messages for the - * mailbox type pointed to by ctx. +/** + * mx_msg_padding_size - Bytes of padding between messages - Wrapper for MxOps::msg_padding_size + * @param ctx Mailbox + * @retval num Number of bytes of padding * * mmdf and mbox add separators, which leads a small discrepancy when computing * vsize for a limited view. diff --git a/pager.c b/pager.c index 5a85e5cbf..765ea3d31 100644 --- a/pager.c +++ b/pager.c @@ -823,36 +823,41 @@ static int check_attachment_marker(char *p) return (int) (*p - *q); } -/* Checks if buf matches the QuoteRegex and doesn't match Smileys. - * pmatch, if non-null, is populated with the regexec match against - * QuoteRegex. This is used by the pager for calling classify_quote. +/** + * mutt_is_quote_line - Is a line of message text a quote? + * @param[in] line Line to test + * @param[out] pmatch Regex sub-matches + * @retval true Line is quoted + * + * Checks if line matches the QuoteRegex and doesn't match Smileys. + * This is used by the pager for calling classify_quote. */ -int mutt_is_quote_line(char *buf, regmatch_t *pmatch) +int mutt_is_quote_line(char *line, regmatch_t *pmatch) { - int is_quote = 0; + bool is_quote = false; regmatch_t pmatch_internal[1], smatch[1]; char c; if (!pmatch) pmatch = pmatch_internal; - if (QuoteRegex && QuoteRegex->regex && regexec(QuoteRegex->regex, buf, 1, pmatch, 0) == 0) + if (QuoteRegex && QuoteRegex->regex && regexec(QuoteRegex->regex, line, 1, pmatch, 0) == 0) { - if (Smileys && Smileys->regex && regexec(Smileys->regex, buf, 1, smatch, 0) == 0) + if (Smileys && Smileys->regex && regexec(Smileys->regex, line, 1, smatch, 0) == 0) { if (smatch[0].rm_so > 0) { - c = buf[smatch[0].rm_so]; - buf[smatch[0].rm_so] = 0; + c = line[smatch[0].rm_so]; + line[smatch[0].rm_so] = 0; - if (regexec(QuoteRegex->regex, buf, 1, pmatch, 0) == 0) - is_quote = 1; + if (regexec(QuoteRegex->regex, line, 1, pmatch, 0) == 0) + is_quote = true; - buf[smatch[0].rm_so] = c; + line[smatch[0].rm_so] = c; } } else - is_quote = 1; + is_quote = true; } return is_quote; @@ -2899,12 +2904,12 @@ int mutt_pager(const char *banner, const char *fname, int flags, struct Pager *e break; case OP_COMPOSE_TO_SENDER: - CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); + CHECK_MODE(IsHeader(extra) || IsMsgAttach(extra)); CHECK_ATTACH; - if (IsMsgAttach (extra)) - mutt_attach_mail_sender (extra->fp, extra->hdr, extra->actx, extra->bdy); + if (IsMsgAttach(extra)) + mutt_attach_mail_sender(extra->fp, extra->hdr, extra->actx, extra->bdy); else - ci_send_message (SEND_TO_SENDER, NULL, NULL, extra->ctx, extra->hdr); + ci_send_message(SEND_TO_SENDER, NULL, NULL, extra->ctx, extra->hdr); pager_menu->redraw = REDRAW_FULL; break; diff --git a/recvattach.c b/recvattach.c index 2d0b094fc..806d3e929 100644 --- a/recvattach.c +++ b/recvattach.c @@ -1570,8 +1570,8 @@ void mutt_view_attachments(struct Header *hdr) case OP_COMPOSE_TO_SENDER: CHECK_ATTACH; - mutt_attach_mail_sender (CURATTACH->fp, hdr, actx, - menu->tagprefix ? NULL : CURATTACH->content); + mutt_attach_mail_sender(CURATTACH->fp, hdr, actx, + menu->tagprefix ? NULL : CURATTACH->content); menu->redraw = REDRAW_FULL; break; diff --git a/recvcmd.c b/recvcmd.c index 568d4bfe2..353ed9f3d 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -1036,6 +1036,13 @@ void mutt_attach_reply(FILE *fp, struct Header *hdr, struct AttachCtx *actx, } } +/** + * mutt_attach_mail_sender - Compose an email to the sender in the email attachment + * @param fp File containing attachment (UNUSED) + * @param hdr Header of email (UNUSED) + * @param actx Attachment Context + * @param cur Current attachment + */ void mutt_attach_mail_sender(FILE *fp, struct Header *hdr, struct AttachCtx *actx, struct Body *cur) { diff --git a/send.c b/send.c index e69efb6ad..78f2f3933 100644 --- a/send.c +++ b/send.c @@ -762,7 +762,7 @@ int mutt_fetch_recips(struct Envelope *out, struct Envelope *in, int flags) } else if (flags & SEND_TO_SENDER) { - mutt_addr_append(&out->to, in->from, 0); + mutt_addr_append(&out->to, in->from, false); } else { @@ -969,7 +969,7 @@ static int envelope_defaults(struct Envelope *env, struct Context *ctx, if (!curenv) return -1; - if (flags & (SEND_REPLY|SEND_TO_SENDER)) + if (flags & (SEND_REPLY | SEND_TO_SENDER)) { #ifdef USE_NNTP if ((flags & SEND_NEWS)) @@ -1006,7 +1006,7 @@ static int envelope_defaults(struct Envelope *env, struct Context *ctx, if (flags & SEND_REPLY) { mutt_make_misc_reply_headers(env, curenv); - make_reference_headers (tag ? NULL : curenv, env, ctx); + make_reference_headers(tag ? NULL : curenv, env, ctx); } } else if (flags & SEND_FORWARD)