From: Richard Russon Date: Mon, 25 Feb 2019 23:28:52 +0000 (+0000) Subject: convert format flags enum into an int X-Git-Tag: 2019-10-25~354^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ef122c7df707f236ed1d04a244e4dc2ea525a937;p=neomutt convert format flags enum into an int This wasn't really an enumeration, but a set of flags. --- diff --git a/addrbook.c b/addrbook.c index 849792d58..604c83491 100644 --- a/addrbook.c +++ b/addrbook.c @@ -71,7 +71,7 @@ static const struct Mapping AliasHelp[] = { static const char *alias_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) + unsigned long data, int flags) { char fmt[SHORT_STRING], addr[SHORT_STRING]; struct Alias *alias = (struct Alias *) data; diff --git a/browser.c b/browser.c index e81216549..ff8620d00 100644 --- a/browser.c +++ b/browser.c @@ -358,7 +358,7 @@ static bool link_is_dir(const char *folder, const char *path) static const char *folder_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) + unsigned long data, int flags) { char fn[SHORT_STRING], fmt[SHORT_STRING], permission[11]; char *t_fmt = NULL; diff --git a/compose.c b/compose.c index 32a516eaa..4f05fcee5 100644 --- a/compose.c +++ b/compose.c @@ -811,7 +811,7 @@ static unsigned long cum_attachs_size(struct Menu *menu) static const char *compose_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) + unsigned long data, int flags) { char fmt[SHORT_STRING], tmp[SHORT_STRING]; int optional = (flags & MUTT_FORMAT_OPTIONAL); diff --git a/compress.c b/compress.c index e33fd56b6..ad1b14e70 100644 --- a/compress.c +++ b/compress.c @@ -262,7 +262,7 @@ static void free_compress_info(struct Mailbox *m) static const char *compress_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) + unsigned long data, int flags) { if (!buf || (data == 0)) return src; diff --git a/format_flags.h b/format_flags.h index 528b49618..b66e790f2 100644 --- a/format_flags.h +++ b/format_flags.h @@ -25,20 +25,14 @@ #include -/** - * enum FormatFlag - Control the behaviour of mutt_expando_format() - */ -enum FormatFlag -{ - MUTT_FORMAT_FORCESUBJ = (1 << 0), ///< print the subject even if unchanged - MUTT_FORMAT_TREE = (1 << 1), ///< draw the thread tree - MUTT_FORMAT_OPTIONAL = (1 << 2), ///< allow optional field processing - MUTT_FORMAT_STAT_FILE = (1 << 3), ///< used by attach_format_str - MUTT_FORMAT_ARROWCURSOR = (1 << 4), ///< reserve space for arrow_cursor - MUTT_FORMAT_INDEX = (1 << 5), ///< this is a main index entry - MUTT_FORMAT_NOFILTER = (1 << 6), ///< do not allow filtering on this pass - MUTT_FORMAT_PLAIN = (1 << 7), ///< do not prepend DISP_TO, DISP_CC ... -}; +#define MUTT_FORMAT_FORCESUBJ (1 << 0) ///< Print the subject even if unchanged +#define MUTT_FORMAT_TREE (1 << 1) ///< Draw the thread tree +#define MUTT_FORMAT_OPTIONAL (1 << 2) ///< Allow optional field processing +#define MUTT_FORMAT_STAT_FILE (1 << 3) ///< Used by attach_format_str +#define MUTT_FORMAT_ARROWCURSOR (1 << 4) ///< Reserve space for arrow_cursor +#define MUTT_FORMAT_INDEX (1 << 5) ///< This is a main index entry +#define MUTT_FORMAT_NOFILTER (1 << 6) ///< Do not allow filtering on this pass +#define MUTT_FORMAT_PLAIN (1 << 7) ///< Do not prepend DISP_TO, DISP_CC ... /** * typedef format_t - Prototype for a mutt_expando_format() callback function @@ -64,6 +58,6 @@ enum FormatFlag typedef const char *format_t(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags); + unsigned long data, int flags); #endif /* MUTT_FORMAT_FLAGS_H */ diff --git a/hdrline.c b/hdrline.c index 0c26e5daa..47bd59cf0 100644 --- a/hdrline.c +++ b/hdrline.c @@ -196,7 +196,7 @@ static bool first_mailing_list(char *buf, size_t buflen, struct Address *a) * * The colors are stored as "magic" strings embedded in the text. */ -static size_t add_index_color(char *buf, size_t buflen, enum FormatFlag flags, char color) +static size_t add_index_color(char *buf, size_t buflen, int flags, char color) { /* only add color markers if we are operating on main index entries. */ if (!(flags & MUTT_FORMAT_INDEX)) @@ -301,8 +301,7 @@ static const char *make_from_prefix(enum FieldType disp) * The field can optionally be prefixed by a character from $from_chars. * If $from_chars is not set, the prefix will be, "To", "Cc", etc */ -static void make_from(struct Envelope *env, char *buf, size_t buflen, - bool do_lists, enum FormatFlag flags) +static void make_from(struct Envelope *env, char *buf, size_t buflen, bool do_lists, int flags) { if (!env || !buf) return; @@ -547,7 +546,7 @@ static bool thread_is_old(struct Context *ctx, struct Email *e) static const char *index_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) + unsigned long data, int flags) { struct HdrFormatInfo *hfi = (struct HdrFormatInfo *) data; char fmt[SHORT_STRING], tmp[LONG_STRING], *p, *tags = NULL; @@ -1454,7 +1453,7 @@ static const char *index_format_str(char *buf, size_t buflen, size_t col, int co * @param flags Format flags */ void mutt_make_string_flags(char *buf, size_t buflen, const char *s, struct Context *ctx, - struct Mailbox *m, struct Email *e, enum FormatFlag flags) + struct Mailbox *m, struct Email *e, int flags) { struct HdrFormatInfo hfi; @@ -1477,7 +1476,7 @@ void mutt_make_string_flags(char *buf, size_t buflen, const char *s, struct Cont * @param flags Format flags */ void mutt_make_string_info(char *buf, size_t buflen, int cols, const char *s, - struct HdrFormatInfo *hfi, enum FormatFlag flags) + struct HdrFormatInfo *hfi, int flags) { mutt_expando_format(buf, buflen, 0, cols, s, index_format_str, (unsigned long) hfi, flags); } diff --git a/hdrline.h b/hdrline.h index e27d1e5de..88acaf405 100644 --- a/hdrline.h +++ b/hdrline.h @@ -52,9 +52,9 @@ bool mutt_is_mail_list(struct Address *addr); bool mutt_is_subscribed_list(struct Address *addr); void mutt_make_string_flags(char *buf, size_t buflen, const char *s, struct Context *ctx, struct Mailbox *m, - struct Email *e, enum FormatFlag flags); + struct Email *e, int flags); void mutt_make_string_info(char *buf, size_t buflen, int cols, const char *s, - struct HdrFormatInfo *hfi, enum FormatFlag flags); + struct HdrFormatInfo *hfi, int flags); #define mutt_make_string(BUF, BUFLEN, S, CTX, M, E) \ mutt_make_string_flags(BUF, BUFLEN, S, CTX, M, E, 0) diff --git a/index.c b/index.c index 150e3459d..ef700f77a 100644 --- a/index.c +++ b/index.c @@ -734,7 +734,7 @@ void index_make_entry(char *buf, size_t buflen, struct Menu *menu, int line) if (!e) return; - enum FormatFlag flag = MUTT_FORMAT_ARROWCURSOR | MUTT_FORMAT_INDEX; + int flag = MUTT_FORMAT_ARROWCURSOR | MUTT_FORMAT_INDEX; struct MuttThread *tmp = NULL; if ((Sort & SORT_MASK) == SORT_THREADS && e->tree) diff --git a/mutt_history.c b/mutt_history.c index 41e30c1ca..0bb89f73f 100644 --- a/mutt_history.c +++ b/mutt_history.c @@ -56,7 +56,7 @@ static const struct Mapping HistoryHelp[] = { static const char *history_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) + unsigned long data, int flags) { char *match = (char *) data; diff --git a/muttlib.c b/muttlib.c index 62abf9ff4..9fd2127da 100644 --- a/muttlib.c +++ b/muttlib.c @@ -814,7 +814,7 @@ void mutt_safe_path(char *buf, size_t buflen, struct Address *a) * @param[in] flags Callback flags */ void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, - format_t *callback, unsigned long data, enum FormatFlag flags) + format_t *callback, unsigned long data, int flags) { char prefix[SHORT_STRING], tmp[LONG_STRING], *cp = NULL, *wptr = buf, ch; char if_str[SHORT_STRING], else_str[SHORT_STRING]; diff --git a/muttlib.h b/muttlib.h index 551b2c9b8..03be75c5e 100644 --- a/muttlib.h +++ b/muttlib.h @@ -46,7 +46,7 @@ void mutt_buffer_adv_mktemp (struct Buffer *buf); void mutt_buffer_mktemp_full(struct Buffer *buf, const char *prefix, const char *suffix, const char *src, int line); int mutt_check_overwrite(const char *attname, const char *path, char *fname, size_t flen, int *append, char **directory); void mutt_encode_path(char *dest, size_t dlen, const char *src); -void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t *callback, unsigned long data, enum FormatFlag flags); +void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t *callback, unsigned long data, int flags); char * mutt_expand_path(char *s, size_t slen); char * mutt_expand_path_regex(char *s, size_t slen, bool regex); char * mutt_gecos_name(char *dest, size_t destlen, struct passwd *pw); diff --git a/ncrypt/crypt_gpgme.c b/ncrypt/crypt_gpgme.c index 1c10eee1d..cdde37a4c 100644 --- a/ncrypt/crypt_gpgme.c +++ b/ncrypt/crypt_gpgme.c @@ -3309,7 +3309,7 @@ int smime_gpgme_application_handler(struct Body *a, struct State *s) static const char *crypt_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) + unsigned long data, int flags) { char fmt[SHORT_STRING]; int kflags = 0; diff --git a/ncrypt/pgpinvoke.c b/ncrypt/pgpinvoke.c index 6f098aa19..f64478cb1 100644 --- a/ncrypt/pgpinvoke.c +++ b/ncrypt/pgpinvoke.c @@ -94,7 +94,7 @@ struct PgpCommandContext static const char *fmt_pgp_command(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) + unsigned long data, int flags) { char fmt[SHORT_STRING]; struct PgpCommandContext *cctx = (struct PgpCommandContext *) data; diff --git a/ncrypt/pgpkey.c b/ncrypt/pgpkey.c index e8354e2af..146b8205e 100644 --- a/ncrypt/pgpkey.c +++ b/ncrypt/pgpkey.c @@ -174,7 +174,7 @@ struct PgpEntry static const char *pgp_entry_fmt(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) + unsigned long data, int flags) { char fmt[SHORT_STRING]; int kflags = 0; diff --git a/ncrypt/smime.c b/ncrypt/smime.c index a8146399a..5a54c9fef 100644 --- a/ncrypt/smime.c +++ b/ncrypt/smime.c @@ -212,7 +212,7 @@ int smime_class_valid_passphrase(void) static const char *fmt_smime_command(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) + unsigned long data, int flags) { char fmt[SHORT_STRING]; struct SmimeCommandContext *cctx = (struct SmimeCommandContext *) data; diff --git a/nntp/browse.c b/nntp/browse.c index b483e2da6..ab64286e1 100644 --- a/nntp/browse.c +++ b/nntp/browse.c @@ -54,7 +54,7 @@ const char *group_index_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) + unsigned long data, int flags) { char fn[SHORT_STRING], fmt[SHORT_STRING]; struct Folder *folder = (struct Folder *) data; diff --git a/nntp/newsrc.c b/nntp/newsrc.c index 9c6445c02..3022bf7f3 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -919,7 +919,7 @@ void nntp_clear_cache(struct NntpAccountData *adata) */ const char *nntp_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, - const char *else_str, unsigned long data, enum FormatFlag flags) + const char *else_str, unsigned long data, int flags) { struct NntpAccountData *adata = (struct NntpAccountData *) data; struct ConnAccount *acct = &adata->conn->account; diff --git a/nntp/nntp.h b/nntp/nntp.h index d2cd3ca36..1f14bba26 100644 --- a/nntp/nntp.h +++ b/nntp/nntp.h @@ -171,10 +171,10 @@ void nntp_newsrc_close(struct NntpAccountData *adata); void nntp_mailbox(struct Mailbox *m, char *buf, size_t buflen); void nntp_expand_path(char *buf, size_t buflen, struct ConnAccount *acct); void nntp_clear_cache(struct NntpAccountData *adata); -const char *nntp_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, unsigned long data, enum FormatFlag flags); +const char *nntp_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, unsigned long data, int flags); int nntp_compare_order(const void *a, const void *b); int nntp_path_probe(const char *path, const struct stat *st); -const char *group_index_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, unsigned long data, enum FormatFlag flags); +const char *group_index_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, unsigned long data, int flags); int nntp_complete(char *buf, size_t buflen); #endif /* MUTT_NNTP_NNTP_H */ diff --git a/query.c b/query.c index 8ea86ec54..a6580c265 100644 --- a/query.c +++ b/query.c @@ -247,7 +247,7 @@ static int query_search(struct Menu *menu, regex_t *rx, int line) static const char *query_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) + unsigned long data, int flags) { struct Entry *entry = (struct Entry *) data; struct Query *query = entry->data; diff --git a/recvattach.c b/recvattach.c index 74822fa76..b64ac5edf 100644 --- a/recvattach.c +++ b/recvattach.c @@ -205,10 +205,9 @@ void mutt_update_tree(struct AttachCtx *actx) * | \%u | Unlink * | \%X | Number of qualifying MIME parts in this part and its children */ -const char *attach_format_str(char *buf, size_t buflen, size_t col, int cols, - char op, const char *src, const char *prec, - const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) +const char *attach_format_str(char *buf, size_t buflen, size_t col, int cols, char op, + const char *src, const char *prec, const char *if_str, + const char *else_str, unsigned long data, int flags) { char fmt[SHORT_STRING]; char charset[SHORT_STRING]; diff --git a/recvattach.h b/recvattach.h index add715445..0fe15078e 100644 --- a/recvattach.h +++ b/recvattach.h @@ -41,7 +41,7 @@ extern char *MessageFormat; void mutt_attach_init(struct AttachCtx *actx); void mutt_update_tree(struct AttachCtx *actx); -const char *attach_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, unsigned long data, enum FormatFlag flags); +const char *attach_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, unsigned long data, int flags); void mutt_view_attachments(struct Email *e); #endif /* MUTT_RECVATTACH_H */ diff --git a/remailer.c b/remailer.c index 0d8d497c3..87eb86343 100644 --- a/remailer.c +++ b/remailer.c @@ -435,7 +435,7 @@ static const char *mix_format_caps(struct Remailer *r) static const char *mix_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) + unsigned long data, int flags) { char fmt[SHORT_STRING]; struct Remailer *remailer = (struct Remailer *) data; diff --git a/sidebar.c b/sidebar.c index 4ba04740a..5076d28d8 100644 --- a/sidebar.c +++ b/sidebar.c @@ -113,7 +113,7 @@ enum DivType static const char *sidebar_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) + unsigned long data, int flags) { struct SbEntry *sbe = (struct SbEntry *) data; unsigned int optional; diff --git a/status.c b/status.c index 2702d8332..508bcf607 100644 --- a/status.c +++ b/status.c @@ -90,7 +90,7 @@ static char *get_sort_str(char *buf, size_t buflen, int method) static const char *status_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, - unsigned long data, enum FormatFlag flags) + unsigned long data, int flags) { char fmt[SHORT_STRING], tmp[SHORT_STRING], *cp = NULL; int count, optional = (flags & MUTT_FORMAT_OPTIONAL);