aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-03-15 08:15:08 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-03-15 08:15:08 +0800
commit959c04d0ceff552c5d9a551f79702c33bdac16a5 (patch)
tree5c813bad5504e96cbbfad42591281a56a4b05bec
parent035fa295cd121615924fb64a219a8cbb06df9155 (diff)
downloadgsoc2013-evolution-959c04d0ceff552c5d9a551f79702c33bdac16a5.tar
gsoc2013-evolution-959c04d0ceff552c5d9a551f79702c33bdac16a5.tar.gz
gsoc2013-evolution-959c04d0ceff552c5d9a551f79702c33bdac16a5.tar.bz2
gsoc2013-evolution-959c04d0ceff552c5d9a551f79702c33bdac16a5.tar.lz
gsoc2013-evolution-959c04d0ceff552c5d9a551f79702c33bdac16a5.tar.xz
gsoc2013-evolution-959c04d0ceff552c5d9a551f79702c33bdac16a5.tar.zst
gsoc2013-evolution-959c04d0ceff552c5d9a551f79702c33bdac16a5.zip
Add argument checks to weekday functions.
-rw-r--r--e-util/e-misc-utils.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/e-util/e-misc-utils.c b/e-util/e-misc-utils.c
index 0f350999f5..776027da09 100644
--- a/e-util/e-misc-utils.c
+++ b/e-util/e-misc-utils.c
@@ -1596,6 +1596,10 @@ GDateWeekday
e_weekday_add_days (GDateWeekday weekday,
guint n_days)
{
+ g_return_val_if_fail (
+ g_date_valid_weekday (weekday),
+ G_DATE_BAD_WEEKDAY);
+
n_days %= 7; /* Weekdays repeat every 7 days. */
while (n_days-- > 0)
@@ -1617,6 +1621,10 @@ GDateWeekday
e_weekday_subtract_days (GDateWeekday weekday,
guint n_days)
{
+ g_return_val_if_fail (
+ g_date_valid_weekday (weekday),
+ G_DATE_BAD_WEEKDAY);
+
n_days %= 7; /* Weekdays repeat every 7 days. */
while (n_days-- > 0)
@@ -1640,6 +1648,9 @@ e_weekday_get_days_between (GDateWeekday weekday1,
{
guint n_days = 0;
+ g_return_val_if_fail (g_date_valid_weekday (weekday1), 0);
+ g_return_val_if_fail (g_date_valid_weekday (weekday2), 0);
+
while (weekday1 != weekday2) {
n_days++;
weekday1 = e_weekday_get_next (weekday1);