]> granicus.if.org Git - neomutt/commitdiff
convert format flags enum into an int
authorRichard Russon <rich@flatcap.org>
Mon, 25 Feb 2019 23:28:52 +0000 (23:28 +0000)
committerRichard Russon <rich@flatcap.org>
Wed, 27 Feb 2019 15:17:43 +0000 (15:17 +0000)
This wasn't really an enumeration, but a set of flags.

24 files changed:
addrbook.c
browser.c
compose.c
compress.c
format_flags.h
hdrline.c
hdrline.h
index.c
mutt_history.c
muttlib.c
muttlib.h
ncrypt/crypt_gpgme.c
ncrypt/pgpinvoke.c
ncrypt/pgpkey.c
ncrypt/smime.c
nntp/browse.c
nntp/newsrc.c
nntp/nntp.h
query.c
recvattach.c
recvattach.h
remailer.c
sidebar.c
status.c

index 849792d580cfdd12f1abe134be36fb7a4ecbbd57..604c83491591a8612b8499445d2e46efc2f7a553 100644 (file)
@@ -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;
index e81216549cf1ca77c75c1dfc4c19e9b063ae3f34..ff8620d00f924628a27547ac040431254725da52 100644 (file)
--- 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;
index 32a516eaafc0d539a77b3fff82ba2ecf8f1c0ab2..4f05fcee5f8da9bdb173a53287cc35716a7bfabb 100644 (file)
--- 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);
index e33fd56b61cb2140b0426d6d66ee3753561b71df..ad1b14e701ff3e57feb691c75639618bfa4b8c40 100644 (file)
@@ -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;
index 528b49618aaa275b92aeec4f9a5224eddbb0d2be..b66e790f24d460264a33c6d9f0073cc3e7bb6963 100644 (file)
 
 #include <stddef.h>
 
-/**
- * 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 */
index 0c26e5daade2812cdb1dcc60e0d124977a1f2b86..47bd59cf05852c0c176d466feca7fcdc450c6bb6 100644 (file)
--- 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);
 }
index e27d1e5de0f2e022a00fdb08c509eed7a7d63df7..88acaf405c230fb52d256a13784191b9cb68c068 100644 (file)
--- 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 150e3459dd32305384928dcb903ac2d002740ddb..ef700f77af9275e8164da1e272a3a9997efca9c5 100644 (file)
--- 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)
index 41e30c1caeb64061e8ca2f1267928bbca95cc9a7..0bb89f73f86af9bd6fdc894040918aa912385cb3 100644 (file)
@@ -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;
 
index 62abf9ff40e04e635b9a975aa234503c7ad81a36..9fd2127da5b73bb6898bb422a374b806c6bd0ec5 100644 (file)
--- 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];
index 551b2c9b8a40d42285f427a2a474324b76d65747..03be75c5e5feff257f337a01e861e80564eee1bb 100644 (file)
--- 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);
index 1c10eee1ddb61ad56bb6c036f8c5e4bb537e39f2..cdde37a4c1874eaa393a659788e68bd2ed98ead4 100644 (file)
@@ -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;
index 6f098aa195ae0eb8c9bd10d3185f1caa94da66d9..f64478cb146eefa68a872692f34e5a2fd71724f8 100644 (file)
@@ -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;
index e8354e2af17e77b190b0e6cfd87ee30c5141d94c..146b8205e043ebafdbd3a96422a6c40af0f3e886 100644 (file)
@@ -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;
index a8146399ada73dd5cface4b6f5e93e496f254cca..5a54c9feff5960483d4e8561f898c50e099fb282 100644 (file)
@@ -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;
index b483e2da6212f8551b0bbe223cb48e7cdd06642e..ab64286e185fdac279cf2ed2f003553157de38e8 100644 (file)
@@ -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;
index 9c6445c02cc38a745559c5f27d928076b9ceb2f8..3022bf7f3395803233d60cb12d4a63f5afda5036 100644 (file)
@@ -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;
index d2cd3ca361936faca90c351e4291448007445819..1f14bba26192f3f7105c68740b69a4bbaebac599 100644 (file)
@@ -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 8ea86ec54e44f32913ee2f50dbb46f4da04d16d2..a6580c265ad6c0c05141da5ee837fbb5c037629d 100644 (file)
--- 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;
index 74822fa769b8a350aef80e4c498509dcecb4ade9..b64ac5edf0c50067a01debdb073ee4cca31530f4 100644 (file)
@@ -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];
index add715445b6b2b09af1bd0bf78d01dfc4cd20a50..0fe15078e14a481998ab39d2324840c142893ae8 100644 (file)
@@ -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 */
index 0d8d497c35157f379ef32dff764b4d848609bc48..87eb86343829192db8798115c26342bf72dfcfa5 100644 (file)
@@ -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;
index 4ba04740ac2c74bc33beb259b1ebe255314fbe51..5076d28d8451b416490c41d9c918098f2b7b0684 100644 (file)
--- 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;
index 2702d833283558d9e0fe185172e91d0e226cc01a..508bcf60741474665cce95268d4640969f3ceb10 100644 (file)
--- 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);