aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-11-01 08:55:38 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-11-01 08:55:38 +0800
commite0668b4fde4f2800ad223b226fe04b7ccb42c56a (patch)
treeed59a1cfe63526049a48c405945d8676bc5fabb3
parenta4768bf6b4c80e7dca746097251702a0d1d8020a (diff)
downloadgsoc2013-evolution-e0668b4fde4f2800ad223b226fe04b7ccb42c56a.tar.gz
gsoc2013-evolution-e0668b4fde4f2800ad223b226fe04b7ccb42c56a.tar.zst
gsoc2013-evolution-e0668b4fde4f2800ad223b226fe04b7ccb42c56a.zip
Shouldn't we be strdup'ing the content? This seems to fix the memory
2000-10-31 Jeffrey Stedfast <fejj@helixcode.com> * mail-format.c (mail_get_message_body): Shouldn't we be strdup'ing the content? This seems to fix the memory corruption problems. (mail_generate_reply): Make sure that the last char in the generated reply text is '\0' (when bodt text doesn't end with a \n, a random char will appear otherwise). svn path=/trunk/; revision=6306
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/mail-callbacks.c4
-rw-r--r--mail/mail-format.c43
3 files changed, 32 insertions, 24 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index a7e6b3c46f..447547fdc6 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+2000-10-31 Jeffrey Stedfast <fejj@helixcode.com>
+
+ * mail-format.c (mail_get_message_body): Shouldn't we be
+ strdup'ing the content? This seems to fix the memory corruption
+ problems.
+ (mail_generate_reply): Make sure that the last char in the
+ generated reply text is '\0' (when bodt text doesn't end with a
+ \n, a random char will appear otherwise).
+
2000-10-31 Dan Winship <danw@helixcode.com>
* mail-config-gui.c (do_test_service): Update for
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 306b4e2003..efe5f8d1f5 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -745,8 +745,8 @@ filter_edit (BonoboUIComponent *uih, void *user_data, const char *path)
GtkWidget *dialog;
gchar *err;
- err = g_strdup_printf (_("Error loading filter information:\n"
- "%s"), ((RuleContext *)fc)->error);
+ err = g_strdup_printf (_("Error loading filter information:\n%s"),
+ ((RuleContext *)fc)->error);
dialog = gnome_warning_dialog (err);
g_free (err);
diff --git a/mail/mail-format.c b/mail/mail-format.c
index 76c21000a6..edf64be621 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -1540,46 +1540,47 @@ mail_get_message_body (CamelDataWrapper *data, gboolean want_plain, gboolean *is
const char *boundary;
char *text = NULL;
GMimeContentField *mime_type;
-
+
/* We only include text, message, and multipart bodies. */
mime_type = camel_data_wrapper_get_mime_type_field (data);
-
+
/* FIXME: This is wrong. We don't want to include large
* images. But if we don't do it this way, we don't get
* the headers...
*/
if (g_strcasecmp (mime_type->type, "message") == 0) {
*is_html = FALSE;
- return get_data_wrapper_text (data);
+ return g_strdup (get_data_wrapper_text (data));
}
-
+
if (g_strcasecmp (mime_type->type, "text") == 0) {
+ fprintf (stderr, "here we are...\n");
*is_html = !g_strcasecmp (mime_type->subtype, "html");
- return get_data_wrapper_text (data);
+ return g_strdup (get_data_wrapper_text (data));
}
-
+
/* If it's not message and it's not text, and it's not
* multipart, we don't want to deal with it.
*/
if (g_strcasecmp (mime_type->type, "multipart") != 0)
return NULL;
-
+
mp = CAMEL_MULTIPART (data);
-
+
if (g_strcasecmp (mime_type->subtype, "alternative") == 0) {
/* Pick our favorite alternative and reply to it. */
-
+
subpart = find_preferred_alternative (mp, want_plain);
if (!subpart)
return NULL;
-
+
data = camel_medium_get_content_object (
CAMEL_MEDIUM (subpart));
return mail_get_message_body (data, want_plain, is_html);
}
-
+
nparts = camel_multipart_get_number (mp);
-
+
/* Otherwise, concatenate all the parts that we can. If we find
* an HTML part in there though, return just that: We don't want
* to deal with merging HTML and non-HTML parts.
@@ -1587,10 +1588,10 @@ mail_get_message_body (CamelDataWrapper *data, gboolean want_plain, gboolean *is
boundary = camel_multipart_get_boundary (mp);
for (i = 0; i < nparts; i++) {
subpart = camel_multipart_get_part (mp, i);
-
+
if (!mail_part_is_inline (subpart))
continue;
-
+
data = camel_medium_get_content_object (
CAMEL_MEDIUM (subpart));
subtext = mail_get_message_body (data, want_plain, is_html);
@@ -1600,20 +1601,17 @@ mail_get_message_body (CamelDataWrapper *data, gboolean want_plain, gboolean *is
g_free (text);
return subtext;
}
-
+
if (text) {
old = text;
- text = g_strdup_printf ("%s\n--%s\n%s", text,
+ text = g_strdup_printf ("%s\n--%s\n%s", old,
boundary, subtext);
g_free (subtext);
g_free (old);
} else
text = subtext;
}
-
- if (!text)
- return NULL;
-
+
return text;
}
@@ -1688,12 +1686,13 @@ mail_generate_reply (CamelMimeMessage *message, gboolean to_all)
break;
d += len + 3;
}
+ *d = '\0';
/* Now convert that to HTML. */
- repl_text = e_text_to_html (quoted_text,
- E_TEXT_TO_HTML_PRE);
+ repl_text = e_text_to_html (quoted_text, E_TEXT_TO_HTML_PRE);
g_free (quoted_text);
}
+
e_msg_composer_set_body_text (composer, repl_text);
g_free (repl_text);
g_free (text);