Skip to content

Commit

Permalink
- fix for PIs name starting with xml
Browse files Browse the repository at this point in the history
 - fixed a potential problem with || and && ops
 - generate win32config.h for those on the Other Side !
Daniel
  • Loading branch information
Daniel Veillard committed Dec 22, 1999
1 parent 0caf07a commit 3c558c3
Show file tree
Hide file tree
Showing 22 changed files with 145 additions and 35 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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 :-(
Expand Down
3 changes: 1 addition & 2 deletions HTMLparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*/

#ifdef WIN32
#define HAVE_FCNTL_H
#include <io.h>
#include "win32config.h"
#else
#include "config.h"
#endif
Expand Down
4 changes: 3 additions & 1 deletion HTMLtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
*/


#ifndef WIN32
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include <stdio.h>
Expand Down
5 changes: 5 additions & 0 deletions SAX.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
*/


#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include "xmlmemory.h"
Expand Down
2 changes: 1 addition & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)

5 changes: 5 additions & 0 deletions debugXML.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
* Daniel.Veillard@w3.org
*/

#ifndef WIN32
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif

Expand Down
4 changes: 3 additions & 1 deletion entities.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
* Daniel.Veillard@w3.org
*/

#ifndef WIN32
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif

Expand Down
6 changes: 6 additions & 0 deletions error.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion nanohttp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
25 changes: 18 additions & 7 deletions parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*/

#ifdef WIN32
#define HAVE_FCNTL_H
#include <io.h>
#include "win32config.h"
#else
#include "config.h"
#endif
Expand Down Expand Up @@ -46,6 +45,14 @@

const char *xmlParserVersion = LIBXML_VERSION;

/*
* List of XML prefixed PI allowed by W3C specs
*/

const char *xmlW3CPIs[] = {
"xml-stylesheet",
NULL
};

/************************************************************************
* *
Expand Down Expand Up @@ -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);
}
Expand Down
3 changes: 1 addition & 2 deletions testHTML.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*/

#ifdef WIN32
#define HAVE_FCNTL_H
#include <io.h>
#include "win32config.h"
#else
#include "config.h"
#endif
Expand Down
3 changes: 1 addition & 2 deletions testSAX.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*/

#ifdef WIN32
#define HAVE_FCNTL_H
#include <io.h>
#include "win32config.h"
#else
#include "config.h"
#endif
Expand Down
3 changes: 1 addition & 2 deletions testXPath.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*/

#ifdef WIN32
#define HAVE_FCNTL_H
#include <io.h>
#include "win32config.h"
#else
#include "config.h"
#endif
Expand Down
3 changes: 1 addition & 2 deletions tester.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*/

#ifdef WIN32
#define HAVE_FCNTL_H
#include <io.h>
#include "win32config.h"
#else
#include "config.h"
#endif
Expand Down
5 changes: 2 additions & 3 deletions tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*/

#ifdef WIN32
#define HAVE_FCNTL_H
#include <io.h>
#include "win32config.h"
#else
#include "config.h"
#endif
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions valid.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
*/

#ifdef WIN32
#define HAVE_FCNTL_H
#include <io.h>
#include "win32config.h"
#else
#include "config.h"
#endif
Expand Down
80 changes: 80 additions & 0 deletions win32config.h.in
Original file line number Diff line number Diff line change
@@ -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;
}
}
3 changes: 1 addition & 2 deletions xlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@


#ifdef WIN32
#define HAVE_FCNTL_H
#include <io.h>
#include "win32config.h"
#else
#include "config.h"
#endif
Expand Down
3 changes: 1 addition & 2 deletions xmlIO.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*/

#ifdef WIN32
#define HAVE_FCNTL_H
#include <io.h>
#include "win32config.h"
#else
#include "config.h"
#endif
Expand Down
3 changes: 1 addition & 2 deletions xmlmemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
*/

#ifdef WIN32
#define HAVE_FCNTL_H
#include <io.h>
#include "win32config.h"
#else
#include "config.h"
#endif
Expand Down
3 changes: 1 addition & 2 deletions xpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
*/

#ifdef WIN32
#define HAVE_FCNTL_H
#include <io.h>
#include "win32config.h"
#else
#include "config.h"
#endif
Expand Down

0 comments on commit 3c558c3

Please sign in to comment.