Skip to content

Commit dde1b81

Browse files
author
YuguoZhang
committed
fixes for building with MSVC
1 parent a2b3b6b commit dde1b81

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

src/compression.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
#include <errno.h>
1919

2020
#include "common.h"
21+
#ifdef _MSC_VER
22+
#define strcasecmp _stricmp
23+
#endif
2124

2225
#ifndef STROPHE_COMPRESSION_BUFFER_SIZE
2326
/** Max buffer size for compressed data (send & receive). */
@@ -110,7 +113,7 @@ static int
110113
_compression_write(xmpp_conn_t *conn, const void *buff, size_t len, int flush)
111114
{
112115
int ret;
113-
const void *buff_end = buff + len;
116+
const void *buff_end = (const char*)buff + len;
114117
struct xmpp_compression *comp = conn->compression.state;
115118
comp->compression.stream.next_in = (Bytef *)buff;
116119
comp->compression.stream.avail_in = len;
@@ -201,7 +204,7 @@ static void *_zlib_alloc(void *opaque, unsigned int items, unsigned int size)
201204
static void _init_zlib_compression(xmpp_ctx_t *ctx, struct zlib_compression *s)
202205
{
203206
s->buffer = strophe_alloc(ctx, STROPHE_COMPRESSION_BUFFER_SIZE);
204-
s->buffer_end = s->buffer + STROPHE_COMPRESSION_BUFFER_SIZE;
207+
s->buffer_end = (const char*)s->buffer + STROPHE_COMPRESSION_BUFFER_SIZE;
205208

206209
s->stream.opaque = ctx;
207210
s->stream.zalloc = _zlib_alloc;

src/conn.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
*/
2222

2323
#include <errno.h>
24+
#ifndef _MSC_VER
2425
#include <netinet/in.h>
26+
#endif
2527
#include <stdarg.h>
2628
#include <string.h>
2729
#include <limits.h>

src/resolver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ resolver_win32_srv_query(const char *fulldomain, unsigned char *buf, size_t len)
982982
insize = recvfrom(sock, (char *)buf, (int)len, 0,
983983
(struct sockaddr *)&dnsaddr, &addrlen);
984984
if (insize == SOCKET_ERROR) {
985-
if (sock_error() == WSAEWOULDBLOCK) {
985+
if (sock_error(NULL) == WSAEWOULDBLOCK) {
986986
Sleep(100);
987987
} else {
988988
break;

src/tls.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
#include "strophe.h"
3030

3131
#include "common.h"
32+
#ifdef _MSC_VER
33+
#include <BaseTsd.h>
34+
typedef SSIZE_T ssize_t;
35+
#endif
3236

3337
const struct conn_interface tls_intf = {
3438
tls_read,

src/tls_schannel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ int tls_start(tls_t *tls)
266266

267267
/* use the domain there as our name */
268268
name = tls->conn->domain;
269-
intf = tls->conn->intf;
269+
intf = &tls->conn->intf;
270270

271271
ctxtreq = ISC_REQ_SEQUENCE_DETECT | ISC_REQ_REPLAY_DETECT |
272272
ISC_REQ_CONFIDENTIALITY | ISC_RET_EXTENDED_ERROR |

0 commit comments

Comments
 (0)