From f3a9fcf8f139f0ba38e45cba38ef90e1288ce073 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Tue, 4 Feb 2020 20:16:59 -0300 Subject: [PATCH] contrib: Fix and simplify range checks --- contrib/evolution/e-cal-data-model.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/contrib/evolution/e-cal-data-model.c b/contrib/evolution/e-cal-data-model.c index 4e13d7fe..0b6f733d 100644 --- a/contrib/evolution/e-cal-data-model.c +++ b/contrib/evolution/e-cal-data-model.c @@ -1898,8 +1898,7 @@ cal_data_model_add_to_subscriber_except_its_range (ECalDataModel *data_model, /* subs_data should have set the old time range, which means only components which didn't fit into the old time range will be added */ - if (!(instance_start <= subs_data->range_end && - instance_end >= subs_data->range_start)) + if (instance_start >= subs_data->range_end || instance_end <= subs_data->range_start) e_cal_data_model_subscriber_component_added (subs_data->subscriber, client, component); return TRUE; @@ -1922,8 +1921,7 @@ cal_data_model_remove_from_subscriber_except_its_range (ECalDataModel *data_mode /* subs_data should have set the new time range, which means only components which don't fit into this new time range will be removed */ - if (!(instance_start <= subs_data->range_end && - instance_end >= subs_data->range_start)) + if (instance_start >= subs_data->range_end || instance_end <= subs_data->range_start) e_cal_data_model_subscriber_component_removed (subs_data->subscriber, client, e_cal_component_id_get_uid (id), e_cal_component_id_get_rid (id)); @@ -2742,8 +2740,8 @@ cal_data_model_foreach_component (ECalDataModel *data_model, /* Is the given time range in the currently used time range? */ if (!(in_range_start == in_range_end && in_range_start == (time_t) 0) && - (in_range_start >= data_model->priv->range_end || - in_range_end <= data_model->priv->range_start)) { + (in_range_start > data_model->priv->range_end || + in_range_end < data_model->priv->range_start)) { UNLOCK_PROPS (); return checked_all; }