Minimal code changes to allow msvc compilation.

-add msvc ssize_t definition in compat.h
-change NUM_OS_RANDOM_BYTES to int from ssize_t in random.h

Includes squashed commit: f7dc99244c8e78dbd0196f612690efcc449c37dc

Inspired by: fbf327b13868861c2877c5754caf5a9816f2603c
This commit is contained in:
Aaron Clauson 2017-11-10 07:06:49 +11:00 committed by xanimo
parent 90d1972d81
commit 3606c85c7d
No known key found for this signature in database
GPG Key ID: 6E8F17C1B1BCDCBE
2 changed files with 7 additions and 1 deletions

View File

@ -75,6 +75,12 @@ typedef u_int SOCKET;
#define MAX_PATH 1024
#endif
// ssize_t is POSIX, and not present when using MSVC.
#ifdef _MSC_VER
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif
// As Solaris does not have the MSG_NOSIGNAL flag for send(2) syscall, it is defined as 0
#if !defined(HAVE_MSG_NOSIGNAL) && !defined(MSG_NOSIGNAL)
#define MSG_NOSIGNAL 0

View File

@ -121,7 +121,7 @@ public:
* sure that the underlying OS APIs for all platforms support the number.
* (many cap out at 256 bytes).
*/
static const ssize_t NUM_OS_RANDOM_BYTES = 32;
static const int NUM_OS_RANDOM_BYTES = 32;
/** Get 32 bytes of system entropy. Do not use this in application code: use
* GetStrongRandBytes instead.