[LIBXML2] Update to version 2.9.7. CORE-14291
[reactos.git] / sdk / lib / 3rdparty / libxml2 / nanoftp.c
index 2135ab9..54fa026 100644 (file)
@@ -12,8 +12,6 @@
 #define HAVE_NETINET_IN_H
 #define HAVE_NETDB_H
 #define HAVE_SYS_TIME_H
-#else /* TESTING */
-#define NEED_SOCKETS
 #endif /* TESTING */
 
 #define IN_LIBXML
 #endif
 
 
-#if defined(__MINGW32__) || defined(_WIN32_WCE)
-#ifndef _WINSOCKAPI_
-#define _WINSOCKAPI_
-#endif
+#if defined(_WIN32) && !defined(__CYGWIN__)
 #include <wsockcompat.h>
-#include <winsock2.h>
-#undef XML_SOCKLEN_T
-#define XML_SOCKLEN_T unsigned int
 #endif
 
 /**
@@ -511,6 +503,8 @@ xmlNanoFTPFreeCtxt(void * ctx) {
     if (ctxt->hostname != NULL) xmlFree(ctxt->hostname);
     if (ctxt->protocol != NULL) xmlFree(ctxt->protocol);
     if (ctxt->path != NULL) xmlFree(ctxt->path);
+    if (ctxt->user != NULL) xmlFree(ctxt->user);
+    if (ctxt->passwd != NULL) xmlFree(ctxt->passwd);
     ctxt->passive = 1;
     if (ctxt->controlFd != INVALID_SOCKET) closesocket(ctxt->controlFd);
     ctxt->controlFd = INVALID_SOCKET;
@@ -907,7 +901,7 @@ xmlNanoFTPConnect(void *ctx) {
            __xmlIOErr(XML_FROM_FTP, 0, "getaddrinfo failed");
            return (-1);
        }
-       if (tmp->ai_addrlen > sizeof(ctxt->ftpAddr)) {
+       if ((size_t)tmp->ai_addrlen > sizeof(ctxt->ftpAddr)) {
            if (result)
                freeaddrinfo (result);
            __xmlIOErr(XML_FROM_FTP, 0, "gethostbyname address mismatch");
@@ -1042,6 +1036,7 @@ xmlNanoFTPConnect(void *ctx) {
                case 2:
                    if (proxyPasswd == NULL)
                        break;
+                    /* Falls through. */
                case 3:
                    if (proxyPasswd != NULL)
                        snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd);
@@ -1111,6 +1106,7 @@ xmlNanoFTPConnect(void *ctx) {
                    ctxt->controlFd = INVALID_SOCKET;
                    return(-1);
                }
+                /* Falls through. */
            case 2:
                /* USER user@host command */
                if (ctxt->user == NULL)
@@ -1164,6 +1160,7 @@ xmlNanoFTPConnect(void *ctx) {
                    ctxt->controlFd = INVALID_SOCKET;
                    return(-1);
                }
+                /* Falls through. */
            case 3:
                /*
                 * If you need support for other Proxy authentication scheme
@@ -1212,6 +1209,7 @@ xmlNanoFTPConnect(void *ctx) {
        case 3:
            __xmlIOErr(XML_FROM_FTP, XML_FTP_ACCNT,
                       "FTP server asking for ACCNT on anonymous\n");
+           /* Falls through. */
        case 1:
        case 4:
        case 5: