mirror of
https://github.com/strophe/libstrophe.git
synced 2026-07-31 17: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 <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <strophe.h>
|
#include <strophe.h>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
@@ -23,6 +22,7 @@
|
|||||||
#include <iphlpapi.h>
|
#include <iphlpapi.h>
|
||||||
#include <mstcpip.h> /* tcp_keepalive */
|
#include <mstcpip.h> /* tcp_keepalive */
|
||||||
#else
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
|
|||||||
@@ -11,11 +11,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <libgen.h> /* basename */
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <strophe.h>
|
#include <strophe.h>
|
||||||
|
#ifndef _WIN32
|
||||||
|
#include <libgen.h> /* basename */
|
||||||
|
#else
|
||||||
|
#define strtok_r strtok_s
|
||||||
|
#define basename(x) "vcard"
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
xmpp_ctx_t *ctx;
|
xmpp_ctx_t *ctx;
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define strcasecmp _stricmp
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef STROPHE_COMPRESSION_BUFFER_SIZE
|
#ifndef STROPHE_COMPRESSION_BUFFER_SIZE
|
||||||
/** Max buffer size for compressed data (send & receive). */
|
/** 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)
|
_compression_write(xmpp_conn_t *conn, const void *buff, size_t len, int flush)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
const void *buff_end = buff + len;
|
const void *buff_end = (const char *)buff + len;
|
||||||
struct xmpp_compression *comp = conn->compression.state;
|
struct xmpp_compression *comp = conn->compression.state;
|
||||||
comp->compression.stream.next_in = (Bytef *)buff;
|
comp->compression.stream.next_in = (Bytef *)buff;
|
||||||
comp->compression.stream.avail_in = len;
|
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)
|
static void _init_zlib_compression(xmpp_ctx_t *ctx, struct zlib_compression *s)
|
||||||
{
|
{
|
||||||
s->buffer = strophe_alloc(ctx, STROPHE_COMPRESSION_BUFFER_SIZE);
|
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.opaque = ctx;
|
||||||
s->stream.zalloc = _zlib_alloc;
|
s->stream.zalloc = _zlib_alloc;
|
||||||
|
|||||||
@@ -21,7 +21,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#ifndef _MSC_VER
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#endif
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.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,
|
insize = recvfrom(sock, (char *)buf, (int)len, 0,
|
||||||
(struct sockaddr *)&dnsaddr, &addrlen);
|
(struct sockaddr *)&dnsaddr, &addrlen);
|
||||||
if (insize == SOCKET_ERROR) {
|
if (insize == SOCKET_ERROR) {
|
||||||
if (sock_error() == WSAEWOULDBLOCK) {
|
if (sock_error(NULL) == WSAEWOULDBLOCK) {
|
||||||
Sleep(100);
|
Sleep(100);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -29,6 +29,10 @@
|
|||||||
#include "strophe.h"
|
#include "strophe.h"
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <BaseTsd.h>
|
||||||
|
typedef SSIZE_T ssize_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
const struct conn_interface tls_intf = {
|
const struct conn_interface tls_intf = {
|
||||||
tls_read,
|
tls_read,
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ int tls_start(tls_t *tls)
|
|||||||
|
|
||||||
/* use the domain there as our name */
|
/* use the domain there as our name */
|
||||||
name = tls->conn->domain;
|
name = tls->conn->domain;
|
||||||
intf = tls->conn->intf;
|
intf = &tls->conn->intf;
|
||||||
|
|
||||||
ctxtreq = ISC_REQ_SEQUENCE_DETECT | ISC_REQ_REPLAY_DETECT |
|
ctxtreq = ISC_REQ_SEQUENCE_DETECT | ISC_REQ_REPLAY_DETECT |
|
||||||
ISC_REQ_CONFIDENTIALITY | ISC_RET_EXTENDED_ERROR |
|
ISC_REQ_CONFIDENTIALITY | ISC_RET_EXTENDED_ERROR |
|
||||||
|
|||||||
Reference in New Issue
Block a user