* fix make check, make cc10 and make line33

This commit is contained in:
Dirk-Jan C. Binnema
2011-09-18 21:29:28 +03:00
parent 3dca2a39f1
commit 553b88620e
4 changed files with 21 additions and 27 deletions

View File

@ -286,8 +286,8 @@ cmd_find (MuStore *store, MuQuery *query, GSList *lst, GError **err)
if (u == 0)
return server_error (NULL, MU_ERROR_NO_MATCHES, "No matches");
else
return MU_OK;
return MU_OK;
}
static MuError
@ -379,8 +379,7 @@ move_or_flag (MuStore *store, GSList *lst, gboolean is_move, GError **err)
GSList *flagitem;
const char *mdir;
docid = get_docid ((const char*)lst->data);
if (docid == 0)
if ((docid = get_docid ((const char*)lst->data)) == 0)
return server_error (err, MU_ERROR_IN_PARAMETERS,
"invalid docid");
@ -396,7 +395,6 @@ move_or_flag (MuStore *store, GSList *lst, gboolean is_move, GError **err)
flagitem = g_slist_nth (lst, 1);
}
flags = get_flags (mu_msg_get_path(msg),
flagitem ? (const gchar*)flagitem->data : NULL);
if (flags == MU_FLAG_INVALID) {
@ -406,7 +404,6 @@ move_or_flag (MuStore *store, GSList *lst, gboolean is_move, GError **err)
}
merr = do_move (store, docid, msg, mdir, flags, is_move, err);
mu_msg_unref (msg);
return merr;
@ -421,6 +418,8 @@ cmd_move (MuStore *store, GSList *lst, GError **err)
(NULL, MU_ERROR_IN_PARAMETERS,
"usage: flag <docid> <maildir> [<flags>]");
return move_or_flag (store, lst, TRUE, err);
}
@ -580,12 +579,12 @@ cmd_index (MuStore *store, GSList *lst, GError **err)
return server_error (NULL, MU_ERROR_IN_PARAMETERS,
"usage: index <maildir>");
maildir = (const char*)lst->data;
index = mu_index_new (store, err);
if (!index)
return server_error (err, MU_ERROR, "failed to create index");
mu_index_stats_clear (&stats);
maildir = (const char*)lst->data;
rv = mu_index_run (index, maildir, FALSE, &stats, index_msg_cb, NULL, NULL);
if (rv != MU_OK && rv != MU_STOP) {
@ -595,10 +594,9 @@ cmd_index (MuStore *store, GSList *lst, GError **err)
mu_index_stats_clear (&stats2);
rv = mu_index_cleanup (index, &stats2, NULL, NULL, err);
if (rv != MU_OK && rv != MU_STOP) {
mu_index_destroy (index);
mu_index_destroy (index);
if (rv != MU_OK && rv != MU_STOP)
return server_error (err, rv, "cleanup failed");
}
info = g_strdup_printf ("(:info index :status complete "
":processed %u :updated %u :cleaned-up %u)",

View File

@ -245,8 +245,7 @@ log_write (const char* domain, GLogLevelFlags level,
if (len == sizeof(buf))
buf[sizeof(buf)-2] = '\n';
len = write (MU_LOG->_fd, buf, (size_t)len);
if (len < 0)
if (write (MU_LOG->_fd, buf, (size_t)len) < 0)
fprintf (stderr, "%s: failed to write to log: %s\n",
__FUNCTION__, strerror(errno));

View File

@ -263,12 +263,12 @@ append_sexp_thread_info (GString *gstr, const MuMsgIterThreadInfo *ti)
char*
mu_msg_to_sexp (MuMsg *msg, unsigned docid, const MuMsgIterThreadInfo *ti,
gboolean headers)
gboolean header)
{
GString *gstr;
time_t t;
gstr = g_string_sized_new (headers ? 1024 : 8192);
gstr = g_string_sized_new (header ? 1024 : 8192);
g_string_append (gstr, "(\n");
if (docid != 0)
@ -279,8 +279,7 @@ mu_msg_to_sexp (MuMsg *msg, unsigned docid, const MuMsgIterThreadInfo *ti,
if (ti)
append_sexp_thread_info (gstr, ti);
append_sexp_attr (gstr,
"subject", mu_msg_get_subject (msg));
append_sexp_attr (gstr, "subject", mu_msg_get_subject (msg));
t = mu_msg_get_date (msg);
/* weird time format for emacs 29-bit ints...*/
@ -302,15 +301,9 @@ mu_msg_to_sexp (MuMsg *msg, unsigned docid, const MuMsgIterThreadInfo *ti,
*
* file attr things can only be gotten from the file (ie., mu
* view), not from the database (mu find). */
if (!headers)
if (!header)
append_sexp_message_file_attr (gstr, msg);
/* we register whether this a db-only msg or not; this is
* useful in the UI to know whether this should be considered
* merely a header or a full message */
g_string_append_printf (gstr, "\t:msgtype %s\n",
headers ? "header" : "view");
g_string_append (gstr, ")\n");
return g_string_free (gstr, FALSE);

View File

@ -105,7 +105,8 @@ test_mu_store_store_msg_and_count (void)
MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,",
NULL, NULL);
g_assert (msg);
g_assert_cmpuint (mu_store_add_msg (store, msg, NULL), ==, TRUE);
g_assert_cmpuint (mu_store_add_msg (store, msg, NULL),
!=, MU_STORE_INVALID_DOCID);
g_assert_cmpuint (1,==,mu_store_count (store, NULL));
g_assert_cmpuint (TRUE,==,mu_store_contains_message
(store,
@ -116,7 +117,8 @@ test_mu_store_store_msg_and_count (void)
msg = mu_msg_new_from_file (MU_TESTMAILDIR2
"bar/cur/mail3", NULL, NULL);
g_assert (msg);
g_assert_cmpuint (mu_store_add_msg (store, msg, NULL), ==, TRUE);
g_assert_cmpuint (mu_store_add_msg (store, msg, NULL),
!=, MU_STORE_INVALID_DOCID);
g_assert_cmpuint (2,==,mu_store_count (store, NULL));
g_assert_cmpuint (TRUE,==,
mu_store_contains_message (store, MU_TESTMAILDIR2
@ -128,7 +130,8 @@ test_mu_store_store_msg_and_count (void)
(MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,",
NULL, NULL);
g_assert (msg);
g_assert_cmpuint (mu_store_add_msg (store, msg, NULL), ==, TRUE);
g_assert_cmpuint (mu_store_add_msg (store, msg, NULL),
!=, MU_STORE_INVALID_DOCID);
g_assert_cmpuint (2,==,mu_store_count (store, NULL));
mu_msg_unref (msg);
@ -159,7 +162,8 @@ test_mu_store_store_msg_remove_and_count (void)
MU_TESTMAILDIR "cur/1283599333.1840_11.cthulhu!2,",
NULL, &err);
g_assert (msg);
g_assert_cmpuint (mu_store_add_msg (store, msg, NULL), ==, TRUE);
g_assert_cmpuint (mu_store_add_msg (store, msg, NULL),
!=, MU_STORE_INVALID_DOCID);
g_assert_cmpuint (1,==,mu_store_count (store, NULL));
mu_msg_unref (msg);