From: Richard Russon Date: Mon, 15 May 2017 13:49:35 +0000 (+0100) Subject: replace 'progress_t' with 'struct Progress' X-Git-Tag: neomutt-20170526~21^2~59 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8c8fccf04723257c1e026b9241b517ff77a440b1;p=neomutt replace 'progress_t' with 'struct Progress' --- diff --git a/curs_lib.c b/curs_lib.c index 5eac76ec6..c15525e96 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -418,7 +418,7 @@ void mutt_curses_message(const char *fmt, ...) va_end(ap); } -void mutt_progress_init(progress_t *progress, const char *msg, +void mutt_progress_init(struct Progress *progress, const char *msg, unsigned short flags, unsigned short inc, long size) { struct timeval tv = { 0, 0 }; @@ -428,7 +428,7 @@ void mutt_progress_init(progress_t *progress, const char *msg, if (option(OPTNOCURSES)) return; - memset(progress, 0, sizeof(progress_t)); + memset(progress, 0, sizeof(struct Progress)); progress->inc = inc; progress->flags = flags; progress->msg = msg; @@ -517,7 +517,7 @@ static void message_bar(int percent, const char *fmt, ...) mutt_refresh(); } -void mutt_progress_update(progress_t *progress, long pos, int percent) +void mutt_progress_update(struct Progress *progress, long pos, int percent) { char posstr[SHORT_STRING]; short update = 0; diff --git a/curs_main.c b/curs_main.c index 55eba2681..cd1105412 100644 --- a/curs_main.c +++ b/curs_main.c @@ -1837,7 +1837,7 @@ int mutt_index_menu(void) if (tag) { char msgbuf[STRING]; - progress_t progress; + struct Progress progress; int px; if (!Context->quiet) diff --git a/imap/imap.c b/imap/imap.c index b5efe175c..686d7730b 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -195,7 +195,7 @@ void imap_logout_all(void) /* imap_read_literal: read bytes bytes from server into file. Not explicitly * buffered, relies on FILE buffering. NOTE: strips \r from \r\n. * Apparently even literals use \r\n-terminated strings ?! */ -int imap_read_literal(FILE *fp, IMAP_DATA *idata, long bytes, progress_t *pbar) +int imap_read_literal(FILE *fp, IMAP_DATA *idata, long bytes, struct Progress *pbar) { long pos; char c; diff --git a/imap/imap_private.h b/imap/imap_private.h index 2e6174a7f..ee4d54a7d 100644 --- a/imap/imap_private.h +++ b/imap/imap_private.h @@ -239,7 +239,7 @@ int imap_exec_msgset(IMAP_DATA *idata, const char *pre, const char *post, int imap_open_connection(IMAP_DATA *idata); void imap_close_connection(IMAP_DATA *idata); IMAP_DATA *imap_conn_find(const struct Account *account, int flags); -int imap_read_literal(FILE *fp, IMAP_DATA *idata, long bytes, progress_t *pbar); +int imap_read_literal(FILE *fp, IMAP_DATA *idata, long bytes, struct Progress *pbar); void imap_expunge_mailbox(IMAP_DATA *idata); void imap_logout(IMAP_DATA **idata); int imap_sync_message(IMAP_DATA *idata, struct Header *hdr, struct Buffer *cmd, int *err_continue); diff --git a/imap/message.c b/imap/message.c index e8e8d3cf2..f224271a2 100644 --- a/imap/message.c +++ b/imap/message.c @@ -365,7 +365,7 @@ int imap_read_headers(IMAP_DATA *idata, int msgbegin, int msgend) "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE " "CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST X-LABEL " "X-KEYWORDS X-MOZILLA-KEYS KEYWORDS X-ORIGINAL-TO"; - progress_t progress; + struct Progress progress; int retval = -1; #ifdef USE_HCACHE @@ -694,7 +694,7 @@ int imap_fetch_message(struct Context *ctx, struct Message *msg, int msgno) char path[_POSIX_PATH_MAX]; char *pc = NULL; long bytes; - progress_t progressbar; + struct Progress progressbar; int uid; int cacheno; IMAP_CACHE *cache = NULL; @@ -917,7 +917,7 @@ int imap_append_message(struct Context *ctx, struct Message *msg) char internaldate[IMAP_DATELEN]; char imap_flags[SHORT_STRING]; size_t len; - progress_t progressbar; + struct Progress progressbar; size_t sent; int c, last; IMAP_MBOX mx; diff --git a/mbox.c b/mbox.c index 5357e5696..4d5f9069f 100644 --- a/mbox.c +++ b/mbox.c @@ -87,7 +87,7 @@ static int mmdf_parse_mailbox(struct Context *ctx) #ifdef NFS_ATTRIBUTE_HACK struct utimbuf newtime; #endif - progress_t progress; + struct Progress progress; char msgbuf[STRING]; if (stat(ctx->path, &sb) == -1) @@ -250,7 +250,7 @@ static int mbox_parse_mailbox(struct Context *ctx) #ifdef NFS_ATTRIBUTE_HACK struct utimbuf newtime; #endif - progress_t progress; + struct Progress progress; char msgbuf[STRING]; /* Save information about the folder at the time we opened it. */ @@ -1008,7 +1008,7 @@ static int mbox_sync_mailbox(struct Context *ctx, int *index_hint) struct m_update_t *newOffset = NULL; struct m_update_t *oldOffset = NULL; FILE *fp = NULL; - progress_t progress; + struct Progress progress; char msgbuf[STRING]; struct Buffy *tmp = NULL; diff --git a/mh.c b/mh.c index 7a592f366..9cf8cc5b6 100644 --- a/mh.c +++ b/mh.c @@ -784,7 +784,7 @@ struct Header *maildir_parse_message(int magic, const char *fname, int is_old, s } static int maildir_parse_dir(struct Context *ctx, struct maildir ***last, - const char *subdir, int *count, progress_t *progress) + const char *subdir, int *count, struct Progress *progress) { DIR *dirp = NULL; struct dirent *de = NULL; @@ -1071,7 +1071,7 @@ static struct maildir *skip_duplicates(struct maildir *p, struct maildir **last) /* * This function does the second parsing pass */ -static void maildir_delayed_parsing(struct Context *ctx, struct maildir **md, progress_t *progress) +static void maildir_delayed_parsing(struct Context *ctx, struct maildir **md, struct Progress *progress) { struct maildir *p, *last = NULL; char fn[_POSIX_PATH_MAX]; @@ -1217,7 +1217,7 @@ static int mh_read_dir(struct Context *ctx, const char *subdir) struct mh_data *data = NULL; int count; char msgbuf[STRING]; - progress_t progress; + struct Progress progress; memset(&mhs, 0, sizeof(mhs)); if (!ctx->quiet) @@ -2251,7 +2251,7 @@ static int mh_sync_mailbox(struct Context *ctx, int *index_hint) header_cache_t *hc = NULL; #endif /* USE_HCACHE */ char msgbuf[STRING]; - progress_t progress; + struct Progress progress; if (ctx->magic == MUTT_MH) i = mh_check_mailbox(ctx, index_hint); diff --git a/mutt_curses.h b/mutt_curses.h index c3d91d68c..4bb108c5b 100644 --- a/mutt_curses.h +++ b/mutt_curses.h @@ -201,7 +201,7 @@ typedef struct color_line #define MUTT_PROGRESS_SIZE (1 << 0) /* traffic-based progress */ #define MUTT_PROGRESS_MSG (1 << 1) /* message-based progress */ -typedef struct +struct Progress { unsigned short inc; unsigned short flags; @@ -210,14 +210,14 @@ typedef struct long size; unsigned int timestamp; char sizestr[SHORT_STRING]; -} progress_t; +}; -void mutt_progress_init(progress_t *progress, const char *msg, +void mutt_progress_init(struct Progress *progress, const char *msg, unsigned short flags, unsigned short inc, long size); /* If percent is positive, it is displayed as percentage, otherwise * percentage is calculated from progress->size and pos if progress * was initialized with positive size, otherwise no percentage is shown */ -void mutt_progress_update(progress_t *progress, long pos, int percent); +void mutt_progress_update(struct Progress *progress, long pos, int percent); /* Windows for different parts of the screen */ struct MuttWindow diff --git a/mutt_notmuch.c b/mutt_notmuch.c index 2585fb8f8..0b0f10116 100644 --- a/mutt_notmuch.c +++ b/mutt_notmuch.c @@ -147,7 +147,7 @@ struct nm_ctxdata struct uri_tag *query_items; - progress_t progress; /**< A progress bar */ + struct Progress progress; /**< A progress bar */ int oldmsgcount; int ignmsgcount; /**< Ignored messages */ @@ -2305,7 +2305,7 @@ static int nm_sync_mailbox(struct Context *ctx, int *index_hint) struct nm_ctxdata *data = get_ctxdata(ctx); int i, rc = 0; char msgbuf[STRING]; - progress_t progress; + struct Progress progress; char *uri = ctx->path; int changed = 0; diff --git a/nntp.c b/nntp.c index c6c5c24d8..327caa663 100644 --- a/nntp.c +++ b/nntp.c @@ -804,7 +804,7 @@ static int nntp_fetch_lines(NNTP_DATA *nntp_data, char *query, size_t qlen, char *line = NULL; unsigned int lines = 0; size_t off = 0; - progress_t progress; + struct Progress progress; if (msg) mutt_progress_init(&progress, msg, MUTT_PROGRESS_MSG, ReadInc, -1); @@ -979,7 +979,7 @@ typedef struct anum_t last; int restore; unsigned char *messages; - progress_t progress; + struct Progress progress; #ifdef USE_HCACHE header_cache_t *hc; #endif @@ -2214,7 +2214,7 @@ int nntp_check_new_groups(NNTP_SERVER *nserv) if (option(OPTLOADDESC)) { unsigned int count = 0; - progress_t progress; + struct Progress progress; mutt_progress_init(&progress, _("Loading descriptions..."), MUTT_PROGRESS_MSG, ReadInc, nserv->groups_num - i); diff --git a/pattern.c b/pattern.c index bf676175d..4cdd7b30a 100644 --- a/pattern.c +++ b/pattern.c @@ -1771,7 +1771,7 @@ int mutt_pattern_func(int op, char *prompt) char buf[LONG_STRING] = "", *simple = NULL; struct Buffer err; int i; - progress_t progress; + struct Progress progress; strfcpy(buf, NONULL(Context->pattern), sizeof(buf)); if (prompt || op != MUTT_LIMIT) @@ -1891,7 +1891,7 @@ int mutt_search_command(int cur, int op) char temp[LONG_STRING]; int incr; struct Header *h = NULL; - progress_t progress; + struct Progress progress; const char *msg = NULL; if (!*LastSearch || (op != OP_SEARCH_NEXT && op != OP_SEARCH_OPPOSITE)) diff --git a/pop.c b/pop.c index c7412aeef..761559464 100644 --- a/pop.c +++ b/pop.c @@ -233,7 +233,7 @@ static int pop_fetch_headers(struct Context *ctx) int i, ret, old_count, new_count, deleted; unsigned short hcached = 0, bcached; POP_DATA *pop_data = (POP_DATA *) ctx->data; - progress_t progress; + struct Progress progress; #ifdef USE_HCACHE header_cache_t *hc = NULL; @@ -514,7 +514,7 @@ static int pop_fetch_message(struct Context *ctx, struct Message *msg, int msgno void *uidl = NULL; char buf[LONG_STRING]; char path[_POSIX_PATH_MAX]; - progress_t progressbar; + struct Progress progressbar; POP_DATA *pop_data = (POP_DATA *) ctx->data; POP_CACHE *cache = NULL; struct Header *h = ctx->hdrs[msgno]; @@ -666,7 +666,7 @@ static int pop_sync_mailbox(struct Context *ctx, int *index_hint) int i, j, ret = 0; char buf[LONG_STRING]; POP_DATA *pop_data = (POP_DATA *) ctx->data; - progress_t progress; + struct Progress progress; #ifdef USE_HCACHE header_cache_t *hc = NULL; #endif diff --git a/pop.h b/pop.h index 460f988fb..76a0070df 100644 --- a/pop.h +++ b/pop.h @@ -97,7 +97,7 @@ int pop_parse_path(const char *path, struct Account *acct); int pop_connect(POP_DATA *pop_data); int pop_open_connection(POP_DATA *pop_data); int pop_query_d(POP_DATA *pop_data, char *buf, size_t buflen, char *msg); -int pop_fetch_data(POP_DATA *pop_data, char *query, progress_t *progressbar, +int pop_fetch_data(POP_DATA *pop_data, char *query, struct Progress *progressbar, int (*funct)(char *, void *), void *data); int pop_reconnect(struct Context *ctx); void pop_logout(struct Context *ctx); diff --git a/pop_lib.c b/pop_lib.c index 6a62b38cc..5bc7b237e 100644 --- a/pop_lib.c +++ b/pop_lib.c @@ -458,7 +458,7 @@ int pop_query_d(POP_DATA *pop_data, char *buf, size_t buflen, char *msg) * -2 - invalid command or execution error, * -3 - error in funct(*line, *data) */ -int pop_fetch_data(POP_DATA *pop_data, char *query, progress_t *progressbar, +int pop_fetch_data(POP_DATA *pop_data, char *query, struct Progress *progressbar, int (*funct)(char *, void *), void *data) { char buf[LONG_STRING]; @@ -550,7 +550,7 @@ int pop_reconnect(struct Context *ctx) { int ret; POP_DATA *pop_data = (POP_DATA *) ctx->data; - progress_t progressbar; + struct Progress progressbar; if (pop_data->status == POP_CONNECTED) return 0; diff --git a/smtp.c b/smtp.c index 7078ed822..0842e3cc5 100644 --- a/smtp.c +++ b/smtp.c @@ -159,7 +159,7 @@ static int smtp_data(struct Connection *conn, const char *msgfile) { char buf[1024]; FILE *fp = NULL; - progress_t progress; + struct Progress progress; struct stat st; int r, term = 0; size_t buflen = 0;