diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-07-06 02:02:01 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-09-14 20:08:34 +0800 |
commit | af704b849e6a28582ca6d75b0ee0ef3a867587cf (patch) | |
tree | d8db9243ed23680f0b78ef5b87ecee4df68eb4b8 /plugins | |
parent | c72aba8f7c13cdc68b1f3dbc1d381be45e0c4cb8 (diff) | |
download | gsoc2013-evolution-af704b849e6a28582ca6d75b0ee0ef3a867587cf.tar.gz gsoc2013-evolution-af704b849e6a28582ca6d75b0ee0ef3a867587cf.tar.zst gsoc2013-evolution-af704b849e6a28582ca6d75b0ee0ef3a867587cf.zip |
Avoid camel_stream_printf().
camel_stream_printf() is next on the chopping block.
Use g_strdup_printf() or a GString to construct a formatted string in
memory, pass it to camel_stream_write() in one go, and then check for
errors (unless it's a memory stream).
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/audio-inline/audio-inline.c | 20 | ||||
-rw-r--r-- | plugins/image-inline/image-inline.c | 6 | ||||
-rw-r--r-- | plugins/itip-formatter/itip-formatter.c | 11 | ||||
-rw-r--r-- | plugins/vcard-inline/vcard-inline.c | 6 |
4 files changed, 30 insertions, 13 deletions
diff --git a/plugins/audio-inline/audio-inline.c b/plugins/audio-inline/audio-inline.c index 507bc953e9..07b1bd679b 100644 --- a/plugins/audio-inline/audio-inline.c +++ b/plugins/audio-inline/audio-inline.c @@ -294,16 +294,22 @@ void org_gnome_audio_inline_format (gpointer ep, EMFormatHookTarget *t) { struct _org_gnome_audio_inline_pobject *pobj; - gchar *classid = g_strdup_printf ("org-gnome-audio-inline-button-panel-%d", org_gnome_audio_class_id_counter); + gchar *classid; + gchar *content; + + classid = g_strdup_printf ( + "org-gnome-audio-inline-button-panel-%d", + org_gnome_audio_class_id_counter); org_gnome_audio_class_id_counter++; d(printf ("audio inline formatter: format classid %s\n", classid)); - pobj = (struct _org_gnome_audio_inline_pobject *) em_format_html_add_pobject ((EMFormatHTML *) t->format, sizeof (*pobj), classid, - t->part, org_gnome_audio_inline_button_panel); - g_object_ref (t->part); - pobj->part = t->part; + pobj = (struct _org_gnome_audio_inline_pobject *) + em_format_html_add_pobject ( + (EMFormatHTML *) t->format, sizeof (*pobj), classid, + t->part, org_gnome_audio_inline_button_panel); + pobj->part = g_object_ref (t->part); pobj->filename = NULL; pobj->playbin = NULL; pobj->play_button = NULL; @@ -313,5 +319,7 @@ org_gnome_audio_inline_format (gpointer ep, EMFormatHookTarget *t) pobj->object.free = org_gnome_audio_inline_pobject_free; pobj->target_state = GST_STATE_NULL; - camel_stream_printf (t->stream, "<object classid=%s></object>\n", classid); + content = g_strdup_printf ("<object classid=%s></object>\n", classid); + camel_stream_write_string (t->stream, content, NULL, NULL); + g_free (content); } diff --git a/plugins/image-inline/image-inline.c b/plugins/image-inline/image-inline.c index edb527c3a6..73a630a259 100644 --- a/plugins/image-inline/image-inline.c +++ b/plugins/image-inline/image-inline.c @@ -448,6 +448,7 @@ org_gnome_image_inline_format (gpointer ep, EMFormatHookTarget *target) { ImageInlinePObject *image_object; gchar *classid; + gchar *content; classid = g_strdup_printf ( "org-gnome-image-inline-display-%d", @@ -466,8 +467,9 @@ org_gnome_image_inline_format (gpointer ep, EMFormatHookTarget *target) image_object->object.free = org_gnome_image_inline_pobject_free; org_gnome_image_inline_decode (image_object); - camel_stream_printf ( - target->stream, "<object classid=%s></object>", classid); + content = g_strdup_printf ("<object classid=%s></object>", classid); + camel_stream_write_string (target->stream, content, NULL, NULL); + g_free (content); g_free (classid); } diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index 0770ea2ebb..f5b2bcdcf0 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -2819,6 +2819,7 @@ format_itip (EPlugin *ep, EMFormatHookTarget *target) CamelDataWrapper *content; CamelStream *stream; GByteArray *byte_array; + gchar *string; classid = g_strdup_printf("itip:///%s", ((EMFormat *) target->format)->part_id->str); @@ -2859,9 +2860,13 @@ format_itip (EPlugin *ep, EMFormatHookTarget *target) g_object_unref (stream); - camel_stream_printf (target->stream, "<table border=0 width=\"100%%\" cellpadding=3><tr>"); - camel_stream_printf (target->stream, "<td valign=top><object classid=\"%s\"></object></td><td width=100%% valign=top>", classid); - camel_stream_printf (target->stream, "</td></tr></table>"); + string = g_strdup_printf ( + "<table border=0 width=\"100%%\" cellpadding=3><tr>" + "<td valign=top><object classid=\"%s\"></object></td>" + "<td width=100%% valign=top></td></tr></table>", + classid); + camel_stream_write_string (target->stream, string, NULL, NULL); + g_free (string); g_free (classid); } diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c index 7e56da440b..78818f328b 100644 --- a/plugins/vcard-inline/vcard-inline.c +++ b/plugins/vcard-inline/vcard-inline.c @@ -313,6 +313,7 @@ org_gnome_vcard_inline_format (gpointer ep, EMFormatHookTarget *target) { VCardInlinePObject *vcard_object; gchar *classid; + gchar *content; classid = g_strdup_printf ( "org-gnome-vcard-inline-display-%d", @@ -332,8 +333,9 @@ org_gnome_vcard_inline_format (gpointer ep, EMFormatHookTarget *target) e_book_client_get_sources (&vcard_object->source_list, NULL); - camel_stream_printf ( - target->stream, "<object classid=%s></object>", classid); + content = g_strdup_printf ("<object classid=%s></object>", classid); + camel_stream_write_string (target->stream, content, NULL, NULL); + g_free (content); g_free (classid); } |