Commit 2db8c125 authored by Daniel Veillard's avatar Daniel Veillard

the modules should not import <config.h> directly, some cleanups Peter

* nanoftp.c nanohttp.c: the modules should not import <config.h>
  directly, some cleanups
* xmlschemas.c: Peter Sobisch found a nasty bug in the Schemas
  validation code.
Daniel
parent 13d07cdc
Tue Jul 8 14:15:07 CEST 2003 Daniel Veillard <daniel@veillard.com>
* nanoftp.c nanohttp.c: the modules should not import <config.h>
directly, some cleanups
* xmlschemas.c: Peter Sobisch found a nasty bug in the Schemas
validation code.
Mon Jul 7 18:00:51 CEST 2003 Daniel Veillard <daniel@veillard.com> Mon Jul 7 18:00:51 CEST 2003 Daniel Veillard <daniel@veillard.com>
* win32/configure.js: Jesse Pelton pointed out a problem in the * win32/configure.js: Jesse Pelton pointed out a problem in the
......
...@@ -68,7 +68,6 @@ ...@@ -68,7 +68,6 @@
#include <libxml/uri.h> #include <libxml/uri.h>
#include <libxml/nanoftp.h> #include <libxml/nanoftp.h>
#include <libxml/globals.h> #include <libxml/globals.h>
#include <config.h>
/* #define DEBUG_FTP 1 */ /* #define DEBUG_FTP 1 */
#ifdef STANDALONE #ifdef STANDALONE
...@@ -125,7 +124,8 @@ static char *proxyPasswd = NULL;/* passwd for proxy authentication */ ...@@ -125,7 +124,8 @@ static char *proxyPasswd = NULL;/* passwd for proxy authentication */
static int proxyType = 0; /* uses TYPE or a@b ? */ static int proxyType = 0; /* uses TYPE or a@b ? */
#ifdef SUPPORT_IP6 #ifdef SUPPORT_IP6
static int have_ipv6() { static
int have_ipv6(void) {
int s; int s;
s = socket (AF_INET6, SOCK_STREAM, 0); s = socket (AF_INET6, SOCK_STREAM, 0);
...@@ -1004,7 +1004,7 @@ xmlNanoFTPConnect(void *ctx) { ...@@ -1004,7 +1004,7 @@ xmlNanoFTPConnect(void *ctx) {
struct hostent *hp; struct hostent *hp;
int port; int port;
int res; int res;
int addrlen; int addrlen = sizeof (struct sockaddr_in);
if (ctxt == NULL) if (ctxt == NULL)
return(-1); return(-1);
...@@ -1026,7 +1026,7 @@ xmlNanoFTPConnect(void *ctx) { ...@@ -1026,7 +1026,7 @@ xmlNanoFTPConnect(void *ctx) {
#ifdef SUPPORT_IP6 #ifdef SUPPORT_IP6
if (have_ipv6 ()) { if (have_ipv6 ()) {
struct addrinfo hints, *res, *result; struct addrinfo hints, *tmp, *result;
result = NULL; result = NULL;
memset (&hints, 0, sizeof(hints)); memset (&hints, 0, sizeof(hints));
...@@ -1040,22 +1040,22 @@ xmlNanoFTPConnect(void *ctx) { ...@@ -1040,22 +1040,22 @@ xmlNanoFTPConnect(void *ctx) {
if (getaddrinfo (ctxt->hostname, NULL, &hints, &result) != 0) if (getaddrinfo (ctxt->hostname, NULL, &hints, &result) != 0)
return (-1); return (-1);
for (res = result; res; res = res->ai_next) for (tmp = result; tmp; tmp = tmp->ai_next)
if (res->ai_family == AF_INET || res->ai_family == AF_INET6) if (tmp->ai_family == AF_INET || tmp->ai_family == AF_INET6)
break; break;
if (res) { if (tmp) {
if (res->ai_family == AF_INET6) { if (tmp->ai_family == AF_INET6) {
memcpy (&ctxt->ftpAddr, res->ai_addr, res->ai_addrlen); memcpy (&ctxt->ftpAddr, tmp->ai_addr, tmp->ai_addrlen);
((struct sockaddr_in6 *) &ctxt->ftpAddr)->sin6_port = htons (port); ((struct sockaddr_in6 *) &ctxt->ftpAddr)->sin6_port = htons (port);
ctxt->controlFd = socket (AF_INET6, SOCK_STREAM, 0); ctxt->controlFd = socket (AF_INET6, SOCK_STREAM, 0);
} }
else { else {
memcpy (&ctxt->ftpAddr, res->ai_addr, res->ai_addrlen); memcpy (&ctxt->ftpAddr, tmp->ai_addr, tmp->ai_addrlen);
((struct sockaddr_in *) &ctxt->ftpAddr)->sin_port = htons (port); ((struct sockaddr_in *) &ctxt->ftpAddr)->sin_port = htons (port);
ctxt->controlFd = socket (AF_INET, SOCK_STREAM, 0); ctxt->controlFd = socket (AF_INET, SOCK_STREAM, 0);
} }
addrlen = res->ai_addrlen; addrlen = tmp->ai_addrlen;
freeaddrinfo (result); freeaddrinfo (result);
} }
} }
...@@ -1607,7 +1607,7 @@ xmlNanoFTPGetConnection(void *ctx) { ...@@ -1607,7 +1607,7 @@ xmlNanoFTPGetConnection(void *ctx) {
char buf6[INET6_ADDRSTRLEN]; char buf6[INET6_ADDRSTRLEN];
inet_ntop (AF_INET6, &((struct sockaddr_in6 *)&dataAddr)->sin6_addr, inet_ntop (AF_INET6, &((struct sockaddr_in6 *)&dataAddr)->sin6_addr,
buf6, INET6_ADDRSTRLEN); buf6, INET6_ADDRSTRLEN);
adp = buf6; adp = (unsigned char *) buf6;
portp = (unsigned char *) &((struct sockaddr_in6 *)&dataAddr)->sin6_port; portp = (unsigned char *) &((struct sockaddr_in6 *)&dataAddr)->sin6_port;
snprintf (buf, sizeof(buf), "EPRT |2|%s|%s|\r\n", adp, portp); snprintf (buf, sizeof(buf), "EPRT |2|%s|%s|\r\n", adp, portp);
} else } else
......
...@@ -80,7 +80,6 @@ ...@@ -80,7 +80,6 @@
#include <libxml/nanohttp.h> #include <libxml/nanohttp.h>
#include <libxml/globals.h> #include <libxml/globals.h>
#include <libxml/uri.h> #include <libxml/uri.h>
#include <config.h>
/** /**
* A couple portability macros * A couple portability macros
...@@ -154,7 +153,8 @@ static int socket_errno(void) { ...@@ -154,7 +153,8 @@ static int socket_errno(void) {
} }
#ifdef SUPPORT_IP6 #ifdef SUPPORT_IP6
static int have_ipv6() { static
int have_ipv6(void) {
int s; int s;
s = socket (AF_INET6, SOCK_STREAM, 0); s = socket (AF_INET6, SOCK_STREAM, 0);
...@@ -956,7 +956,7 @@ static int ...@@ -956,7 +956,7 @@ static int
xmlNanoHTTPConnectHost(const char *host, int port) xmlNanoHTTPConnectHost(const char *host, int port)
{ {
struct hostent *h; struct hostent *h;
struct sockaddr *addr; struct sockaddr *addr = NULL;
struct in_addr ia; struct in_addr ia;
struct sockaddr_in sockin; struct sockaddr_in sockin;
......
...@@ -5413,8 +5413,9 @@ xmlSchemaValidateType(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr elem, ...@@ -5413,8 +5413,9 @@ xmlSchemaValidateType(xmlSchemaValidCtxtPtr ctxt, xmlNodePtr elem,
xmlSchemaTypePtr type) { xmlSchemaTypePtr type) {
xmlChar *nil; xmlChar *nil;
if ((elem->content == NULL) || (type == NULL) || (elemDecl == NULL)) if ((elem == NULL) || (type == NULL) || (elemDecl == NULL))
return(0); return(0);
/* /*
* 3.3.4 : 2 * 3.3.4 : 2
*/ */
......
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