[evolution-data-server/gnome-3-10] e-vcard: Fix case sensitivity of string comparisions



commit eb8a7ada6bb432d25f62ed11cf7b9cd1040d6c85
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Sat Nov 23 08:39:01 2013 -0500

    e-vcard: Fix case sensitivity of string comparisions
    
    The rest of the code (and the specification) uniformly users
    case-insensitive comparisons of attribute names and parameter values.
    
    (cherry picked from commit 88240da1b6e1c39801c4de19d91e79dee205d842)

 addressbook/libebook-contacts/e-vcard.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/addressbook/libebook-contacts/e-vcard.c b/addressbook/libebook-contacts/e-vcard.c
index 4f47253..98bded6 100644
--- a/addressbook/libebook-contacts/e-vcard.c
+++ b/addressbook/libebook-contacts/e-vcard.c
@@ -1575,7 +1575,8 @@ e_vcard_append_attribute (EVCard *evc,
 
        /* Handle UID special case:
         * No need to parse the vcard to append an UID attribute */
-       if (evc->priv->vcard != NULL && g_strcmp0 (attr->name, EVC_UID) == 0) {
+       if (evc->priv->vcard != NULL && attr->name != NULL &&
+           g_ascii_strcasecmp (attr->name, EVC_UID) == 0) {
                evc->priv->attributes = g_list_append (evc->priv->attributes, attr);
        } else {
                evc->priv->attributes = g_list_append (e_vcard_ensure_attributes (evc), attr);
@@ -1655,7 +1656,8 @@ e_vcard_add_attribute (EVCard *evc,
 
        /* Handle UID special case:
         * No need to parse the vcard to append an UID attribute */
-       if (evc->priv->vcard != NULL && g_strcmp0 (attr->name, EVC_UID) == 0) {
+       if (evc->priv->vcard != NULL && attr->name != NULL &&
+           g_ascii_strcasecmp (attr->name, EVC_UID) == 0) {
                evc->priv->attributes = g_list_prepend (evc->priv->attributes, attr);
        } else {
                evc->priv->attributes = g_list_prepend (e_vcard_ensure_attributes (evc), attr);
@@ -2220,7 +2222,7 @@ e_vcard_attribute_remove_param_value (EVCardAttribute *attr,
        for (l = params; l; l = l->next) {
                param = l->data;
                if (g_ascii_strcasecmp (e_vcard_attribute_param_get_name (param), param_name) == 0) {
-                       l = g_list_find_custom (param->values, s, (GCompareFunc) strcmp);
+                       l = g_list_find_custom (param->values, s, (GCompareFunc) g_ascii_strcasecmp);
                        if (l == NULL) {
                                return;
                        }


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