diff --git a/src/3rdparty/jansson/dump.c b/src/3rdparty/jansson/dump.c index a92fdf7d..0f8996e7 100644 --- a/src/3rdparty/jansson/dump.c +++ b/src/3rdparty/jansson/dump.c @@ -20,13 +20,10 @@ #include #include -#if defined(HAVE_UNISTD_H) && !defined(_MSC_VER) -#include -#endif - -#if defined(_MSC_VER) -#include -typedef SSIZE_T ssize_t; +#if defined(HAVE_UNISTD_H) +# include +#elif defined(_MSC_VER) +# include #endif #include "jansson.h" @@ -72,10 +69,13 @@ static int dump_to_file(const char *buffer, size_t size, void *data) static int dump_to_fd(const char *buffer, size_t size, void *data) { int *dest = (int *)data; -#ifdef HAVE_UNISTD_H +# if defined(HAVE_UNISTD_H) if(write(*dest, buffer, size) == (ssize_t)size) return 0; -#endif +# elif (defined(_MSC_VER)) + if (write(*dest, buffer, (unsigned int) size) == (int) size) + return 0; +# endif return -1; } diff --git a/src/3rdparty/jansson/hashtable_seed.c b/src/3rdparty/jansson/hashtable_seed.c index 5caeec97..8aed5406 100644 --- a/src/3rdparty/jansson/hashtable_seed.c +++ b/src/3rdparty/jansson/hashtable_seed.c @@ -21,7 +21,7 @@ #include #endif -#if defined(HAVE_UNISTD_H) && !defined(_MSC_VER) +#ifdef HAVE_UNISTD_H #include #endif diff --git a/src/3rdparty/jansson/jansson_private_config.h b/src/3rdparty/jansson/jansson_private_config.h index 22800f84..671993d9 100644 --- a/src/3rdparty/jansson/jansson_private_config.h +++ b/src/3rdparty/jansson/jansson_private_config.h @@ -92,7 +92,9 @@ #define HAVE_SYS_TYPES_H 1 /* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 +#ifndef _MSC_VER +# define HAVE_UNISTD_H 1 +#endif /* 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 b124244f..d9399696 100644 --- a/src/3rdparty/jansson/load.c +++ b/src/3rdparty/jansson/load.c @@ -18,12 +18,12 @@ #include #include -#if defined(HAVE_UNISTD_H) && !defined(_MSC_VER) -#include -#endif - -#ifdef _MSC_VER -#define STDIN_FILENO 0 +#if defined(HAVE_UNISTD_H) +# include +#elif defined(_MSC_VER) +# include +# define HAVE_UNISTD_H +# define STDIN_FILENO 0 #endif #include "jansson.h" diff --git a/src/Platform_mac.cpp b/src/Platform_mac.cpp index 3b5daef5..5e53aacb 100644 --- a/src/Platform_mac.cpp +++ b/src/Platform_mac.cpp @@ -30,13 +30,23 @@ #include "Platform.h" #include "version.h" +#ifdef XMRIG_NVIDIA_PROJECT +# include "nvidia/cryptonight.h" +#endif + static inline char *createUserAgent() { - const size_t max = 128; + const size_t max = 160; char *buf = new char[max]; - snprintf(buf, max, "%s/%s (Macintosh; Intel Mac OS X) libuv/%s clang/%d.%d.%d", APP_NAME, APP_VERSION, uv_version_string(), __clang_major__, __clang_minor__, __clang_patchlevel__); + +# ifdef XMRIG_NVIDIA_PROJECT + const int cudaVersion = cuda_get_runtime_version(); + snprintf(buf, max, "%s/%s (Macintosh; Intel Mac OS X) libuv/%s CUDA/%d.%d clang/%d.%d.%d", APP_NAME, APP_VERSION, uv_version_string(), cudaVersion / 1000, cudaVersion % 100, __clang_major__, __clang_minor__, __clang_patchlevel__); +# else + snprintf(buf, max, "%s/%s (Macintosh; Intel Mac OS X) libuv/%s clang/%d.%d.%d", APP_NAME, APP_VERSION, uv_version_string(), __clang_major__, __clang_minor__, __clang_patchlevel__); +# endif return buf; } diff --git a/src/Platform_unix.cpp b/src/Platform_unix.cpp index 6a65193c..27d8de37 100644 --- a/src/Platform_unix.cpp +++ b/src/Platform_unix.cpp @@ -32,10 +32,14 @@ #include "Platform.h" #include "version.h" +#ifdef XMRIG_NVIDIA_PROJECT +# include "nvidia/cryptonight.h" +#endif + static inline char *createUserAgent() { - const size_t max = 128; + const size_t max = 160; char *buf = new char[max]; int length = snprintf(buf, max, "%s/%s (Linux ", APP_NAME, APP_VERSION); @@ -46,6 +50,11 @@ static inline char *createUserAgent() length += snprintf(buf + length, max - length, "i686) libuv/%s", uv_version_string()); # endif +# ifdef XMRIG_NVIDIA_PROJECT + const int cudaVersion = cuda_get_runtime_version(); + length += snprintf(buf + length, max - length, " CUDA/%d.%d", cudaVersion / 1000, cudaVersion % 100); +# endif + # ifdef __GNUC__ length += snprintf(buf + length, max - length, " gcc/%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); # endif diff --git a/src/Platform_win.cpp b/src/Platform_win.cpp index e61dc773..880bdd98 100644 --- a/src/Platform_win.cpp +++ b/src/Platform_win.cpp @@ -30,6 +30,10 @@ #include "Platform.h" #include "version.h" +#ifdef XMRIG_NVIDIA_PROJECT +# include "nvidia/cryptonight.h" +#endif + static inline OSVERSIONINFOEX winOsVersion() { @@ -63,6 +67,11 @@ static inline char *createUserAgent() length += snprintf(buf + length, max - length, ") libuv/%s", uv_version_string()); # endif +# ifdef XMRIG_NVIDIA_PROJECT + const int cudaVersion = cuda_get_runtime_version(); + length += snprintf(buf + length, max - length, " CUDA/%d.%d", cudaVersion / 1000, cudaVersion % 100); +# endif + # ifdef __GNUC__ length += snprintf(buf + length, max - length, " gcc/%d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); # elif _MSC_VER