- fix for PIs name starting with xml
- fixed a potential problem with || and && ops
- generate win32config.h for those on the Other Side !
Daniel
diff --git a/ChangeLog b/ChangeLog
index 58680f9..cb6aae3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Dec 22 12:20:53 CET 1999 Daniel Veillard <Daniel.Veillard@w3.org>
+
+ * 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 <Daniel.Veillard@w3.org>
* parser.c: fixed a stupid = vs. == bug :-(
diff --git a/HTMLparser.c b/HTMLparser.c
index 0215b7a..7276e7c 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -7,8 +7,7 @@
*/
#ifdef WIN32
-#define HAVE_FCNTL_H
-#include <io.h>
+#include "win32config.h"
#else
#include "config.h"
#endif
diff --git a/HTMLtree.c b/HTMLtree.c
index 1265a0a..c84daea 100644
--- a/HTMLtree.c
+++ b/HTMLtree.c
@@ -7,7 +7,9 @@
*/
-#ifndef WIN32
+#ifdef WIN32
+#include "win32config.h"
+#else
#include "config.h"
#endif
#include <stdio.h>
diff --git a/SAX.c b/SAX.c
index 6d95d44..be5a0ab 100644
--- a/SAX.c
+++ b/SAX.c
@@ -7,6 +7,11 @@
*/
+#ifdef WIN32
+#include "win32config.h"
+#else
+#include "config.h"
+#endif
#include <stdio.h>
#include <stdlib.h>
#include "xmlmemory.h"
diff --git a/configure.in b/configure.in
index f52084c..59ef481 100644
--- a/configure.in
+++ b/configure.in
@@ -142,5 +142,5 @@
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 37213f6..2344bb2 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -7,6 +7,11 @@
* Daniel Veillard <Daniel.Veillard@w3.org>
*/
+#ifdef WIN32
+#include "win32config.h"
+#else
+#include "config.h"
+#endif
#include <stdio.h>
#include "tree.h"
#include "parser.h"
diff --git a/encoding.c b/encoding.c
index e80cbd5..12eed70 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 c7e96cc..2e73684 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 b77839e..18fdbd0 100644
--- a/error.c
+++ b/error.c
@@ -6,6 +6,12 @@
* Daniel Veillard <Daniel.Veillard@w3.org>
*/
+#ifdef WIN32
+#include "win32config.h"
+#else
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <stdarg.h>
#include "parser.h"
diff --git a/nanohttp.c b/nanohttp.c
index 0445c9c..8224d49 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 <stdio.h>
#include <string.h>
diff --git a/parser.c b/parser.c
index 09f987c..98656d4 100644
--- a/parser.c
+++ b/parser.c
@@ -7,8 +7,7 @@
*/
#ifdef WIN32
-#define HAVE_FCNTL_H
-#include <io.h>
+#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 @@
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 430ab22..41ebea3 100644
--- a/testHTML.c
+++ b/testHTML.c
@@ -7,8 +7,7 @@
*/
#ifdef WIN32
-#define HAVE_FCNTL_H
-#include <io.h>
+#include "win32config.h"
#else
#include "config.h"
#endif
diff --git a/testSAX.c b/testSAX.c
index ecd9644..f33a1d6 100644
--- a/testSAX.c
+++ b/testSAX.c
@@ -7,8 +7,7 @@
*/
#ifdef WIN32
-#define HAVE_FCNTL_H
-#include <io.h>
+#include "win32config.h"
#else
#include "config.h"
#endif
diff --git a/testXPath.c b/testXPath.c
index b31d3ea..b9824f2 100644
--- a/testXPath.c
+++ b/testXPath.c
@@ -7,8 +7,7 @@
*/
#ifdef WIN32
-#define HAVE_FCNTL_H
-#include <io.h>
+#include "win32config.h"
#else
#include "config.h"
#endif
diff --git a/tester.c b/tester.c
index 1187627..3ee565b 100644
--- a/tester.c
+++ b/tester.c
@@ -7,8 +7,7 @@
*/
#ifdef WIN32
-#define HAVE_FCNTL_H
-#include <io.h>
+#include "win32config.h"
#else
#include "config.h"
#endif
diff --git a/tree.c b/tree.c
index 83bed92..3242aec 100644
--- a/tree.c
+++ b/tree.c
@@ -7,8 +7,7 @@
*/
#ifdef WIN32
-#define HAVE_FCNTL_H
-#include <io.h>
+#include "win32config.h"
#else
#include "config.h"
#endif
@@ -3000,7 +2999,7 @@
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 1efdbd0..3af1dcd 100644
--- a/valid.c
+++ b/valid.c
@@ -8,8 +8,7 @@
*/
#ifdef WIN32
-#define HAVE_FCNTL_H
-#include <io.h>
+#include "win32config.h"
#else
#include "config.h"
#endif
diff --git a/win32config.h.in b/win32config.h.in
new file mode 100644
index 0000000..6d19083
--- /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 <io.h>
+#include <winsock2.h>
+
+#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 <math.h>
+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 805156a..4bd10aa 100644
--- a/xlink.c
+++ b/xlink.c
@@ -9,8 +9,7 @@
#ifdef WIN32
-#define HAVE_FCNTL_H
-#include <io.h>
+#include "win32config.h"
#else
#include "config.h"
#endif
diff --git a/xmlIO.c b/xmlIO.c
index 3526a0a..c7c9a86 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -7,8 +7,7 @@
*/
#ifdef WIN32
-#define HAVE_FCNTL_H
-#include <io.h>
+#include "win32config.h"
#else
#include "config.h"
#endif
diff --git a/xmlmemory.c b/xmlmemory.c
index 1915052..7076f80 100644
--- a/xmlmemory.c
+++ b/xmlmemory.c
@@ -5,8 +5,7 @@
*/
#ifdef WIN32
-#define HAVE_FCNTL_H
-#include <io.h>
+#include "win32config.h"
#else
#include "config.h"
#endif
diff --git a/xpath.c b/xpath.c
index 9181e33..c5ce36a 100644
--- a/xpath.c
+++ b/xpath.c
@@ -14,8 +14,7 @@
*/
#ifdef WIN32
-#define HAVE_FCNTL_H
-#include <io.h>
+#include "win32config.h"
#else
#include "config.h"
#endif