gnumeric r16663 - in trunk: . plugins/fn-date
- From: mortenw svn gnome org
- To: svn-commits-list gnome org
- Subject: gnumeric r16663 - in trunk: . plugins/fn-date
- Date: Tue, 24 Jun 2008 23:26:16 +0000 (UTC)
Author: mortenw
Date: Tue Jun 24 23:26:16 2008
New Revision: 16663
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16663&view=rev
Log:
2008-06-24 Morten Welinder <terra gnome org>
* functions.c (gnumeric_networkdays): Check date validity.
(gnumeric_days360): Ditto. Fixes #540055.
Modified:
trunk/NEWS
trunk/plugins/fn-date/ChangeLog
trunk/plugins/fn-date/functions.c
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Tue Jun 24 23:26:16 2008
@@ -53,6 +53,7 @@
* Add missing "return" in CODE.
* Fix EDATE issue. [#539868]
* Fix RANK crash. [#540015]
+ * Fix DAYS360 and NETWORKDAYS for invalid dates. [#540055]
SeÃn de BÃrca:
* Move to tango based icons. [#450444]
Modified: trunk/plugins/fn-date/functions.c
==============================================================================
--- trunk/plugins/fn-date/functions.c (original)
+++ trunk/plugins/fn-date/functions.c Tue Jun 24 23:26:16 2008
@@ -926,6 +926,9 @@
datetime_serial_to_g (&date1, serial1, date_conv);
datetime_serial_to_g (&date2, serial2, date_conv);
+ if (!g_date_valid (&date1) || !g_date_valid (&date2))
+ return value_new_error_VALUE (ei->pos);
+
return value_new_int (days_between_basis (&date1, &date2, basis));
}
@@ -1261,14 +1264,14 @@
/* Move to mondays, and check for problems */
start_serial = get_serial_weekday (start_serial, &start_offset, conv);
end_serial = get_serial_weekday (end_serial, &end_offset, conv);
- if (start_serial < 0 || end_serial < 0)
+ if (!g_date_valid (&start_date) || start_serial < 0 || end_serial < 0)
return value_new_error_NUM (ei->pos);
res = end_serial - start_serial;
res -= ((res/7)*2); /* Remove weekends */
if (argv[2] != NULL) {
- GnmValue const *e =
+ GnmValue *e =
value_area_foreach (argv[2], ei->pos,
CELL_ITER_IGNORE_BLANK,
(GnmValueIterFunc)&cb_networkdays_holiday,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]