diff options
author | Matthew Loper <mloper@src.gnome.org> | 2000-02-09 08:48:28 +0800 |
---|---|---|
committer | Matthew Loper <mloper@src.gnome.org> | 2000-02-09 08:48:28 +0800 |
commit | 66dc424c9c809c775e1491299bb2a8c97715865f (patch) | |
tree | d15e62877fc1cacc537f61b82f40a45fb7b01fb3 /tests/test-formatter.c | |
parent | c9f1db9bd04c54e488d2c3670c9baed990aa205f (diff) | |
download | gsoc2013-evolution-66dc424c9c809c775e1491299bb2a8c97715865f.tar gsoc2013-evolution-66dc424c9c809c775e1491299bb2a8c97715865f.tar.gz gsoc2013-evolution-66dc424c9c809c775e1491299bb2a8c97715865f.tar.bz2 gsoc2013-evolution-66dc424c9c809c775e1491299bb2a8c97715865f.tar.lz gsoc2013-evolution-66dc424c9c809c775e1491299bb2a8c97715865f.tar.xz gsoc2013-evolution-66dc424c9c809c775e1491299bb2a8c97715865f.tar.zst gsoc2013-evolution-66dc424c9c809c775e1491299bb2a8c97715865f.zip |
+ * tests/test-formatter.c (convert_to_html_and_print): Use the
+ buffer length of the stream to create strings which are then
+ printed, rather than printing the stream (which might not have a
+ trailing \0) directly.
+
+ * camel/camel-formatter.c (str_tolower): New function; makes a
+ string lowercase.
svn path=/trunk/; revision=1698
Diffstat (limited to 'tests/test-formatter.c')
-rw-r--r-- | tests/test-formatter.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/tests/test-formatter.c b/tests/test-formatter.c index b3e0ca76a6..536d3e9bbf 100644 --- a/tests/test-formatter.c +++ b/tests/test-formatter.c @@ -14,16 +14,29 @@ static void convert_to_html_and_print (CamelMimeMessage *msg) { CamelFormatter* cmf = camel_formatter_new(); + gchar* header_str; + gchar* body_str; + CamelStream* header_stream = camel_stream_mem_new (CAMEL_STREAM_FS_WRITE); CamelStream* body_stream = camel_stream_mem_new (CAMEL_STREAM_FS_WRITE); camel_formatter_mime_message_to_html ( cmf, msg, header_stream, body_stream); + + header_str = g_strndup ( + CAMEL_STREAM_MEM (header_stream)->buffer->data, + CAMEL_STREAM_MEM (header_stream)->buffer->len); + body_str = g_strndup ( + CAMEL_STREAM_MEM (body_stream)->buffer->data, + CAMEL_STREAM_MEM (body_stream)->buffer->len); g_print ("Header follows\n----------------------\n%s\n", - (CAMEL_STREAM_MEM(header_stream))->buffer->data); + header_str); g_print ("Body follows\n----------------------\n%s\n", - (CAMEL_STREAM_MEM(body_stream))->buffer->data); + body_str); + + g_free (header_str); + g_free (body_str); } static void @@ -63,12 +76,14 @@ main (int argc, char**argv) printf ("You must create the file mail.test before running this test"); exit(2); } - - camel_data_wrapper_construct_from_stream ( CAMEL_DATA_WRAPPER (message), input_stream); + + camel_data_wrapper_construct_from_stream ( + CAMEL_DATA_WRAPPER (message), input_stream); camel_debug_level = CAMEL_LOG_LEVEL_FULL_DEBUG; convert_to_html_and_print (message); + camel_stream_close (input_stream); gtk_object_unref (GTK_OBJECT (input_stream)); |