libxslt r1462 - in trunk: . doc libexslt libxslt



Author: veillard
Date: Thu Apr  3 06:34:12 2008
New Revision: 1462
URL: http://svn.gnome.org/viewvc/libxslt?rev=1462&view=rev

Log:
* libexslt/date.c: applied patch from Peter Pawlowski  fixing
  a timezone offset problem, fixes #521680
* libxslt/namespaces.c: a bit of space/tabs cleanup
Daniel


Modified:
   trunk/ChangeLog
   trunk/doc/xsltproc.1
   trunk/libexslt/date.c
   trunk/libxslt/namespaces.c

Modified: trunk/doc/xsltproc.1
==============================================================================
--- trunk/doc/xsltproc.1	(original)
+++ trunk/doc/xsltproc.1	Thu Apr  3 06:34:12 2008
@@ -1,11 +1,11 @@
 .\"     Title: xsltproc
 .\"    Author: John Fleck <jfleck inkstain net>
 .\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: $Date: 2008-03-03 09:42:08 +0100 (Mon, 03 Mar 2008) $
+.\"      Date: $Date: 2008-04-03 06:26:46 +0200 (Thu, 03 Apr 2008) $
 .\"    Manual: xsltproc Manual
 .\"    Source: libxslt
 .\"
-.TH "XSLTPROC" "1" "$Date: 2008\-03\-03 09:42:08 +0100 (Mon, 03 Mar 2008) $" "libxslt" "xsltproc Manual"
+.TH "XSLTPROC" "1" "$Date: 2008\-04\-03 06:26:46 +0200 (Thu, 03 Apr 2008) $" "libxslt" "xsltproc Manual"
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)

Modified: trunk/libexslt/date.c
==============================================================================
--- trunk/libexslt/date.c	(original)
+++ trunk/libexslt/date.c	Thu Apr  3 06:34:12 2008
@@ -747,7 +747,8 @@
 exsltDateCurrent (void)
 {
     struct tm *localTm, *gmTm;
-    time_t secs, gsecs;
+    time_t secs;
+    int local_s, gm_s;
 #if HAVE_LOCALTIME_R
     struct tm localTmS;
 #endif
@@ -795,9 +796,30 @@
                            ((gmTm->tm_mday * 1440) + (gmTm->tm_hour * 60) +
                              gmTm->tm_min));
 #endif
-    gsecs = mktime(gmTm);
-    ret->value.date.tzo = (secs - gsecs) / 60;
-
+    local_s = localTm->tm_hour * SECS_PER_HOUR +
+        localTm->tm_min * SECS_PER_MIN +
+        localTm->tm_sec;
+    
+    gm_s = gmTm->tm_hour * SECS_PER_HOUR +
+        gmTm->tm_min * SECS_PER_MIN +
+        gmTm->tm_sec;
+    
+    if (localTm->tm_year < gmTm->tm_year) {
+ 	ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60;
+    } else if (localTm->tm_year > gmTm->tm_year) {
+ 	ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60;
+    } else if (localTm->tm_mon < gmTm->tm_mon) {
+ 	ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60;
+    } else if (localTm->tm_mon > gmTm->tm_mon) {
+ 	ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60;
+    } else if (localTm->tm_mday < gmTm->tm_mday) {
+ 	ret->value.date.tzo = -((SECS_PER_DAY - local_s) + gm_s)/60;
+    } else if (localTm->tm_mday > gmTm->tm_mday) {
+ 	ret->value.date.tzo = ((SECS_PER_DAY - gm_s) + local_s)/60;
+    } else  {
+ 	ret->value.date.tzo = (local_s - gm_s)/60;
+    }
+ 
     return ret;
 }
 #endif
@@ -2158,7 +2180,7 @@
 
     /* ISO 8601 adjustment, 3 is Thu */
     diy += (3 - diw);
-    if(diy < 1) {
+    if (diy < 1) {
 	year = dt->value.date.year - 1;
 	if(year == 0) year--;
 	diy = DAY_IN_YEAR(31, 12, year) + diy;

Modified: trunk/libxslt/namespaces.c
==============================================================================
--- trunk/libxslt/namespaces.c	(original)
+++ trunk/libxslt/namespaces.c	Thu Apr  3 06:34:12 2008
@@ -546,7 +546,7 @@
 	    * Hmm, we could also try to reuse an in-scope
 	    * namespace with a matching ns-name but a different
 	    * ns-prefix.
-	    * What has higher priority? 
+	    * What has higher priority?
 	    *  1) If keeping the prefix: create a new ns-decl.
 	    *  2) If reusal: first lookup ns-names; then fallback
 	    *     to creation of a new ns-decl.
@@ -583,13 +583,13 @@
     {
 	xmlChar pref[30];
 	int counter = 1;
-		
+
 	do {
 	    snprintf((char *) pref, 30, "%s_%d", nsPrefix, counter++);
 	    ns = xmlSearchNs(target->doc, target, BAD_CAST pref);
 	    if (counter > 1000) {
 		xsltTransformError(ctxt, NULL, invocNode,
-		    "Internal error in xsltAcquireResultInScopeNs(): "		    
+		    "Internal error in xsltAcquireResultInScopeNs(): "
 		    "Failed to compute a unique ns-prefix for the "
 		    "generated element");
 		return(NULL);
@@ -599,7 +599,7 @@
 	/* TODO: Check result */
 	return(ns);
     }
-    return(NULL);   
+    return(NULL);
 }
 
 /**



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]