[evolution-data-server/gnome-2-32] libecal: catch invalid CalObjModType values
- From: Patrick Ohly <pohly src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-2-32] libecal: catch invalid CalObjModType values
- Date: Tue, 7 Jun 2011 12:10:05 +0000 (UTC)
commit 87186c07c7c08c984c85ad09e25e93299a2c030c
Author: Patrick Ohly <patrick ohly intel com>
Date: Thu May 12 09:36:59 2011 +0200
libecal: catch invalid CalObjModType values
This protects backends without their own parameter checking
from being invoked with invalid CalObjModType values. Note
that this only excludes values that haven't been defined.
Backends still need to check whether they support the
selected mode.
(cherry picked from commit e6eb665600248a28bccf268be70d5d3ffcdadb62)
calendar/libecal/e-cal.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index 445cd34..fcdc9f2 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -3655,7 +3655,15 @@ e_cal_modify_object (ECal *ecal, icalcomponent *icalcomp, CalObjModType mod, GEr
e_return_error_if_fail (E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
e_return_error_if_fail (icalcomp, E_CALENDAR_STATUS_INVALID_ARG);
e_return_error_if_fail (icalcomponent_is_valid (icalcomp), E_CALENDAR_STATUS_INVALID_ARG);
- e_return_error_if_fail (mod & CALOBJ_MOD_ALL, E_CALENDAR_STATUS_INVALID_ARG);
+ switch (mod) {
+ case CALOBJ_MOD_THIS:
+ case CALOBJ_MOD_THISANDPRIOR:
+ case CALOBJ_MOD_THISANDFUTURE:
+ case CALOBJ_MOD_ALL:
+ break;
+ default:
+ e_return_error_if_fail ("valid CalObjModType" && FALSE, E_CALENDAR_STATUS_INVALID_ARG);
+ }
priv = ecal->priv;
e_return_error_if_fail (priv->gdbus_cal, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
@@ -3726,7 +3734,16 @@ e_cal_remove_object_with_mod (ECal *ecal, const gchar *uid,
e_return_error_if_fail (E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
e_return_error_if_fail (uid, E_CALENDAR_STATUS_INVALID_ARG);
- e_return_error_if_fail (mod & CALOBJ_MOD_ALL, E_CALENDAR_STATUS_INVALID_ARG);
+ switch (mod) {
+ case CALOBJ_MOD_THIS:
+ case CALOBJ_MOD_THISANDPRIOR:
+ case CALOBJ_MOD_THISANDFUTURE:
+ case CALOBJ_MOD_ONLY_THIS:
+ case CALOBJ_MOD_ALL:
+ break;
+ default:
+ e_return_error_if_fail ("valid CalObjModType" && FALSE, E_CALENDAR_STATUS_INVALID_ARG);
+ }
priv = ecal->priv;
e_return_error_if_fail (priv->gdbus_cal, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]