evolution-data-server r8496 - in trunk/calendar: . backends/caldav backends/contacts backends/file backends/google backends/groupwise backends/http backends/weather libecal libedata-cal tests/ecal
- From: pchen svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r8496 - in trunk/calendar: . backends/caldav backends/contacts backends/file backends/google backends/groupwise backends/http backends/weather libecal libedata-cal tests/ecal
- Date: Mon, 18 Feb 2008 07:33:06 +0000 (GMT)
Author: pchen
Date: Mon Feb 18 07:33:06 2008
New Revision: 8496
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8496&view=rev
Log:
2008-02-14 Chenthill Palanisamy <pchenthill novell com>
Fixes #516408
* backends/caldav/e-cal-backend-caldav.c
(e_cal_component_get_href), (e_cal_component_get_etag),
(synchronize_cache), (pack_cobj), (caldav_modify_object),
(caldav_remove_object), (process_object), (caldav_get_timezone):
* backends/contacts/e-cal-backend-contacts.c
(e_cal_backend_contacts_get_free_busy),
(e_cal_backend_contacts_get_timezone):
* backends/file/e-cal-backend-file.c (save_file_when_idle),
(notify_removals_cb), (notify_adds_modifies_cb),
(e_cal_backend_file_get_object),
(e_cal_backend_file_get_timezone),
(e_cal_backend_file_get_free_busy),
(e_cal_backend_file_receive_objects):
* backends/google/e-cal-backend-google-utils.c
(e_go_item_from_cal_component), (get_date):
* backends/google/e-cal-backend-google.c
(e_cal_backend_google_get_timezone):
* backends/groupwise/e-cal-backend-groupwise-utils.c
(add_send_options_data_to_item), (set_rrule_from_comp),
(set_properties_from_cal_component), (start_freebusy_session),
(e_cal_backend_groupwise_store_settings):
* backends/groupwise/e-cal-backend-groupwise.c (get_deltas),
(e_cal_backend_groupwise_get_timezone):
* backends/http/e-cal-backend-http.c (retrieval_done),
(e_cal_backend_http_get_default_object),
(e_cal_backend_http_get_timezone),
(e_cal_backend_http_get_free_busy):
* backends/weather/e-cal-backend-weather.c
* (finished_retrieval_cb),
(e_cal_backend_weather_get_timezone),
(e_cal_backend_weather_get_free_busy):
* libecal/e-cal-component.c (e_cal_component_get_as_string),
(e_cal_component_get_recurid_as_string):
* libecal/e-cal-component.h:
* libecal/e-cal-recur.c (e_cal_recur_set_rule_end_date):
* libecal/e-cal.c (foreach_tzid_callback),
(e_cal_get_component_as_string_internal), (e_cal_create_object),
(e_cal_modify_object), (e_cal_receive_objects),
(e_cal_send_objects), (e_cal_add_timezone),
(e_cal_set_default_timezone):
* libedata-cal/e-cal-backend-cache.c
(e_cal_backend_cache_put_component),
(e_cal_backend_cache_put_timezone),
(e_cal_backend_cache_put_default_timezone):
* libedata-cal/e-data-cal-view.c (add_object_to_cache):
* tests/ecal/test-ecal.c (list_uids): Remove the duping of
* memory
which is returned from libical and free the returned by libical.
Modified:
trunk/calendar/ChangeLog
trunk/calendar/backends/caldav/e-cal-backend-caldav.c
trunk/calendar/backends/contacts/e-cal-backend-contacts.c
trunk/calendar/backends/file/e-cal-backend-file.c
trunk/calendar/backends/google/e-cal-backend-google-utils.c
trunk/calendar/backends/google/e-cal-backend-google.c
trunk/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
trunk/calendar/backends/groupwise/e-cal-backend-groupwise.c
trunk/calendar/backends/http/e-cal-backend-http.c
trunk/calendar/backends/weather/e-cal-backend-weather.c
trunk/calendar/libecal/e-cal-component.c
trunk/calendar/libecal/e-cal-component.h
trunk/calendar/libecal/e-cal-recur.c
trunk/calendar/libecal/e-cal.c
trunk/calendar/libedata-cal/e-cal-backend-cache.c
trunk/calendar/libedata-cal/e-data-cal-view.c
trunk/calendar/tests/ecal/test-ecal.c
Modified: trunk/calendar/backends/caldav/e-cal-backend-caldav.c
==============================================================================
--- trunk/calendar/backends/caldav/e-cal-backend-caldav.c (original)
+++ trunk/calendar/backends/caldav/e-cal-backend-caldav.c Mon Feb 18 07:33:06 2008
@@ -272,7 +272,7 @@
}
-static const char *
+static char *
icomp_x_prop_get (icalcomponent *comp, const char *key)
{
icalproperty *xprop;
@@ -308,7 +308,7 @@
icomp_x_prop_set (icomp, X_E_CALDAV "HREF", href);
}
-static const char *
+static char *
e_cal_component_get_href (ECalComponent *comp)
{
icalcomponent *icomp;
@@ -317,7 +317,7 @@
str = NULL;
icomp = e_cal_component_get_icalcomponent (comp);
- str = (char *) icomp_x_prop_get (icomp, X_E_CALDAV "HREF");
+ str = icomp_x_prop_get (icomp, X_E_CALDAV "HREF");
return str;
}
@@ -335,7 +335,7 @@
}
-static const char *
+static char *
e_cal_component_get_etag (ECalComponent *comp)
{
icalcomponent *icomp;
@@ -344,7 +344,7 @@
str = NULL;
icomp = e_cal_component_get_icalcomponent (comp);
- str = (char *) icomp_x_prop_get (icomp, X_E_CALDAV "ETAG");
+ str = icomp_x_prop_get (icomp, X_E_CALDAV "ETAG");
return str;
}
@@ -1255,13 +1255,13 @@
return;
}
- hindex = g_hash_table_new (g_str_hash, g_str_equal);
+ hindex = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
cobjs = e_cal_backend_cache_get_components (bcache);
/* build up a index for the href entry */
for (citer = cobjs; citer; citer = g_list_next (citer)) {
ECalComponent *ccomp = E_CAL_COMPONENT (citer->data);
- const char *href;
+ char *href;
href = e_cal_component_get_href (ccomp);
@@ -1276,7 +1276,7 @@
/* see if we have to upate or add some objects */
for (i = 0, object = sobjs; i < len; i++, object++) {
ECalComponent *ccomp;
- const char *etag = NULL;
+ char *etag = NULL;
if (object->status != 200) {
/* just continue here, so that the object
@@ -1301,6 +1301,7 @@
}
caldav_object_free (object, FALSE);
+ g_free (etag);
}
/* remove old (not on server anymore) items from cache */
@@ -1654,7 +1655,7 @@
g_assert (objstr);
- return g_strdup (objstr);
+ return objstr;
}
@@ -1773,8 +1774,8 @@
if (online) {
CalDAVObject object;
- object.href = g_strdup (e_cal_component_get_href (cache_comp));
- object.etag = g_strdup (e_cal_component_get_etag (cache_comp));
+ object.href = e_cal_component_get_href (cache_comp);
+ object.etag = e_cal_component_get_etag (cache_comp);
object.cdata = pack_cobj (cbdav, comp);
status = caldav_server_put_object (cbdav, &object);
@@ -1841,8 +1842,8 @@
if (online) {
CalDAVObject caldav_object;
- caldav_object.href = g_strdup (e_cal_component_get_href (cache_comp));
- caldav_object.etag = g_strdup (e_cal_component_get_etag (cache_comp));
+ caldav_object.href = e_cal_component_get_href (cache_comp);
+ caldav_object.etag = e_cal_component_get_etag (cache_comp);
caldav_object.cdata = NULL;
status = caldav_server_delete_object (cbdav, &caldav_object);
@@ -1973,14 +1974,14 @@
CalDAVObject object = { NULL, };
if (ccomp) {
- const char *href;
- const char *etag;
+ char *href;
+ char *etag;
href = e_cal_component_get_href (ccomp);
etag = e_cal_component_get_etag (ccomp);
- object.href = g_strdup (href);
- object.etag = g_strdup (etag);
+ object.href = href;
+ object.etag = etag;
} else {
object.href = e_cal_component_gen_href (ecomp);
@@ -2035,14 +2036,14 @@
* of recurring appointments - yet - */
if (online) {
CalDAVObject object;
- const char *href;
- const char *etag;
+ char *href;
+ char *etag;
href = e_cal_component_get_href (ccomp);
etag = e_cal_component_get_etag (ccomp);
- object.href = g_strdup (href);
- object.etag = g_strdup (etag);
+ object.href = href;
+ object.etag = etag;
object.cdata = NULL;
status = caldav_server_delete_object (cbdav,
@@ -2268,7 +2269,7 @@
return GNOME_Evolution_Calendar_InvalidObject;
}
- *object = g_strdup (icalcomponent_as_ical_string (icalcomp));
+ *object = icalcomponent_as_ical_string (icalcomp);
return GNOME_Evolution_Calendar_Success;
}
Modified: trunk/calendar/backends/contacts/e-cal-backend-contacts.c
==============================================================================
--- trunk/calendar/backends/contacts/e-cal-backend-contacts.c (original)
+++ trunk/calendar/backends/contacts/e-cal-backend-contacts.c Mon Feb 18 07:33:06 2008
@@ -655,7 +655,7 @@
icalcomponent_set_dtend (vfb, icaltime_from_timet_with_zone (end, FALSE, utc_zone));
calobj = icalcomponent_as_ical_string (vfb);
- *freebusy = g_list_append (NULL, g_strdup (calobj));
+ *freebusy = g_list_append (NULL, calobj);
icalcomponent_free (vfb);
/* WRITE ME */
@@ -789,7 +789,7 @@
if (!icalcomp)
return GNOME_Evolution_Calendar_InvalidObject;
- *object = g_strdup (icalcomponent_as_ical_string (icalcomp));
+ *object = icalcomponent_as_ical_string (icalcomp);
return GNOME_Evolution_Calendar_Success;
}
Modified: trunk/calendar/backends/file/e-cal-backend-file.c
==============================================================================
--- trunk/calendar/backends/file/e-cal-backend-file.c (original)
+++ trunk/calendar/backends/file/e-cal-backend-file.c Mon Feb 18 07:33:06 2008
@@ -174,6 +174,7 @@
buf = icalcomponent_as_ical_string (priv->icalcomp);
result = gnome_vfs_write (handle, buf, strlen (buf) * sizeof (char), &out);
+ g_free (buf);
gnome_vfs_close (handle);
if (result != GNOME_VFS_OK) {
gnome_vfs_uri_unref (uri);
@@ -735,6 +736,7 @@
e_cal_backend_notify_object_removed (context->backend, id, old_obj_str, NULL);
e_cal_component_free_id (id);
+ g_free (old_obj_str);
g_object_unref (comp);
}
}
@@ -763,6 +765,7 @@
return;
e_cal_backend_notify_object_created (context->backend, new_obj_str);
+ g_free (new_obj_str);
} else {
old_icomp = e_cal_component_get_icalcomponent (old_obj_data->full_object);
new_icomp = e_cal_component_get_icalcomponent (new_obj_data->full_object);
@@ -779,6 +782,8 @@
e_cal_backend_notify_object_modified (context->backend, old_obj_str, new_obj_str);
}
+ g_free (old_obj_str);
+ g_free (new_obj_str);
}
}
@@ -1122,7 +1127,7 @@
return GNOME_Evolution_Calendar_ObjectNotFound;
}
- *object = g_strdup (icalcomponent_as_ical_string (icalcomp));
+ *object = icalcomponent_as_ical_string (icalcomp);
icalcomponent_free (icalcomp);
}
@@ -1139,7 +1144,7 @@
/* add all detached recurrences */
g_hash_table_foreach (obj_data->recurrences, (GHFunc) add_detached_recur_to_vcalendar, icalcomp);
- *object = g_strdup (icalcomponent_as_ical_string (icalcomp));
+ *object = icalcomponent_as_ical_string (icalcomp);
icalcomponent_free (icalcomp);
} else
@@ -1186,7 +1191,7 @@
return GNOME_Evolution_Calendar_InvalidObject;
}
- *object = g_strdup (icalcomponent_as_ical_string (icalcomp));
+ *object = icalcomponent_as_ical_string (icalcomp);
g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
return GNOME_Evolution_Calendar_Success;
@@ -1534,7 +1539,7 @@
if (e_cal_backend_mail_account_get_default (&address, &name)) {
vfb = create_user_free_busy (cbfile, address, name, start, end);
calobj = icalcomponent_as_ical_string (vfb);
- *freebusy = g_list_append (*freebusy, g_strdup (calobj));
+ *freebusy = g_list_append (*freebusy, calobj);
icalcomponent_free (vfb);
g_free (address);
g_free (name);
@@ -1545,7 +1550,7 @@
if (e_cal_backend_mail_account_is_valid (address, &name)) {
vfb = create_user_free_busy (cbfile, address, name, start, end);
calobj = icalcomponent_as_ical_string (vfb);
- *freebusy = g_list_append (*freebusy, g_strdup (calobj));
+ *freebusy = g_list_append (*freebusy, calobj);
icalcomponent_free (vfb);
g_free (name);
}
@@ -2552,7 +2557,7 @@
case ICAL_METHOD_CANCEL:
if (cancel_received_object (cbfile, subcomp)) {
ECalComponentId *id;
- object = (char *) icalcomponent_as_ical_string (subcomp);
+ object = icalcomponent_as_ical_string (subcomp);
obj_data = g_hash_table_lookup (priv->comp_uid_hash, uid);
if (obj_data)
old_object = e_cal_component_get_as_string (obj_data->full_object);
@@ -2569,6 +2574,7 @@
e_cal_component_free_id (id);
g_free (old_object);
+ g_free (object);
}
break;
default:
Modified: trunk/calendar/backends/google/e-cal-backend-google-utils.c
==============================================================================
--- trunk/calendar/backends/google/e-cal-backend-google-utils.c (original)
+++ trunk/calendar/backends/google/e-cal-backend-google-utils.c Mon Feb 18 07:33:06 2008
@@ -617,14 +617,14 @@
e_cal_component_get_dtstart (comp, &dt);
itt = icaltime_convert_to_zone (*dt.value, default_zone);
dt.value = &itt;
- temp = g_strdup (get_date (dt));
+ temp = get_date (dt);
gdata_entry_set_start_time (entry, temp);
/* End Time */
e_cal_component_get_dtend (comp, &dt);
itt = icaltime_convert_to_zone (*dt.value, default_zone);
dt.value = &itt;
- temp = g_strdup (get_date (dt));
+ temp = get_date (dt);
gdata_entry_set_end_time (entry, temp);
/* Content / Description */
@@ -815,7 +815,7 @@
gchar *
get_date (ECalComponentDateTime dt)
{
- const char *temp;
+ char *temp;
struct icaltimetype itt;
struct icaltimetype *itt_u;
gchar *month;
@@ -833,8 +833,6 @@
itt.is_daylight = itt_u->is_daylight;
itt.zone = itt_u->zone;
- temp = icaltime_as_ical_string(itt);
-
month = (itt.month<10) ? g_strdup_printf("0%d", itt.month):g_strdup_printf ("%d", itt.month);
day = (itt.day < 10) ? g_strdup_printf("0%d", itt.day):g_strdup_printf ("%d", itt.day);
@@ -842,9 +840,15 @@
minute = (itt.minute<10) ? g_strdup_printf("0%d", itt.minute):g_strdup_printf ("%d", itt.minute);
second = (itt.second<10) ? g_strdup_printf ("0%d", itt.second):g_strdup_printf ("%d", itt.second);
+ /* FIXME not the best way to do this */
temp = g_strdup_printf ("%d-%s-%sT%s:%s:%s.000", itt.year, month, day, hour, minute, second);
+ g_free (month);
+ g_free (day);
+ g_free (hour);
+ g_free (minute);
+ g_free (second);
- return g_strdup(temp);
+ return temp;
}
static gboolean
Modified: trunk/calendar/backends/google/e-cal-backend-google.c
==============================================================================
--- trunk/calendar/backends/google/e-cal-backend-google.c (original)
+++ trunk/calendar/backends/google/e-cal-backend-google.c Mon Feb 18 07:33:06 2008
@@ -247,7 +247,7 @@
if (!icalcomp)
return GNOME_Evolution_Calendar_InvalidObject;
- *object = g_strdup (icalcomponent_as_ical_string (icalcomp));
+ *object = icalcomponent_as_ical_string (icalcomp);
return GNOME_Evolution_Calendar_Success;
}
Modified: trunk/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
==============================================================================
--- trunk/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c (original)
+++ trunk/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c Mon Feb 18 07:33:06 2008
@@ -170,33 +170,36 @@
e_gw_item_set_reply_request (item, TRUE);
x_val = icalproperty_get_x (icalprop);
if (strcmp (x_val, "convenient")) {
- const char *value;
+ char *value;
int i = atoi (x_val);
temp = icaltime_current_time_with_zone (default_zone ? default_zone : utc);
icaltime_adjust (&temp, i, 0, 0, 0);
icaltime_set_timezone (&temp, default_zone);
temp = icaltime_convert_to_zone (temp, utc);
value = icaltime_as_ical_string (temp);
- e_gw_item_set_reply_within (item, (char *) value);
+ e_gw_item_set_reply_within (item, value);
+ g_free (value);
}
} else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-EXPIRE")) {
- const char *expire = NULL;
+ char *expire = NULL;
x_val = icalproperty_get_x (icalprop);
temp = icaltime_current_time_with_zone (default_zone ? default_zone : utc);
icaltime_adjust (&temp, atoi (x_val), 0, 0, 0);
icaltime_set_timezone (&temp, default_zone);
temp = icaltime_convert_to_zone (temp, utc);
expire = icaltime_as_ical_string (temp);
- e_gw_item_set_expires (item, (char *) expire);
+ e_gw_item_set_expires (item, expire);
+ g_free (expire);
} else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-DELAY")) {
- const char *delay = NULL;
+ char *delay = NULL;
x_val = icalproperty_get_x (icalprop);
temp = icaltime_from_string (x_val);
icaltime_set_timezone (&temp, default_zone);
temp = icaltime_convert_to_zone (temp, utc);
delay = icaltime_as_ical_string (temp);
- e_gw_item_set_delay_until (item, (char *) delay);
+ e_gw_item_set_delay_until (item, delay);
+ g_free (delay);
} else if (!strcmp (x_name, "X-EVOLUTION-OPTIONS-TRACKINFO")) {
sendoptions_set = TRUE;
@@ -458,7 +461,6 @@
/* assumes only one rrule is present */
ical_recur = (struct icalrecurrencetype *) rrule_list->data;
- g_message ("DEBUG: Processing rule\n%s\n", icalrecurrencetype_as_string (ical_recur));
/*set the data */
switch (ical_recur->freq) {
case ICAL_DAILY_RECURRENCE :
@@ -479,7 +481,7 @@
if (ical_recur->count != 0)
item_rrule->count = ical_recur->count;
else
- item_rrule->until = g_strdup (icaltime_as_ical_string (ical_recur->until));
+ item_rrule->until = icaltime_as_ical_string (ical_recur->until);
item_rrule->interval = ical_recur->interval;
@@ -511,7 +513,7 @@
if (!icaltime_get_timezone (*(dt->value)))
icaltime_set_timezone (dt->value, default_zone ? default_zone : utc);
itt_utc = icaltime_convert_to_zone (*dt->value, utc);
- item_exdate_list = g_slist_append (item_exdate_list, g_strdup (icaltime_as_ical_string (itt_utc)));
+ item_exdate_list = g_slist_append (item_exdate_list, icaltime_as_ical_string (itt_utc));
}
}
e_gw_item_set_exdate_list (item, item_exdate_list);
@@ -524,6 +526,7 @@
set_properties_from_cal_component (EGwItem *item, ECalComponent *comp, ECalBackendGroupwise *cbgw)
{
const char *uid, *location;
+ char *value;
ECalComponentDateTime dt;
ECalComponentClassification classif;
ECalComponentTransparency transp;
@@ -581,7 +584,9 @@
if (!icaltime_get_timezone (*dt.value))
icaltime_set_timezone (dt.value, default_zone ? default_zone : utc);
itt_utc = icaltime_convert_to_zone (*dt.value, utc);
- e_gw_item_set_end_date (item, icaltime_as_ical_string (itt_utc));
+ value = icaltime_as_ical_string (itt_utc);
+ e_gw_item_set_end_date (item, value);
+ g_free (value);
e_cal_component_free_datetime (&dt);
}
@@ -596,7 +601,9 @@
if (!icaltime_get_timezone (*dt.value))
icaltime_set_timezone (dt.value, default_zone);
itt_utc = icaltime_convert_to_zone (*dt.value, utc);
- e_gw_item_set_due_date (item, icaltime_as_ical_string (itt_utc));
+ value = icaltime_as_ical_string (itt_utc);
+ e_gw_item_set_due_date (item, value);
+ g_free (value);
e_cal_component_free_datetime (&dt);
}
@@ -672,7 +679,9 @@
if (!icaltime_get_timezone (*dt.value))
icaltime_set_timezone (dt.value, default_zone);
itt_utc = icaltime_convert_to_zone (*dt.value, utc);
- e_gw_item_set_start_date (item, icaltime_as_ical_string (itt_utc));
+ value = icaltime_as_ical_string (itt_utc);
+ e_gw_item_set_start_date (item, value);
+ g_free (value);
} else if (e_gw_item_get_item_type (item) == E_GW_ITEM_TYPE_APPOINTMENT) {
e_cal_component_free_datetime (&dt);
/* appointments need the start date property */
@@ -693,12 +702,16 @@
if (!icaltime_get_timezone (*dt.value))
icaltime_set_timezone (dt.value, default_zone);
itt_utc = icaltime_convert_to_zone (*dt.value, utc);
- e_gw_item_set_creation_date (item, icaltime_as_ical_string (itt_utc));
+ value = icaltime_as_ical_string (itt_utc);
+ e_gw_item_set_creation_date (item, value);
+ g_free (value);
} else {
struct icaltimetype itt;
e_cal_component_get_dtstamp (comp, &itt);
- e_gw_item_set_creation_date (item, icaltime_as_ical_string (itt));
+ value = icaltime_as_ical_string (itt);
+ e_gw_item_set_creation_date (item, value);
+ g_free (value);
}
e_cal_component_free_icaltimetype (dt.value);
@@ -1556,7 +1569,7 @@
GList *l;
icaltimetype icaltime;
icaltimezone *utc;
- const char *start_date, *end_date;
+ char *start_date, *end_date;
if (users == NULL)
return E_GW_CONNECTION_STATUS_INVALID_OBJECT;
@@ -1587,6 +1600,8 @@
e_gw_message_write_string_parameter (msg, "startDate", NULL, start_date);
e_gw_message_write_string_parameter (msg, "endDate", NULL, end_date);
+ g_free (start_date);
+ g_free (end_date);
e_gw_message_write_footer (msg);
@@ -2026,7 +2041,7 @@
/* Delay delivery */
if (gopts->delay_enabled) {
- const char *value;
+ char *value;
tt = icaltime_today ();
icaltime_adjust (&tt, gopts->delay_until, 0, 0, 0);
value = icaltime_as_ical_string (tt);
Modified: trunk/calendar/backends/groupwise/e-cal-backend-groupwise.c
==============================================================================
--- trunk/calendar/backends/groupwise/e-cal-backend-groupwise.c (original)
+++ trunk/calendar/backends/groupwise/e-cal-backend-groupwise.c Mon Feb 18 07:33:06 2008
@@ -540,14 +540,17 @@
if (calid->recur_key && calid->ical_id) {
const char *rid = NULL;
+ char *temp;
icaltimetype tt = icaltime_from_string (calid->ical_id);
if (!tt.is_date) {
tt = icaltime_convert_to_zone (tt, priv->default_zone);
icaltime_set_timezone (&tt, priv->default_zone);
rid = icaltime_as_ical_string (tt);
+ temp = rid;
} else
rid = calid->ical_id;
real_key = g_strconcat (calid->recur_key, "@", rid, NULL);
+ g_free (temp);
}
if (!calid->recur_key || real_key) {
@@ -1545,7 +1548,7 @@
if (!icalcomp)
return GNOME_Evolution_Calendar_InvalidObject;
- *object = g_strdup (icalcomponent_as_ical_string (icalcomp));
+ *object = icalcomponent_as_ical_string (icalcomp);
return GNOME_Evolution_Calendar_Success;
}
Modified: trunk/calendar/backends/http/e-cal-backend-http.c
==============================================================================
--- trunk/calendar/backends/http/e-cal-backend-http.c (original)
+++ trunk/calendar/backends/http/e-cal-backend-http.c Mon Feb 18 07:33:06 2008
@@ -333,19 +333,24 @@
comp = e_cal_component_new ();
if (e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (subcomp))) {
const char *uid, *orig_key, *orig_value;
+ char *obj;
e_cal_backend_cache_put_component (priv->cache, comp);
e_cal_component_get_uid (comp, &uid);
/* middle (void*) cast only because of 'dereferencing type-punned pointer will break strict-aliasing rules' */
if (g_hash_table_lookup_extended (old_cache, uid, (void **)(void*)&orig_key, (void **)(void*)&orig_value)) {
+ obj = icalcomponent_as_ical_string (subcomp);
e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbhttp),
orig_value,
- icalcomponent_as_ical_string (subcomp));
+ obj);
+ g_free (obj);
g_hash_table_remove (old_cache, uid);
} else {
+ obj = icalcomponent_as_ical_string (subcomp);
e_cal_backend_notify_object_created (E_CAL_BACKEND (cbhttp),
- icalcomponent_as_ical_string (subcomp));
+ obj);
+ g_free (obj);
}
}
@@ -688,7 +693,7 @@
kind = e_cal_backend_get_kind (E_CAL_BACKEND (backend));
icalcomp = e_cal_util_new_component (kind);
- *object = g_strdup (icalcomponent_as_ical_string (icalcomp));
+ *object = icalcomponent_as_ical_string (icalcomp);
icalcomponent_free (icalcomp);
return GNOME_Evolution_Calendar_Success;
@@ -746,7 +751,7 @@
if (!icalcomp)
return GNOME_Evolution_Calendar_InvalidObject;
- *object = g_strdup (icalcomponent_as_ical_string (icalcomp));
+ *object = icalcomponent_as_ical_string (icalcomp);
return GNOME_Evolution_Calendar_Success;
}
@@ -1048,7 +1053,7 @@
if (e_cal_backend_mail_account_get_default (&address, &name)) {
vfb = create_user_free_busy (cbhttp, address, name, start, end);
calobj = icalcomponent_as_ical_string (vfb);
- *freebusy = g_list_append (*freebusy, g_strdup (calobj));
+ *freebusy = g_list_append (*freebusy, calobj);
icalcomponent_free (vfb);
g_free (address);
g_free (name);
@@ -1060,7 +1065,7 @@
if (e_cal_backend_mail_account_is_valid (address, &name)) {
vfb = create_user_free_busy (cbhttp, address, name, start, end);
calobj = icalcomponent_as_ical_string (vfb);
- *freebusy = g_list_append (*freebusy, g_strdup (calobj));
+ *freebusy = g_list_append (*freebusy, calobj);
icalcomponent_free (vfb);
g_free (name);
}
Modified: trunk/calendar/backends/weather/e-cal-backend-weather.c
==============================================================================
--- trunk/calendar/backends/weather/e-cal-backend-weather.c (original)
+++ trunk/calendar/backends/weather/e-cal-backend-weather.c Mon Feb 18 07:33:06 2008
@@ -149,26 +149,32 @@
l = e_cal_backend_cache_get_components (priv->cache);
for (; l != NULL; l = g_list_next (l)) {
ECalComponentId *id;
+ char *obj;
icomp = e_cal_component_get_icalcomponent (E_CAL_COMPONENT (l->data));
id = e_cal_component_get_id (E_CAL_COMPONENT (l->data));
+ obj = icalcomponent_as_ical_string (icomp);
e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbw),
id,
- icalcomponent_as_ical_string (icomp),
+ obj,
NULL);
e_cal_component_free_id (id);
+ g_free (obj);
g_object_unref (G_OBJECT (l->data));
}
g_list_free (l);
e_file_cache_clean (E_FILE_CACHE (priv->cache));
for (l = forecasts; l != NULL; l = g_list_next (l)) {
+ char *obj;
comp = create_weather (cbw, l->data);
e_cal_backend_cache_put_component (priv->cache, comp);
icomp = e_cal_component_get_icalcomponent (comp);
- e_cal_backend_notify_object_created (E_CAL_BACKEND (cbw), icalcomponent_as_ical_string (icomp));
+ obj = icalcomponent_as_ical_string (icomp);
+ e_cal_backend_notify_object_created (E_CAL_BACKEND (cbw), obj);
+ g_free (obj);
}
priv->is_loading = FALSE;
@@ -579,7 +585,7 @@
if (!icalcomp)
return GNOME_Evolution_Calendar_InvalidObject;
- *object = g_strdup (icalcomponent_as_ical_string (icalcomp));
+ *object = icalcomponent_as_ical_string (icalcomp);
return GNOME_Evolution_Calendar_Success;
}
@@ -662,7 +668,7 @@
icalcomponent_set_dtend (vfb, icaltime_from_timet_with_zone (end, FALSE, utc_zone));
calobj = icalcomponent_as_ical_string (vfb);
- *freebusy = g_list_append (NULL, g_strdup (calobj));
+ *freebusy = g_list_append (NULL, calobj);
icalcomponent_free (vfb);
return GNOME_Evolution_Calendar_Success;
Modified: trunk/calendar/libecal/e-cal-component.c
==============================================================================
--- trunk/calendar/libecal/e-cal-component.c (original)
+++ trunk/calendar/libecal/e-cal-component.c Mon Feb 18 07:33:06 2008
@@ -1245,7 +1245,7 @@
e_cal_component_get_as_string (ECalComponent *comp)
{
ECalComponentPrivate *priv;
- char *str, *buf;
+ char *str;
g_return_val_if_fail (comp != NULL, NULL);
g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), NULL);
@@ -1256,16 +1256,9 @@
/* Ensure that the user has committed the new SEQUENCE */
g_return_val_if_fail (priv->need_sequence_inc == FALSE, NULL);
- /* We dup the string; libical owns that memory */
-
str = icalcomponent_as_ical_string (priv->icalcomp);
- if (str)
- buf = g_strdup (str);
- else
- buf = NULL;
-
- return buf;
+ return str;
}
/* Used from g_hash_table_foreach(); ensures that an alarm subcomponent
@@ -3568,7 +3561,7 @@
*
* Return value: the recurrence ID as a string.
*/
-const char *
+char *
e_cal_component_get_recurid_as_string (ECalComponent *comp)
{
ECalComponentRange range;
@@ -3584,7 +3577,7 @@
e_cal_component_free_range (&range);
return icaltime_is_valid_time (tt) && !icaltime_is_null_time (tt) ?
- icaltime_as_ical_string (tt) : "0";
+ icaltime_as_ical_string (tt) : g_strdup ("0");
}
/**
Modified: trunk/calendar/libecal/e-cal-component.h
==============================================================================
--- trunk/calendar/libecal/e-cal-component.h (original)
+++ trunk/calendar/libecal/e-cal-component.h Mon Feb 18 07:33:06 2008
@@ -292,7 +292,7 @@
void e_cal_component_set_priority (ECalComponent *comp, int *priority);
void e_cal_component_get_recurid (ECalComponent *comp, ECalComponentRange *recur_id);
-const char *e_cal_component_get_recurid_as_string (ECalComponent *comp);
+char *e_cal_component_get_recurid_as_string (ECalComponent *comp);
void e_cal_component_set_recurid (ECalComponent *comp, ECalComponentRange *recur_id);
void e_cal_component_get_rdate_list (ECalComponent *comp, GSList **period_list);
Modified: trunk/calendar/libecal/e-cal-recur.c
==============================================================================
--- trunk/calendar/libecal/e-cal-recur.c (original)
+++ trunk/calendar/libecal/e-cal-recur.c Mon Feb 18 07:33:06 2008
@@ -3997,7 +3997,8 @@
icalvalue *value;
icaltimezone *utc_zone;
struct icaltimetype icaltime;
- const char *end_date_string, *xname;
+ const char *xname;
+ char *end_date_string;
/* We save the value as a UTC DATE-TIME. */
utc_zone = icaltimezone_get_utc_timezone ();
@@ -4022,6 +4023,8 @@
param = icalparameter_new_x (end_date_string);
icalparameter_set_xname (param, EVOLUTION_END_DATE_PARAMETER);
icalproperty_add_parameter (prop, param);
+
+ g_free (end_date_string);
}
#ifdef G_OS_WIN32
Modified: trunk/calendar/libecal/e-cal.c
==============================================================================
--- trunk/calendar/libecal/e-cal.c (original)
+++ trunk/calendar/libecal/e-cal.c Mon Feb 18 07:33:06 2008
@@ -4093,7 +4093,7 @@
vtimezone_as_string = icalcomponent_as_ical_string (vtimezone_comp);
g_hash_table_insert (data->timezone_hash, (char*) tzid,
- g_strdup (vtimezone_as_string));
+ vtimezone_as_string);
}
/* This appends the value string to the GString given in data. */
@@ -4171,7 +4171,7 @@
vcal_string);
/* Get the string for the VEVENT/VTODO. */
- obj_string = g_strdup (icalcomponent_as_ical_string (icalcomp));
+ obj_string = icalcomponent_as_ical_string (icalcomp);
/* If there were any timezones to send, create a complete VCALENDAR,
else just send the VEVENT/VTODO string. */
@@ -4228,6 +4228,7 @@
CORBA_Environment ev;
ECalendarStatus status;
ECalendarOp *our_op;
+ char *obj;
e_return_error_if_fail (ecal && E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
@@ -4251,10 +4252,12 @@
CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Cal_createObject (priv->cal, icalcomponent_as_ical_string (icalcomp), &ev);
+ obj = icalcomponent_as_ical_string (icalcomp);
+ GNOME_Evolution_Calendar_Cal_createObject (priv->cal, obj, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
e_calendar_free_op (our_op);
+ g_free (obj);
CORBA_exception_free (&ev);
@@ -4263,6 +4266,7 @@
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
}
+ g_free (obj);
CORBA_exception_free (&ev);
e_flag_wait (our_op->done);
@@ -4304,6 +4308,7 @@
CORBA_Environment ev;
ECalendarStatus status;
ECalendarOp *our_op;
+ char *obj;
e_return_error_if_fail (ecal && E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
e_return_error_if_fail (icalcomp, E_CALENDAR_STATUS_INVALID_ARG);
@@ -4328,10 +4333,12 @@
CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Cal_modifyObject (priv->cal, icalcomponent_as_ical_string (icalcomp), mod, &ev);
+ obj = icalcomponent_as_ical_string (icalcomp);
+ GNOME_Evolution_Calendar_Cal_modifyObject (priv->cal, obj, mod, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
e_calendar_free_op (our_op);
+ g_free (obj);
CORBA_exception_free (&ev);
@@ -4340,6 +4347,7 @@
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
}
+ g_free (obj);
CORBA_exception_free (&ev);
e_flag_wait (our_op->done);
@@ -4468,6 +4476,7 @@
CORBA_Environment ev;
ECalendarStatus status;
ECalendarOp *our_op;
+ char *obj;
e_return_error_if_fail (ecal && E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
@@ -4491,10 +4500,12 @@
CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Cal_receiveObjects (priv->cal, icalcomponent_as_ical_string (icalcomp), &ev);
+ obj = icalcomponent_as_ical_string (icalcomp);
+ GNOME_Evolution_Calendar_Cal_receiveObjects (priv->cal, obj, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
e_calendar_free_op (our_op);
+ g_free (obj);
CORBA_exception_free (&ev);
@@ -4503,6 +4514,7 @@
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
}
+ g_free (obj);
CORBA_exception_free (&ev);
e_flag_wait (our_op->done);
@@ -4536,6 +4548,7 @@
CORBA_Environment ev;
ECalendarStatus status;
ECalendarOp *our_op;
+ char *obj;
e_return_error_if_fail (ecal && E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
@@ -4559,10 +4572,12 @@
CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Cal_sendObjects (priv->cal, icalcomponent_as_ical_string (icalcomp), &ev);
+ obj = icalcomponent_as_ical_string (icalcomp);
+ GNOME_Evolution_Calendar_Cal_sendObjects (priv->cal, obj, &ev);
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
e_calendar_free_op (our_op);
+ g_free (obj);
CORBA_exception_free (&ev);
@@ -4571,6 +4586,7 @@
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
}
+ g_free (obj);
CORBA_exception_free (&ev);
e_flag_wait (our_op->done);
@@ -4740,7 +4756,7 @@
CORBA_Environment ev;
ECalendarStatus status;
ECalendarOp *our_op;
- const char *tzobj;
+ char *tzobj;
icalcomponent *icalcomp;
e_return_error_if_fail (ecal && E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
@@ -4791,6 +4807,7 @@
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
e_calendar_free_op (our_op);
+ g_free (tzobj);
CORBA_exception_free (&ev);
@@ -4799,6 +4816,7 @@
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
}
+ g_free (tzobj);
CORBA_exception_free (&ev);
e_flag_wait (our_op->done);
@@ -4940,6 +4958,7 @@
if (BONOBO_EX (&ev)) {
e_calendar_remove_op (ecal, our_op);
e_calendar_free_op (our_op);
+ g_free (tzobj);
CORBA_exception_free (&ev);
@@ -4948,6 +4967,7 @@
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
}
+ g_free (tzobj);
CORBA_exception_free (&ev);
e_flag_wait (our_op->done);
Modified: trunk/calendar/libedata-cal/e-cal-backend-cache.c
==============================================================================
--- trunk/calendar/libedata-cal/e-cal-backend-cache.c (original)
+++ trunk/calendar/libedata-cal/e-cal-backend-cache.c Mon Feb 18 07:33:06 2008
@@ -377,7 +377,7 @@
ECalComponent *comp)
{
char *real_key, *uid, *comp_str;
- const char *rid;
+ char *rid;
gboolean retval;
ECalBackendCachePrivate *priv;
@@ -402,6 +402,7 @@
g_free (real_key);
g_free (comp_str);
+ g_free (rid);
return retval;
}
@@ -605,6 +606,7 @@
icaltimezone *new_zone;
icalcomponent *icalcomp;
gboolean retval;
+ char *obj;
g_return_val_if_fail (E_IS_CAL_BACKEND_CACHE (cache), FALSE);
g_return_val_if_fail (zone != NULL, FALSE);
@@ -616,15 +618,17 @@
if (!icalcomp)
return FALSE;
+ obj = icalcomponent_as_ical_string (icalcomp);
if (e_file_cache_get_object (E_FILE_CACHE (cache), icaltimezone_get_tzid ((icaltimezone *)zone))) {
retval = e_file_cache_replace_object (E_FILE_CACHE (cache),
icaltimezone_get_tzid ((icaltimezone *)zone),
- icalcomponent_as_ical_string (icalcomp));
+ obj);
} else {
retval = e_file_cache_add_object (E_FILE_CACHE (cache),
icaltimezone_get_tzid ((icaltimezone *)zone),
- icalcomponent_as_ical_string (icalcomp));
+ obj);
}
+ g_free (obj);
if (!retval)
return FALSE;
@@ -652,6 +656,7 @@
ECalBackendCachePrivate *priv;
icalcomponent *icalcomp;
gboolean retval;
+ char *obj;
g_return_val_if_fail (E_IS_CAL_BACKEND_CACHE (cache), FALSE);
@@ -662,14 +667,16 @@
if (!icalcomp)
return FALSE;
+ obj = icalcomponent_as_ical_string (icalcomp);
if (e_file_cache_get_object (E_FILE_CACHE (cache), "default_zone")) {
retval = e_file_cache_replace_object (E_FILE_CACHE (cache), "default_zone",
- icalcomponent_as_ical_string (icalcomp));
+ obj);
} else {
retval = e_file_cache_add_object (E_FILE_CACHE (cache),
"default_zone",
- icalcomponent_as_ical_string (icalcomp));
+ obj);
}
+ g_free (obj);
if (!retval)
return FALSE;
Modified: trunk/calendar/libedata-cal/e-data-cal-view.c
==============================================================================
--- trunk/calendar/libedata-cal/e-data-cal-view.c (original)
+++ trunk/calendar/libedata-cal/e-data-cal-view.c Mon Feb 18 07:33:06 2008
@@ -102,9 +102,12 @@
return;
}
- if (e_cal_component_is_instance (comp))
- real_uid = g_strdup_printf ("%s %s", uid, e_cal_component_get_recurid_as_string (comp));
- else
+ if (e_cal_component_is_instance (comp)) {
+ char *str;
+ str = e_cal_component_get_recurid_as_string (comp) ;
+ real_uid = g_strdup_printf ("%s %s", uid, str);
+ g_free (str);
+ } else
real_uid = g_strdup (uid);
if (g_hash_table_lookup (priv->matched_objects, real_uid))
Modified: trunk/calendar/tests/ecal/test-ecal.c
==============================================================================
--- trunk/calendar/tests/ecal/test-ecal.c (original)
+++ trunk/calendar/tests/ecal/test-ecal.c Mon Feb 18 07:33:06 2008
@@ -116,9 +116,11 @@
printf ("\n");
for (l = objects; l; l = l->next) {
+ char *obj = icalcomponent_as_ical_string (l->data);
printf ("------------------------------\n");
- printf ("%s", icalcomponent_as_ical_string (l->data));
+ printf ("%s", obj);
printf ("------------------------------\n");
+ free (obj);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]