`strings.h` and `resolv.h` are not available on MSVC, and some POSIX functions are renamed or deprecated

For all of those missing/deprecated POSIX functions, we just add a macro mapping to the _underscored version of MSVC.
pull/1/head
Daniel Cohen Gindi 8 years ago
parent fdf5f8876f
commit fbf48c65f3
  1. 7
      libvncclient/rfbproto.c
  2. 4
      libvncclient/vncviewer.c
  3. 7
      libvncserver/rfbserver.c
  4. 4
      libvncserver/sockets.c
  5. 4
      libvncserver/stats.c
  6. 5
      libvncserver/websockets.c

@ -53,7 +53,12 @@
#endif
#include <jpeglib.h>
#endif
#ifndef _MSC_VER
/* Strings.h is not available in MSVC */
#include <strings.h>
#endif
#include <stdarg.h>
#include <time.h>
@ -65,7 +70,7 @@
#include "tls.h"
#ifdef _MSC_VER
# define snprintf _snprintf
# define snprintf _snprintf /* MSVC went straight to the underscored syntax */
#endif
/*

@ -26,6 +26,10 @@
#include <winsock2.h>
#endif
#ifdef _MSC_VER
#define strdup _strdup /* Prevent POSIX deprecation warnings */
#endif
#ifdef __STRICT_ANSI__
#define _BSD_SOURCE
#define _POSIX_SOURCE

@ -83,6 +83,13 @@
#include "rfbssl.h"
#endif
#ifdef _MSC_VER
#define snprintf _snprintf /* Missing in MSVC */
/* Prevent POSIX deprecation warnings */
#define close _close
#define strdup _strdup
#endif
#ifdef __MINGW32__
static int compat_mkdir(const char *path, int mode)
{

@ -109,6 +109,10 @@ int deny_severity=LOG_WARNING;
#define closesocket close
#endif
#ifdef _MSC_VER
#define snprintf _snprintf /* Missing in MSVC */
#endif
int rfbMaxClientWait = 20000; /* time (ms) after which we decide client has
gone away - needed to stop us hanging */

@ -26,6 +26,10 @@
#include <rfb/rfb.h>
#ifdef _MSC_VER
#define snprintf _snprintf /* Missing in MSVC */
#endif
char *messageNameServer2Client(uint32_t type, char *buf, int len);
char *messageNameClient2Server(uint32_t type, char *buf, int len);
char *encodingName(uint32_t enc, char *buf, int len);

@ -31,10 +31,13 @@
#endif
#include <rfb/rfb.h>
#include <resolv.h> /* __b64_ntop */
/* errno */
#include <errno.h>
#ifndef _MSC_VER
#include <resolv.h> /* __b64_ntop */
#endif
#ifdef LIBVNCSERVER_HAVE_ENDIAN_H
#include <endian.h>
#elif LIBVNCSERVER_HAVE_SYS_ENDIAN_H

Loading…
Cancel
Save