diff --git a/api.cpp b/api.cpp index 9014f3a..6edfd31 100644 --- a/api.cpp +++ b/api.cpp @@ -257,7 +257,7 @@ static char *getpoolnfo(char *params) static void gpuhwinfos(int gpu_id) { - char buf[256]; + char buf[512]; char pstate[8]; char* card; struct cgpu_info *cgpu = NULL; diff --git a/scrypt.cpp b/scrypt.cpp index a6b9b70..68e81e4 100644 --- a/scrypt.cpp +++ b/scrypt.cpp @@ -50,7 +50,17 @@ using namespace Concurrency; #if _MSC_VER > 1800 #undef _THROW1 +#if __cplusplus < 201101L #define _THROW1(x) throw(std::bad_alloc) +#else +#define _THROW1(x) noexcept(false) +#endif +#elif !defined(_MSC_VER) +#if __cplusplus < 201101L +#define _THROW1(x) throw(std::bad_alloc) +#else +#define _THROW1(x) noexcept(false) +#endif #endif // A thin wrapper around the builtin __m128i type @@ -63,9 +73,9 @@ public: void * operator new[](size_t size) _THROW1(_STD bad_alloc) { void *p; if ((p = _aligned_malloc(size, 16)) == 0) { static const std::bad_alloc nomem; _RAISE(nomem); } return (p); } void operator delete[](void *p) { _aligned_free(p); } #else - void * operator new(size_t size) throw(std::bad_alloc) { void *p; if (posix_memalign(&p, 16, size) < 0) { static const std::bad_alloc nomem; throw nomem; } return (p); } + void * operator new(size_t size) _THROW1(_STD bad_alloc) { void *p; if (posix_memalign(&p, 16, size) < 0) { static const std::bad_alloc nomem; throw nomem; } return (p); } void operator delete(void *p) { free(p); } - void * operator new[](size_t size) throw(std::bad_alloc) { void *p; if (posix_memalign(&p, 16, size) < 0) { static const std::bad_alloc nomem; throw nomem; } return (p); } + void * operator new[](size_t size) _THROW1(_STD bad_alloc) { void *p; if (posix_memalign(&p, 16, size) < 0) { static const std::bad_alloc nomem; throw nomem; } return (p); } void operator delete[](void *p) { free(p); } #endif uint32x4_t() { }; diff --git a/scrypt/test_kernel.cu b/scrypt/test_kernel.cu index e4467d1..ab5b03c 100644 --- a/scrypt/test_kernel.cu +++ b/scrypt/test_kernel.cu @@ -47,7 +47,7 @@ texture texRef2D_4_V; template __device__ __forceinline__ void block_mixer(uint4 &b, uint4 &bx, const int x1, const int x2, const int x3); -static __host__ __device__ uint4& operator^=(uint4& left, const uint4& right) { +static __device__ uint4& operator^=(uint4& left, const uint4& right) { left.x ^= right.x; left.y ^= right.y; left.z ^= right.z; @@ -55,7 +55,7 @@ static __host__ __device__ uint4& operator^=(uint4& left, const uint4& right) { return left; } -static __host__ __device__ uint4& operator+=(uint4& left, const uint4& right) { +static __device__ uint4& operator+=(uint4& left, const uint4& right) { left.x += right.x; left.y += right.y; left.z += right.z; @@ -63,7 +63,6 @@ static __host__ __device__ uint4& operator+=(uint4& left, const uint4& right) { return left; } - /* write_keys writes the 8 keys being processed by a warp to the global * scratchpad. To effectively use memory bandwidth, it performs the writes * (and reads, for read_keys) 128 bytes at a time per memory location diff --git a/scrypt/titan_kernel.cu b/scrypt/titan_kernel.cu index 1758722..57672a2 100644 --- a/scrypt/titan_kernel.cu +++ b/scrypt/titan_kernel.cu @@ -50,7 +50,7 @@ __constant__ uint32_t c_SCRATCH_WU_PER_WARP_1; // (SCRATCH * WU_PER_WARP)-1 template __device__ __forceinline__ void block_mixer(uint4 &b, uint4 &bx, const int x1, const int x2, const int x3); -static __host__ __device__ uint4& operator ^= (uint4& left, const uint4& right) { +static __device__ uint4& operator ^= (uint4& left, const uint4& right) { left.x ^= right.x; left.y ^= right.y; left.z ^= right.z; @@ -58,7 +58,7 @@ static __host__ __device__ uint4& operator ^= (uint4& left, const uint4& right) return left; } -static __host__ __device__ uint4& operator += (uint4& left, const uint4& right) { +static __device__ uint4& operator += (uint4& left, const uint4& right) { left.x += right.x; left.y += right.y; left.z += right.z; diff --git a/sia/sia-rpc.cpp b/sia/sia-rpc.cpp index 5eafe9e..4770426 100644 --- a/sia/sia-rpc.cpp +++ b/sia/sia-rpc.cpp @@ -74,10 +74,10 @@ char* sia_getheader(CURL *curl, struct pool_infos *pool) struct data_buffer all_data = { 0 }; struct curl_slist *headers = NULL; char data[256] = { 0 }; - char url[512]; + char url[512*3]; // nanopool - snprintf(url, 512, "%s/miner/header?address=%s&worker=%s", //&longpoll + snprintf(url, sizeof(url), "%s/miner/header?address=%s&worker=%s", //&longpoll pool->url, pool->user, pool->pass); if (opt_protocol) @@ -148,7 +148,7 @@ bool sia_submit(CURL *curl, struct pool_infos *pool, struct work *work) struct data_buffer all_data = { 0 }; struct curl_slist *headers = NULL; char buf[256] = { 0 }; - char url[512]; + char url[512*3]; if (opt_protocol) applog_hex(work->data, 80); @@ -156,7 +156,7 @@ bool sia_submit(CURL *curl, struct pool_infos *pool, struct work *work) //applog_hex(&work->data[10], 4); // nanopool - snprintf(url, 512, "%s/miner/header?address=%s&worker=%s", + snprintf(url, sizeof(url), "%s/miner/header?address=%s&worker=%s", pool->url, pool->user, pool->pass); if (opt_protocol) diff --git a/util.cpp b/util.cpp index 9c2194d..66617af 100644 --- a/util.cpp +++ b/util.cpp @@ -616,7 +616,7 @@ err_out: json_t *json_rpc_call_pool(CURL *curl, struct pool_infos *pool, const char *req, bool longpoll_scan, bool longpoll, int *curl_err) { - char userpass[512]; + char userpass[768]; // todo, malloc and store that in pool array snprintf(userpass, sizeof(userpass), "%s%c%s", pool->user, strlen(pool->pass)?':':'\0', pool->pass); @@ -627,7 +627,7 @@ json_t *json_rpc_call_pool(CURL *curl, struct pool_infos *pool, const char *req, /* called only from longpoll thread, we have the lp_url */ json_t *json_rpc_longpoll(CURL *curl, char *lp_url, struct pool_infos *pool, const char *req, int *curl_err) { - char userpass[512]; + char userpass[768]; snprintf(userpass, sizeof(userpass), "%s%c%s", pool->user, strlen(pool->pass)?':':'\0', pool->pass);