From: Richard Russon Date: Thu, 28 Feb 2019 14:35:55 +0000 (+0000) Subject: rename variables: progressbar -> progress X-Git-Tag: 2019-10-25~345^2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f81bca05e1c4eff15b3f71e46a7889cf15e864b2;p=neomutt rename variables: progressbar -> progress Consistent variable naming makes the code easier to read. --- diff --git a/imap/message.c b/imap/message.c index d51477c6b..cb917c11b 100644 --- a/imap/message.c +++ b/imap/message.c @@ -1421,7 +1421,7 @@ int imap_append_message(struct Mailbox *m, struct Message *msg) char internaldate[IMAP_DATELEN]; char imap_flags[128]; size_t len; - struct Progress progressbar; + struct Progress progress; size_t sent; int c, last; int rc; @@ -1451,8 +1451,7 @@ int imap_append_message(struct Mailbox *m, struct Message *msg) } rewind(fp); - mutt_progress_init(&progressbar, _("Uploading message..."), - MUTT_PROGRESS_SIZE, C_NetInc, len); + mutt_progress_init(&progress, _("Uploading message..."), MUTT_PROGRESS_SIZE, C_NetInc, len); mutt_date_make_imap(internaldate, sizeof(internaldate), msg->received); @@ -1500,7 +1499,7 @@ int imap_append_message(struct Mailbox *m, struct Message *msg) { sent += len; flush_buffer(buf, &len, adata->conn); - mutt_progress_update(&progressbar, sent, -1); + mutt_progress_update(&progress, sent, -1); } } @@ -1838,7 +1837,7 @@ int imap_msg_open(struct Mailbox *m, struct Message *msg, int msgno) char buf[1024]; char *pc = NULL; unsigned int bytes; - struct Progress progressbar; + struct Progress progress; unsigned int uid; bool retried = false; bool read; @@ -1925,11 +1924,10 @@ int imap_msg_open(struct Mailbox *m, struct Message *msg, int msgno) } if (output_progress) { - mutt_progress_init(&progressbar, _("Fetching message..."), + mutt_progress_init(&progress, _("Fetching message..."), MUTT_PROGRESS_SIZE, C_NetInc, bytes); } - if (imap_read_literal(msg->fp, adata, bytes, - output_progress ? &progressbar : NULL) < 0) + if (imap_read_literal(msg->fp, adata, bytes, output_progress ? &progress : NULL) < 0) { goto bail; } diff --git a/mutt_attach.c b/mutt_attach.c index 8a13f739f..e397c57da 100644 --- a/mutt_attach.c +++ b/mutt_attach.c @@ -525,13 +525,12 @@ int mutt_view_attachment(FILE *fp, struct Body *a, int flag, struct Email *e, { if (a->description) { - snprintf(desc, sizeof(desc), - _("---Command: %-20.20s Description: %s"), cmd, a->description); + snprintf(desc, sizeof(desc), _("---Command: %-20.20s Description: %s"), + cmd, a->description); } else { - snprintf(desc, sizeof(desc), - _("---Command: %-30.30s Attachment: %s"), cmd, type); + snprintf(desc, sizeof(desc), _("---Command: %-30.30s Attachment: %s"), cmd, type); } } diff --git a/pop/pop.c b/pop/pop.c index d44628555..c98095a78 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -1060,7 +1060,7 @@ static int pop_msg_open(struct Mailbox *m, struct Message *msg, int msgno) char buf[1024]; char path[PATH_MAX]; - struct Progress progressbar; + struct Progress progress; struct PopAccountData *adata = pop_adata_get(m); struct Email *e = m->emails[msgno]; struct PopEmailData *edata = e->edata; @@ -1109,7 +1109,7 @@ static int pop_msg_open(struct Mailbox *m, struct Message *msg, int msgno) return -1; } - mutt_progress_init(&progressbar, _("Fetching message..."), MUTT_PROGRESS_SIZE, + mutt_progress_init(&progress, _("Fetching message..."), MUTT_PROGRESS_SIZE, C_NetInc, e->content->length + e->content->offset - 1); /* see if we can put in body cache; use our cache as fallback */ @@ -1129,7 +1129,7 @@ static int pop_msg_open(struct Mailbox *m, struct Message *msg, int msgno) snprintf(buf, sizeof(buf), "RETR %d\r\n", e->refno); - const int ret = pop_fetch_data(adata, buf, &progressbar, fetch_message, msg->fp); + const int ret = pop_fetch_data(adata, buf, &progress, fetch_message, msg->fp); if (ret == 0) break; diff --git a/pop/pop_lib.c b/pop/pop_lib.c index 5dd697748..14576fa7b 100644 --- a/pop/pop_lib.c +++ b/pop/pop_lib.c @@ -477,11 +477,11 @@ int pop_query_d(struct PopAccountData *adata, char *buf, size_t buflen, char *ms /** * pop_fetch_data - Read Headers with callback function - * @param adata POP Account data - * @param query POP query to send to server - * @param progressbar Progress bar - * @param func Function called for each header read - * @param data Data to pass to the callback + * @param adata POP Account data + * @param query POP query to send to server + * @param progress Progress bar + * @param func Function called for each header read + * @param data Data to pass to the callback * @retval 0 Successful * @retval -1 Connection lost * @retval -2 Invalid command or execution error @@ -491,7 +491,7 @@ int pop_query_d(struct PopAccountData *adata, char *buf, size_t buflen, char *ms * func(NULL, *data) if rewind(*data) needs, exits when fail or done. */ int pop_fetch_data(struct PopAccountData *adata, const char *query, - struct Progress *progressbar, int (*func)(char *, void *), void *data) + struct Progress *progress, int (*func)(char *, void *), void *data) { char buf[1024]; long pos = 0; @@ -533,8 +533,8 @@ int pop_fetch_data(struct PopAccountData *adata, const char *query, } else { - if (progressbar) - mutt_progress_update(progressbar, pos, -1); + if (progress) + mutt_progress_update(progress, pos, -1); if ((ret == 0) && (func(inbuf, data) < 0)) ret = -3; lenbuf = 0; @@ -603,14 +603,14 @@ int pop_reconnect(struct Mailbox *m) int ret = pop_open_connection(adata); if (ret == 0) { - struct Progress progressbar; - mutt_progress_init(&progressbar, _("Verifying message indexes..."), + struct Progress progress; + mutt_progress_init(&progress, _("Verifying message indexes..."), MUTT_PROGRESS_SIZE, C_NetInc, 0); for (int i = 0; i < m->msg_count; i++) m->emails[i]->refno = -1; - ret = pop_fetch_data(adata, "UIDL\r\n", &progressbar, check_uidl, m); + ret = pop_fetch_data(adata, "UIDL\r\n", &progress, check_uidl, m); if (ret == -2) { mutt_error("%s", adata->err_msg); diff --git a/pop/pop_private.h b/pop/pop_private.h index 9279986dd..a84ccf5ce 100644 --- a/pop/pop_private.h +++ b/pop/pop_private.h @@ -130,8 +130,8 @@ int pop_parse_path(const char *path, struct ConnAccount *acct); int pop_connect(struct PopAccountData *adata); int pop_open_connection(struct PopAccountData *adata); int pop_query_d(struct PopAccountData *adata, char *buf, size_t buflen, char *msg); -int pop_fetch_data(struct PopAccountData *adata, const char *query, struct Progress *progressbar, - int (*func)(char *, void *), void *data); +int pop_fetch_data(struct PopAccountData *adata, const char *query, + struct Progress *progress, int (*func)(char *, void *), void *data); int pop_reconnect(struct Mailbox *m); void pop_logout(struct Mailbox *m); struct PopAccountData *pop_adata_get(struct Mailbox *m);