diff --git a/examples/bot.c b/examples/bot.c index 7980053a..5197ad13 100644 --- a/examples/bot.c +++ b/examples/bot.c @@ -20,11 +20,12 @@ #include #include #include -#include #ifdef _WIN32 #include #include +#else +#include #endif #include diff --git a/examples/complex.c b/examples/complex.c index 4f980f30..00da5a44 100644 --- a/examples/complex.c +++ b/examples/complex.c @@ -13,7 +13,6 @@ #include #include #include -#include #ifdef _WIN32 #include @@ -23,6 +22,7 @@ #include #include /* tcp_keepalive */ #else +#include #include #include #include diff --git a/examples/vcard.c b/examples/vcard.c index 1ed8cdf2..1ce0eb61 100644 --- a/examples/vcard.c +++ b/examples/vcard.c @@ -11,11 +11,16 @@ */ #include -#include /* basename */ #include #include #include #include +#ifndef _WIN32 +#include /* basename */ +#else +#define strtok_r strtok_s +#define basename(x) "vcard" +#endif typedef struct { xmpp_ctx_t *ctx; diff --git a/src/compression.c b/src/compression.c index b1a2c3a7..a7fee9e8 100644 --- a/src/compression.c +++ b/src/compression.c @@ -18,6 +18,9 @@ #include #include "common.h" +#ifdef _MSC_VER +#define strcasecmp _stricmp +#endif #ifndef STROPHE_COMPRESSION_BUFFER_SIZE /** Max buffer size for compressed data (send & receive). */ @@ -110,7 +113,7 @@ static int _compression_write(xmpp_conn_t *conn, const void *buff, size_t len, int flush) { int ret; - const void *buff_end = buff + len; + const void *buff_end = (const char *)buff + len; struct xmpp_compression *comp = conn->compression.state; comp->compression.stream.next_in = (Bytef *)buff; comp->compression.stream.avail_in = len; @@ -201,7 +204,7 @@ static void *_zlib_alloc(void *opaque, unsigned int items, unsigned int size) static void _init_zlib_compression(xmpp_ctx_t *ctx, struct zlib_compression *s) { s->buffer = strophe_alloc(ctx, STROPHE_COMPRESSION_BUFFER_SIZE); - s->buffer_end = s->buffer + STROPHE_COMPRESSION_BUFFER_SIZE; + s->buffer_end = (char *)s->buffer + STROPHE_COMPRESSION_BUFFER_SIZE; s->stream.opaque = ctx; s->stream.zalloc = _zlib_alloc; diff --git a/src/conn.c b/src/conn.c index f586a59d..96968be5 100644 --- a/src/conn.c +++ b/src/conn.c @@ -21,7 +21,9 @@ */ #include +#ifndef _MSC_VER #include +#endif #include #include #include diff --git a/src/resolver.c b/src/resolver.c index 028320a0..bc8cd189 100644 --- a/src/resolver.c +++ b/src/resolver.c @@ -982,7 +982,7 @@ resolver_win32_srv_query(const char *fulldomain, unsigned char *buf, size_t len) insize = recvfrom(sock, (char *)buf, (int)len, 0, (struct sockaddr *)&dnsaddr, &addrlen); if (insize == SOCKET_ERROR) { - if (sock_error() == WSAEWOULDBLOCK) { + if (sock_error(NULL) == WSAEWOULDBLOCK) { Sleep(100); } else { break; diff --git a/src/tls.c b/src/tls.c index e15fbb1d..5d084711 100644 --- a/src/tls.c +++ b/src/tls.c @@ -29,6 +29,10 @@ #include "strophe.h" #include "common.h" +#ifdef _MSC_VER +#include +typedef SSIZE_T ssize_t; +#endif const struct conn_interface tls_intf = { tls_read, diff --git a/src/tls_schannel.c b/src/tls_schannel.c index 6463bbe5..65783ecf 100644 --- a/src/tls_schannel.c +++ b/src/tls_schannel.c @@ -266,7 +266,7 @@ int tls_start(tls_t *tls) /* use the domain there as our name */ name = tls->conn->domain; - intf = tls->conn->intf; + intf = &tls->conn->intf; ctxtreq = ISC_REQ_SEQUENCE_DETECT | ISC_REQ_REPLAY_DETECT | ISC_REQ_CONFIDENTIALITY | ISC_RET_EXTENDED_ERROR |