soylent r117 - trunk/src
- From: treitter svn gnome org
- To: svn-commits-list gnome org
- Subject: soylent r117 - trunk/src
- Date: Wed, 2 Apr 2008 08:04:47 +0100 (BST)
Author: treitter
Date: Wed Apr 2 08:04:46 2008
New Revision: 117
URL: http://svn.gnome.org/viewvc/soylent?rev=117&view=rev
Log:
Fix another off-by-one bug in the vcard-handling code for edits
Modified:
trunk/src/eds-utils.c
trunk/src/soylent-browser-person-view.c
Modified: trunk/src/eds-utils.c
==============================================================================
--- trunk/src/eds-utils.c (original)
+++ trunk/src/eds-utils.c Wed Apr 2 08:04:46 2008
@@ -162,6 +162,7 @@
GList *attr_list_prev = NULL;
GList *attr_list_head = NULL;
EVCardAttribute *attr = NULL;
+ EVCardAttribute *attr_prev = NULL;
GList *type_existing = NULL;
g_return_val_if_fail (e_contact, retval);
@@ -170,15 +171,17 @@
g_return_val_if_fail (field_id < E_CONTACT_FIELD_LAST, retval);
g_return_val_if_fail (type, retval);
g_return_val_if_fail (!g_str_equal (type, ""), retval);
- g_return_val_if_fail (abs_num >= 0, retval);
+ g_return_val_if_fail (abs_num > 0, retval);
/* value may be NULL */
+ g_debug ("abs_num passed in: %d", abs_num);
+
attr_list_head = e_contact_get_attributes (e_contact, field_id);
if (attr_list_head)
{
/* FIXME: there's got to be a cleaner way to do this */
for (attr_list = attr_list_head;
- attr_list && (abs_num >= 0);
+ attr_list && (abs_num > 0);
attr_list = g_list_next (attr_list))
{
attr = attr_list->data;
@@ -188,22 +191,33 @@
if (type_existing && g_str_equal (type, type_existing->data))
{
abs_num--;
+ attr_prev = attr;
+ attr_list_prev = attr_list;
}
-
- attr_list_prev = attr_list;
}
- if (attr && abs_num >= 0)
+ g_debug ("attr_list: %p", attr_list);
+ g_debug ("attr: %p", attr);
+ g_debug ("attr_list_prev: %p", attr_list_prev);
+ g_debug ("attr_prev: %p", attr_prev);
+ g_debug ("abs_num: %d", abs_num);
+ /* XXX: the abs_num >= 0 check seems unnecessary */
+ if (attr_prev && abs_num >= 0)
{
if (value && !g_str_equal (value, ""))
{
- e_vcard_attribute_remove_values (attr);
- e_vcard_attribute_add_value (attr, value);
+ e_vcard_attribute_remove_values (attr_prev);
+ e_vcard_attribute_add_value (attr_prev, value);
}
else
{
+ g_debug ("deleting link: %p: %s", attr_list_prev,
+ (gchar*) e_vcard_attribute_get_value
+ (attr_list_prev->data));
+ g_debug ("attr_list_head before delete: %p", attr_list_head);
attr_list_head = g_list_delete_link (attr_list_head,
attr_list_prev);
+ g_debug ("attr_list_head after delete: %p", attr_list_head);
}
e_contact_set_attributes (e_contact, field_id, attr_list_head);
Modified: trunk/src/soylent-browser-person-view.c
==============================================================================
--- trunk/src/soylent-browser-person-view.c (original)
+++ trunk/src/soylent-browser-person-view.c Wed Apr 2 08:04:46 2008
@@ -363,6 +363,13 @@
{
gboolean view_update_retval = FALSE;
+ /* FIXME: cut this */
+ {
+ EContact *e_contact = soylent_person_get_e_contact (person);
+ soylent_debug ("\n%s\n", e_vcard_to_string (E_VCARD (e_contact),
+ EVC_FORMAT_VCARD_30));
+ }
+
view_update_retval = soylent_browser_person_view_update (browser,
person);
if (view_update_retval)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]