diff options
author | Milan Crha <mcrha@redhat.com> | 2013-11-15 16:06:57 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2013-11-15 16:06:57 +0800 |
commit | 570c6374806d0f1ec59cf7a72543efe6b5b637be (patch) | |
tree | c5390b1fcb73f30c28bf37168add9bf1dc622b42 /e-util/e-attachment.c | |
parent | 1be51f232560f864ba8795a38e55d472b5b0e2b3 (diff) | |
download | gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar.gz gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar.bz2 gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar.lz gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar.xz gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar.zst gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.zip |
Fix/mute issues found by Coverity scan
This makes the code free of Coverity scan issues.
It is sometimes quite pedantic and expects/suggests some
coding habits, thus certain changes may look weird, but for a good
thing, I hope. The code is also tagged with Coverity scan
suppressions, to keep the code as is and hide the warning too.
Also note that Coverity treats g_return_if_fail(), g_assert() and
similar macros as unreliable, and it's true these can be disabled
during the compile time, thus it brings in other set of 'weird'
changes.
Diffstat (limited to 'e-util/e-attachment.c')
-rw-r--r-- | e-util/e-attachment.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/e-util/e-attachment.c b/e-util/e-attachment.c index e2b64ab92b..42d5e93caf 100644 --- a/e-util/e-attachment.c +++ b/e-util/e-attachment.c @@ -2191,6 +2191,11 @@ e_attachment_load_finish (EAttachment *attachment, g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), FALSE); simple = G_SIMPLE_ASYNC_RESULT (result); + if (g_simple_async_result_propagate_error (simple, error)) { + attachment_set_loading (attachment, FALSE); + return FALSE; + } + load_context = g_simple_async_result_get_op_res_gpointer (simple); if (load_context != NULL && load_context->mime_part != NULL) { @@ -2206,8 +2211,6 @@ e_attachment_load_finish (EAttachment *attachment, attachment, load_context->mime_part); } - g_simple_async_result_propagate_error (simple, error); - attachment_set_loading (attachment, FALSE); return (load_context != NULL); @@ -2529,8 +2532,8 @@ e_attachment_open_finish (EAttachment *attachment, g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), FALSE); simple = G_SIMPLE_ASYNC_RESULT (result); - success = g_simple_async_result_get_op_res_gboolean (simple); - g_simple_async_result_propagate_error (simple, error); + success = !g_simple_async_result_propagate_error (simple, error) && + g_simple_async_result_get_op_res_gboolean (simple); return success; } @@ -3066,10 +3069,14 @@ e_attachment_save_finish (EAttachment *attachment, g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (result), NULL); simple = G_SIMPLE_ASYNC_RESULT (result); + if (g_simple_async_result_propagate_error (simple, error)) { + attachment_set_saving (attachment, FALSE); + return NULL; + } + destination = g_simple_async_result_get_op_res_gpointer (simple); if (destination != NULL) g_object_ref (destination); - g_simple_async_result_propagate_error (simple, error); attachment_set_saving (attachment, FALSE); |