From f14ab0afa345a49816beb215a1b3e2042c13ec40 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Wed, 23 Aug 2006 06:14:03 +0000 Subject: =?UTF-8?q?=09**=20Fix=20for=20bug=20#350395=20by=20=C3=83=C2=98ys?= =?UTF-8?q?tein=20Gisn=C3=83=C2=A5s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/trunk/; revision=32635 --- plugins/itip-formatter/ChangeLog | 7 +++++++ plugins/itip-formatter/itip-view.c | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/itip-formatter/ChangeLog b/plugins/itip-formatter/ChangeLog index c38d2e7694..ddaf22984b 100644 --- a/plugins/itip-formatter/ChangeLog +++ b/plugins/itip-formatter/ChangeLog @@ -1,3 +1,10 @@ +2006-08-23 Srinivasa Ragavan + + ** Fix for bug #350395 by Øystein Gisnås + + * itip-view.c: (format_date_and_time_x): The patch adds some extra + checks to avoid the crash. + 2006-08-18 Chenthill Palanisamy Fixes #328268 diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c index 64cb01f1ef..3d644eca93 100644 --- a/plugins/itip-formatter/itip-view.c +++ b/plugins/itip-formatter/itip-view.c @@ -150,7 +150,8 @@ format_date_and_time_x (struct tm *date_tm, /* Calculate a normalized "tomorrow" */ tomorrow_tm = *current_tm; - if (tomorrow_tm.tm_mday == time_days_in_month (date_tm->tm_year + 1900, date_tm->tm_mon)) { + /* Don't need this if date is in the past. Also, year assumption won't fail. */ + if (date_tm->tm_year >= current_tm->tm_year && tomorrow_tm.tm_mday == time_days_in_month (date_tm->tm_year + 1900, date_tm->tm_mon)) { tomorrow_tm.tm_mday = 1; if (tomorrow_tm.tm_mon == 11) { tomorrow_tm.tm_mon = 1; @@ -164,7 +165,8 @@ format_date_and_time_x (struct tm *date_tm, /* Calculate a normalized "next seven days" */ week_tm = *current_tm; - if (week_tm.tm_mday + 6 > time_days_in_month (date_tm->tm_year + 1900, date_tm->tm_mon)) { + /* Don't need this if date is in the past. Also, year assumption won't fail. */ + if (date_tm->tm_year >= current_tm->tm_year && week_tm.tm_mday + 6 > time_days_in_month (date_tm->tm_year + 1900, date_tm->tm_mon)) { week_tm.tm_mday = (week_tm.tm_mday + 6) % time_days_in_month (date_tm->tm_year + 1900, date_tm->tm_mon); if (week_tm.tm_mon == 11) { week_tm.tm_mon = 1; -- cgit v1.2.3