From 79ec5b35a834e63ef1713a8ed58f8c394db35dfe Mon Sep 17 00:00:00 2001 From: Iain Holmes Date: Mon, 17 Sep 2001 20:31:36 +0000 Subject: Fix the use of qsort svn path=/trunk/; revision=12906 --- my-evolution/ChangeLog | 5 +++++ my-evolution/e-summary-calendar.c | 12 ++++++++---- my-evolution/e-summary.c | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) (limited to 'my-evolution') diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog index 4757c35759..b01c8b3297 100644 --- a/my-evolution/ChangeLog +++ b/my-evolution/ChangeLog @@ -1,3 +1,8 @@ +2001-09-17 Iain Holmes + + * e-summary-calendar.c (uids_to_array): Correctly use qsort. + (e_summary_calendar_event_sort_func): Dereference the e1 and e2. + 2001-09-17 Federico Mena Quintero * e-summary.c (e_summary_init): There is no need to initialize the diff --git a/my-evolution/e-summary-calendar.c b/my-evolution/e-summary-calendar.c index 789cff124a..85c14546b0 100644 --- a/my-evolution/e-summary-calendar.c +++ b/my-evolution/e-summary-calendar.c @@ -51,10 +51,14 @@ e_summary_calendar_event_sort_func (const void *e1, { ESummaryCalEvent *event1, *event2; - event1 = (ESummaryCalEvent *) e1; - event2 = (ESummaryCalEvent *) e2; + event1 = *(ESummaryCalEvent **) e1; + event2 = *(ESummaryCalEvent **) e2; - return icaltime_compare (*event1->dt.value, *event2->dt.value); + if (event1->dt.value == NULL || event2->dt.value == NULL) { + return 0; + } + + return icaltime_compare (*(event1->dt.value), *(event2->dt.value)); } static GPtrArray * @@ -95,7 +99,7 @@ uids_to_array (ESummary *summary, g_ptr_array_add (array, event); } - qsort (array->pdata, array->len, sizeof (ESummaryCalEvent), e_summary_calendar_event_sort_func); + qsort (array->pdata, array->len, sizeof (ESummaryCalEvent *), e_summary_calendar_event_sort_func); return array; } diff --git a/my-evolution/e-summary.c b/my-evolution/e-summary.c index 9ef4ff6f0a..582926bf10 100644 --- a/my-evolution/e-summary.c +++ b/my-evolution/e-summary.c @@ -38,6 +38,7 @@ #include #include +#include #include "e-summary.h" #include "e-summary-preferences.h" -- cgit v1.2.3