applied patch from Maurice van der Pot to fix EXSLT week-in-year extenson
authorDaniel Veillard <veillard@src.gnome.org>
Wed, 10 Oct 2007 14:34:38 +0000 (14:34 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Wed, 10 Oct 2007 14:34:38 +0000 (14:34 +0000)
* 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

ChangeLog
NEWS
libexslt/date.c
tests/exslt/date/date.1.out
tests/exslt/date/date.1.xml
tests/exslt/date/datetime.1.out

index c68c47a..81cdc3e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/NEWS b/NEWS
index 3febd99..e029454 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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),
index 2325de3..1127e18 100644 (file)
@@ -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);
 
index d301e02..f22546c 100644 (file)
@@ -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
     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
index 0d9c8eb..562e08e 100644 (file)
@@ -1,10 +1,15 @@
-<?xml version="1.0"?>\r
-<page>\r
-  <!-- valid xs:date -->\r
-  <date date="0001-12-31Z"/>\r
-  <date date="3000-01-31"/>\r
-  <date date="2000-02-29"/>\r
-  <date date="9990001-12-31Z"/>\r
-  <date date="-0004-02-29"/>\r
-</page>\r
-\r
+<?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>
+
index 2eadb08..c0b4c53 100644 (file)
@@ -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