aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-11-15 16:06:57 +0800
committerMilan Crha <mcrha@redhat.com>2013-11-15 16:06:57 +0800
commit570c6374806d0f1ec59cf7a72543efe6b5b637be (patch)
treec5390b1fcb73f30c28bf37168add9bf1dc622b42 /composer/e-msg-composer.c
parent1be51f232560f864ba8795a38e55d472b5b0e2b3 (diff)
downloadgsoc2013-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 'composer/e-msg-composer.c')
-rw-r--r--composer/e-msg-composer.c124
1 files changed, 59 insertions, 65 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 9b721b0d4b..502f098d87 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -2142,7 +2142,7 @@ static gboolean
msg_composer_key_press_event (GtkWidget *widget,
GdkEventKey *event)
{
- EMsgComposer *composer = E_MSG_COMPOSER (widget);
+ EMsgComposer *composer;
GtkWidget *input_widget;
GtkhtmlEditor *editor;
EWebViewGtkHTML *web_view;
@@ -3140,88 +3140,82 @@ e_msg_composer_new_with_message (EShell *shell,
table, identity_uid);
}
- if (postto == NULL) {
- auto_cc = g_hash_table_new_full (
- (GHashFunc) camel_strcase_hash,
- (GEqualFunc) camel_strcase_equal,
- (GDestroyNotify) g_free,
- (GDestroyNotify) NULL);
-
- auto_bcc = g_hash_table_new_full (
- (GHashFunc) camel_strcase_hash,
- (GEqualFunc) camel_strcase_equal,
- (GDestroyNotify) g_free,
- (GDestroyNotify) NULL);
-
- if (source != NULL) {
- composer_add_auto_recipients (source, "cc", auto_cc);
- composer_add_auto_recipients (source, "bcc", auto_bcc);
- }
+ auto_cc = g_hash_table_new_full (
+ (GHashFunc) camel_strcase_hash,
+ (GEqualFunc) camel_strcase_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) NULL);
+
+ auto_bcc = g_hash_table_new_full (
+ (GHashFunc) camel_strcase_hash,
+ (GEqualFunc) camel_strcase_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) NULL);
- to = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
- cc = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
- bcc = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_BCC);
+ if (source != NULL) {
+ composer_add_auto_recipients (source, "cc", auto_cc);
+ composer_add_auto_recipients (source, "bcc", auto_bcc);
+ }
- len = CAMEL_ADDRESS (to)->addresses->len;
- for (i = 0; i < len; i++) {
- const gchar *name, *addr;
+ to = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
+ cc = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
+ bcc = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_BCC);
- if (camel_internet_address_get (to, i, &name, &addr)) {
- EDestination *dest = e_destination_new ();
- e_destination_set_name (dest, name);
- e_destination_set_email (dest, addr);
- To = g_list_append (To, dest);
- }
+ len = CAMEL_ADDRESS (to)->addresses->len;
+ for (i = 0; i < len; i++) {
+ const gchar *name, *addr;
+
+ if (camel_internet_address_get (to, i, &name, &addr)) {
+ EDestination *dest = e_destination_new ();
+ e_destination_set_name (dest, name);
+ e_destination_set_email (dest, addr);
+ To = g_list_append (To, dest);
}
+ }
- Tov = destination_list_to_vector (To);
- g_list_free (To);
+ Tov = destination_list_to_vector (To);
+ g_list_free (To);
- len = CAMEL_ADDRESS (cc)->addresses->len;
- for (i = 0; i < len; i++) {
- const gchar *name, *addr;
+ len = CAMEL_ADDRESS (cc)->addresses->len;
+ for (i = 0; i < len; i++) {
+ const gchar *name, *addr;
- if (camel_internet_address_get (cc, i, &name, &addr)) {
- EDestination *dest = e_destination_new ();
- e_destination_set_name (dest, name);
- e_destination_set_email (dest, addr);
+ if (camel_internet_address_get (cc, i, &name, &addr)) {
+ EDestination *dest = e_destination_new ();
+ e_destination_set_name (dest, name);
+ e_destination_set_email (dest, addr);
- if (g_hash_table_contains (auto_cc, addr))
- e_destination_set_auto_recipient (dest, TRUE);
+ if (g_hash_table_contains (auto_cc, addr))
+ e_destination_set_auto_recipient (dest, TRUE);
- Cc = g_list_append (Cc, dest);
- }
+ Cc = g_list_append (Cc, dest);
}
+ }
- Ccv = destination_list_to_vector (Cc);
- g_hash_table_destroy (auto_cc);
- g_list_free (Cc);
+ Ccv = destination_list_to_vector (Cc);
+ g_hash_table_destroy (auto_cc);
+ g_list_free (Cc);
- len = CAMEL_ADDRESS (bcc)->addresses->len;
- for (i = 0; i < len; i++) {
- const gchar *name, *addr;
+ len = CAMEL_ADDRESS (bcc)->addresses->len;
+ for (i = 0; i < len; i++) {
+ const gchar *name, *addr;
- if (camel_internet_address_get (bcc, i, &name, &addr)) {
- EDestination *dest = e_destination_new ();
- e_destination_set_name (dest, name);
- e_destination_set_email (dest, addr);
+ if (camel_internet_address_get (bcc, i, &name, &addr)) {
+ EDestination *dest = e_destination_new ();
+ e_destination_set_name (dest, name);
+ e_destination_set_email (dest, addr);
- if (g_hash_table_contains (auto_bcc, addr))
- e_destination_set_auto_recipient (dest, TRUE);
+ if (g_hash_table_contains (auto_bcc, addr))
+ e_destination_set_auto_recipient (dest, TRUE);
- Bcc = g_list_append (Bcc, dest);
- }
+ Bcc = g_list_append (Bcc, dest);
}
-
- Bccv = destination_list_to_vector (Bcc);
- g_hash_table_destroy (auto_bcc);
- g_list_free (Bcc);
- } else {
- Tov = NULL;
- Ccv = NULL;
- Bccv = NULL;
}
+ Bccv = destination_list_to_vector (Bcc);
+ g_hash_table_destroy (auto_bcc);
+ g_list_free (Bcc);
+
if (source != NULL)
g_object_unref (source);