mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-23 01:52:48 +03:00
xmlschemastypes.c: accept endOfDayFrag Times set to "24:00:00" mean "end of day" and should not cause an error.
This commit is contained in:
committed by
Daniel Veillard
parent
b29377109b
commit
a1dca81df7
@@ -62,7 +62,7 @@ struct _xmlSchemaValDate {
|
|||||||
long year;
|
long year;
|
||||||
unsigned int mon :4; /* 1 <= mon <= 12 */
|
unsigned int mon :4; /* 1 <= mon <= 12 */
|
||||||
unsigned int day :5; /* 1 <= day <= 31 */
|
unsigned int day :5; /* 1 <= day <= 31 */
|
||||||
unsigned int hour :5; /* 0 <= hour <= 23 */
|
unsigned int hour :5; /* 0 <= hour <= 24 */
|
||||||
unsigned int min :6; /* 0 <= min <= 59 */
|
unsigned int min :6; /* 0 <= min <= 59 */
|
||||||
double sec;
|
double sec;
|
||||||
unsigned int tz_flag :1; /* is tzo explicitely set? */
|
unsigned int tz_flag :1; /* is tzo explicitely set? */
|
||||||
@@ -1139,9 +1139,13 @@ static const unsigned int daysInMonthLeap[12] =
|
|||||||
#define VALID_DATE(dt) \
|
#define VALID_DATE(dt) \
|
||||||
(VALID_YEAR(dt->year) && VALID_MONTH(dt->mon) && VALID_MDAY(dt))
|
(VALID_YEAR(dt->year) && VALID_MONTH(dt->mon) && VALID_MDAY(dt))
|
||||||
|
|
||||||
|
#define VALID_END_OF_DAY(dt) \
|
||||||
|
((dt)->hour == 24 && (dt)->min == 0 && (dt)->sec == 0)
|
||||||
|
|
||||||
#define VALID_TIME(dt) \
|
#define VALID_TIME(dt) \
|
||||||
(VALID_HOUR(dt->hour) && VALID_MIN(dt->min) && \
|
(((VALID_HOUR(dt->hour) && VALID_MIN(dt->min) && \
|
||||||
VALID_SEC(dt->sec) && VALID_TZO(dt->tzo))
|
VALID_SEC(dt->sec)) || VALID_END_OF_DAY(dt)) && \
|
||||||
|
VALID_TZO(dt->tzo))
|
||||||
|
|
||||||
#define VALID_DATETIME(dt) \
|
#define VALID_DATETIME(dt) \
|
||||||
(VALID_DATE(dt) && VALID_TIME(dt))
|
(VALID_DATE(dt) && VALID_TIME(dt))
|
||||||
@@ -1355,7 +1359,7 @@ _xmlSchemaParseTime (xmlSchemaValDatePtr dt, const xmlChar **str) {
|
|||||||
return ret;
|
return ret;
|
||||||
if (*cur != ':')
|
if (*cur != ':')
|
||||||
return 1;
|
return 1;
|
||||||
if (!VALID_HOUR(value))
|
if (!VALID_HOUR(value) && value != 24 /* Allow end-of-day hour */)
|
||||||
return 2;
|
return 2;
|
||||||
cur++;
|
cur++;
|
||||||
|
|
||||||
@@ -1377,7 +1381,7 @@ _xmlSchemaParseTime (xmlSchemaValDatePtr dt, const xmlChar **str) {
|
|||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if ((!VALID_SEC(dt->sec)) || (!VALID_TZO(dt->tzo)))
|
if (!VALID_TIME(dt))
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
*str = cur;
|
*str = cur;
|
||||||
|
Reference in New Issue
Block a user