fixed compilation for windows

This commit is contained in:
Frank Morgner
2013-08-09 07:21:40 +02:00
parent fc578afc54
commit af02f4026a

View File

@@ -22,14 +22,15 @@
#include "config.h" #include "config.h"
#endif #endif
#if defined HAVE_DECL_MSG_NOSIGNAL && !HAVE_DECL_MSG_NOSIGNAL #if (!defined HAVE_DECL_MSG_NOSIGNAL) || !HAVE_DECL_MSG_NOSIGNAL
#define MSG_NOSIGNAL #define MSG_NOSIGNAL 0
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#define close(s) closesocket(s) #define close(s) closesocket(s)
#define snprintf _snprintf
#ifndef AI_NUMERICSERV #ifndef AI_NUMERICSERV
#define AI_NUMERICSERV 0 #define AI_NUMERICSERV 0
#endif #endif
@@ -72,7 +73,7 @@ ssize_t sendall(int sock, const void *buffer, size_t size)
ssize_t r; ssize_t r;
for (sent = 0; sent < size; sent += r) { for (sent = 0; sent < size; sent += r) {
r = send(sock, (void *) (buffer+sent), size-sent, MSG_NOSIGNAL); r = send(sock, (void *) (((unsigned char *) buffer)+sent), size-sent, MSG_NOSIGNAL);
if (r < 0) if (r < 0)
return r; return r;