diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2007-10-10 14:34:38 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2007-10-10 14:34:38 +0000 |
commit | c21fe206b08ec948a70edcd24ba5030d7634fab9 (patch) | |
tree | 600f1a523f4ab1c6c1a425d80af6bd661f4ac2a6 | |
parent | e513120fb960095941b394f30461df18b81ff9f6 (diff) | |
download | libxslt-c21fe206b08ec948a70edcd24ba5030d7634fab9.tar.gz libxslt-c21fe206b08ec948a70edcd24ba5030d7634fab9.tar.bz2 libxslt-c21fe206b08ec948a70edcd24ba5030d7634fab9.zip |
applied patch from Maurice van der Pot to fix EXSLT week-in-year extenson
* libexslt/date.c tests/exslt/date/datetime.1.out
tests/exslt/date/date.1.out tests/exslt/date/date.1.xml:
applied patch from Maurice van der Pot to fix EXSLT
week-in-year extenson which was not conforming to the definition.
This also changes the output of the tests a bit. Should fix #452876
Daniel
svn path=/trunk/; revision=1446
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | NEWS | 10 | ||||
-rw-r--r-- | libexslt/date.c | 24 | ||||
-rw-r--r-- | tests/exslt/date/date.1.out | 96 | ||||
-rw-r--r-- | tests/exslt/date/date.1.xml | 25 | ||||
-rw-r--r-- | tests/exslt/date/datetime.1.out | 8 |
6 files changed, 145 insertions, 26 deletions
@@ -1,3 +1,11 @@ +Wed Oct 10 16:33:09 CEST 2007 Daniel Veillard <daniel@veillard.com> + + * libexslt/date.c tests/exslt/date/datetime.1.out + tests/exslt/date/date.1.out tests/exslt/date/date.1.xml: + applied patch from Maurice van der Pot to fix EXSLT + week-in-year extenson which was not conforming to the definition. + This also changes the output of the tests a bit. Should fix #452876 + Thu Aug 30 08:18:08 HKT 2007 William Brack <wbrack@mmm.com.hk> * python/libxslt.c: applied patch from Daniel Gryniewicz to @@ -10,6 +10,16 @@ ChangeLog.html to the SVN at http://svn.gnome.org/viewcvs/libxslt/trunk/ code base.Those are the public releases made: +1.1.22: Aug 23 2007: + - Bug fixes: RVT cleanup problems (William Brack), exclude-result-prefix + bug (William Brack), stylesheet compilation error handling (Rob Richards). + + - Portability fixes: improve build with VS2005 (Rob Richards), + fixing build on AIX (Bjorn Wiberg), fix the security file checks on + Windows (Roland Schwarz and Rob Richards). + - Improvement: add an --encoding option to xsltproc (Drazen Kacar). + + 1.1.21: Jun 12 2007: - Bug fixes: out of memory allocation errors (William Brack), namespace problem on compound predicates (William Brack), diff --git a/libexslt/date.c b/libexslt/date.c index 2325de33..1127e18a 100644 --- a/libexslt/date.c +++ b/libexslt/date.c @@ -2129,7 +2129,7 @@ static double exsltDateWeekInYear (const xmlChar *dateTime) { exsltDateValPtr dt; - long fdiy, fdiw, ret; + long diy, diw, year, ret; if (dateTime == NULL) { #ifdef WITH_TIME @@ -2147,20 +2147,26 @@ exsltDateWeekInYear (const xmlChar *dateTime) } } - fdiy = DAY_IN_YEAR(1, 1, dt->value.date.year); - + diy = DAY_IN_YEAR(dt->value.date.day, dt->value.date.mon, + dt->value.date.year); + /* * Determine day-in-week (0=Sun, 1=Mon, etc.) then adjust so Monday * is the first day-in-week */ - fdiw = (_exsltDateDayInWeek(fdiy, dt->value.date.year) + 6) % 7; - - ret = (DAY_IN_YEAR(dt->value.date.day, dt->value.date.mon, - dt->value.date.year) + fdiw) / 7; + diw = (_exsltDateDayInWeek(diy, dt->value.date.year) + 6) % 7; /* ISO 8601 adjustment, 3 is Thu */ - if (fdiw <= 3) - ret += 1; + diy += (3 - diw); + if(diy < 1) { + year = dt->value.date.year - 1; + if(year == 0) year--; + diy = DAY_IN_YEAR(31, 12, year) + diy; + } else if (diy > DAY_IN_YEAR(31, 12, dt->value.date.year)) { + diy -= DAY_IN_YEAR(31, 12, dt->value.date.year); + } + + ret = ((diy - 1) / 7) + 1; exsltDateFreeDate(dt); diff --git a/tests/exslt/date/date.1.out b/tests/exslt/date/date.1.out index d301e029..f22546c5 100644 --- a/tests/exslt/date/date.1.out +++ b/tests/exslt/date/date.1.out @@ -7,7 +7,7 @@ month-in-year : 12 month-name : December month-abbreviation : Dec - week-in-year : 53 + week-in-year : 1 day-in-year : 365 day-in-month : 31 day-of-week-in-month : 5 @@ -61,7 +61,7 @@ month-in-year : 12 month-name : December month-abbreviation : Dec - week-in-year : 53 + week-in-year : 1 day-in-year : 365 day-in-month : 31 day-of-week-in-month : 5 @@ -79,7 +79,7 @@ month-in-year : 2 month-name : February month-abbreviation : Feb - week-in-year : 10 + week-in-year : 9 day-in-year : 60 day-in-month : 29 day-of-week-in-month : 5 @@ -90,3 +90,93 @@ hour-in-day : NaN minute-in-hour : NaN second-in-minute : NaN + + Test Date : 1999-01-02 + year : 1999 + leap-year : false + month-in-year : 1 + month-name : January + month-abbreviation : Jan + week-in-year : 53 + day-in-year : 2 + day-in-month : 2 + day-of-week-in-month : 1 + day-in-week : 7 + day-name : Saturday + day-abbreviation : Sat + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 1999-01-03 + year : 1999 + leap-year : false + month-in-year : 1 + month-name : January + month-abbreviation : Jan + week-in-year : 53 + day-in-year : 3 + day-in-month : 3 + day-of-week-in-month : 1 + day-in-week : 1 + day-name : Sunday + day-abbreviation : Sun + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2004-01-01 + year : 2004 + leap-year : true + month-in-year : 1 + month-name : January + month-abbreviation : Jan + week-in-year : 1 + day-in-year : 1 + day-in-month : 1 + day-of-week-in-month : 1 + day-in-week : 5 + day-name : Thursday + day-abbreviation : Thu + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2006-01-01 + year : 2006 + leap-year : false + month-in-year : 1 + month-name : January + month-abbreviation : Jan + week-in-year : 52 + day-in-year : 1 + day-in-month : 1 + day-of-week-in-month : 1 + day-in-week : 1 + day-name : Sunday + day-abbreviation : Sun + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN + + Test Date : 2007-12-31 + year : 2007 + leap-year : false + month-in-year : 12 + month-name : December + month-abbreviation : Dec + week-in-year : 1 + day-in-year : 365 + day-in-month : 31 + day-of-week-in-month : 5 + day-in-week : 2 + day-name : Monday + day-abbreviation : Mon + time : + hour-in-day : NaN + minute-in-hour : NaN + second-in-minute : NaN diff --git a/tests/exslt/date/date.1.xml b/tests/exslt/date/date.1.xml index 0d9c8eb7..562e08e8 100644 --- a/tests/exslt/date/date.1.xml +++ b/tests/exslt/date/date.1.xml @@ -1,10 +1,15 @@ -<?xml version="1.0"?>
-<page>
- <!-- valid xs:date -->
- <date date="0001-12-31Z"/>
- <date date="3000-01-31"/>
- <date date="2000-02-29"/>
- <date date="9990001-12-31Z"/>
- <date date="-0004-02-29"/>
-</page>
-
+<?xml version="1.0"?> +<page> + <!-- valid xs:date --> + <date date="0001-12-31Z"/> + <date date="3000-01-31"/> + <date date="2000-02-29"/> + <date date="9990001-12-31Z"/> + <date date="-0004-02-29"/> + <date date="1999-01-02"/> + <date date="1999-01-03"/> + <date date="2004-01-01"/> + <date date="2006-01-01"/> + <date date="2007-12-31"/> +</page> + diff --git a/tests/exslt/date/datetime.1.out b/tests/exslt/date/datetime.1.out index 2eadb08e..c0b4c537 100644 --- a/tests/exslt/date/datetime.1.out +++ b/tests/exslt/date/datetime.1.out @@ -25,7 +25,7 @@ month-in-year : 12 month-name : December month-abbreviation : Dec - week-in-year : 53 + week-in-year : 1 day-in-year : 365 day-in-month : 31 day-of-week-in-month : 5 @@ -43,7 +43,7 @@ month-in-year : 12 month-name : December month-abbreviation : Dec - week-in-year : 53 + week-in-year : 52 day-in-year : 365 day-in-month : 31 day-of-week-in-month : 5 @@ -61,7 +61,7 @@ month-in-year : 12 month-name : December month-abbreviation : Dec - week-in-year : 53 + week-in-year : 52 day-in-year : 366 day-in-month : 31 day-of-week-in-month : 5 @@ -79,7 +79,7 @@ month-in-year : 12 month-name : December month-abbreviation : Dec - week-in-year : 53 + week-in-year : 1 day-in-year : 366 day-in-month : 31 day-of-week-in-month : 5 |