[evolution/wip/webkit2] Prefer g_output_stream_write_all() over g_output_stream_write()
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Prefer g_output_stream_write_all() over g_output_stream_write()
- Date: Wed, 22 Apr 2015 12:56:00 +0000 (UTC)
commit 53a546d3d8040fa218a9acdafb8915ae231da7ed
Author: Milan Crha <mcrha redhat com>
Date: Mon Feb 9 14:51:40 2015 +0100
Prefer g_output_stream_write_all() over g_output_stream_write()
Just to make sure that all data had been written, while the later
can finish successfully without actually write all the data it was
requested to write.
composer/e-msg-composer.c | 3 ++-
mail/em-utils.c | 3 ++-
smime/lib/e-pkcs12.c | 9 ++++-----
3 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 26a816a..7794877 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -213,6 +213,7 @@ emcu_part_to_html (EMsgComposer *composer,
GString *part_id;
EShell *shell;
GtkWindow *window;
+ gsize n_bytes_written = 0;
GQueue queue = G_QUEUE_INIT;
shell = e_shell_get_default ();
@@ -259,7 +260,7 @@ emcu_part_to_html (EMsgComposer *composer,
g_object_unref (formatter);
g_object_unref (part_list);
- g_output_stream_write (stream, "", 1, NULL, NULL);
+ g_output_stream_write_all (stream, "", 1, &n_bytes_written, NULL, NULL);
g_output_stream_close (stream, NULL, NULL);
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 2991629..b320d00 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1202,6 +1202,7 @@ em_utils_message_to_html (CamelSession *session,
GtkWindow *window;
EMailPart *hidden_text_html_part = NULL;
EMailPartValidityFlags is_validity_found = 0;
+ gsize n_bytes_written = 0;
GQueue queue = G_QUEUE_INIT;
GList *head, *link;
gchar *data;
@@ -1286,7 +1287,7 @@ em_utils_message_to_html (CamelSession *session,
g_output_stream_write_all (
stream, append, strlen (append), NULL, NULL, NULL);
- g_output_stream_write (stream, "", 1, NULL, NULL);
+ g_output_stream_write_all (stream, "", 1, &n_bytes_written, NULL, NULL);
g_output_stream_close (stream, NULL, NULL);
diff --git a/smime/lib/e-pkcs12.c b/smime/lib/e-pkcs12.c
index 9e5e2ff..464fa81 100644
--- a/smime/lib/e-pkcs12.c
+++ b/smime/lib/e-pkcs12.c
@@ -292,13 +292,12 @@ encoder_output_cb (void *arg,
const char *buf,
unsigned long len)
{
+ gsize n_bytes_written = 0;
GError *error = NULL;
- g_output_stream_write (G_OUTPUT_STREAM (arg), buf, len, NULL, &error);
-
- if (error != NULL) {
- g_warning ("I/O error during certificate backup, error message: %s", error->message);
- g_error_free (error);
+ if (!g_output_stream_write_all (G_OUTPUT_STREAM (arg), buf, len, &n_bytes_written, NULL, &error)) {
+ g_warning ("I/O error during certificate backup, error message: %s", error ? error->message :
"Unknown error");
+ g_clear_error (&error);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]