[evolution-patches] Re: [Evolution-hackers] e_cal_get_object_list query



On Mon, 2003-12-01 at 05:42, William Jon McCann wrote:
> JP Rosevear wrote:
> >>Nope, I think I missed implementing direct time_t searches in the
> >>backend sexp stuff - can you submit a patch to libecal to fix this?
> > 
> > 
> > To do the iso_start and iso_end thing in e-cal i mean.
> > 
> > -JP
> 
> Here is the patch.
> 
> Is this ok to commit?

Comments inline.
> 
> ______________________________________________________________________
> Index: calendar/ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
> retrieving revision 1.29
> diff -u -r1.29 ChangeLog
> --- calendar/ChangeLog	28 Nov 2003 12:02:02 -0000	1.29
> +++ calendar/ChangeLog	1 Dec 2003 10:23:56 -0000
> @@ -1,3 +1,8 @@
> +2003-12-01  William Jon McCann  <mccann jhu edu>
> +
> +	* libecal/e-cal.c (e_cal_generate_instances): Fix query and
> +	get object list as components.
> +
>  2003-11-28  Rodrigo Moya <rodrigo ximian com>
>  
>  	* backends/groupwise/e-gw-connection.c (parse_response_status): new
> Index: calendar/libecal/e-cal.c
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal.c,v
> retrieving revision 1.8
> diff -u -r1.8 e-cal.c
> --- calendar/libecal/e-cal.c	27 Nov 2003 02:30:09 -0000	1.8
> +++ calendar/libecal/e-cal.c	1 Dec 2003 10:24:02 -0000
> @@ -2627,6 +2627,7 @@
>  	GList *instances;
>  	GList *l;
>  	char *query;
> +	char *iso_start, *iso_end;
>  	
>  	g_return_if_fail (ecal != NULL);
>  	g_return_if_fail (E_IS_CAL (ecal));
> @@ -2638,24 +2639,23 @@
>  	g_return_if_fail (start <= end);
>  	g_return_if_fail (cb != NULL);
>  
> +	iso_start = isodate_from_time_t (start);
> +	iso_end   = isodate_from_time_t (end);
>  	/* Generate objects */
> -	query = g_strdup_printf ("(occur-in-time-range? (%lu) (%lu))", start, end);
> -	if (!e_cal_get_object_list (ecal, query, &objects, NULL)) {
> +	query = g_strdup_printf ("(occur-in-time-range? (make-time \"%s\") (make-time \"%s\"))", iso_start, iso_end);
> +	g_free (iso_start);
> +	g_free (iso_end);
> +	if (!e_cal_get_object_list_as_comp (ecal, query, &objects, NULL)) {
>  		g_free (query);
>  		return;
>  	}	
>  	g_free (query);
> -
>  	instances = NULL;
>  
> -	for (l = objects; l; l = l->next) {
> -		ECalComponent *comp;
> -
> -		comp = l->data;
> -		e_cal_recur_generate_instances (comp, start, end, add_instance, &instances,
> +	for (l = objects; l != NULL; l = l->next) {

Using l != NULL is inconsistent with the code in the rest of the method,
better just to leave the check the same I think.

> +		e_cal_recur_generate_instances (l->data, start, end, add_instance, &instances,
>  					      e_cal_resolve_tzid_cb, ecal,
>  					      priv->default_zone);
> -		g_object_unref (G_OBJECT (comp));

Why did you remove the unref?  I believe this is a leak.

-JP
-- 
JP Rosevear <jpr ximian com>
Ximian, Inc.




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