derick Tue Jul 15 17:37:33 2008 UTC
Modified files:
/php-src/ext/date/lib dow.c parse_date.c parse_date.re timelib.h
Log:
- Also add the warnings for times. This does not make sense for the english
text parser, as invalid times are never allowed in there.
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/dow.c?r1=1.15&r2=1.16&diff_format=u
Index: php-src/ext/date/lib/dow.c
diff -u php-src/ext/date/lib/dow.c:1.15 php-src/ext/date/lib/dow.c:1.16
--- php-src/ext/date/lib/dow.c:1.15 Mon Jul 14 17:30:08 2008
+++ php-src/ext/date/lib/dow.c Tue Jul 15 17:37:32 2008
@@ -16,7 +16,7 @@
+--+
*/
-/* $Id: dow.c,v 1.15 2008/07/14 17:30:08 derick Exp $ */
+/* $Id: dow.c,v 1.16 2008/07/15 17:37:32 derick Exp $ */
#include "timelib.h"
@@ -140,6 +140,14 @@
return day + ((w - 1) * 7) + d;
}
+int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s)
+{
+ if (h < 0 || h > 23 || i < 0 || i > 59 || s < 0 || s > 59) {
+ return 0;
+ }
+ return 1;
+}
+
int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d)
{
if (m < 1 || m > 12 || d < 1 || d > timelib_days_in_month(y, m)) {
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.c?r1=1.93&r2=1.94&diff_format=u
Index: php-src/ext/date/lib/parse_date.c
diff -u php-src/ext/date/lib/parse_date.c:1.93
php-src/ext/date/lib/parse_date.c:1.94
--- php-src/ext/date/lib/parse_date.c:1.93 Mon Jul 14 17:30:08 2008
+++ php-src/ext/date/lib/parse_date.c Tue Jul 15 17:37:32 2008
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Mon Jul 14 19:27:22 2008 */
+/* Generated by re2c 0.13.5 on Tue Jul 15 19:35:53 2008 */
#line 1 "ext/date/lib/parse_date.re"
/*
+--+
@@ -18,7 +18,7 @@
+--+
*/
-/* $Id: parse_date.c,v 1.93 2008/07/14 17:30:08 derick Exp $ */
+/* $Id: parse_date.c,v 1.94 2008/07/15 17:37:32 derick Exp $ */
#include "timelib.h"
@@ -23630,6 +23630,12 @@
}
}
+ /* do funky checking whether the parsed time was valid time */
+ if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
+ s->time->s != TIMELIB_UNSET &&
+ !timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
+ add_pbf_warning(s, "The parsed time was invalid", string, ptr);
+ }
/* do funky checking whether the parsed date was valid date */
if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
s->time->d != TIMELIB_UNSET &&
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.re?r1=1.84&r2=1.85&diff_format=u
Index: php-src/ext/date/lib/parse_date.re
diff -u php-src/ext/date/lib/parse_date.re:1.84
php-src/ext/date/lib/parse_date.re:1.85
--- php-src/ext/date/lib/parse_date.re:1.84 Mon Jul 14 17:30:09 2008
+++ php-src/ext/date/lib/parse_date.re Tue Jul 15 17:37:33 2008
@@ -16,7 +16,7 @@
+--+
*/
-/* $Id: parse_date.re,v 1.84 2008/07/14 17:30:09 derick Exp $ */
+/* $Id: parse_date.re,v 1.85 2008/07/15 17:37:33 derick Exp $ */
#include "timelib.h"
@@ -2040,6 +2040,12 @@
}
}
+ /* do funky checking whether the parsed time was valid time */
+ if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
+ s->time->s != TIMELIB_UNSET &&
+ !timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
+ add_pbf_warning(s, "The parsed time was invalid", string, ptr);
+ }
/* do funky checking whether the parsed date was valid date */
if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
s->time->d != TIMELIB_UNSET &&
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/timelib.h?r1=1.31&r2=1.32&diff_format=u
Index: php-src/ext/date/lib/timelib.h
diff -u php-src/ext/date/lib/timelib.h:1.31 php-src/ext/date/lib/timelib.h:1.32
--- php-src/ext/date/lib/timelib.h:1.31 Mon Jul 14 17:30:09 2008
+++ php-src/ext/date/lib/timelib.h Tue Jul 15 17:37:33 2008
@@ -16,7 +16,7 @@
+--+
*/
-/* $Id: timelib.h,v 1.31 2008/07/14 17:30:09 derick Exp $ */
+/* $Id: timelib.h,v 1.32 2008/07/15 17:37:33 derick Exp $ */
#ifndef __TIMELIB_H__
#define __TIMELIB_H__
@@ -56,6 +56,7 @@
timelib_sll timelib_daynr_from_weeknr(timelib_sll y, timelib_sll w,
timelib_sll d);
timelib_sll timelib_days_in_month(timelib_sll y, timelib_sll m);
void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d,
timelib_sll *iw, timelib_sll *iy);
+int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s);
int timelib_valid_date(timelib_sll y, timeli