1
0
mirror of https://gitlab.gnome.org/GNOME/libxslt synced 2025-07-29 15:41:13 +03:00

applied patch from Peter Pawlowski fixing a timezone offset problem, fixes

* 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

svn path=/trunk/; revision=1462
This commit is contained in:
Daniel Veillard
2008-04-03 05:34:12 +00:00
parent 21aec4db49
commit f4ffd9fa72
4 changed files with 39 additions and 11 deletions

View File

@ -1,3 +1,9 @@
Thu Apr 3 07:32:36 CEST 2008 Daniel Veillard <daniel@veillard.com>
* libexslt/date.c: applied patch from Peter Pawlowski fixing
a timezone offset problem, fixes #521680
* libxslt/namespaces.c: a bit of space/tabs cleanup
Thu Apr 3 06:25:02 CEST 2008 Daniel Veillard <daniel@veillard.com> Thu Apr 3 06:25:02 CEST 2008 Daniel Veillard <daniel@veillard.com>
* doc/xsltproc.xml doc/xsltproc.1 doc/xsltproc.html: small fix to * doc/xsltproc.xml doc/xsltproc.1 doc/xsltproc.html: small fix to

View File

@ -1,11 +1,11 @@
.\" Title: xsltproc .\" Title: xsltproc
.\" Author: John Fleck <jfleck@inkstain.net> .\" Author: John Fleck <jfleck@inkstain.net>
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.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 .\" Manual: xsltproc Manual
.\" Source: libxslt .\" 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 .\" disable hyphenation
.nh .nh
.\" disable justification (adjust text to left margin only) .\" disable justification (adjust text to left margin only)

View File

@ -747,7 +747,8 @@ static exsltDateValPtr
exsltDateCurrent (void) exsltDateCurrent (void)
{ {
struct tm *localTm, *gmTm; struct tm *localTm, *gmTm;
time_t secs, gsecs; time_t secs;
int local_s, gm_s;
#if HAVE_LOCALTIME_R #if HAVE_LOCALTIME_R
struct tm localTmS; struct tm localTmS;
#endif #endif
@ -795,9 +796,30 @@ exsltDateCurrent (void)
((gmTm->tm_mday * 1440) + (gmTm->tm_hour * 60) + ((gmTm->tm_mday * 1440) + (gmTm->tm_hour * 60) +
gmTm->tm_min)); gmTm->tm_min));
#endif #endif
gsecs = mktime(gmTm); local_s = localTm->tm_hour * SECS_PER_HOUR +
ret->value.date.tzo = (secs - gsecs) / 60; 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; return ret;
} }
#endif #endif
@ -2158,7 +2180,7 @@ exsltDateWeekInYear (const xmlChar *dateTime)
/* ISO 8601 adjustment, 3 is Thu */ /* ISO 8601 adjustment, 3 is Thu */
diy += (3 - diw); diy += (3 - diw);
if(diy < 1) { if (diy < 1) {
year = dt->value.date.year - 1; year = dt->value.date.year - 1;
if(year == 0) year--; if(year == 0) year--;
diy = DAY_IN_YEAR(31, 12, year) + diy; diy = DAY_IN_YEAR(31, 12, year) + diy;

View File

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