[evolution-mapi/gnome-2-28] Bug #608320 - Also close Unicode string with \0\0 in a stream
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-mapi/gnome-2-28] Bug #608320 - Also close Unicode string with \0\0 in a stream
- Date: Fri, 29 Jan 2010 13:39:58 +0000 (UTC)
commit 43335b30a4bc8313f4fd8d1e330a62198dde7812
Author: Milan Crha <mcrha redhat com>
Date: Fri Jan 29 14:39:48 2010 +0100
Bug #608320 - Also close Unicode string with \0\0 in a stream
src/camel/camel-mapi-utils.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/camel/camel-mapi-utils.c b/src/camel/camel-mapi-utils.c
index 637b174..657f3e2 100644
--- a/src/camel/camel-mapi-utils.c
+++ b/src/camel/camel-mapi-utils.c
@@ -166,12 +166,18 @@ mapi_item_set_body_stream (MapiItem *item, CamelStream *body, MapiItemPartType p
} else {
gsize written = 0;
gchar *in_unicode;
+ guint8 byte = 0;
+ while (stream->value->len > 0 && !stream->value->data [stream->value->len - 1]) {
+ stream->value->len--;
+ }
/* convert to unicode, because stream is supposed to be in it */
in_unicode = g_convert ((const gchar *)stream->value->data, stream->value->len, "UTF-16", "UTF-8", NULL, &written, NULL);
if (in_unicode && written > 0) {
g_byte_array_set_size (stream->value, 0);
g_byte_array_append (stream->value, (const guint8 *) in_unicode, written);
+ g_byte_array_append (stream->value, &byte, 1);
+ g_byte_array_append (stream->value, &byte, 1);
}
g_free (in_unicode);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]