From 9debe3352135af9f53d1e7a979f5a46b5410dd60 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 3 Sep 2013 21:47:27 -0500 Subject: Protect against invalid begin or end dates --- src/planner.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/planner.c b/src/planner.c index 1643651..6cbf80c 100644 --- a/src/planner.c +++ b/src/planner.c @@ -184,6 +184,8 @@ indicator_datetime_planner_get_appointments (IndicatorDatetimePlanner * self, GD GSList * appointments; g_return_val_if_fail (INDICATOR_IS_DATETIME_PLANNER (self), NULL); + g_return_val_if_fail (begin != NULL, NULL); + g_return_val_if_fail (end != NULL, NULL); appointments = INDICATOR_DATETIME_PLANNER_GET_CLASS (self)->get_appointments (self, begin, end); return g_slist_sort (appointments, compare_appointments_by_start_time); -- cgit v1.2.3 From 2a97f6029b467702a362d0b1b7108717366d903e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 3 Sep 2013 21:55:23 -0500 Subject: Don't unref NULLs --- src/service.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/service.c b/src/service.c index fec2bb1..421e3dd 100644 --- a/src/service.c +++ b/src/service.c @@ -577,9 +577,9 @@ get_all_appointments_this_month (IndicatorDatetimeService * self) if (p->planner != NULL) { - GDateTime * calendar_date; - GDateTime * begin; - GDateTime * end; + GDateTime * calendar_date = NULL; + GDateTime * begin = NULL; + GDateTime * end = NULL; int y, m, d; calendar_date = get_calendar_date (self); @@ -593,9 +593,12 @@ get_all_appointments_this_month (IndicatorDatetimeService * self) begin, end); - g_date_time_unref (end); - g_date_time_unref (begin); - g_date_time_unref (calendar_date); + if (end != NULL) + g_date_time_unref (end); + if (begin != NULL) + g_date_time_unref (begin); + if (calendar_date != NULL) + g_date_time_unref (calendar_date); } return appointments; -- cgit v1.2.3 From f96fb5c43dcfa24f155bda145fe53c1d87669a36 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 6 Sep 2013 12:45:52 -0500 Subject: Removing check for NULL items --- src/service.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/service.c b/src/service.c index 421e3dd..5fba01e 100644 --- a/src/service.c +++ b/src/service.c @@ -593,12 +593,9 @@ get_all_appointments_this_month (IndicatorDatetimeService * self) begin, end); - if (end != NULL) - g_date_time_unref (end); - if (begin != NULL) - g_date_time_unref (begin); - if (calendar_date != NULL) - g_date_time_unref (calendar_date); + g_date_time_unref (end); + g_date_time_unref (begin); + g_date_time_unref (calendar_date); } return appointments; -- cgit v1.2.3 From 55ed2b1b22607f3b9618640294d233eee15db767 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 6 Sep 2013 12:47:27 -0500 Subject: Making sure we have 0.1 between our bounds on the seconds --- src/service.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/service.c b/src/service.c index 5fba01e..c1f8752 100644 --- a/src/service.c +++ b/src/service.c @@ -585,9 +585,9 @@ get_all_appointments_this_month (IndicatorDatetimeService * self) calendar_date = get_calendar_date (self); g_date_time_get_ymd (calendar_date, &y, &m, &d); begin = g_date_time_new_local (y, m, 1, - 0, 0, 0); + 0, 0, 0.1); end = g_date_time_new_local (y, m, g_date_get_days_in_month(m,y), - 23, 59, 0); + 23, 59, 59.9); appointments = indicator_datetime_planner_get_appointments (p->planner, begin, -- cgit v1.2.3 From dfc6f669720cd38250c57bf2efff97caedfaca81 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 6 Sep 2013 12:52:30 -0500 Subject: Make all seconds a tenth of a second in bounds --- src/service.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/service.c b/src/service.c index c46beeb..f6d1d59 100644 --- a/src/service.c +++ b/src/service.c @@ -227,7 +227,7 @@ calculate_seconds_until_next_fifteen_minutes (GDateTime * now) g_date_time_get_day_of_month (next), g_date_time_get_hour (next), g_date_time_get_minute (next), - 1); + 0.1); str = g_date_time_format (start_of_next, "%F %T"); g_debug ("%s %s the next timestamp rebuild will be at %s", G_STRLOC, G_STRFUNC, str); @@ -299,7 +299,7 @@ calculate_milliseconds_until_next_minute (GDateTime * now) g_date_time_get_day_of_month (next), g_date_time_get_hour (next), g_date_time_get_minute (next), - 0); + 0.1); interval_usec = g_date_time_difference (start_of_next, now); interval_msec = (interval_usec + 999) / 1000; @@ -1650,8 +1650,8 @@ update_appointment_lists (IndicatorDatetimeService * self) /* get all the appointments in the calendar month */ g_date_time_get_ymd (calendar_date, &y, &m, &d); - begin = g_date_time_new_local (y, m, 1, 0, 0, 0); - end = g_date_time_new_local (y, m, g_date_get_days_in_month(m,y), 23, 59, 0); + begin = g_date_time_new_local (y, m, 1, 0, 0, 0.1); + end = g_date_time_new_local (y, m, g_date_get_days_in_month(m,y), 23, 59, 59.9); if (begin && end) indicator_datetime_planner_get_appointments (planner, begin, end, on_calendar_appointments_ready, -- cgit v1.2.3 From fde292a8ff3c830ea27f3a11f45e959596fede09 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 8 Sep 2013 13:17:08 -0500 Subject: Bad merge --- src/planner.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/planner.c b/src/planner.c index 17cc55b..e826c2c 100644 --- a/src/planner.c +++ b/src/planner.c @@ -188,6 +188,8 @@ indicator_datetime_planner_get_appointments (IndicatorDatetimePlanner * self, IndicatorDatetimePlannerClass * klass; g_return_if_fail (INDICATOR_IS_DATETIME_PLANNER (self)); + g_return_val_if_fail (begin != NULL, NULL); + g_return_val_if_fail (end != NULL, NULL); klass = INDICATOR_DATETIME_PLANNER_GET_CLASS (self); g_return_if_fail (klass->get_appointments != NULL); @@ -203,8 +205,6 @@ indicator_datetime_planner_get_appointments_finish (IndicatorDatetimePlanner * GSList * appointments; g_return_val_if_fail (INDICATOR_IS_DATETIME_PLANNER (self), NULL); - g_return_val_if_fail (begin != NULL, NULL); - g_return_val_if_fail (end != NULL, NULL); klass = INDICATOR_DATETIME_PLANNER_GET_CLASS (self); g_return_val_if_fail (klass->get_appointments_finish != NULL, NULL); -- cgit v1.2.3