mirror of
https://github.com/strophe/libstrophe.git
synced 2026-07-17 19:36:22 +00:00
fixes for building with MSVC
This commit is contained in:
committed by
Steffen Jaeckel
parent
f8cda0f65c
commit
79066d797b
@@ -20,11 +20,12 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <conio.h>
|
||||
#include <ctype.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <strophe.h>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <conio.h>
|
||||
@@ -23,6 +22,7 @@
|
||||
#include <iphlpapi.h>
|
||||
#include <mstcpip.h> /* tcp_keepalive */
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
@@ -11,11 +11,16 @@
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <libgen.h> /* basename */
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strophe.h>
|
||||
#ifndef _WIN32
|
||||
#include <libgen.h> /* basename */
|
||||
#else
|
||||
#define strtok_r strtok_s
|
||||
#define basename(x) "vcard"
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
xmpp_ctx_t *ctx;
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
#include <errno.h>
|
||||
|
||||
#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;
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -29,6 +29,10 @@
|
||||
#include "strophe.h"
|
||||
|
||||
#include "common.h"
|
||||
#ifdef _MSC_VER
|
||||
#include <BaseTsd.h>
|
||||
typedef SSIZE_T ssize_t;
|
||||
#endif
|
||||
|
||||
const struct conn_interface tls_intf = {
|
||||
tls_read,
|
||||
|
||||
@@ -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 |
|
||||
|
||||
Reference in New Issue
Block a user