summaryrefslogtreecommitdiff
path: root/nanoftp.c
diff options
context:
space:
mode:
Diffstat (limited to 'nanoftp.c')
-rw-r--r--nanoftp.c46
1 files changed, 19 insertions, 27 deletions
diff --git a/nanoftp.c b/nanoftp.c
index 2135ab9..077bfe2 100644
--- a/nanoftp.c
+++ b/nanoftp.c
@@ -775,7 +775,7 @@ xmlNanoFTPSendUser(void *ctx) {
#ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, "%s", buf);
#endif
- res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
+ res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed");
return(res);
@@ -803,7 +803,7 @@ xmlNanoFTPSendPasswd(void *ctx) {
#ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, "%s", buf);
#endif
- res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
+ res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed");
return(res);
@@ -834,7 +834,7 @@ xmlNanoFTPQuit(void *ctx) {
#ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, "%s", buf); /* Just to be consistent, even though we know it can't have a % in it */
#endif
- res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
+ res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed");
return(res);
@@ -908,8 +908,6 @@ xmlNanoFTPConnect(void *ctx) {
return (-1);
}
if (tmp->ai_addrlen > sizeof(ctxt->ftpAddr)) {
- if (result)
- freeaddrinfo (result);
__xmlIOErr(XML_FROM_FTP, 0, "gethostbyname address mismatch");
return (-1);
}
@@ -930,9 +928,9 @@ xmlNanoFTPConnect(void *ctx) {
#endif
{
if (proxy)
- hp = gethostbyname (GETHOSTBYNAME_ARG_CAST proxy);
+ hp = gethostbyname (proxy);
else
- hp = gethostbyname (GETHOSTBYNAME_ARG_CAST ctxt->hostname);
+ hp = gethostbyname (ctxt->hostname);
if (hp == NULL) {
__xmlIOErr(XML_FROM_FTP, 0, "gethostbyname failed");
return (-1);
@@ -1030,7 +1028,7 @@ xmlNanoFTPConnect(void *ctx) {
#ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, "%s", buf);
#endif
- res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
+ res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->controlFd);
@@ -1052,7 +1050,7 @@ xmlNanoFTPConnect(void *ctx) {
#ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, "%s", buf);
#endif
- res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
+ res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->controlFd);
@@ -1093,7 +1091,7 @@ xmlNanoFTPConnect(void *ctx) {
#ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, "%s", buf);
#endif
- res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
+ res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
@@ -1124,7 +1122,7 @@ xmlNanoFTPConnect(void *ctx) {
#ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, "%s", buf);
#endif
- res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
+ res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
@@ -1146,7 +1144,7 @@ xmlNanoFTPConnect(void *ctx) {
#ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, "%s", buf);
#endif
- res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
+ res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->controlFd); ctxt->controlFd = INVALID_SOCKET;
@@ -1246,13 +1244,7 @@ xmlNanoFTPConnectTo(const char *server, int port) {
if (port <= 0)
return(NULL);
ctxt = (xmlNanoFTPCtxtPtr) xmlNanoFTPNewCtxt(NULL);
- if (ctxt == NULL)
- return(NULL);
ctxt->hostname = xmlMemStrdup(server);
- if (ctxt->hostname == NULL) {
- xmlNanoFTPFreeCtxt(ctxt);
- return(NULL);
- }
if (port != 0)
ctxt->port = port;
res = xmlNanoFTPConnect(ctxt);
@@ -1296,7 +1288,7 @@ xmlNanoFTPCwd(void *ctx, const char *directory) {
#ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, "%s", buf);
#endif
- res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
+ res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed");
return(res);
@@ -1329,8 +1321,8 @@ xmlNanoFTPDele(void *ctx, const char *file) {
int len;
int res;
- if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET) ||
- (file == NULL)) return(-1);
+ if ((ctxt == NULL) || (ctxt->controlFd == INVALID_SOCKET) || (file == NULL)) return(-1);
+ if (file == NULL) return (0);
/*
* Expected response code for DELE:
@@ -1347,7 +1339,7 @@ xmlNanoFTPDele(void *ctx, const char *file) {
#ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, "%s", buf);
#endif
- res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
+ res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed");
return(res);
@@ -1419,7 +1411,7 @@ xmlNanoFTPGetConnection(void *ctx) {
#ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, "%s", buf);
#endif
- res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
+ res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
@@ -1520,7 +1512,7 @@ xmlNanoFTPGetConnection(void *ctx) {
xmlGenericError(xmlGenericErrorContext, "%s", buf);
#endif
- res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
+ res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
@@ -1757,7 +1749,7 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData,
#ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, "%s", buf);
#endif
- res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
+ res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
@@ -1852,7 +1844,7 @@ xmlNanoFTPGetSocket(void *ctx, const char *filename) {
#ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, "%s", buf);
#endif
- res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
+ res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;
@@ -1872,7 +1864,7 @@ xmlNanoFTPGetSocket(void *ctx, const char *filename) {
#ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, "%s", buf);
#endif
- res = send(ctxt->controlFd, SEND_ARG2_CAST buf, len, 0);
+ res = send(ctxt->controlFd, buf, len, 0);
if (res < 0) {
__xmlIOErr(XML_FROM_FTP, 0, "send failed");
closesocket(ctxt->dataFd); ctxt->dataFd = INVALID_SOCKET;