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
diff --git a/ChangeLog b/ChangeLog
index bf70f90..6758cf3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+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>
 
 	* win32/configure.js: Jesse Pelton pointed out a problem in the
diff --git a/nanoftp.c b/nanoftp.c
index 16dc6f2..3c6257c 100644
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -68,7 +68,6 @@
 #include <libxml/uri.h>
 #include <libxml/nanoftp.h>
 #include <libxml/globals.h>
-#include <config.h>
 
 /* #define DEBUG_FTP 1  */
 #ifdef STANDALONE
@@ -125,7 +124,8 @@
 static int proxyType = 0;	/* uses TYPE or a@b ? */
 
 #ifdef SUPPORT_IP6
-static int have_ipv6() {
+static
+int have_ipv6(void) {
     int s;
 
     s = socket (AF_INET6, SOCK_STREAM, 0);
@@ -1004,7 +1004,7 @@
     struct hostent *hp;
     int port;
     int res;
-    int addrlen;
+    int addrlen = sizeof (struct sockaddr_in);
 
     if (ctxt == NULL)
 	return(-1);
@@ -1026,7 +1026,7 @@
 
 #ifdef SUPPORT_IP6
     if (have_ipv6 ()) {
-	struct addrinfo hints, *res, *result;
+	struct addrinfo hints, *tmp, *result;
 
 	result = NULL;
 	memset (&hints, 0, sizeof(hints));
@@ -1040,22 +1040,22 @@
 	    if (getaddrinfo (ctxt->hostname, NULL, &hints, &result) != 0)
 		return (-1);
 
-	for (res = result; res; res = res->ai_next)
-	    if (res->ai_family == AF_INET || res->ai_family == AF_INET6)
+	for (tmp = result; tmp; tmp = tmp->ai_next)
+	    if (tmp->ai_family == AF_INET || tmp->ai_family == AF_INET6)
 		break;
 
-	if (res) {
-	    if (res->ai_family == AF_INET6) {
-		memcpy (&ctxt->ftpAddr, res->ai_addr, res->ai_addrlen);
+	if (tmp) {
+	    if (tmp->ai_family == AF_INET6) {
+		memcpy (&ctxt->ftpAddr, tmp->ai_addr, tmp->ai_addrlen);
 		((struct sockaddr_in6 *) &ctxt->ftpAddr)->sin6_port = htons (port);
 		ctxt->controlFd = socket (AF_INET6, SOCK_STREAM, 0);
 	    }
 	    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);
 		ctxt->controlFd = socket (AF_INET, SOCK_STREAM, 0);
 	    }
-	    addrlen = res->ai_addrlen;
+	    addrlen = tmp->ai_addrlen;
 	    freeaddrinfo (result);
 	}
     }
@@ -1607,7 +1607,7 @@
 	    char buf6[INET6_ADDRSTRLEN];
 	    inet_ntop (AF_INET6, &((struct sockaddr_in6 *)&dataAddr)->sin6_addr,
 		    buf6, INET6_ADDRSTRLEN);
-	    adp = buf6;
+	    adp = (unsigned char *) buf6;
 	    portp = (unsigned char *) &((struct sockaddr_in6 *)&dataAddr)->sin6_port;
 	    snprintf (buf, sizeof(buf), "EPRT |2|%s|%s|\r\n", adp, portp);
         } else
diff --git a/nanohttp.c b/nanohttp.c
index c16cf0b..0034a17 100644
--- a/nanohttp.c
+++ b/nanohttp.c
@@ -80,7 +80,6 @@
 #include <libxml/nanohttp.h>
 #include <libxml/globals.h>
 #include <libxml/uri.h>
-#include <config.h>
 
 /**
  * A couple portability macros
@@ -154,7 +153,8 @@
 }
 
 #ifdef SUPPORT_IP6
-static int have_ipv6() {
+static
+int have_ipv6(void) {
     int s;
 
     s = socket (AF_INET6, SOCK_STREAM, 0);
@@ -956,7 +956,7 @@
 xmlNanoHTTPConnectHost(const char *host, int port)
 {
     struct hostent *h;
-    struct sockaddr *addr;
+    struct sockaddr *addr = NULL;
     struct in_addr ia;
     struct sockaddr_in sockin;
 
diff --git a/xmlschemas.c b/xmlschemas.c
index fa623a8..7a2dfbe 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -5413,8 +5413,9 @@
 			  xmlSchemaTypePtr type) {
     xmlChar *nil;
 
-    if ((elem->content == NULL) || (type == NULL) || (elemDecl == NULL))
+    if ((elem == NULL) || (type == NULL) || (elemDecl == NULL))
 	return(0);
+
     /*
      * 3.3.4 : 2
      */