Skip to content

Commit ee099a2

Browse files
YuguoZhangYuguo Zhang
authored andcommitted
examples: build using MSVC
1 parent dde1b81 commit ee099a2

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

examples/bot.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
#include <stdio.h>
2121
#include <stdlib.h>
2222
#include <string.h>
23-
#include <unistd.h>
2423

2524
#ifdef _WIN32
2625
#include <conio.h>
2726
#include <ctype.h>
27+
#else
28+
#include <unistd.h>
2829
#endif
2930

3031
#include <strophe.h>

examples/complex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <stdio.h>
1414
#include <stdlib.h>
1515
#include <string.h>
16-
#include <unistd.h>
1716

1817
#ifdef _WIN32
1918
#include <conio.h>
@@ -23,6 +22,7 @@
2322
#include <iphlpapi.h>
2423
#include <mstcpip.h> /* tcp_keepalive */
2524
#else
25+
#include <unistd.h>
2626
#include <sys/socket.h>
2727
#include <netinet/in.h>
2828
#include <netinet/tcp.h>

examples/vcard.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@
1111
*/
1212

1313
#include <assert.h>
14-
#include <libgen.h> /* basename */
1514
#include <string.h>
1615
#include <stdio.h>
1716
#include <stdlib.h>
1817
#include <strophe.h>
18+
#ifndef _WIN32
19+
#include <libgen.h> /* basename */
20+
#else
21+
#define strtok_r strtok_s
22+
#define basename(x) "vcard"
23+
#endif
1924

2025
typedef struct {
2126
xmpp_ctx_t *ctx;

src/compression.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static int
113113
_compression_write(xmpp_conn_t *conn, const void *buff, size_t len, int flush)
114114
{
115115
int ret;
116-
const void *buff_end = (const char*)buff + len;
116+
const void *buff_end = (const char *)buff + len;
117117
struct xmpp_compression *comp = conn->compression.state;
118118
comp->compression.stream.next_in = (Bytef *)buff;
119119
comp->compression.stream.avail_in = len;
@@ -204,7 +204,7 @@ static void *_zlib_alloc(void *opaque, unsigned int items, unsigned int size)
204204
static void _init_zlib_compression(xmpp_ctx_t *ctx, struct zlib_compression *s)
205205
{
206206
s->buffer = strophe_alloc(ctx, STROPHE_COMPRESSION_BUFFER_SIZE);
207-
s->buffer_end = (const char*)s->buffer + STROPHE_COMPRESSION_BUFFER_SIZE;
207+
s->buffer_end = (const char *)s->buffer + STROPHE_COMPRESSION_BUFFER_SIZE;
208208

209209
s->stream.opaque = ctx;
210210
s->stream.zalloc = _zlib_alloc;

0 commit comments

Comments
 (0)