mu: fix some compiler warnings
This commit is contained in:
@ -354,6 +354,7 @@ ignore_dir_entry (struct dirent *entry, unsigned char d_type)
|
|||||||
/* looks like a backup / tempsave file */
|
/* looks like a backup / tempsave file */
|
||||||
if (entry->d_name[u + 1] == '\0')
|
if (entry->d_name[u + 1] == '\0')
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
continue;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -429,19 +429,23 @@ append_sexp_thread_info (GString *gstr, const MuMsgIterThreadInfo *ti)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
append_sexp_param (GString *gstr, GSList *param)
|
append_sexp_param (GString *gstr, const GSList *param)
|
||||||
{
|
{
|
||||||
for (;param; param = g_slist_next (param)) {
|
for (;param; param = g_slist_next (param)) {
|
||||||
|
const char *str;
|
||||||
char *key, *value;
|
char *key, *value;
|
||||||
|
|
||||||
key = param->data;
|
str = param->data;
|
||||||
key = key ? mu_str_escape_c_literal (key, FALSE) : "";
|
key = str ? mu_str_escape_c_literal (str, FALSE) : g_strdup ("");
|
||||||
|
|
||||||
param = g_slist_next (param);
|
param = g_slist_next (param);
|
||||||
value = param->data;
|
str = param->data;
|
||||||
value = value ? mu_str_escape_c_literal (value, FALSE) : "";
|
value = str ? mu_str_escape_c_literal (str, FALSE) : g_strdup ("");
|
||||||
|
|
||||||
g_string_append_printf (gstr, "(\"%s\" . \"%s\")", key, value);
|
g_string_append_printf (gstr, "(\"%s\" . \"%s\")", key, value);
|
||||||
|
g_free (key);
|
||||||
|
g_free (value);
|
||||||
|
|
||||||
if (param->next)
|
if (param->next)
|
||||||
g_string_append_c (gstr, ' ');
|
g_string_append_c (gstr, ' ');
|
||||||
}
|
}
|
||||||
|
|||||||
30
lib/mu-msg.c
30
lib/mu-msg.c
@ -521,23 +521,21 @@ get_body (MuMsg *self, MuMsgOptions opts, gboolean want_html)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct _ContentTypeData {
|
typedef struct {
|
||||||
const GMimeContentType *ctype;
|
GMimeContentType *ctype;
|
||||||
gboolean want_html;
|
gboolean want_html;
|
||||||
};
|
} ContentTypeData;
|
||||||
typedef struct _ContentTypeData ContentTypeData;
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
find_content_type (MuMsg *msg, MuMsgPart *mpart, ContentTypeData *cdata)
|
find_content_type (MuMsg *msg, MuMsgPart *mpart, ContentTypeData *cdata)
|
||||||
{
|
{
|
||||||
|
GMimePart *wanted;
|
||||||
|
|
||||||
if (!GMIME_IS_PART(mpart->data))
|
if (!GMIME_IS_PART(mpart->data))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* text-like attachments are included when in text-mode */
|
/* text-like attachments are included when in text-mode */
|
||||||
|
|
||||||
GMimePart *wanted = NULL;
|
|
||||||
|
|
||||||
if (!cdata->want_html &&
|
if (!cdata->want_html &&
|
||||||
(mpart->part_type & MU_MSG_PART_TYPE_TEXT_PLAIN))
|
(mpart->part_type & MU_MSG_PART_TYPE_TEXT_PLAIN))
|
||||||
wanted = mpart->data;
|
wanted = mpart->data;
|
||||||
@ -545,8 +543,12 @@ find_content_type (MuMsg *msg, MuMsgPart *mpart, ContentTypeData *cdata)
|
|||||||
cdata->want_html &&
|
cdata->want_html &&
|
||||||
(mpart->part_type & MU_MSG_PART_TYPE_TEXT_HTML))
|
(mpart->part_type & MU_MSG_PART_TYPE_TEXT_HTML))
|
||||||
wanted = mpart->data;
|
wanted = mpart->data;
|
||||||
|
else
|
||||||
|
wanted = NULL;
|
||||||
|
|
||||||
if (wanted)
|
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)
|
get_content_type_parameters (MuMsg *self, MuMsgOptions opts, gboolean want_html)
|
||||||
{
|
{
|
||||||
ContentTypeData cdata;
|
ContentTypeData cdata;
|
||||||
|
|
||||||
cdata.want_html = want_html;
|
cdata.want_html = want_html;
|
||||||
cdata.ctype = NULL;
|
cdata.ctype = NULL;
|
||||||
|
|
||||||
mu_msg_part_foreach (self, opts,
|
mu_msg_part_foreach (self, opts,
|
||||||
(MuMsgPartForeachFunc)find_content_type,
|
(MuMsgPartForeachFunc)find_content_type,
|
||||||
&cdata);
|
&cdata);
|
||||||
|
|
||||||
if (cdata.ctype) {
|
if (cdata.ctype) {
|
||||||
const GSList *paramlist;
|
|
||||||
const GMimeParam *param;
|
GSList *paramlist;
|
||||||
|
const GMimeParam *param;
|
||||||
|
|
||||||
paramlist = NULL;
|
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) {
|
for (; param; param = param->next) {
|
||||||
paramlist = g_slist_prepend (paramlist,
|
paramlist = g_slist_prepend (paramlist,
|
||||||
|
|||||||
@ -183,8 +183,8 @@ test_mu_msg_02 (void)
|
|||||||
static void
|
static void
|
||||||
test_mu_msg_03 (void)
|
test_mu_msg_03 (void)
|
||||||
{
|
{
|
||||||
MuMsg *msg;
|
MuMsg *msg;
|
||||||
GSList *params;
|
const GSList *params;
|
||||||
|
|
||||||
msg = get_msg (MU_TESTMAILDIR4 "/1283599333.1840_11.cthulhu!2,");
|
msg = get_msg (MU_TESTMAILDIR4 "/1283599333.1840_11.cthulhu!2,");
|
||||||
g_assert_cmpstr (mu_msg_get_to(msg),
|
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");
|
"\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_cmpuint (g_slist_length ((GSList*)params), ==, 2);
|
||||||
|
|
||||||
g_assert_cmpstr ((char*)params->data,==, "charset");
|
g_assert_cmpstr ((char*)params->data,==, "charset");
|
||||||
@ -375,7 +376,7 @@ test_mu_msg_references_dups (void)
|
|||||||
|
|
||||||
mlist = mu_msg_get_mailing_list (msg);
|
mlist = mu_msg_get_mailing_list (msg);
|
||||||
g_assert_cmpstr (mlist ,==, "Example of List Id");
|
g_assert_cmpstr (mlist ,==, "Example of List Id");
|
||||||
|
|
||||||
mu_msg_unref (msg);
|
mu_msg_unref (msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user