1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-30 22:43:14 +03:00

applied a patch from Charles Bozeman fixing a side effect in date handling

* test/schemas/date_0.xml xmlschemastypes.c: applied a patch from
  Charles Bozeman fixing a side effect in date handling
Daniel
This commit is contained in:
Daniel Veillard
2004-05-29 20:12:46 +00:00
parent 218ed39dc4
commit 669adfcd3a
5 changed files with 135 additions and 296 deletions

View File

@ -1,3 +1,8 @@
Sat May 29 21:35:52 CEST 2004 Daniel Veillard <daniel@veillard.com>
* test/schemas/date_0.xml xmlschemastypes.c: applied a patch from
Charles Bozeman fixing a side effect in date handling
Thu May 27 19:47:48 MDT 2004 John Fleck <jfleck@inkstain.net> Thu May 27 19:47:48 MDT 2004 John Fleck <jfleck@inkstain.net>
* doc/tutorial/xmltutorial.xml fix lack of cast in Xpath example * doc/tutorial/xmltutorial.xml fix lack of cast in Xpath example

View File

@ -217,7 +217,8 @@ pnode=pxmlDoc-&gt;children-&gt;children;</pre>
<p>Website: <a <p>Website: <a
href="http://pmade.org/pjones/software/xmlwrapp/">http://pmade.org/pjones/software/xmlwrapp/</a></p> href="http://pmade.org/pjones/software/xmlwrapp/">http://pmade.org/pjones/software/xmlwrapp/</a></p>
</li> </li>
--></ul></li> -->
</ul></li>
<li>How to validate a document a posteriori ? <li>How to validate a document a posteriori ?
<p>It is possible to validate documents which had not been validated at <p>It is possible to validate documents which had not been validated at
initial parsing time or documents which have been built from scratch initial parsing time or documents which have been built from scratch

View File

@ -12,8 +12,7 @@ H2 {font-family: Verdana,Arial,Helvetica}
H3 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica}
A:link, A:visited, A:active { text-decoration: underline } A:link, A:visited, A:active { text-decoration: underline }
</style> </style>
<title>The XML C parser and toolkit of Gnome <title>The XML C parser and toolkit of Gnome</title>
</title>
</head> </head>
<body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000"> <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
<table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"> <table border="0" width="100%" cellpadding="5" cellspacing="0" align="center">
@ -46,10 +45,8 @@ A:link, A:visited, A:active { text-decoration: underline }
<table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"> <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd">
<tr> <tr>
<td align="center"> <td align="center">
<h1>The XML C parser and toolkit of Gnome <h1>The XML C parser and toolkit of Gnome</h1>
</h1> <h2>libxml</h2>
<h2>libxml
</h2>
</td> </td>
</tr> </tr>
</table> </table>
@ -72,8 +69,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<tr> <tr>
<td colspan="1" bgcolor="#eecfa1" align="center"> <td colspan="1" bgcolor="#eecfa1" align="center">
<center> <center>
<b>Main Menu <b>Main Menu</b>
</b>
</center> </center>
</td> </td>
</tr> </tr>
@ -85,80 +81,61 @@ A:link, A:visited, A:active { text-decoration: underline }
</form> </form>
<ul> <ul>
<li> <li>
<a href="index.html">Home <a href="index.html">Home</a>
</a>
</li> </li>
<li> <li>
<a href="intro.html">Introduction <a href="intro.html">Introduction</a>
</a>
</li> </li>
<li> <li>
<a href="FAQ.html">FAQ <a href="FAQ.html">FAQ</a>
</a>
</li> </li>
<li> <li>
<a href="docs.html" style="font-weight:bold">Developer Menu <a href="docs.html" style="font-weight:bold">Developer Menu</a>
</a>
</li> </li>
<li> <li>
<a href="bugs.html">Reporting bugs and getting help <a href="bugs.html">Reporting bugs and getting help</a>
</a>
</li> </li>
<li> <li>
<a href="help.html">How to help <a href="help.html">How to help</a>
</a>
</li> </li>
<li> <li>
<a href="downloads.html">Downloads <a href="downloads.html">Downloads</a>
</a>
</li> </li>
<li> <li>
<a href="news.html">News <a href="news.html">News</a>
</a>
</li> </li>
<li> <li>
<a href="XMLinfo.html">XML <a href="XMLinfo.html">XML</a>
</a>
</li> </li>
<li> <li>
<a href="XSLT.html">XSLT <a href="XSLT.html">XSLT</a>
</a>
</li> </li>
<li> <li>
<a href="xmldtd.html">Validation &amp; DTDs <a href="xmldtd.html">Validation &amp; DTDs</a>
</a>
</li> </li>
<li> <li>
<a href="encoding.html">Encodings support <a href="encoding.html">Encodings support</a>
</a>
</li> </li>
<li> <li>
<a href="catalog.html">Catalog support <a href="catalog.html">Catalog support</a>
</a>
</li> </li>
<li> <li>
<a href="namespaces.html">Namespaces <a href="namespaces.html">Namespaces</a>
</a>
</li> </li>
<li> <li>
<a href="contribs.html">Contributions <a href="contribs.html">Contributions</a>
</a>
</li> </li>
<li> <li>
<a href="examples/index.html" style="font-weight:bold">Code Examples <a href="examples/index.html" style="font-weight:bold">Code Examples</a>
</a>
</li> </li>
<li> <li>
<a href="html/index.html" style="font-weight:bold">API Menu <a href="html/index.html" style="font-weight:bold">API Menu</a>
</a>
</li> </li>
<li> <li>
<a href="guidelines.html">XML Guidelines <a href="guidelines.html">XML Guidelines</a>
</a>
</li> </li>
<li> <li>
<a href="ChangeLog.html">ChangeLog <a href="ChangeLog.html">ChangeLog</a>
</a>
</li> </li>
</ul> </ul>
</td> </td>
@ -168,8 +145,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<tr> <tr>
<td colspan="1" bgcolor="#eecfa1" align="center"> <td colspan="1" bgcolor="#eecfa1" align="center">
<center> <center>
<b>Related links <b>Related links</b>
</b>
</center> </center>
</td> </td>
</tr> </tr>
@ -177,44 +153,34 @@ A:link, A:visited, A:active { text-decoration: underline }
<td bgcolor="#fffacd"> <td bgcolor="#fffacd">
<ul> <ul>
<li> <li>
<a href="http://mail.gnome.org/archives/xml/">Mail archive <a href="http://mail.gnome.org/archives/xml/">Mail archive</a>
</a>
</li> </li>
<li> <li>
<a href="http://xmlsoft.org/XSLT/">XSLT libxslt <a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a>
</a>
</li> </li>
<li> <li>
<a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2 <a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a>
</a>
</li> </li>
<li> <li>
<a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec <a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a>
</a>
</li> </li>
<li> <li>
<a href="ftp://xmlsoft.org/">FTP <a href="ftp://xmlsoft.org/">FTP</a>
</a>
</li> </li>
<li> <li>
<a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries <a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a>
</a>
</li> </li>
<li> <li>
<a href="http://garypennington.net/libxml2/">Solaris binaries <a href="http://garypennington.net/libxml2/">Solaris binaries</a>
</a>
</li> </li>
<li> <li>
<a href="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries <a href="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries</a>
</a>
</li> </li>
<li> <li>
<a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings <a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a>
</a>
</li> </li>
<li> <li>
<a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker <a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker</a>
</a>
</li> </li>
</ul> </ul>
</td> </td>
@ -236,227 +202,77 @@ A:link, A:visited, A:active { text-decoration: underline }
<td bgcolor="#fffacd"> <td bgcolor="#fffacd">
<p></p> <p></p>
<p style="text-align: right; font-style: italic; font-size: 10pt">"Programming <p style="text-align: right; font-style: italic; font-size: 10pt">"Programming
with libxml2 is like the thrilling embrace of an exotic stranger." with libxml2 is like the thrilling embrace of an exotic stranger." <a href="http://diveintomark.org/archives/2004/02/18/libxml2">Mark
<a href="http://diveintomark.org/archives/2004/02/18/libxml2">Mark Pilgrim</a></p>
Pilgrim
</a>
</p>
<p>Libxml2 is the XML C parser and toolkit developed for the Gnome project <p>Libxml2 is the XML C parser and toolkit developed for the Gnome project
(but usable outside of the Gnome platform), it is free software available (but usable outside of the Gnome platform), it is free software available
under the under the <a href="http://www.opensource.org/licenses/mit-license.html">MIT
<a href="http://www.opensource.org/licenses/mit-license.html">MIT License</a>. XML itself is a metalanguage to design markup languages, i.e.
License
</a>
. XML itself is a metalanguage to design markup languages, i.e.
text language where semantic and structure are added to the content using text language where semantic and structure are added to the content using
extra "markup" information enclosed between angle brackets. HTML is the most extra "markup" information enclosed between angle brackets. HTML is the most
well-known markup language. Though the library is written in C well-known markup language. Though the library is written in C <a href="python.html">a variety of language bindings</a> make it available in
<a href="python.html">a variety of language bindings other environments.</p>
</a>
make it available in
other environments.
</p>
<p>Libxml2 is known to be very portable, the library should build and work <p>Libxml2 is known to be very portable, the library should build and work
without serious troubles on a variety of systems (Linux, Unix, Windows, without serious troubles on a variety of systems (Linux, Unix, Windows,
CygWin, MacOS, MacOS X, RISC Os, OS/2, VMS, QNX, MVS, ...) CygWin, MacOS, MacOS X, RISC Os, OS/2, VMS, QNX, MVS, ...)</p>
</p>
<p>Libxml2 implements a number of existing standards related to markup <p>Libxml2 implements a number of existing standards related to markup
languages: languages:</p>
</p> <ul><li>the XML standard: <a href="http://www.w3.org/TR/REC-xml">http://www.w3.org/TR/REC-xml</a></li>
<ul> <li>the XML standard: <li>Namespaces in XML: <a href="http://www.w3.org/TR/REC-xml-names/">http://www.w3.org/TR/REC-xml-names/</a></li>
<a href="http://www.w3.org/TR/REC-xml">http://www.w3.org/TR/REC-xml <li>XML Base: <a href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a></li>
</a> <li><a href="http://www.cis.ohio-state.edu/rfc/rfc2396.txt">RFC 2396</a> :
</li> Uniform Resource Identifiers <a href="http://www.ietf.org/rfc/rfc2396.txt">http://www.ietf.org/rfc/rfc2396.txt</a></li>
<li>XML Path Language (XPath) 1.0: <a href="http://www.w3.org/TR/xpath">http://www.w3.org/TR/xpath</a></li>
<li>HTML4 parser: <a href="http://www.w3.org/TR/html401/">http://www.w3.org/TR/html401/</a></li>
<li>Namespaces in XML: <li>XML Pointer Language (XPointer) Version 1.0: <a href="http://www.w3.org/TR/xptr">http://www.w3.org/TR/xptr</a></li>
<a href="http://www.w3.org/TR/REC-xml-names/">http://www.w3.org/TR/REC-xml-names/ <li>XML Inclusions (XInclude) Version 1.0: <a href="http://www.w3.org/TR/xinclude/">http://www.w3.org/TR/xinclude/</a></li>
</a> <li>ISO-8859-x encodings, as well as <a href="http://www.cis.ohio-state.edu/rfc/rfc2044.txt">rfc2044</a> [UTF-8]
</li> and <a href="http://www.cis.ohio-state.edu/rfc/rfc2781.txt">rfc2781</a>
[UTF-16] Unicode encodings, and more if using iconv support</li>
<li>part of SGML Open Technical Resolution TR9401:1997</li>
<li>XML Base: <li>XML Catalogs Working Draft 06 August 2001: <a href="http://www.oasis-open.org/committees/entity/spec-2001-08-06.html">http://www.oasis-open.org/committees/entity/spec-2001-08-06.html</a></li>
<a href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/ <li>Canonical XML Version 1.0: <a href="http://www.w3.org/TR/xml-c14n">http://www.w3.org/TR/xml-c14n</a>
</a> and the Exclusive XML Canonicalization CR draft <a href="http://www.w3.org/TR/xml-exc-c14n">http://www.w3.org/TR/xml-exc-c14n</a></li>
</li> <li>Relax NG, ISO/IEC 19757-2:2003, <a href="http://www.oasis-open.org/committees/relax-ng/spec-20011203.html">http://www.oasis-open.org/committees/relax-ng/spec-20011203.html</a></li>
<li>W3C XML Schemas Part 2: Datatypes <a href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/">REC 02 May
2001</a></li>
<li> <a href="http://www.cis.ohio-state.edu/rfc/rfc2396.txt">RFC 2396 <li>W3C <a href="http://www.w3.org/TR/xml-id/">xml:id</a> Working Draft 7
</a> April 2004</li>
:
Uniform Resource Identifiers
<a href="http://www.ietf.org/rfc/rfc2396.txt">http://www.ietf.org/rfc/rfc2396.txt
</a>
</li>
<li>XML Path Language (XPath) 1.0:
<a href="http://www.w3.org/TR/xpath">http://www.w3.org/TR/xpath
</a>
</li>
<li>HTML4 parser:
<a href="http://www.w3.org/TR/html401/">http://www.w3.org/TR/html401/
</a>
</li>
<li>XML Pointer Language (XPointer) Version 1.0:
<a href="http://www.w3.org/TR/xptr">http://www.w3.org/TR/xptr
</a>
</li>
<li>XML Inclusions (XInclude) Version 1.0:
<a href="http://www.w3.org/TR/xinclude/">http://www.w3.org/TR/xinclude/
</a>
</li>
<li>ISO-8859-x encodings, as well as
<a href="http://www.cis.ohio-state.edu/rfc/rfc2044.txt">rfc2044
</a>
[UTF-8]
and
<a href="http://www.cis.ohio-state.edu/rfc/rfc2781.txt">rfc2781
</a>
[UTF-16] Unicode encodings, and more if using iconv support
</li>
<li>part of SGML Open Technical Resolution TR9401:1997
</li>
<li>XML Catalogs Working Draft 06 August 2001:
<a href="http://www.oasis-open.org/committees/entity/spec-2001-08-06.html">http://www.oasis-open.org/committees/entity/spec-2001-08-06.html
</a>
</li>
<li>Canonical XML Version 1.0:
<a href="http://www.w3.org/TR/xml-c14n">http://www.w3.org/TR/xml-c14n
</a>
and the Exclusive XML Canonicalization CR draft
<a href="http://www.w3.org/TR/xml-exc-c14n">http://www.w3.org/TR/xml-exc-c14n
</a>
</li>
<li>Relax NG, ISO/IEC 19757-2:2003,
<a href="http://www.oasis-open.org/committees/relax-ng/spec-20011203.html">http://www.oasis-open.org/committees/relax-ng/spec-20011203.html
</a>
</li>
<li>W3C XML Schemas Part 2: Datatypes
<a href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/">REC 02 May
2001
</a>
</li>
<li>W3C
<a href="http://www.w3.org/TR/xml-id/">xml:id
</a>
Working Draft 7
April 2004
</li>
</ul> </ul>
<p>In most cases libxml2 tries to implement the specifications in a <p>In most cases libxml2 tries to implement the specifications in a
relatively strictly compliant way. As of release 2.4.16, libxml2 passed all relatively strictly compliant way. As of release 2.4.16, libxml2 passed all
1800+ tests from the 1800+ tests from the <a href="http://www.oasis-open.org/committees/xml-conformance/">OASIS XML Tests
<a href="http://www.oasis-open.org/committees/xml-conformance/">OASIS XML Tests Suite</a>.</p>
Suite
</a>
.
</p>
<p>To some extent libxml2 provides support for the following additional <p>To some extent libxml2 provides support for the following additional
specifications but doesn't claim to implement them completely: specifications but doesn't claim to implement them completely:</p>
</p> <ul><li>Document Object Model (DOM) <a href="http://www.w3.org/TR/DOM-Level-2-Core/">http://www.w3.org/TR/DOM-Level-2-Core/</a>
<ul> <li>Document Object Model (DOM)
<a href="http://www.w3.org/TR/DOM-Level-2-Core/">http://www.w3.org/TR/DOM-Level-2-Core/
</a>
the document model, but it doesn't implement the API itself, gdome2 does the document model, but it doesn't implement the API itself, gdome2 does
this on top of libxml2 this on top of libxml2</li>
</li> <li><a href="http://www.cis.ohio-state.edu/rfc/rfc959.txt">RFC 959</a> :
libxml2 implements a basic FTP client code</li>
<li><a href="http://www.cis.ohio-state.edu/rfc/rfc1945.txt">RFC 1945</a> :
<li> <a href="http://www.cis.ohio-state.edu/rfc/rfc959.txt">RFC 959 HTTP/1.0, again a basic HTTP client code</li>
</a> <li>SAX: a SAX2 like interface and a minimal SAX1 implementation compatible
: with early expat versions</li>
libxml2 implements a basic FTP client code
</li>
<li> <a href="http://www.cis.ohio-state.edu/rfc/rfc1945.txt">RFC 1945
</a>
:
HTTP/1.0, again a basic HTTP client code
</li>
<li>SAX: a SAX2 like interface and a minimal SAX1 implementation compatible
with early expat versions
</li>
</ul> </ul>
<p>A partial implementation of <p>A partial implementation of <a href="http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/">XML Schemas Part
<a href="http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/">XML Schemas Part 1: Structure</a> is being worked on but it would be far too early to make any
1: Structure conformance statement about it at the moment.</p>
</a> <p>Separate documents:</p>
is being worked on but it would be far too early to make any <ul><li><a href="http://xmlsoft.org/XSLT/">the libxslt page</a> providing an
conformance statement about it at the moment.
</p>
<p>Separate documents:
</p>
<ul> <li> <a href="http://xmlsoft.org/XSLT/">the libxslt page
</a>
providing an
implementation of XSLT 1.0 and common extensions like EXSLT for implementation of XSLT 1.0 and common extensions like EXSLT for
libxml2 libxml2</li>
</li> <li><a href="http://www.cs.unibo.it/~casarini/gdome2/">the gdome2 page</a>
: a standard DOM2 implementation for libxml2</li>
<li><a href="http://www.aleksey.com/xmlsec/">the XMLSec page</a>: an
<li> <a href="http://www.cs.unibo.it/~casarini/gdome2/">the gdome2 page implementation of <a href="http://www.w3.org/TR/xmldsig-core/">W3C XML
</a> Digital Signature</a> for libxml2</li>
<li>also check the related links section below for more related and active
: a standard DOM2 implementation for libxml2 projects.</li>
</li>
<li> <a href="http://www.aleksey.com/xmlsec/">the XMLSec page
</a>
: an
implementation of
<a href="http://www.w3.org/TR/xmldsig-core/">W3C XML
Digital Signature
</a>
for libxml2
</li>
<li>also check the related links section below for more related and active
projects.
</li>
</ul> </ul>
<p>Logo designed by <p>Logo designed by <a href="mailto:liyanage@access.ch">Marc Liyanage</a>.</p>
<a href="mailto:liyanage@access.ch">Marc Liyanage
</a>
.
</p>
<p> <p>
<a href="bugs.html">Daniel Veillard <a href="bugs.html">Daniel Veillard</a>
</a>
</p> </p>
</td> </td>
</tr> </tr>

View File

@ -12,6 +12,7 @@
<date1>2000-05-18Z</date1> <date1>2000-05-18Z</date1>
<dt1>2000-05-18T00:00:00</dt1> <dt1>2000-05-18T00:00:00</dt1>
<dt2>2002-05-19T21:30:00.99</dt2> <dt2>2002-05-19T21:30:00.99</dt2>
<dt1>1969-12-31T23:00:01-01:00</dt1>
<hol>--01-01</hol> <hol>--01-01</hol>
<hol>--07-04</hol> <hol>--07-04</hol>
<hol>--12-25</hol> <hol>--12-25</hol>

View File

@ -2607,6 +2607,26 @@ xmlSchemaCompareDurations(xmlSchemaValPtr x, xmlSchemaValPtr y)
#define FQUOTIENT_RANGE(a,low,high) (FQUOTIENT((a-low),(high-low))) #define FQUOTIENT_RANGE(a,low,high) (FQUOTIENT((a-low),(high-low)))
#define MODULO_RANGE(a,low,high) ((MODULO((a-low),(high-low)))+low) #define MODULO_RANGE(a,low,high) ((MODULO((a-low),(high-low)))+low)
/**
* xmlSchemaDupVal:
* @v: the #xmlSchemaValPtr value to duplicate
*
* Makes a copy of @v. The calling program is responsible for freeing
* the returned value.
*
* returns a pointer to a duplicated #xmlSchemaValPtr or NULL if error.
*/
static xmlSchemaValPtr
xmlSchemaDupVal (xmlSchemaValPtr v)
{
xmlSchemaValPtr ret = xmlSchemaNewValue(v->type);
if (ret == NULL)
return NULL;
memcpy(ret, v, sizeof(xmlSchemaVal));
return ret;
}
/** /**
* _xmlSchemaDateAdd: * _xmlSchemaDateAdd:
* @dt: an #xmlSchemaValPtr * @dt: an #xmlSchemaValPtr
@ -2614,14 +2634,15 @@ xmlSchemaCompareDurations(xmlSchemaValPtr x, xmlSchemaValPtr y)
* *
* Compute a new date/time from @dt and @dur. This function assumes @dt * Compute a new date/time from @dt and @dur. This function assumes @dt
* is either #XML_SCHEMAS_DATETIME, #XML_SCHEMAS_DATE, #XML_SCHEMAS_GYEARMONTH, * is either #XML_SCHEMAS_DATETIME, #XML_SCHEMAS_DATE, #XML_SCHEMAS_GYEARMONTH,
* or #XML_SCHEMAS_GYEAR. * or #XML_SCHEMAS_GYEAR. The returned #xmlSchemaVal is the same type as
* @dt. The calling program is responsible for freeing the returned value.
* *
* Returns date/time pointer or NULL. * Returns a pointer to a new #xmlSchemaVal or NULL if error.
*/ */
static xmlSchemaValPtr static xmlSchemaValPtr
_xmlSchemaDateAdd (xmlSchemaValPtr dt, xmlSchemaValPtr dur) _xmlSchemaDateAdd (xmlSchemaValPtr dt, xmlSchemaValPtr dur)
{ {
xmlSchemaValPtr ret; xmlSchemaValPtr ret, tmp;
long carry, tempdays, temp; long carry, tempdays, temp;
xmlSchemaValDatePtr r, d; xmlSchemaValDatePtr r, d;
xmlSchemaValDurationPtr u; xmlSchemaValDurationPtr u;
@ -2633,8 +2654,15 @@ _xmlSchemaDateAdd (xmlSchemaValPtr dt, xmlSchemaValPtr dur)
if (ret == NULL) if (ret == NULL)
return NULL; return NULL;
/* make a copy so we don't alter the original value */
tmp = xmlSchemaDupVal(dt);
if (tmp == NULL) {
xmlSchemaFreeValue(ret);
return NULL;
}
r = &(ret->value.date); r = &(ret->value.date);
d = &(dt->value.date); d = &(tmp->value.date);
u = &(dur->value.dur); u = &(dur->value.dur);
/* normalization */ /* normalization */
@ -2740,32 +2768,20 @@ _xmlSchemaDateAdd (xmlSchemaValPtr dt, xmlSchemaValPtr dur)
} }
} }
return ret; xmlSchemaFreeValue(tmp);
}
/**
* xmlSchemaDupVal:
* @v: value to duplicate
*
* returns a duplicated value.
*/
static xmlSchemaValPtr
xmlSchemaDupVal (xmlSchemaValPtr v)
{
xmlSchemaValPtr ret = xmlSchemaNewValue(v->type);
if (ret == NULL)
return ret;
memcpy(ret, v, sizeof(xmlSchemaVal));
return ret; return ret;
} }
/** /**
* xmlSchemaDateNormalize: * xmlSchemaDateNormalize:
* @dt: an #xmlSchemaValPtr * @dt: an #xmlSchemaValPtr of a date/time type value.
* @offset: number of seconds to adjust @dt by.
* *
* Normalize @dt to GMT time. * Normalize @dt to GMT time. The @offset parameter is subtracted from
* the return value is a time-zone offset is present on @dt.
* *
* Returns a normalized copy of @dt or NULL if error.
*/ */
static xmlSchemaValPtr static xmlSchemaValPtr
xmlSchemaDateNormalize (xmlSchemaValPtr dt, double offset) xmlSchemaDateNormalize (xmlSchemaValPtr dt, double offset)