Commit a63922d8 authored by Alexandre Julliard's avatar Alexandre Julliard

xslt: Import upstream release 1.1.36.

parent 3110b72e
...@@ -14,25 +14,6 @@ ...@@ -14,25 +14,6 @@
#include <string.h> #include <string.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
#ifdef HAVE_NAN_H
#include <nan.h>
#endif
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include <libxml/hash.h> #include <libxml/hash.h>
......
...@@ -14,9 +14,7 @@ ...@@ -14,9 +14,7 @@
#include "libxslt.h" #include "libxslt.h"
#include <string.h> #include <string.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/tree.h> #include <libxml/tree.h>
......
...@@ -15,13 +15,6 @@ ...@@ -15,13 +15,6 @@
#include <string.h> #include <string.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/tree.h> #include <libxml/tree.h>
...@@ -194,36 +187,18 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI) ...@@ -194,36 +187,18 @@ xsltDocumentFunctionLoadDocument(xmlXPathParserContextPtr ctxt, xmlChar* URI)
xmlXPathFreeContext(xptrctxt); xmlXPathFreeContext(xptrctxt);
#endif /* LIBXML_XPTR_ENABLED */ #endif /* LIBXML_XPTR_ENABLED */
if (resObj == NULL) if ((resObj != NULL) && (resObj->type != XPATH_NODESET)) {
goto out_fragment; xsltTransformError(tctxt, NULL, NULL,
"document() : XPointer does not select a node set: #%s\n",
switch (resObj->type) { fragment);
case XPATH_NODESET: xmlXPathFreeObject(resObj);
break; resObj = NULL;
case XPATH_UNDEFINED:
case XPATH_BOOLEAN:
case XPATH_NUMBER:
case XPATH_STRING:
case XPATH_POINT:
case XPATH_USERS:
case XPATH_XSLT_TREE:
case XPATH_RANGE:
case XPATH_LOCATIONSET:
xsltTransformError(tctxt, NULL, NULL,
"document() : XPointer does not select a node set: #%s\n",
fragment);
goto out_object;
} }
valuePush(ctxt, resObj);
xmlFree(fragment);
return;
out_object:
xmlXPathFreeObject(resObj);
out_fragment: out_fragment:
valuePush(ctxt, xmlXPathNewNodeSet(NULL)); if (resObj == NULL)
resObj = xmlXPathNewNodeSet(NULL);
valuePush(ctxt, resObj);
xmlFree(fragment); xmlFree(fragment);
} }
......
...@@ -14,25 +14,6 @@ ...@@ -14,25 +14,6 @@
#include <string.h> #include <string.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
#ifdef HAVE_NAN_H
#include <nan.h>
#endif
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include <libxml/hash.h> #include <libxml/hash.h>
......
...@@ -14,24 +14,6 @@ ...@@ -14,24 +14,6 @@
#include <string.h> #include <string.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_MATH_H
#include <math.h>
#endif
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
#ifdef HAVE_NAN_H
#include <nan.h>
#endif
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#ifndef XSLT_NEED_TRIO #ifndef XSLT_NEED_TRIO
#include <stdio.h> #include <stdio.h>
#else #else
......
...@@ -18,23 +18,7 @@ ...@@ -18,23 +18,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
#ifdef HAVE_MATH_H #if defined(_WIN32)
#include <math.h>
#endif
#ifdef HAVE_FLOAT_H
#include <float.h>
#endif
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
#ifdef HAVE_NAN_H
#include <nan.h>
#endif
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <windows.h> #include <windows.h>
#ifndef INVALID_FILE_ATTRIBUTES #ifndef INVALID_FILE_ATTRIBUTES
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) #define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
...@@ -279,7 +263,7 @@ xsltCheckFilename (const char *path) ...@@ -279,7 +263,7 @@ xsltCheckFilename (const char *path)
{ {
#ifdef HAVE_STAT #ifdef HAVE_STAT
struct stat stat_buffer; struct stat stat_buffer;
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32)
DWORD dwAttrs; DWORD dwAttrs;
dwAttrs = GetFileAttributesA(path); dwAttrs = GetFileAttributesA(path);
...@@ -384,7 +368,7 @@ xsltCheckWrite(xsltSecurityPrefsPtr sec, ...@@ -384,7 +368,7 @@ xsltCheckWrite(xsltSecurityPrefsPtr sec,
if ((uri->scheme == NULL) || if ((uri->scheme == NULL) ||
(xmlStrEqual(BAD_CAST uri->scheme, BAD_CAST "file"))) { (xmlStrEqual(BAD_CAST uri->scheme, BAD_CAST "file"))) {
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32)
if ((uri->path)&&(uri->path[0]=='/')&& if ((uri->path)&&(uri->path[0]=='/')&&
(uri->path[1]!='\0')&&(uri->path[2]==':')) (uri->path[1]!='\0')&&(uri->path[2]==':'))
ret = xsltCheckWritePath(sec, ctxt, uri->path+1); ret = xsltCheckWritePath(sec, ctxt, uri->path+1);
......
...@@ -637,7 +637,6 @@ xsltNewTransformContext(xsltStylesheetPtr style, xmlDocPtr doc) { ...@@ -637,7 +637,6 @@ xsltNewTransformContext(xsltStylesheetPtr style, xmlDocPtr doc) {
cur->prof = 0; cur->prof = 0;
cur->style = style; cur->style = style;
xmlXPathInit();
cur->xpathCtxt = xmlXPathNewContext(doc); cur->xpathCtxt = xmlXPathNewContext(doc);
if (cur->xpathCtxt == NULL) { if (cur->xpathCtxt == NULL) {
xsltTransformError(NULL, NULL, (xmlNodePtr) doc, xsltTransformError(NULL, NULL, (xmlNodePtr) doc,
......
...@@ -363,7 +363,6 @@ xsltReleaseRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT) ...@@ -363,7 +363,6 @@ xsltReleaseRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT)
} }
/* /*
* Clear the document tree. * Clear the document tree.
* REVISIT TODO: Do we expect ID/IDREF tables to be existent?
*/ */
if (RVT->children != NULL) { if (RVT->children != NULL) {
xmlFreeNodeList(RVT->children); xmlFreeNodeList(RVT->children);
...@@ -374,10 +373,6 @@ xsltReleaseRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT) ...@@ -374,10 +373,6 @@ xsltReleaseRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT)
xmlFreeIDTable((xmlIDTablePtr) RVT->ids); xmlFreeIDTable((xmlIDTablePtr) RVT->ids);
RVT->ids = NULL; RVT->ids = NULL;
} }
if (RVT->refs != NULL) {
xmlFreeRefTable((xmlRefTablePtr) RVT->refs);
RVT->refs = NULL;
}
/* /*
* Reset the ownership information. * Reset the ownership information.
...@@ -968,6 +963,8 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, ...@@ -968,6 +963,8 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable,
xmlDocPtr container; xmlDocPtr container;
xmlNodePtr oldInsert; xmlNodePtr oldInsert;
xmlDocPtr oldOutput; xmlDocPtr oldOutput;
const xmlChar *oldLastText;
int oldLastTextSize, oldLastTextUse;
xsltStackElemPtr oldVar = ctxt->contextVariable; xsltStackElemPtr oldVar = ctxt->contextVariable;
/* /*
...@@ -993,6 +990,9 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, ...@@ -993,6 +990,9 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable,
oldOutput = ctxt->output; oldOutput = ctxt->output;
oldInsert = ctxt->insert; oldInsert = ctxt->insert;
oldLastText = ctxt->lasttext;
oldLastTextSize = ctxt->lasttsize;
oldLastTextUse = ctxt->lasttuse;
ctxt->output = container; ctxt->output = container;
ctxt->insert = (xmlNodePtr) container; ctxt->insert = (xmlNodePtr) container;
...@@ -1007,6 +1007,9 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable, ...@@ -1007,6 +1007,9 @@ xsltEvalVariable(xsltTransformContextPtr ctxt, xsltStackElemPtr variable,
ctxt->contextVariable = oldVar; ctxt->contextVariable = oldVar;
ctxt->insert = oldInsert; ctxt->insert = oldInsert;
ctxt->output = oldOutput; ctxt->output = oldOutput;
ctxt->lasttext = oldLastText;
ctxt->lasttsize = oldLastTextSize;
ctxt->lasttuse = oldLastTextUse;
result = xmlXPathNewValueTree((xmlNodePtr) container); result = xmlXPathNewValueTree((xmlNodePtr) container);
} }
......
...@@ -9,75 +9,6 @@ ...@@ -9,75 +9,6 @@
#ifndef __LIBXSLT_WIN32_CONFIG__ #ifndef __LIBXSLT_WIN32_CONFIG__
#define __LIBXSLT_WIN32_CONFIG__ #define __LIBXSLT_WIN32_CONFIG__
#define HAVE_CTYPE_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STDARG_H 1
#define HAVE_MALLOC_H 1
#define HAVE_TIME_H 1
#define HAVE_LOCALTIME 1
#define HAVE_GMTIME 1
#define HAVE_TIME 1
#define HAVE_MATH_H 1
#define HAVE_FCNTL_H 1
#include <io.h>
#define HAVE_ISINF
#define HAVE_ISNAN
#include <math.h>
#ifdef _WIN32
/* MS C-runtime has functions which can be used in order to determine if
a given floating-point variable contains NaN, (+-)INF. These are
preferred, because floating-point technology is considered propriatary
by MS and we can assume that their functions know more about their
oddities than we do. */
#include <float.h>
/* Bjorn Reese figured a quite nice construct for isinf() using the
_fpclass() function. */
#ifndef isinf
#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
: ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
#endif
/* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */
#ifndef isnan
#define isnan(d) (_isnan(d))
#endif
#else /* _MSC_VER */
static int isinf (double d) {
int expon = 0;
double val = frexp (d, &expon);
if (expon == 1025) {
if (val == 0.5) {
return 1;
} else if (val == -0.5) {
return -1;
} else {
return 0;
}
} else {
return 0;
}
}
static int isnan (double d) {
int expon = 0;
double val = frexp (d, &expon);
if (expon == 1025) {
if (val == 0.5) {
return 0;
} else if (val == -0.5) {
return 0;
} else {
return 1;
}
} else {
return 0;
}
}
#endif /* _MSC_VER */
#include <direct.h>
/* snprintf emulation taken from http://stackoverflow.com/a/8712996/1956010 */ /* snprintf emulation taken from http://stackoverflow.com/a/8712996/1956010 */
#if defined(_MSC_VER) && _MSC_VER < 1900 #if defined(_MSC_VER) && _MSC_VER < 1900
...@@ -115,15 +46,6 @@ __inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...) ...@@ -115,15 +46,6 @@ __inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...)
#define HAVE_SYS_STAT_H #define HAVE_SYS_STAT_H
#define HAVE_STAT #define HAVE_STAT
#define HAVE_STRING_H
#include <libxml/xmlversion.h>
#ifndef ATTRIBUTE_UNUSED
#define ATTRIBUTE_UNUSED
#endif
#define _WINSOCKAPI_
#endif /* __LIBXSLT_WIN32_CONFIG__ */ #endif /* __LIBXSLT_WIN32_CONFIG__ */
...@@ -20,26 +20,26 @@ extern "C" { ...@@ -20,26 +20,26 @@ extern "C" {
* *
* the version string like "1.2.3" * the version string like "1.2.3"
*/ */
#define LIBXSLT_DOTTED_VERSION "1.1.35" #define LIBXSLT_DOTTED_VERSION "1.1.36"
/** /**
* LIBXSLT_VERSION: * LIBXSLT_VERSION:
* *
* the version number: 1.2.3 value is 10203 * the version number: 1.2.3 value is 10203
*/ */
#define LIBXSLT_VERSION 10135 #define LIBXSLT_VERSION 10136
/** /**
* LIBXSLT_VERSION_STRING: * LIBXSLT_VERSION_STRING:
* *
* the version number string, 1.2.3 value is "10203" * the version number string, 1.2.3 value is "10203"
*/ */
#define LIBXSLT_VERSION_STRING "10135" #define LIBXSLT_VERSION_STRING "10136"
/** /**
* LIBXSLT_VERSION_EXTRA: * LIBXSLT_VERSION_EXTRA:
* *
* extra version information, used to show a CVS compilation * extra version information, used to show a Git commit description
*/ */
#define LIBXSLT_VERSION_EXTRA "" #define LIBXSLT_VERSION_EXTRA ""
...@@ -86,7 +86,6 @@ extern "C" { ...@@ -86,7 +86,6 @@ extern "C" {
#define XSLT_NEED_TRIO #define XSLT_NEED_TRIO
#endif #endif
#ifdef __VMS #ifdef __VMS
#define HAVE_MATH_H 1
#define HAVE_SYS_STAT_H 1 #define HAVE_SYS_STAT_H 1
#ifndef XSLT_NEED_TRIO #ifndef XSLT_NEED_TRIO
#define XSLT_NEED_TRIO #define XSLT_NEED_TRIO
......
...@@ -3,134 +3,56 @@ ...@@ -3,134 +3,56 @@
* Description: macros for marking symbols as exportable/importable. * Description: macros for marking symbols as exportable/importable.
* *
* Copy: See Copyright for the status of this software. * Copy: See Copyright for the status of this software.
*
* Author: Igor Zlatkovic <igor@zlatkovic.com>
*/ */
#ifndef __XSLT_EXPORTS_H__ #ifndef __XSLT_EXPORTS_H__
#define __XSLT_EXPORTS_H__ #define __XSLT_EXPORTS_H__
/** #if defined(_WIN32) || defined(__CYGWIN__)
* XSLTPUBFUN: /** DOC_DISABLE */
* XSLTPUBFUN, XSLTPUBVAR, XSLTCALL
* #ifdef LIBXSLT_STATIC
* Macros which declare an exportable function, an exportable variable and #define XSLTPUBLIC
* the calling convention used for functions. #elif defined(IN_LIBXSLT)
* #define XSLTPUBLIC __declspec(dllexport)
* Please use an extra block for every platform/compiler combination when #else
* modifying this, rather than overlong #ifdef lines. This helps #define XSLTPUBLIC __declspec(dllimport)
* readability as well as the fact that different compilers on the same #endif
* platform might need different definitions.
*/ #define XSLTCALL __cdecl
/** DOC_ENABLE */
#else /* not Windows */
/** /**
* XSLTPUBFUN: * XSLTPUBLIC:
*
* Macros which declare an exportable function
*/
#define XSLTPUBFUN
/**
* XSLTPUBVAR:
* *
* Macros which declare an exportable variable * Macro which declares a public symbol
*/ */
#define XSLTPUBVAR extern #define XSLTPUBLIC
/** /**
* XSLTCALL: * XSLTCALL:
* *
* Macros which declare the called convention for exported functions * Macro which declares the calling convention for exported functions
*/ */
#define XSLTCALL #define XSLTCALL
/** DOC_DISABLE */ #endif /* platform switch */
/* Windows platform with MS compiler */
#if defined(_WIN32) && defined(_MSC_VER)
#undef XSLTPUBFUN
#undef XSLTPUBVAR
#undef XSLTCALL
#if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC)
#define XSLTPUBFUN __declspec(dllexport)
#define XSLTPUBVAR __declspec(dllexport)
#else
#define XSLTPUBFUN
#if !defined(LIBXSLT_STATIC)
#define XSLTPUBVAR __declspec(dllimport) extern
#else
#define XSLTPUBVAR extern
#endif
#endif
#define XSLTCALL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif
/* Windows platform with Borland compiler */
#if defined(_WIN32) && defined(__BORLANDC__)
#undef XSLTPUBFUN
#undef XSLTPUBVAR
#undef XSLTCALL
#if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC)
#define XSLTPUBFUN __declspec(dllexport)
#define XSLTPUBVAR __declspec(dllexport) extern
#else
#define XSLTPUBFUN
#if !defined(LIBXSLT_STATIC)
#define XSLTPUBVAR __declspec(dllimport) extern
#else
#define XSLTPUBVAR extern
#endif
#endif
#define XSLTCALL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif
/* Windows platform with GNU compiler (Mingw) */
#if defined(_WIN32) && defined(__MINGW32__)
#undef XSLTPUBFUN
#undef XSLTPUBVAR
#undef XSLTCALL
/* /*
#if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) * XSLTPUBFUN:
*/ *
#if !defined(LIBXSLT_STATIC) * Macro which declares an exportable function
#define XSLTPUBFUN __declspec(dllexport) */
#define XSLTPUBVAR __declspec(dllexport) extern #define XSLTPUBFUN XSLTPUBLIC
#else
#define XSLTPUBFUN
#if !defined(LIBXSLT_STATIC)
#define XSLTPUBVAR __declspec(dllimport) extern
#else
#define XSLTPUBVAR extern
#endif
#endif
#define XSLTCALL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif
/* Cygwin platform (does not define _WIN32), GNU compiler */ /**
#if defined(__CYGWIN__) * XSLTPUBVAR:
#undef XSLTPUBFUN *
#undef XSLTPUBVAR * Macro which declares an exportable variable
#undef XSLTCALL */
#if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) #define XSLTPUBVAR XSLTPUBLIC extern
#define XSLTPUBFUN __declspec(dllexport)
#define XSLTPUBVAR __declspec(dllexport)
#else
#define XSLTPUBFUN
#if !defined(LIBXSLT_STATIC)
#define XSLTPUBVAR __declspec(dllimport) extern
#else
#define XSLTPUBVAR extern
#endif
#endif
#define XSLTCALL __cdecl
#endif
/* Compatibility */ /* Compatibility */
#if !defined(LIBXSLT_PUBLIC) #if !defined(LIBXSLT_PUBLIC)
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
typedef locale_t xsltLocale; typedef locale_t xsltLocale;
typedef xmlChar xsltLocaleChar; typedef xmlChar xsltLocaleChar;
#elif defined(_WIN32) && !defined(__CYGWIN__) #elif defined(_WIN32)
/* /*
* XSLT_LOCALE_WINAPI: * XSLT_LOCALE_WINAPI:
......
...@@ -19,17 +19,16 @@ ...@@ -19,17 +19,16 @@
#endif #endif
#include <string.h> #include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <time.h> #include <time.h>
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <stdarg.h>
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/tree.h> #include <libxml/tree.h>
...@@ -42,7 +41,7 @@ ...@@ -42,7 +41,7 @@
#include "imports.h" #include "imports.h"
#include "transform.h" #include "transform.h"
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32)
#define XSLT_WIN32_PERFORMANCE_COUNTER #define XSLT_WIN32_PERFORMANCE_COUNTER
#endif #endif
......
...@@ -13,9 +13,6 @@ ...@@ -13,9 +13,6 @@
#define __XML_XSLTUTILS_H__ #define __XML_XSLTUTILS_H__
#include <libxslt/xsltconfig.h> #include <libxslt/xsltconfig.h>
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif
#include <libxml/xpath.h> #include <libxml/xpath.h>
#include <libxml/dict.h> #include <libxml/dict.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment