From e3dd4a6581626825be0e04b1426a1138459db46c Mon Sep 17 00:00:00 2001 From: XMRig Date: Thu, 17 Aug 2017 06:43:32 +0300 Subject: [PATCH] Fixed config load for MSVC. --- src/3rdparty/jansson/dump.c | 8 +++++++- src/3rdparty/jansson/hashtable_seed.c | 2 +- src/3rdparty/jansson/jansson_private_config.h | 4 +--- src/3rdparty/jansson/load.c | 7 ++++++- src/Options.cpp | 2 ++ 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/3rdparty/jansson/dump.c b/src/3rdparty/jansson/dump.c index 59b9b2c73..a92fdf7d1 100644 --- a/src/3rdparty/jansson/dump.c +++ b/src/3rdparty/jansson/dump.c @@ -19,10 +19,16 @@ #include #include #include -#ifdef HAVE_UNISTD_H + +#if defined(HAVE_UNISTD_H) && !defined(_MSC_VER) #include #endif +#if defined(_MSC_VER) +#include +typedef SSIZE_T ssize_t; +#endif + #include "jansson.h" #include "strbuffer.h" #include "utf.h" diff --git a/src/3rdparty/jansson/hashtable_seed.c b/src/3rdparty/jansson/hashtable_seed.c index 8aed54068..5caeec972 100644 --- a/src/3rdparty/jansson/hashtable_seed.c +++ b/src/3rdparty/jansson/hashtable_seed.c @@ -21,7 +21,7 @@ #include #endif -#ifdef HAVE_UNISTD_H +#if defined(HAVE_UNISTD_H) && !defined(_MSC_VER) #include #endif diff --git a/src/3rdparty/jansson/jansson_private_config.h b/src/3rdparty/jansson/jansson_private_config.h index 671993d95..22800f84a 100644 --- a/src/3rdparty/jansson/jansson_private_config.h +++ b/src/3rdparty/jansson/jansson_private_config.h @@ -92,9 +92,7 @@ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ -#ifndef _MSC_VER -# define HAVE_UNISTD_H 1 -#endif +#define HAVE_UNISTD_H 1 /* Define to 1 if the system has the type 'unsigned long long int'. */ #define HAVE_UNSIGNED_LONG_LONG_INT 1 diff --git a/src/3rdparty/jansson/load.c b/src/3rdparty/jansson/load.c index 6b3d1e25c..b124244f5 100644 --- a/src/3rdparty/jansson/load.c +++ b/src/3rdparty/jansson/load.c @@ -17,10 +17,15 @@ #include #include #include -#ifdef HAVE_UNISTD_H + +#if defined(HAVE_UNISTD_H) && !defined(_MSC_VER) #include #endif +#ifdef _MSC_VER +#define STDIN_FILENO 0 +#endif + #include "jansson.h" #include "strbuffer.h" #include "utf.h" diff --git a/src/Options.cpp b/src/Options.cpp index 15493e25b..36d570b43 100644 --- a/src/Options.cpp +++ b/src/Options.cpp @@ -506,6 +506,8 @@ void Options::parseConfig(const char *fileName) return; } + uv_fs_req_cleanup(&req); + json_error_t err; json_t *config = json_loadfd(fd, 0, &err);