[evolution-patches] Fix for #271969
- From: Veerapuram Varadhan <vvaradhan novell com>
- To: Evo-patches <evolution-patches lists ximian com>
- Subject: [evolution-patches] Fix for #271969
- Date: Mon, 01 Aug 2005 21:08:26 -0600
Hi,
Attached patch is taken from
http://bugzilla.gnome.org/show_bug.cgi?id=271969
Refer to the bug for more-details.
The patch looks good to me, however, would like to request for an
expert's review comments/suggestion. :-)
Thanks,
V. Varadhan
--- calendar/backends/file/e-cal-backend-file.c 2005-07-21 18:24:47.255439795 +0530
+++ ../evolution-data-server.new/calendar/backends/file/e-cal-backend-file.c 2005-07-21 18:25:28.372232186 +0530
@@ -1477,7 +1477,7 @@
EXmlHash *ehash;
} ECalBackendFileComputeChangesData;
-static void
+static gboolean
e_cal_backend_file_compute_changes_foreach_key (const char *key, gpointer value, gpointer data)
{
ECalBackendFileComputeChangesData *be_data = data;
@@ -1494,8 +1494,9 @@
e_cal_component_set_uid (comp, key);
be_data->deletes = g_list_prepend (be_data->deletes, e_cal_component_get_as_string (comp));
- e_xmlhash_remove (be_data->ehash, key);
+ return TRUE;
}
+ return FALSE;
}
static ECalBackendSyncStatus
@@ -1555,7 +1556,7 @@
be_data.deletes = NULL;
be_data.ehash = ehash;
- e_xmlhash_foreach_key (ehash, (EXmlHashFunc)e_cal_backend_file_compute_changes_foreach_key, &be_data);
+ e_xmlhash_foreach_key_remove (ehash, (EXmlHashRemoveFunc)e_cal_backend_file_compute_changes_foreach_key, &be_data);
*deletes = be_data.deletes;
--- libedataserver/e-xml-hash-utils.c 2005-07-21 18:24:47.256439669 +0530
+++ ../evolution-data-server.new/libedataserver/e-xml-hash-utils.c 2005-07-20 17:03:08.000000000 +0530
@@ -319,6 +319,32 @@
g_hash_table_foreach (hash->objects, foreach_hash_func, &data);
}
+typedef struct {
+ EXmlHashRemoveFunc func;
+ gpointer user_data;
+} foreach_data_remove_t;
+
+static gboolean
+foreach_hash_remove_func (gpointer key, gpointer value, gpointer user_data)
+{
+ foreach_data_remove_t *data = (foreach_data_remove_t *) user_data;
+
+ return data->func ((const char *) key, (const char *) value, data->user_data);
+}
+
+void
+e_xmlhash_foreach_key_remove (EXmlHash *hash, EXmlHashRemoveFunc func, gpointer user_data)
+{
+ foreach_data_remove_t data;
+
+ g_return_if_fail (hash != NULL);
+ g_return_if_fail (func != NULL);
+
+ data.func = func;
+ data.user_data = user_data;
+ g_hash_table_foreach_remove (hash->objects, foreach_hash_remove_func, &data);
+}
+
/**
* e_xmlhash_write:
* @hash: The #EXmlHash to write.
--- libedataserver/e-xml-hash-utils.h 2005-07-21 18:24:47.257439542 +0530
+++ ../evolution-data-server.new/libedataserver/e-xml-hash-utils.h 2005-07-21 18:31:04.460638126 +0530
@@ -58,6 +58,7 @@
} EXmlHashStatus;
typedef void (* EXmlHashFunc) (const char *key, const char *value, gpointer user_data);
+typedef gboolean (* EXmlHashRemoveFunc) (const char *key, const char *value, gpointer user_data);
typedef struct EXmlHash EXmlHash;
@@ -76,6 +77,10 @@
EXmlHashFunc func,
gpointer user_data);
+void e_xmlhash_foreach_key_remove (EXmlHash *hash,
+ EXmlHashRemoveFunc func,
+ gpointer user_data);
+
void e_xmlhash_write (EXmlHash *hash);
void e_xmlhash_destroy (EXmlHash *hash);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]