1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-12-22 04:02:04 +03:00

Cast length for send and recv

Windows takes the byte length as an integer rather than size_t as
POSIX does.
This commit is contained in:
Matt Clarkson
2015-05-28 09:57:53 +01:00
parent d94365acd9
commit 0633c1a189

View File

@@ -2933,7 +2933,12 @@ push(FILE *fp, SOCKET sock, SSL *ssl, const char *buf, int64_t len)
if (ferror(fp))
n = -1;
} else {
n = (int)send(sock, buf + sent, (size_t)k, MSG_NOSIGNAL);
#ifdef _WIN32
typedef int len_t;
#else
typedef size_t len_t;
#endif
n = (int)send(sock, buf + sent, (len_t)k, MSG_NOSIGNAL);
}
if (n <= 0)
@@ -2975,7 +2980,12 @@ static int pull(FILE *fp, struct mg_connection *conn, char *buf, int len)
nread = SSL_read(conn->ssl, buf, len);
#endif
} else {
nread = (int)recv(conn->client.sock, buf, (size_t)len, 0);
#ifdef _WIN32
typedef int len_t;
#else
typedef size_t len_t;
#endif
nread = (int)recv(conn->client.sock, buf, (len_t)len, 0);
}
if (conn->ctx->stop_flag) {
return -1;