From 6b9af3bc4616208e7ff06a6d755618057130129f Mon Sep 17 00:00:00 2001 From: Not Zed Date: Mon, 16 Aug 2004 03:31:21 +0000 Subject: don't include the terminating NUL in the data length. 2004-08-13 Not Zed * em-utils.c (em_utils_message_to_html): don't include the terminating NUL in the data length. (em_utils_part_to_html): nor here. svn path=/trunk/; revision=26942 --- mail/ChangeLog | 6 ++++++ mail/em-utils.c | 34 +++++++++++++++++----------------- 2 files changed, 23 insertions(+), 17 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index cdfd4f8ef5..4eb07d0555 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2004-08-13 Not Zed + + * em-utils.c (em_utils_message_to_html): don't include the + terminating NUL in the data length. + (em_utils_part_to_html): nor here. + 2004-08-12 Carlos Garnacho Parro * em-utils.c: Optionally use GtkFileChooser if compiled against diff --git a/mail/em-utils.c b/mail/em-utils.c index b46a77646d..6d7d4a2ba6 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -1417,17 +1417,17 @@ em_utils_part_to_html(CamelMimePart *part, ssize_t *len, EMFormat *source) if (source->charset) em_format_set_default_charset((EMFormat *)emfq, source->charset); } - em_format_part((EMFormat *) emfq, (CamelStream *) mem, part); - g_object_unref (emfq); - - camel_stream_write ((CamelStream *) mem, "", 1); - camel_object_unref (mem); - + em_format_part((EMFormat *) emfq, (CamelStream *)mem, part); + g_object_unref(emfq); + + camel_stream_write((CamelStream *) mem, "", 1); + camel_object_unref(mem); + text = buf->data; if (len) - *len = buf->len; + *len = buf->len-1; g_byte_array_free (buf, FALSE); - + return text; } @@ -1450,24 +1450,24 @@ em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32 CamelStreamMem *mem; GByteArray *buf; char *text; - + buf = g_byte_array_new (); mem = (CamelStreamMem *) camel_stream_mem_new (); camel_stream_mem_set_byte_array (mem, buf); - + emfq = em_format_quote_new(credits, (CamelStream *)mem, flags); em_format_set_session((EMFormat *)emfq, session); em_format_format_clone((EMFormat *)emfq, NULL, NULL, message, source); g_object_unref (emfq); - - camel_stream_write ((CamelStream *) mem, "", 1); - camel_object_unref (mem); - + + camel_stream_write((CamelStream *)mem, "", 1); + camel_object_unref(mem); + text = buf->data; if (len) - *len = buf->len; - g_byte_array_free (buf, FALSE); - + *len = buf->len-1; + g_byte_array_free(buf, FALSE); + return text; } -- cgit v1.2.3