From 3c558c3753117057d81f6ff0fea6991d9a015456 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Wed, 22 Dec 1999 11:30:41 +0000 Subject: [PATCH] - fix for PIs name starting with xml - fixed a potential problem with || and && ops - generate win32config.h for those on the Other Side ! Daniel --- ChangeLog | 5 +++ HTMLparser.c | 3 +- HTMLtree.c | 4 ++- SAX.c | 5 +++ configure.in | 2 +- debugXML.c | 5 +++ encoding.c | 4 ++- entities.c | 4 ++- error.c | 6 ++++ nanohttp.c | 5 ++- parser.c | 25 ++++++++++----- testHTML.c | 3 +- testSAX.c | 3 +- testXPath.c | 3 +- tester.c | 3 +- tree.c | 5 ++- valid.c | 3 +- win32config.h.in | 80 ++++++++++++++++++++++++++++++++++++++++++++++++ xlink.c | 3 +- xmlIO.c | 3 +- xmlmemory.c | 3 +- xpath.c | 3 +- 22 files changed, 145 insertions(+), 35 deletions(-) create mode 100644 win32config.h.in diff --git a/ChangeLog b/ChangeLog index 58680f90..cb6aae31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Dec 22 12:20:53 CET 1999 Daniel Veillard + + * parser.c: fix for PIs name starting with xml + * tree.c: fixed a potential problem with || and && ops + Tue Dec 21 17:22:17 CET 1999 Daniel Veillard * parser.c: fixed a stupid = vs. == bug :-( diff --git a/HTMLparser.c b/HTMLparser.c index 0215b7a7..7276e7c5 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -7,8 +7,7 @@ */ #ifdef WIN32 -#define HAVE_FCNTL_H -#include +#include "win32config.h" #else #include "config.h" #endif diff --git a/HTMLtree.c b/HTMLtree.c index 1265a0ab..c84daea5 100644 --- a/HTMLtree.c +++ b/HTMLtree.c @@ -7,7 +7,9 @@ */ -#ifndef WIN32 +#ifdef WIN32 +#include "win32config.h" +#else #include "config.h" #endif #include diff --git a/SAX.c b/SAX.c index 6d95d44b..be5a0abd 100644 --- a/SAX.c +++ b/SAX.c @@ -7,6 +7,11 @@ */ +#ifdef WIN32 +#include "win32config.h" +#else +#include "config.h" +#endif #include #include #include "xmlmemory.h" diff --git a/configure.in b/configure.in index f52084c8..59ef481d 100644 --- a/configure.in +++ b/configure.in @@ -142,5 +142,5 @@ AC_SUBST(HAVE_ISINF) AC_SUBST(Z_LIBS) AC_SUBST(M_LIBS) -AC_OUTPUT(libxml.spec Makefile doc/Makefile example/Makefile xml-config) +AC_OUTPUT(libxml.spec Makefile doc/Makefile example/Makefile xml-config win32config.h) diff --git a/debugXML.c b/debugXML.c index 37213f6e..2344bb22 100644 --- a/debugXML.c +++ b/debugXML.c @@ -7,6 +7,11 @@ * Daniel Veillard */ +#ifdef WIN32 +#include "win32config.h" +#else +#include "config.h" +#endif #include #include "tree.h" #include "parser.h" diff --git a/encoding.c b/encoding.c index e80cbd50..12eed70f 100644 --- a/encoding.c +++ b/encoding.c @@ -19,7 +19,9 @@ * Daniel.Veillard@w3.org */ -#ifndef WIN32 +#ifdef WIN32 +#include "win32config.h" +#else #include "config.h" #endif diff --git a/entities.c b/entities.c index c7e96ccb..2e736843 100644 --- a/entities.c +++ b/entities.c @@ -6,7 +6,9 @@ * Daniel.Veillard@w3.org */ -#ifndef WIN32 +#ifdef WIN32 +#include "win32config.h" +#else #include "config.h" #endif diff --git a/error.c b/error.c index b77839e8..18fdbd0f 100644 --- a/error.c +++ b/error.c @@ -6,6 +6,12 @@ * Daniel Veillard */ +#ifdef WIN32 +#include "win32config.h" +#else +#include "config.h" +#endif + #include #include #include "parser.h" diff --git a/nanohttp.c b/nanohttp.c index 0445c9cd..8224d492 100644 --- a/nanohttp.c +++ b/nanohttp.c @@ -14,10 +14,13 @@ /* TODO add compression support, Send the Accept- , and decompress on the fly with ZLIB if found at compile-time */ -#ifndef WIN32 +#ifdef WIN32 +#include "win32config.h" +#else #include "config.h" #endif + #include #include diff --git a/parser.c b/parser.c index 09f987c4..98656d49 100644 --- a/parser.c +++ b/parser.c @@ -7,8 +7,7 @@ */ #ifdef WIN32 -#define HAVE_FCNTL_H -#include +#include "win32config.h" #else #include "config.h" #endif @@ -46,6 +45,14 @@ const char *xmlParserVersion = LIBXML_VERSION; +/* + * List of XML prefixed PI allowed by W3C specs + */ + +const char *xmlW3CPIs[] = { + "xml-stylesheet", + NULL +}; /************************************************************************ * * @@ -3321,17 +3328,21 @@ xmlParsePITarget(xmlParserCtxtPtr ctxt) { xmlChar *name; name = xmlParseName(ctxt); - if ((name != NULL) && (name[3] == 0) && + if ((name != NULL) && ((name[0] == 'x') || (name[0] == 'X')) && ((name[1] == 'm') || (name[1] == 'M')) && ((name[2] == 'l') || (name[2] == 'L'))) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) { - ctxt->sax->error(ctxt->userData, + int i; + for (i = 0;;i++) { + if (xmlW3CPIs[i] == NULL) break; + if (!xmlStrcmp(name, (const xmlChar *)xmlW3CPIs[i])) + return(name); + } + if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) { + ctxt->sax->warning(ctxt->userData, "xmlParsePItarget: invalid name prefix 'xml'\n"); ctxt->errNo = XML_ERR_RESERVED_XML_NAME; - /* ctxt->wellFormed = 0; !!! ? */ } - return(NULL); } return(name); } diff --git a/testHTML.c b/testHTML.c index 430ab222..41ebea32 100644 --- a/testHTML.c +++ b/testHTML.c @@ -7,8 +7,7 @@ */ #ifdef WIN32 -#define HAVE_FCNTL_H -#include +#include "win32config.h" #else #include "config.h" #endif diff --git a/testSAX.c b/testSAX.c index ecd9644a..f33a1d6e 100644 --- a/testSAX.c +++ b/testSAX.c @@ -7,8 +7,7 @@ */ #ifdef WIN32 -#define HAVE_FCNTL_H -#include +#include "win32config.h" #else #include "config.h" #endif diff --git a/testXPath.c b/testXPath.c index b31d3ea7..b9824f2c 100644 --- a/testXPath.c +++ b/testXPath.c @@ -7,8 +7,7 @@ */ #ifdef WIN32 -#define HAVE_FCNTL_H -#include +#include "win32config.h" #else #include "config.h" #endif diff --git a/tester.c b/tester.c index 11876275..3ee565b6 100644 --- a/tester.c +++ b/tester.c @@ -7,8 +7,7 @@ */ #ifdef WIN32 -#define HAVE_FCNTL_H -#include +#include "win32config.h" #else #include "config.h" #endif diff --git a/tree.c b/tree.c index 83bed92b..3242aece 100644 --- a/tree.c +++ b/tree.c @@ -7,8 +7,7 @@ */ #ifdef WIN32 -#define HAVE_FCNTL_H -#include +#include "win32config.h" #else #include "config.h" #endif @@ -3000,7 +2999,7 @@ xmlGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *namespace) { if ((!xmlStrcmp(prop->name, name)) && (((prop->ns == NULL) && (node->ns != NULL) && (!xmlStrcmp(node->ns->href, namespace))) || - (prop->ns != NULL) && (!xmlStrcmp(prop->ns->href, namespace)))) { + ((prop->ns != NULL) && (!xmlStrcmp(prop->ns->href, namespace))))) { xmlChar *ret; ret = xmlNodeListGetString(node->doc, prop->val, 1); diff --git a/valid.c b/valid.c index 1efdbd06..3af1dcd7 100644 --- a/valid.c +++ b/valid.c @@ -8,8 +8,7 @@ */ #ifdef WIN32 -#define HAVE_FCNTL_H -#include +#include "win32config.h" #else #include "config.h" #endif diff --git a/win32config.h.in b/win32config.h.in new file mode 100644 index 00000000..6d19083d --- /dev/null +++ b/win32config.h.in @@ -0,0 +1,80 @@ +#define HAVE_CTYPE_H +#define HAVE_STDLIB_H +#define HAVE_MALLOC_H +#define HAVE_TIME_H +#define HAVE_FCNTL_H + +#define LIBXML_VERSION "@LIBXML_VERSION@" + +#include +#include + +#define EWOULDBLOCK WSAEWOULDBLOCK +#define EINPROGRESS WSAEINPROGRESS +#define EALREADY WSAEALREADY +#define ENOTSOCK WSAENOTSOCK +#define EDESTADDRREQ WSAEDESTADDRREQ +#define EMSGSIZE WSAEMSGSIZE +#define EPROTOTYPE WSAEPROTOTYPE +#define ENOPROTOOPT WSAENOPROTOOPT +#define EPROTONOSUPPORT WSAEPROTONOSUPPORT +#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT +#define EOPNOTSUPP WSAEOPNOTSUPP +#define EPFNOSUPPORT WSAEPFNOSUPPORT +#define EAFNOSUPPORT WSAEAFNOSUPPORT +#define EADDRINUSE WSAEADDRINUSE +#define EADDRNOTAVAIL WSAEADDRNOTAVAIL +#define ENETDOWN WSAENETDOWN +#define ENETUNREACH WSAENETUNREACH +#define ENETRESET WSAENETRESET +#define ECONNABORTED WSAECONNABORTED +#define ECONNRESET WSAECONNRESET +#define ENOBUFS WSAENOBUFS +#define EISCONN WSAEISCONN +#define ENOTCONN WSAENOTCONN +#define ESHUTDOWN WSAESHUTDOWN +#define ETOOMANYREFS WSAETOOMANYREFS +#define ETIMEDOUT WSAETIMEDOUT +#define ECONNREFUSED WSAECONNREFUSED +#define ELOOP WSAELOOP +#define ENAMETOOLONG WSAENAMETOOLONG +#define EHOSTDOWN WSAEHOSTDOWN +#define EHOSTUNREACH WSAEHOSTUNREACH +#define ENOTEMPTY WSAENOTEMPTY +#define EPROCLIM WSAEPROCLIM +#define EUSERS WSAEUSERS +#define EDQUOT WSAEDQUOT +#define ESTALE WSAESTALE +#define EREMOTE WSAEREMOTE + +#include +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; + } +} diff --git a/xlink.c b/xlink.c index 805156a3..4bd10aad 100644 --- a/xlink.c +++ b/xlink.c @@ -9,8 +9,7 @@ #ifdef WIN32 -#define HAVE_FCNTL_H -#include +#include "win32config.h" #else #include "config.h" #endif diff --git a/xmlIO.c b/xmlIO.c index 3526a0a0..c7c9a86c 100644 --- a/xmlIO.c +++ b/xmlIO.c @@ -7,8 +7,7 @@ */ #ifdef WIN32 -#define HAVE_FCNTL_H -#include +#include "win32config.h" #else #include "config.h" #endif diff --git a/xmlmemory.c b/xmlmemory.c index 19150527..7076f80b 100644 --- a/xmlmemory.c +++ b/xmlmemory.c @@ -5,8 +5,7 @@ */ #ifdef WIN32 -#define HAVE_FCNTL_H -#include +#include "win32config.h" #else #include "config.h" #endif diff --git a/xpath.c b/xpath.c index 9181e338..c5ce36af 100644 --- a/xpath.c +++ b/xpath.c @@ -14,8 +14,7 @@ */ #ifdef WIN32 -#define HAVE_FCNTL_H -#include +#include "win32config.h" #else #include "config.h" #endif