mu: fix some compiler warnings

This commit is contained in:
djcb 2017-06-24 12:20:16 +02:00
parent cde35be271
commit 99423234b8
4 changed files with 32 additions and 22 deletions

View File

@ -354,6 +354,7 @@ ignore_dir_entry (struct dirent *entry, unsigned char d_type)
/* looks like a backup / tempsave file */
if (entry->d_name[u + 1] == '\0')
return TRUE;
continue;
default:
continue;
}

View File

@ -429,19 +429,23 @@ append_sexp_thread_info (GString *gstr, const MuMsgIterThreadInfo *ti)
}
static void
append_sexp_param (GString *gstr, GSList *param)
append_sexp_param (GString *gstr, const GSList *param)
{
for (;param; param = g_slist_next (param)) {
const char *str;
char *key, *value;
key = param->data;
key = key ? mu_str_escape_c_literal (key, FALSE) : "";
str = param->data;
key = str ? mu_str_escape_c_literal (str, FALSE) : g_strdup ("");
param = g_slist_next (param);
value = param->data;
value = value ? mu_str_escape_c_literal (value, FALSE) : "";
str = param->data;
value = str ? mu_str_escape_c_literal (str, FALSE) : g_strdup ("");
g_string_append_printf (gstr, "(\"%s\" . \"%s\")", key, value);
g_free (key);
g_free (value);
if (param->next)
g_string_append_c (gstr, ' ');
}

View File

@ -521,23 +521,21 @@ get_body (MuMsg *self, MuMsgOptions opts, gboolean want_html)
}
struct _ContentTypeData {
const GMimeContentType *ctype;
gboolean want_html;
};
typedef struct _ContentTypeData ContentTypeData;
typedef struct {
GMimeContentType *ctype;
gboolean want_html;
} ContentTypeData;
static void
find_content_type (MuMsg *msg, MuMsgPart *mpart, ContentTypeData *cdata)
{
GMimePart *wanted;
if (!GMIME_IS_PART(mpart->data))
return;
/* text-like attachments are included when in text-mode */
GMimePart *wanted = NULL;
if (!cdata->want_html &&
(mpart->part_type & MU_MSG_PART_TYPE_TEXT_PLAIN))
wanted = mpart->data;
@ -545,8 +543,12 @@ find_content_type (MuMsg *msg, MuMsgPart *mpart, ContentTypeData *cdata)
cdata->want_html &&
(mpart->part_type & MU_MSG_PART_TYPE_TEXT_HTML))
wanted = mpart->data;
else
wanted = NULL;
if (wanted)
cdata->ctype = g_mime_object_get_content_type (wanted);
cdata->ctype = g_mime_object_get_content_type (
GMIME_OBJECT(wanted));
}
@ -554,19 +556,21 @@ static const GSList*
get_content_type_parameters (MuMsg *self, MuMsgOptions opts, gboolean want_html)
{
ContentTypeData cdata;
cdata.want_html = want_html;
cdata.ctype = NULL;
cdata.ctype = NULL;
mu_msg_part_foreach (self, opts,
(MuMsgPartForeachFunc)find_content_type,
&cdata);
if (cdata.ctype) {
const GSList *paramlist;
const GMimeParam *param;
GSList *paramlist;
const GMimeParam *param;
paramlist = NULL;
param = g_mime_content_type_get_params (cdata.ctype);
param = g_mime_content_type_get_params (cdata.ctype);
for (; param; param = param->next) {
paramlist = g_slist_prepend (paramlist,

View File

@ -183,8 +183,8 @@ test_mu_msg_02 (void)
static void
test_mu_msg_03 (void)
{
MuMsg *msg;
GSList *params;
MuMsg *msg;
const GSList *params;
msg = get_msg (MU_TESTMAILDIR4 "/1283599333.1840_11.cthulhu!2,");
g_assert_cmpstr (mu_msg_get_to(msg),
@ -201,7 +201,8 @@ test_mu_msg_03 (void)
==,
"\nLet's write some fünkÿ text\nusing umlauts.\n\nFoo.\n");
params = mu_msg_get_body_text_content_type_parameters(msg, MU_MSG_OPTION_NONE);
params = mu_msg_get_body_text_content_type_parameters(
msg, MU_MSG_OPTION_NONE);
g_assert_cmpuint (g_slist_length ((GSList*)params), ==, 2);
g_assert_cmpstr ((char*)params->data,==, "charset");
@ -375,7 +376,7 @@ test_mu_msg_references_dups (void)
mlist = mu_msg_get_mailing_list (msg);
g_assert_cmpstr (mlist ,==, "Example of List Id");
mu_msg_unref (msg);
}