Skip to content

Commit 6cbf7d3

Browse files
committed
win32 compat
1 parent 4333ef6 commit 6cbf7d3

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

library/zitilib/zitilib.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -336,22 +336,7 @@ int Ziti_load_context_with_timeout(ziti_handle_t *h, const char *identity, int t
336336
return err;
337337
}
338338

339-
#if _WIN32
340-
static const char * fmt_win32err(int err) {
341-
static char wszMsgBuff[512]; // Buffer for text.
342-
343-
// Try to get the message from the system errors.
344-
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM |
345-
FORMAT_MESSAGE_IGNORE_INSERTS,
346-
NULL,
347-
WSAGetLastError(),
348-
0,
349-
wszMsgBuff,
350-
512,
351-
NULL );
352-
return wszMsgBuff;
353-
}
354-
#endif
339+
355340

356341
#ifdef __MINGW32__
357342
static const IN_ADDR in4addr_loopback;

library/zitilib/zl_sockets.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@
2121
#include <ziti/ziti_log.h>
2222
#include "utils.h"
2323

24+
#if _WIN32
25+
static const char * fmt_win32err(int err) {
26+
static char wszMsgBuff[512]; // Buffer for text.
27+
28+
// Try to get the message from the system errors.
29+
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
30+
NULL,
31+
WSAGetLastError(),
32+
0,
33+
wszMsgBuff,
34+
512,
35+
NULL);
36+
return wszMsgBuff;
37+
}
38+
#endif
39+
2440
bool zl_is_blocking(ziti_socket_t s) {
2541
#if _WIN32
2642
/*

0 commit comments

Comments
 (0)