[evolution-data-server] M!102 - Stored values are never read



commit 6d359a8d7cf878de4ca6ed901c76a6e3db1d8fdd
Author: Дилян Палаузов <git-dpa aegee org>
Date:   Tue Oct 4 10:13:04 2022 +0000

    M!102 - Stored values are never read
    
    Closes https://gitlab.gnome.org/GNOME/evolution-data-server/-/merge_requests/102

 src/addressbook/libebook/e-destination.c              |  1 -
 .../libedata-book/e-book-backend-sqlitedb.c           | 19 +++++++++++--------
 src/camel/camel-filter-driver.c                       |  3 +--
 src/camel/camel-mime-filter-pgp.c                     |  4 +---
 src/camel/camel-mime-utils.c                          |  2 --
 src/camel/camel-text-index.c                          |  2 ++
 src/camel/providers/imapx/camel-imapx-input-stream.c  |  2 --
 7 files changed, 15 insertions(+), 18 deletions(-)
---
diff --git a/src/addressbook/libebook/e-destination.c b/src/addressbook/libebook/e-destination.c
index cf841004f..cd06601c8 100644
--- a/src/addressbook/libebook/e-destination.c
+++ b/src/addressbook/libebook/e-destination.c
@@ -453,7 +453,6 @@ e_destination_set_contact (EDestination *dest,
                                /* Make sure that when parent with parent_id does not exist the item will be 
appended to root
                                 * destination. */
                                if (parent_dest == NULL && lists_count == 0 && list_iterations > 0) {
-                                       parent_id = "0";
                                        parent_dest = dest;
                                }
                                if (type != NONE && parent_dest) {
diff --git a/src/addressbook/libedata-book/e-book-backend-sqlitedb.c 
b/src/addressbook/libedata-book/e-book-backend-sqlitedb.c
index e5eca3ed5..f02bb1d77 100644
--- a/src/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/src/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -314,7 +314,7 @@ book_backend_sql_exec_real (sqlite3 *db,
                             GError **error)
 {
        gchar *errmsg = NULL;
-       gint ret = -1, retries = 0;
+       gint ret, retries = 0;
 
        ret = sqlite3_exec (db, stmt, callback, data, &errmsg);
        while (ret == SQLITE_BUSY || ret == SQLITE_LOCKED || ret == -1) {
@@ -1111,9 +1111,11 @@ create_contacts_table (EBookBackendSqliteDB *ebsdb,
                sqlite3_free (stmt);
 
                /* Give the UID an index in this table, always */
-               stmt = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS LISTINDEX ON %Q (uid)", tmp);
-               success = book_backend_sql_exec (ebsdb->priv->db, stmt, NULL, NULL, error);
-               sqlite3_free (stmt);
+               if (success) {
+                       stmt = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS LISTINDEX ON %Q (uid)", tmp);
+                       success = book_backend_sql_exec (ebsdb->priv->db, stmt, NULL, NULL, error);
+                       sqlite3_free (stmt);
+               }
 
                /* Create indexes if specified */
                if (success && (ebsdb->priv->attr_list_indexes & INDEX_PREFIX) != 0) {
@@ -1154,7 +1156,7 @@ create_contacts_table (EBookBackendSqliteDB *ebsdb,
                        g_free (tmp);
 
                        /* For any indexed column, also index the localized column */
-                       if (ebsdb->priv->summary_fields[i].field != E_CONTACT_REV) {
+                       if (success && ebsdb->priv->summary_fields[i].field != E_CONTACT_REV) {
                                tmp = g_strdup_printf (
                                        "INDEX_%s_localized_%s",
                                        summary_dbname_from_field (ebsdb, 
ebsdb->priv->summary_fields[i].field),
@@ -1184,7 +1186,7 @@ create_contacts_table (EBookBackendSqliteDB *ebsdb,
                        g_free (tmp);
                }
 
-               if ((ebsdb->priv->summary_fields[i].index & INDEX_PHONE) != 0 &&
+               if (success && (ebsdb->priv->summary_fields[i].index & INDEX_PHONE) != 0 &&
                    ebsdb->priv->summary_fields[i].type != E_TYPE_CONTACT_ATTR_LIST) {
                        /* Derive index name from field & folder */
                        tmp = g_strdup_printf (
@@ -1237,7 +1239,6 @@ create_contacts_table (EBookBackendSqliteDB *ebsdb,
 
                if (success && g_strcmp0 (current_region, stored_region) != 0) {
                        success = upgrade_contacts_table (ebsdb, folderid, current_region, lc_collate, error);
-                       relocalized = TRUE;
                }
 
                g_free (stored_region);
@@ -2646,7 +2647,7 @@ e_book_backend_sqlitedb_remove_contacts (EBookBackendSqliteDB *ebsdb,
        }
 
        /* Delete the auxillary contact infos first */
-       if (success && ebsdb->priv->have_attr_list) {
+       if (ebsdb->priv->have_attr_list) {
                gchar *lists_folder = g_strdup_printf ("%s_lists", folderid);
 
                stmt = generate_delete_stmt (lists_folder, uids);
@@ -5312,7 +5313,9 @@ upgrade_contacts_table (EBookBackendSqliteDB *ebsdb,
                success = book_backend_sql_exec (
                        ebsdb->priv->db, stmt, NULL, NULL, error);
                sqlite3_free (stmt);
+       }
 
+       if (success) {
                stmt = sqlite3_mprintf (
                        "UPDATE folders SET lc_collate = %Q WHERE folder_id = %Q",
                        lc_collate, folderid);
diff --git a/src/camel/camel-filter-driver.c b/src/camel/camel-filter-driver.c
index ab0bd0d27..48830ba7b 100644
--- a/src/camel/camel-filter-driver.c
+++ b/src/camel/camel-filter-driver.c
@@ -1932,7 +1932,6 @@ filter_driver_filter_message_internal (CamelFilterDriver *driver,
        gboolean filtered = FALSE;
        CamelSExpResult *r;
        GList *list, *link;
-       gint result;
 
        g_return_val_if_fail (message != NULL || (source != NULL && uid != NULL), -1);
 
@@ -1991,12 +1990,12 @@ filter_driver_filter_message_internal (CamelFilterDriver *driver,
        }
 
        list = g_queue_peek_head_link (&driver->priv->rules);
-       result = CAMEL_SEARCH_NOMATCH;
        filtered = list != NULL;
 
        for (link = list; link != NULL; link = g_list_next (link)) {
                struct _filter_rule *rule = link->data;
                struct _get_message data;
+               gint result;
 
                if (driver->priv->terminated) {
                        camel_filter_driver_log (driver, FILTER_LOG_INFO, "Stopped processing per request");
diff --git a/src/camel/camel-mime-filter-pgp.c b/src/camel/camel-mime-filter-pgp.c
index 562965933..5c9f31c22 100644
--- a/src/camel/camel-mime-filter-pgp.c
+++ b/src/camel/camel-mime-filter-pgp.c
@@ -85,10 +85,8 @@ mime_filter_pgp_run (CamelMimeFilter *mime_filter,
                }
 
                if (inptr == inend) {
-                       if (!last) {
+                       if (!last)
                                camel_mime_filter_backup (mime_filter, start, inend - start);
-                               inend = start;
-                       }
                        break;
                }
 
diff --git a/src/camel/camel-mime-utils.c b/src/camel/camel-mime-utils.c
index 87836d932..4dfcc3780 100644
--- a/src/camel/camel-mime-utils.c
+++ b/src/camel/camel-mime-utils.c
@@ -235,8 +235,6 @@ camel_uuencode_close (guchar *in,
                        *bufptr++ = CAMEL_UUENCODE_CHAR (((b1 << 2) | ((b2 >> 6) & 0x3)) & 0x3f);
                        *bufptr++ = CAMEL_UUENCODE_CHAR (b2 & 0x3f);
 
-                       i = 0;
-                       saved = 0;
                        uulen += 3;
                }
        }
diff --git a/src/camel/camel-text-index.c b/src/camel/camel-text-index.c
index a9827ed2a..44909f04d 100644
--- a/src/camel/camel-text-index.c
+++ b/src/camel/camel-text-index.c
@@ -535,6 +535,8 @@ text_index_compress_nosync (CamelIndex *idx)
 
        /* If this fails, we'll pick up something during restart? */
        ret = camel_index_rename ((CamelIndex *) newidx, oldpath);
+       if (ret == -1)
+               goto fail;
 
 #define myswap(a, b) { gpointer tmp = a; a = b; b = tmp; }
        /* Poke the private data across to the new object */
diff --git a/src/camel/providers/imapx/camel-imapx-input-stream.c 
b/src/camel/providers/imapx/camel-imapx-input-stream.c
index 64e814dd1..84ea22c02 100644
--- a/src/camel/providers/imapx/camel-imapx-input-stream.c
+++ b/src/camel/providers/imapx/camel-imapx-input-stream.c
@@ -430,8 +430,6 @@ camel_imapx_input_stream_astring (CamelIMAPXInputStream *is,
                } else {
                        guchar *o, *oe;
 
-                       tok = IMAPX_TOK_STRING;
-
                        /* <any %x01-7F except "(){ " / %x00-1F / %x7F > */
                        o = is->priv->tokenbuf;
                        oe = is->priv->tokenbuf + is->priv->bufsize - 1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]