aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/connect.c5
-rw-r--r--lib/ftp.c10
-rw-r--r--lib/multi.c2
-rw-r--r--lib/telnet.c7
-rw-r--r--lib/timeval.c1
-rw-r--r--lib/transfer.c10
-rw-r--r--lib/url.c10
7 files changed, 24 insertions, 21 deletions
diff --git a/lib/connect.c b/lib/connect.c
index dd4401585..faa5c419a 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -417,6 +417,7 @@ static bool verifyconnect(curl_socket_t sockfd)
/* This wasn't a successful connect */
return FALSE;
#else
+ (void)sockfd;
return TRUE;
#endif
}
@@ -571,7 +572,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
*/
for (ai = remotehost->addr; ai; ai = ai->ai_next, aliasindex++) {
sockfd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
- if (sockfd < 0)
+ if (sockfd == CURL_SOCKET_BAD)
continue;
#else
/*
@@ -681,7 +682,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
}
before = after;
}
- if (sockfd < 0) {
+ if (sockfd == CURL_SOCKET_BAD) {
/* no good connect was made */
*sockconn = -1;
failf(data, "Connect failed");
diff --git a/lib/ftp.c b/lib/ftp.c
index 3b417c9e1..758c918cc 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -166,7 +166,7 @@ static CURLcode AllowServerConnect(struct connectdata *conn)
default:
/* we have received data here */
{
- int s;
+ curl_socket_t s;
size_t size = sizeof(struct sockaddr_in);
struct sockaddr_in add;
@@ -175,7 +175,7 @@ static CURLcode AllowServerConnect(struct connectdata *conn)
sclose(sock); /* close the first socket */
- if (-1 == s) {
+ if (CURL_SOCKET_BAD == s) {
/* DIE! */
failf(data, "Error accept()ing server connect");
return CURLE_FTP_PORT_FAILED;
@@ -766,7 +766,7 @@ CURLcode Curl_ftp_done(struct connectdata *conn)
#endif
/* shut down the socket to inform the server we're done */
sclose(conn->sock[SECONDARYSOCKET]);
- conn->sock[SECONDARYSOCKET] = -1;
+ conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD;
if(!ftp->no_transfer) {
/* Let's see what the server says about the transfer we just performed,
@@ -2379,10 +2379,10 @@ CURLcode Curl_ftp(struct connectdata *conn)
if(connected)
retcode = Curl_ftp_nextconnect(conn);
- if(retcode && (conn->sock[SECONDARYSOCKET] >= 0)) {
+ if(retcode && (conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD)) {
/* Failure detected, close the second socket if it was created already */
sclose(conn->sock[SECONDARYSOCKET]);
- conn->sock[SECONDARYSOCKET] = -1;
+ conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD;
}
if(ftp->no_transfer)
diff --git a/lib/multi.c b/lib/multi.c
index e4ee5c63d..0da68317a 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -486,7 +486,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
* possibly know if the connection is in a good shape or not now. */
easy->easy_conn->bits.close = TRUE;
- if(-1 !=easy->easy_conn->sock[SECONDARYSOCKET]) {
+ if(CURL_SOCKET_BAD != easy->easy_conn->sock[SECONDARYSOCKET]) {
/* if we failed anywhere, we must clean up the secondary socket if
it was used */
sclose(easy->easy_conn->sock[SECONDARYSOCKET]);
diff --git a/lib/telnet.c b/lib/telnet.c
index 2d9adda51..6e1f52b7f 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -1091,12 +1091,12 @@ CURLcode Curl_telnet(struct connectdata *conn)
HANDLE stdin_handle;
HANDLE objs[2];
DWORD waitret;
- DWORD nread;
+ DWORD readfile_read;
#else
fd_set readfd;
fd_set keepfd;
- ssize_t nread;
#endif
+ ssize_t nread;
bool keepon = TRUE;
char *buf = data->state.buffer;
struct TELNET *tn;
@@ -1203,10 +1203,11 @@ CURLcode Curl_telnet(struct connectdata *conn)
char *buffer = buf;
if(!ReadFile(stdin_handle, buf, sizeof(data->state.buffer),
- (LPDWORD)&nread, NULL)) {
+ &readfile_read, NULL)) {
keepon = FALSE;
break;
}
+ nread = readfile_read;
while(nread--) {
outbuf[0] = *buffer++;
diff --git a/lib/timeval.c b/lib/timeval.c
index 736d5631d..dff9aa841 100644
--- a/lib/timeval.c
+++ b/lib/timeval.c
@@ -63,6 +63,7 @@ static int gettimeofday(struct timeval *tp, void *nothing)
tp->tv_sec = Sec;
tp->tv_usec = Usec;
#endif /* WITHOUT_MM_LIB */
+ (void)nothing;
return 0;
}
#else /* WIN32 */
diff --git a/lib/transfer.c b/lib/transfer.c
index 16ed596f1..cc13a6c42 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1312,13 +1312,13 @@ CURLcode Curl_readwrite_init(struct connectdata *conn)
if(conn->bits.getheader || !data->set.no_body) {
FD_ZERO (&k->readfd); /* clear it */
- if(conn->sockfd != -1) {
+ if(conn->sockfd != CURL_SOCKET_BAD) {
FD_SET (conn->sockfd, &k->readfd); /* read socket */
k->keepon |= KEEP_READ;
}
FD_ZERO (&k->writefd); /* clear it */
- if(conn->writesockfd != -1) {
+ if(conn->writesockfd != CURL_SOCKET_BAD) {
/* HTTP 1.1 magic:
Even if we require a 100-return code before uploading data, we might
@@ -1408,7 +1408,7 @@ Transfer(struct connectdata *conn)
is different*/
Curl_readwrite_init(conn);
- if((conn->sockfd == -1) && (conn->writesockfd == -1))
+ if((conn->sockfd == CURL_SOCKET_BAD) && (conn->writesockfd == CURL_SOCKET_BAD))
/* nothing to read, nothing to write, we're already OK! */
return CURLE_OK;
@@ -1953,11 +1953,11 @@ CURLcode Curl_perform(struct SessionHandle *data)
* possibly know if the connection is in a good shape or not now. */
conn->bits.close = TRUE;
- if(-1 != conn->sock[SECONDARYSOCKET]) {
+ if(CURL_SOCKET_BAD != conn->sock[SECONDARYSOCKET]) {
/* if we failed anywhere, we must clean up the secondary socket if
it was used */
sclose(conn->sock[SECONDARYSOCKET]);
- conn->sock[SECONDARYSOCKET]=-1;
+ conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD;
}
}
diff --git a/lib/url.c b/lib/url.c
index 0b06cf5ea..2b215bdbf 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1341,9 +1341,9 @@ CURLcode Curl_disconnect(struct connectdata *conn)
Curl_SSL_Close(conn);
/* close possibly still open sockets */
- if(-1 != conn->sock[SECONDARYSOCKET])
+ if(CURL_SOCKET_BAD != conn->sock[SECONDARYSOCKET])
sclose(conn->sock[SECONDARYSOCKET]);
- if(-1 != conn->sock[FIRSTSOCKET])
+ if(CURL_SOCKET_BAD != conn->sock[FIRSTSOCKET])
sclose(conn->sock[FIRSTSOCKET]);
Curl_safefree(conn->user);
@@ -2022,8 +2022,8 @@ static CURLcode CreateConnection(struct SessionHandle *data,
/* and we setup a few fields in case we end up actually using this struct */
conn->data = data; /* remember our daddy */
- conn->sock[FIRSTSOCKET] = -1; /* no file descriptor */
- conn->sock[SECONDARYSOCKET] = -1; /* no file descriptor */
+ conn->sock[FIRSTSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */
+ conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */
conn->connectindex = -1; /* no index */
conn->bits.httpproxy = (data->change.proxy && *data->change.proxy &&
(data->set.proxytype == CURLPROXY_HTTP))?
@@ -3164,7 +3164,7 @@ static CURLcode SetupConnection(struct connectdata *conn,
conn->bytecount = 0;
conn->headerbytecount = 0;
- if(-1 == conn->sock[FIRSTSOCKET]) {
+ if(CURL_SOCKET_BAD == conn->sock[FIRSTSOCKET]) {
bool connected;
/* Connect only if not already connected! */