[evolution-data-server/gnome-40] Ensure non-const pointers passed to I_CAL_IS_... functions



commit 1941cad69482e453b3dee1f855452d793384fb0d
Author: Milan Crha <mcrha redhat com>
Date:   Wed Apr 7 11:17:09 2021 +0200

    Ensure non-const pointers passed to I_CAL_IS_... functions
    
    Related to https://gitlab.gnome.org/GNOME/glib/-/issues/2353

 src/calendar/libecal/e-cal-component-alarm-repeat.c  |  2 +-
 src/calendar/libecal/e-cal-component-alarm-trigger.c | 16 ++++++++--------
 src/calendar/libecal/e-cal-component-alarm.c         |  4 ++--
 src/calendar/libecal/e-cal-component-attendee.c      |  4 ++--
 src/calendar/libecal/e-cal-component-datetime.c      |  6 +++---
 src/calendar/libecal/e-cal-component-organizer.c     |  4 ++--
 src/calendar/libecal/e-cal-component-parameter-bag.c |  4 ++--
 src/calendar/libecal/e-cal-component-period.c        | 16 ++++++++--------
 src/calendar/libecal/e-cal-component-property-bag.c  |  4 ++--
 src/calendar/libecal/e-cal-component.c               |  2 +-
 src/calendar/libecal/e-cal-util.c                    |  4 ++--
 11 files changed, 33 insertions(+), 33 deletions(-)
---
diff --git a/src/calendar/libecal/e-cal-component-alarm-repeat.c 
b/src/calendar/libecal/e-cal-component-alarm-repeat.c
index 18c4cc35d..787b8df4f 100644
--- a/src/calendar/libecal/e-cal-component-alarm-repeat.c
+++ b/src/calendar/libecal/e-cal-component-alarm-repeat.c
@@ -52,7 +52,7 @@ ECalComponentAlarmRepeat *
 e_cal_component_alarm_repeat_new (gint repetitions,
                                  const ICalDuration *interval)
 {
-       g_return_val_if_fail (I_CAL_IS_DURATION (interval), NULL);
+       g_return_val_if_fail (I_CAL_IS_DURATION ((ICalDuration *) interval), NULL);
 
        return e_cal_component_alarm_repeat_new_seconds (repetitions,
                i_cal_duration_as_int ((ICalDuration *) interval));
diff --git a/src/calendar/libecal/e-cal-component-alarm-trigger.c 
b/src/calendar/libecal/e-cal-component-alarm-trigger.c
index 7a91add5e..1d22b9e8b 100644
--- a/src/calendar/libecal/e-cal-component-alarm-trigger.c
+++ b/src/calendar/libecal/e-cal-component-alarm-trigger.c
@@ -63,7 +63,7 @@ e_cal_component_alarm_trigger_new_relative (ECalComponentAlarmTriggerKind kind,
        ECalComponentAlarmTrigger *trigger;
 
        g_return_val_if_fail (kind != E_CAL_COMPONENT_ALARM_TRIGGER_ABSOLUTE, NULL);
-       g_return_val_if_fail (I_CAL_IS_DURATION (duration), NULL);
+       g_return_val_if_fail (I_CAL_IS_DURATION ((ICalDuration *) duration), NULL);
 
        trigger = g_slice_new0 (ECalComponentAlarmTrigger);
        trigger->parameter_bag = e_cal_component_parameter_bag_new ();
@@ -93,7 +93,7 @@ e_cal_component_alarm_trigger_new_absolute (const ICalTime *absolute_time)
 {
        ECalComponentAlarmTrigger *trigger;
 
-       g_return_val_if_fail (I_CAL_IS_TIME (absolute_time), NULL);
+       g_return_val_if_fail (I_CAL_IS_TIME ((ICalTime *) absolute_time), NULL);
 
        trigger = g_slice_new0 (ECalComponentAlarmTrigger);
        trigger->parameter_bag = e_cal_component_parameter_bag_new ();
@@ -121,7 +121,7 @@ e_cal_component_alarm_trigger_new_from_property (const ICalProperty *property)
 {
        ECalComponentAlarmTrigger *trigger;
 
-       g_return_val_if_fail (I_CAL_IS_PROPERTY (property), NULL);
+       g_return_val_if_fail (I_CAL_IS_PROPERTY ((ICalProperty *) property), NULL);
 
        if (i_cal_property_isa ((ICalProperty *) property) != I_CAL_TRIGGER_PROPERTY)
                return NULL;
@@ -218,7 +218,7 @@ e_cal_component_alarm_trigger_set_from_property (ECalComponentAlarmTrigger *trig
        gboolean relative;
 
        g_return_if_fail (trigger != NULL);
-       g_return_if_fail (I_CAL_IS_PROPERTY (property));
+       g_return_if_fail (I_CAL_IS_PROPERTY ((ICalProperty *) property));
        g_return_if_fail (i_cal_property_isa (prop) == I_CAL_TRIGGER_PROPERTY);
 
        g_clear_object (&trigger->rel_duration);
@@ -415,7 +415,7 @@ e_cal_component_alarm_trigger_set_relative (ECalComponentAlarmTrigger *trigger,
 {
        g_return_if_fail (trigger != NULL);
        g_return_if_fail (kind != E_CAL_COMPONENT_ALARM_TRIGGER_ABSOLUTE);
-       g_return_if_fail (I_CAL_IS_DURATION (duration));
+       g_return_if_fail (I_CAL_IS_DURATION ((ICalDuration *) duration));
 
        g_clear_object (&trigger->rel_duration);
        g_clear_object (&trigger->abs_time);
@@ -443,7 +443,7 @@ e_cal_component_alarm_trigger_set_absolute (ECalComponentAlarmTrigger *trigger,
                                            const ICalTime *absolute_time)
 {
        g_return_if_fail (trigger != NULL);
-       g_return_if_fail (I_CAL_IS_TIME (absolute_time));
+       g_return_if_fail (I_CAL_IS_TIME ((ICalTime *) absolute_time));
 
        g_clear_object (&trigger->rel_duration);
        g_clear_object (&trigger->abs_time);
@@ -532,7 +532,7 @@ e_cal_component_alarm_trigger_set_duration (ECalComponentAlarmTrigger *trigger,
                                            const ICalDuration *duration)
 {
        g_return_if_fail (trigger != NULL);
-       g_return_if_fail (I_CAL_IS_DURATION (duration));
+       g_return_if_fail (I_CAL_IS_DURATION ((ICalDuration *) duration));
 
        if (trigger->kind == E_CAL_COMPONENT_ALARM_TRIGGER_ABSOLUTE)
                return;
@@ -585,7 +585,7 @@ e_cal_component_alarm_trigger_set_absolute_time (ECalComponentAlarmTrigger *trig
                                                 const ICalTime *absolute_time)
 {
        g_return_if_fail (trigger != NULL);
-       g_return_if_fail (I_CAL_IS_TIME (absolute_time));
+       g_return_if_fail (I_CAL_IS_TIME ((ICalTime *) absolute_time));
 
        if (trigger->kind != E_CAL_COMPONENT_ALARM_TRIGGER_ABSOLUTE)
                return;
diff --git a/src/calendar/libecal/e-cal-component-alarm.c b/src/calendar/libecal/e-cal-component-alarm.c
index 52f00def5..228b32e3d 100644
--- a/src/calendar/libecal/e-cal-component-alarm.c
+++ b/src/calendar/libecal/e-cal-component-alarm.c
@@ -93,7 +93,7 @@ e_cal_component_alarm_new_from_component (const ICalComponent *component)
 {
        ECalComponentAlarm *alarm;
 
-       g_return_val_if_fail (I_CAL_IS_COMPONENT (component), NULL);
+       g_return_val_if_fail (I_CAL_IS_COMPONENT ((ICalComponent *) component), NULL);
 
        if (i_cal_component_isa ((ICalComponent *) component) != I_CAL_VALARM_COMPONENT)
                return NULL;
@@ -243,7 +243,7 @@ e_cal_component_alarm_set_from_component (ECalComponentAlarm *alarm,
        ICalProperty *prop, *repeat = NULL;
 
        g_return_if_fail (alarm != NULL);
-       g_return_if_fail (I_CAL_IS_COMPONENT (component));
+       g_return_if_fail (I_CAL_IS_COMPONENT ((ICalComponent *) component));
        g_return_if_fail (i_cal_component_isa ((ICalComponent *) component) == I_CAL_VALARM_COMPONENT);
 
        g_free (alarm->uid);
diff --git a/src/calendar/libecal/e-cal-component-attendee.c b/src/calendar/libecal/e-cal-component-attendee.c
index 7a0fe28c6..b295f59f6 100644
--- a/src/calendar/libecal/e-cal-component-attendee.c
+++ b/src/calendar/libecal/e-cal-component-attendee.c
@@ -146,7 +146,7 @@ e_cal_component_attendee_new_from_property (const ICalProperty *property)
 {
        ECalComponentAttendee *attendee;
 
-       g_return_val_if_fail (I_CAL_IS_PROPERTY (property), NULL);
+       g_return_val_if_fail (I_CAL_IS_PROPERTY ((ICalProperty *) property), NULL);
 
        if (i_cal_property_isa ((ICalProperty *) property) != I_CAL_ATTENDEE_PROPERTY)
                return NULL;
@@ -260,7 +260,7 @@ e_cal_component_attendee_set_from_property (ECalComponentAttendee *attendee,
        ICalParameter *param;
 
        g_return_if_fail (attendee != NULL);
-       g_return_if_fail (I_CAL_IS_PROPERTY (property));
+       g_return_if_fail (I_CAL_IS_PROPERTY ((ICalProperty *) property));
        g_return_if_fail (i_cal_property_isa (prop) == I_CAL_ATTENDEE_PROPERTY);
 
        e_cal_component_attendee_set_value (attendee, i_cal_property_get_attendee (prop));
diff --git a/src/calendar/libecal/e-cal-component-datetime.c b/src/calendar/libecal/e-cal-component-datetime.c
index 29b040b36..9e35fb6df 100644
--- a/src/calendar/libecal/e-cal-component-datetime.c
+++ b/src/calendar/libecal/e-cal-component-datetime.c
@@ -57,7 +57,7 @@ e_cal_component_datetime_new (const ICalTime *value,
 {
        ECalComponentDateTime *dt;
 
-       g_return_val_if_fail (I_CAL_IS_TIME (value), NULL);
+       g_return_val_if_fail (I_CAL_IS_TIME ((ICalTime *) value), NULL);
 
        dt = g_slice_new0 (ECalComponentDateTime);
        e_cal_component_datetime_set (dt, value, tzid);
@@ -155,7 +155,7 @@ e_cal_component_datetime_set (ECalComponentDateTime *dt,
                              const gchar *tzid)
 {
        g_return_if_fail (dt != NULL);
-       g_return_if_fail (I_CAL_IS_TIME (value));
+       g_return_if_fail (I_CAL_IS_TIME ((ICalTime *) value));
 
        e_cal_component_datetime_set_value (dt, value);
        e_cal_component_datetime_set_tzid (dt, tzid);
@@ -194,7 +194,7 @@ e_cal_component_datetime_set_value (ECalComponentDateTime *dt,
                                    const ICalTime *value)
 {
        g_return_if_fail (dt != NULL);
-       g_return_if_fail (I_CAL_IS_TIME (value));
+       g_return_if_fail (I_CAL_IS_TIME ((ICalTime *) value));
 
        if (dt->value != value) {
                g_clear_object (&dt->value);
diff --git a/src/calendar/libecal/e-cal-component-organizer.c 
b/src/calendar/libecal/e-cal-component-organizer.c
index dcb75d6d9..078b3ad61 100644
--- a/src/calendar/libecal/e-cal-component-organizer.c
+++ b/src/calendar/libecal/e-cal-component-organizer.c
@@ -113,7 +113,7 @@ e_cal_component_organizer_new_from_property (const ICalProperty *property)
 {
        ECalComponentOrganizer *organizer;
 
-       g_return_val_if_fail (I_CAL_IS_PROPERTY (property), NULL);
+       g_return_val_if_fail (I_CAL_IS_PROPERTY ((ICalProperty *) property), NULL);
 
        if (i_cal_property_isa ((ICalProperty *) property) != I_CAL_ORGANIZER_PROPERTY)
                return NULL;
@@ -210,7 +210,7 @@ e_cal_component_organizer_set_from_property (ECalComponentOrganizer *organizer,
        ICalParameter *param;
 
        g_return_if_fail (organizer != NULL);
-       g_return_if_fail (I_CAL_IS_PROPERTY (property));
+       g_return_if_fail (I_CAL_IS_PROPERTY ((ICalProperty *) property));
        g_return_if_fail (i_cal_property_isa (prop) == I_CAL_ORGANIZER_PROPERTY);
 
        e_cal_component_organizer_set_value (organizer, i_cal_property_get_organizer (prop));
diff --git a/src/calendar/libecal/e-cal-component-parameter-bag.c 
b/src/calendar/libecal/e-cal-component-parameter-bag.c
index 276e39da3..71cd0bcc8 100644
--- a/src/calendar/libecal/e-cal-component-parameter-bag.c
+++ b/src/calendar/libecal/e-cal-component-parameter-bag.c
@@ -154,7 +154,7 @@ e_cal_component_parameter_bag_set_from_property (ECalComponentParameterBag *bag,
        ICalParameter *param;
 
        g_return_if_fail (bag != NULL);
-       g_return_if_fail (I_CAL_IS_PROPERTY (property));
+       g_return_if_fail (I_CAL_IS_PROPERTY ((ICalProperty *) property));
 
        e_cal_component_parameter_bag_clear (bag);
 
@@ -241,7 +241,7 @@ e_cal_component_parameter_bag_add (ECalComponentParameterBag *bag,
                                  const ICalParameter *param)
 {
        g_return_if_fail (bag != NULL);
-       g_return_if_fail (I_CAL_IS_PARAMETER (param));
+       g_return_if_fail (I_CAL_IS_PARAMETER ((ICalParameter *) param));
 
        e_cal_component_parameter_bag_take (bag,
                i_cal_parameter_clone ((ICalParameter *) param));
diff --git a/src/calendar/libecal/e-cal-component-period.c b/src/calendar/libecal/e-cal-component-period.c
index 80f107d82..22f130b5f 100644
--- a/src/calendar/libecal/e-cal-component-period.c
+++ b/src/calendar/libecal/e-cal-component-period.c
@@ -59,7 +59,7 @@ e_cal_component_period_new_datetime (const ICalTime *start,
 {
        ECalComponentPeriod *period;
 
-       g_return_val_if_fail (I_CAL_IS_TIME (start), NULL);
+       g_return_val_if_fail (I_CAL_IS_TIME ((ICalTime *) start), NULL);
 
        period = g_slice_new0 (ECalComponentPeriod);
        period->kind = E_CAL_COMPONENT_PERIOD_DATETIME;
@@ -88,8 +88,8 @@ e_cal_component_period_new_duration (const ICalTime *start,
 {
        ECalComponentPeriod *period;
 
-       g_return_val_if_fail (I_CAL_IS_TIME (start), NULL);
-       g_return_val_if_fail (I_CAL_IS_DURATION (duration), NULL);
+       g_return_val_if_fail (I_CAL_IS_TIME ((ICalTime *) start), NULL);
+       g_return_val_if_fail (I_CAL_IS_DURATION ((ICalDuration *) duration), NULL);
 
        period = g_slice_new0 (ECalComponentPeriod);
        period->kind = E_CAL_COMPONENT_PERIOD_DURATION;
@@ -193,7 +193,7 @@ e_cal_component_period_set_datetime_full (ECalComponentPeriod *period,
                                          const ICalTime *end)
 {
        g_return_if_fail (period != NULL);
-       g_return_if_fail (I_CAL_IS_TIME (start));
+       g_return_if_fail (I_CAL_IS_TIME ((ICalTime *) start));
 
        g_clear_object (&period->duration);
 
@@ -220,8 +220,8 @@ e_cal_component_period_set_duration_full (ECalComponentPeriod *period,
                                          const ICalDuration *duration)
 {
        g_return_if_fail (period != NULL);
-       g_return_if_fail (I_CAL_IS_TIME (start));
-       g_return_if_fail (I_CAL_IS_DURATION (duration));
+       g_return_if_fail (I_CAL_IS_TIME ((ICalTime *) start));
+       g_return_if_fail (I_CAL_IS_DURATION ((ICalDuration *) duration));
 
        g_clear_object (&period->end);
 
@@ -265,7 +265,7 @@ e_cal_component_period_set_start (ECalComponentPeriod *period,
                                  const ICalTime *start)
 {
        g_return_if_fail (period != NULL);
-       g_return_if_fail (I_CAL_IS_TIME (start));
+       g_return_if_fail (I_CAL_IS_TIME ((ICalTime *) start));
 
        if (period->start != start) {
                g_clear_object (&period->start);
@@ -360,7 +360,7 @@ e_cal_component_period_set_duration (ECalComponentPeriod *period,
 {
        g_return_if_fail (period != NULL);
        g_return_if_fail (period->kind == E_CAL_COMPONENT_PERIOD_DURATION);
-       g_return_if_fail (I_CAL_IS_DURATION (duration));
+       g_return_if_fail (I_CAL_IS_DURATION ((ICalDuration *) duration));
 
        if (period->duration != duration) {
                g_clear_object (&period->duration);
diff --git a/src/calendar/libecal/e-cal-component-property-bag.c 
b/src/calendar/libecal/e-cal-component-property-bag.c
index e4bfc977f..ce1a9459f 100644
--- a/src/calendar/libecal/e-cal-component-property-bag.c
+++ b/src/calendar/libecal/e-cal-component-property-bag.c
@@ -154,7 +154,7 @@ e_cal_component_property_bag_set_from_component (ECalComponentPropertyBag *bag,
        ICalProperty *prop;
 
        g_return_if_fail (bag != NULL);
-       g_return_if_fail (I_CAL_IS_COMPONENT (component));
+       g_return_if_fail (I_CAL_IS_COMPONENT ((ICalComponent *) component));
 
        e_cal_component_property_bag_clear (bag);
 
@@ -241,7 +241,7 @@ e_cal_component_property_bag_add (ECalComponentPropertyBag *bag,
                                  const ICalProperty *prop)
 {
        g_return_if_fail (bag != NULL);
-       g_return_if_fail (I_CAL_IS_PROPERTY (prop));
+       g_return_if_fail (I_CAL_IS_PROPERTY ((ICalProperty *) prop));
 
        e_cal_component_property_bag_take (bag,
                i_cal_property_clone ((ICalProperty *) prop));
diff --git a/src/calendar/libecal/e-cal-component.c b/src/calendar/libecal/e-cal-component.c
index eb5257baa..c8c1ed10b 100644
--- a/src/calendar/libecal/e-cal-component.c
+++ b/src/calendar/libecal/e-cal-component.c
@@ -1852,7 +1852,7 @@ e_cal_component_set_dtstamp (ECalComponent *comp,
        ICalProperty *prop;
 
        g_return_if_fail (E_IS_CAL_COMPONENT (comp));
-       g_return_if_fail (I_CAL_IS_TIME (tt));
+       g_return_if_fail (I_CAL_IS_TIME ((ICalTime *) tt));
        g_return_if_fail (comp->priv->icalcomp != NULL);
 
        prop = i_cal_component_get_first_property (comp->priv->icalcomp, I_CAL_DTSTAMP_PROPERTY);
diff --git a/src/calendar/libecal/e-cal-util.c b/src/calendar/libecal/e-cal-util.c
index 9e87a6526..3381d423c 100644
--- a/src/calendar/libecal/e-cal-util.c
+++ b/src/calendar/libecal/e-cal-util.c
@@ -3090,9 +3090,9 @@ e_cal_util_clamp_vtimezone (ICalComponent *vtimezone,
 {
        g_return_if_fail (I_CAL_IS_COMPONENT (vtimezone));
        g_return_if_fail (i_cal_component_isa (vtimezone) == I_CAL_VTIMEZONE_COMPONENT);
-       g_return_if_fail (I_CAL_IS_TIME (from));
+       g_return_if_fail (I_CAL_IS_TIME ((ICalTime *) from));
        if (to)
-               g_return_if_fail (I_CAL_IS_TIME (to));
+               g_return_if_fail (I_CAL_IS_TIME ((ICalTime *) to));
 
        e_cal_util_clamp_vtimezone_subcomps (vtimezone, I_CAL_XSTANDARD_COMPONENT, from, to);
        e_cal_util_clamp_vtimezone_subcomps (vtimezone, I_CAL_XDAYLIGHT_COMPONENT, from, to);


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