* make mu compile warning-free with clang/clang++

This commit is contained in:
Dirk-Jan C. Binnema
2012-02-29 21:08:23 +02:00
parent 6761f0e5d3
commit f02bb34188
2 changed files with 25 additions and 24 deletions

View File

@ -287,7 +287,7 @@ check_param_num (GSList *args, unsigned min, unsigned max)
do { \ do { \
if (!check_param_num((ARGS),(MN),(MX))) \ if (!check_param_num((ARGS),(MN),(MX))) \
return server_error(NULL,MU_ERROR_IN_PARAMETERS, \ return server_error(NULL,MU_ERROR_IN_PARAMETERS, \
(USAGE)); \ "%s",(USAGE)); \
} while (0) } while (0)
@ -362,7 +362,8 @@ cmd_find (MuStore *store, MuQuery *query, GSList *args, GError **err)
return_if_fail_param_num (args, 2, 2, usage); return_if_fail_param_num (args, 2, 2, usage);
if ((maxnum = atoi((const char*)args->next->data)) == 0) if ((maxnum = atoi((const char*)args->next->data)) == 0)
return server_error (NULL, MU_ERROR_IN_PARAMETERS, usage); return server_error (NULL, MU_ERROR_IN_PARAMETERS,
"%s", usage);
/* TODO: ask for *all* results, then, get the <maxnum> newest /* TODO: ask for *all* results, then, get the <maxnum> newest
* ones; it seems we cannot get a sorted list of a subset of * ones; it seems we cannot get a sorted list of a subset of
@ -496,7 +497,7 @@ do_move (MuStore *store, unsigned docid, MuMsg *msg, const char *maildir,
* wel */ * wel */
rv = mu_store_update_msg (store, docid, msg, err); rv = mu_store_update_msg (store, docid, msg, err);
if (rv == MU_STORE_INVALID_DOCID) if (rv == MU_STORE_INVALID_DOCID)
return server_error (err, MU_ERROR_XAPIAN, return server_error (err, MU_ERROR_XAPIAN, "%s",
"failed to update message"); "failed to update message");
sexp = mu_msg_to_sexp (msg, docid, NULL, TRUE); sexp = mu_msg_to_sexp (msg, docid, NULL, TRUE);
@ -589,7 +590,7 @@ cmd_remove (MuStore *store, GSList *args, GError **err)
"no valid doc for docid"); "no valid doc for docid");
if (unlink (path) != 0) if (unlink (path) != 0)
return server_error (err, MU_ERROR_FILE_CANNOT_UNLINK, return server_error (err, MU_ERROR_FILE_CANNOT_UNLINK, "%s",
strerror (errno)); strerror (errno));
if (!mu_store_remove_path (store, path)) if (!mu_store_remove_path (store, path))

View File

@ -31,16 +31,16 @@ enum _MuFlags {
/* next 6 are seen in the file-info part of maildir message /* next 6 are seen in the file-info part of maildir message
* file names, ie., in a name like "1234345346:2,<fileinfo>", * file names, ie., in a name like "1234345346:2,<fileinfo>",
* <fileinfo> consists of zero or more of the following * <fileinfo> consists of zero or more of the following
* characters (in ascii order) */ * characters (in ascii order) */
MU_FLAG_DRAFT = 1 << 0, MU_FLAG_DRAFT = 1 << 0,
MU_FLAG_FLAGGED = 1 << 1, MU_FLAG_FLAGGED = 1 << 1,
MU_FLAG_PASSED = 1 << 2, MU_FLAG_PASSED = 1 << 2,
MU_FLAG_REPLIED = 1 << 3, MU_FLAG_REPLIED = 1 << 3,
MU_FLAG_SEEN = 1 << 4, MU_FLAG_SEEN = 1 << 4,
MU_FLAG_TRASHED = 1 << 5, MU_FLAG_TRASHED = 1 << 5,
/* decides on cur/ or new/ in the maildir */ /* decides on cur/ or new/ in the maildir */
MU_FLAG_NEW = 1 << 6, MU_FLAG_NEW = 1 << 6,
/* content flags -- not visible in the filename, but used for /* content flags -- not visible in the filename, but used for
* searching */ * searching */
@ -55,7 +55,7 @@ enum _MuFlags {
}; };
typedef enum _MuFlags MuFlags; typedef enum _MuFlags MuFlags;
#define MU_FLAG_INVALID ((unsigned)-1) #define MU_FLAG_INVALID ((MuFlags)-1)
enum _MuFlagType { enum _MuFlagType {
MU_FLAG_TYPE_MAILFILE = 1 << 0, MU_FLAG_TYPE_MAILFILE = 1 << 0,
@ -65,15 +65,15 @@ enum _MuFlagType {
}; };
typedef enum _MuFlagType MuFlagType; typedef enum _MuFlagType MuFlagType;
#define MU_FLAG_TYPE_ANY ((MuFlags)-1) #define MU_FLAG_TYPE_ANY ((MuFlagType)-1)
#define MU_FLAG_TYPE_INVALID ((MuFlagType)-1) #define MU_FLAG_TYPE_INVALID ((MuFlagType)-1)
/** /**
* Get the type of flag (mailfile, maildir, pseudo or content) * Get the type of flag (mailfile, maildir, pseudo or content)
* *
* @param flag a MuFlag * @param flag a MuFlag
* *
* @return the flag type or MU_FLAG_TYPE_INVALID in case of error * @return the flag type or MU_FLAG_TYPE_INVALID in case of error
*/ */
MuFlagType mu_flag_type (MuFlags flag) G_GNUC_CONST; MuFlagType mu_flag_type (MuFlags flag) G_GNUC_CONST;
@ -81,19 +81,19 @@ MuFlagType mu_flag_type (MuFlags flag) G_GNUC_CONST;
/** /**
* Get the flag character * Get the flag character
* *
* @param flag a MuFlag (single) * @param flag a MuFlag (single)
* *
* @return the character, or 0 in case of error * @return the character, or 0 in case of error
*/ */
char mu_flag_char (MuFlags flag) G_GNUC_CONST; char mu_flag_char (MuFlags flag) G_GNUC_CONST;
/** /**
* Get the flag name * Get the flag name
* *
* @param flag a single MuFlag * @param flag a single MuFlag
* *
* @return the name (don't free) as string or NULL in case of error * @return the name (don't free) as string or NULL in case of error
*/ */
const char* mu_flag_name (MuFlags flag) G_GNUC_CONST; const char* mu_flag_name (MuFlags flag) G_GNUC_CONST;
@ -101,10 +101,10 @@ const char* mu_flag_name (MuFlags flag) G_GNUC_CONST;
/** /**
* Get the string representation of an OR'ed set of flags * Get the string representation of an OR'ed set of flags
* *
* @param flags MuFlag (OR'ed) * @param flags MuFlag (OR'ed)
* @param types allowable types (OR'ed) for the result; the rest is ignored * @param types allowable types (OR'ed) for the result; the rest is ignored
* *
* @return The string representation (static, don't free), or NULL in * @return The string representation (static, don't free), or NULL in
* case of error * case of error
*/ */
@ -113,10 +113,10 @@ const char* mu_flags_to_str_s (MuFlags flags, MuFlagType types);
/** /**
* Get the (OR'ed) flags corresponding to a string representation * Get the (OR'ed) flags corresponding to a string representation
* *
* @param str the string representation * @param str the string representation
* @param types the flag types to acceps (other will be ignored) * @param types the flag types to acceps (other will be ignored)
* *
* @return the (OR'ed) flags * @return the (OR'ed) flags
*/ */
MuFlags mu_flags_from_str (const char *str, MuFlagType types); MuFlags mu_flags_from_str (const char *str, MuFlagType types);
@ -129,12 +129,12 @@ MuFlags mu_flags_from_str (const char *str, MuFlagType types);
* which means resp. "add this flag" or "remove this flag" from * which means resp. "add this flag" or "remove this flag" from
* oldflags. So, e.g. "-N+S" would unset the NEW flag and set the * oldflags. So, e.g. "-N+S" would unset the NEW flag and set the
* SEEN flag, without affecting other flags. * SEEN flag, without affecting other flags.
* *
* @param str the string representation * @param str the string representation
* @param old flags to update * @param old flags to update
* @param types the flag types to accept (other will be ignored) * @param types the flag types to accept (other will be ignored)
* *
* @return * @return
*/ */
MuFlags mu_flags_from_str_delta (const char *str, MuFlags oldflags, MuFlags mu_flags_from_str_delta (const char *str, MuFlags oldflags,
MuFlagType types); MuFlagType types);
@ -146,7 +146,7 @@ typedef void (*MuFlagsForeachFunc) (MuFlags flag, gpointer user_data);
/** /**
* call a function for each available flag * call a function for each available flag
* *
* @param func a function to call * @param func a function to call
* @param user_data a user pointer to pass to the function * @param user_data a user pointer to pass to the function
*/ */