From 01ebc092d274d5244d2375d049f3baf91750f2a6 Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Sat, 14 Apr 2018 22:09:39 +0200 Subject: fix a few conversion warnings - fix conversion from large type tp small --- xmrstak/backend/cpu/crypto/cryptonight_aesni.h | 2 +- xmrstak/backend/cpu/hwlocMemory.cpp | 2 +- xmrstak/backend/cpu/minethd.cpp | 10 +++++----- xmrstak/backend/cpu/minethd.hpp | 2 +- xmrstak/misc/console.cpp | 4 ++-- xmrstak/misc/console.hpp | 2 +- xmrstak/misc/executor.hpp | 2 +- xmrstak/misc/telemetry.cpp | 4 ++-- xmrstak/net/socket.cpp | 3 ++- 9 files changed, 16 insertions(+), 15 deletions(-) diff --git a/xmrstak/backend/cpu/crypto/cryptonight_aesni.h b/xmrstak/backend/cpu/crypto/cryptonight_aesni.h index c7d28e9..7562de1 100644 --- a/xmrstak/backend/cpu/crypto/cryptonight_aesni.h +++ b/xmrstak/backend/cpu/crypto/cryptonight_aesni.h @@ -429,7 +429,7 @@ inline void cryptonight_monero_tweak(uint64_t* mem_out, __m128i tmp) tmp = _mm_castps_si128(_mm_movehl_ps(_mm_castsi128_ps(tmp), _mm_castsi128_ps(tmp))); uint64_t vh = _mm_cvtsi128_si64(tmp); - uint8_t x = vh >> 24; + uint8_t x = static_cast(vh >> 24); static const uint16_t table = 0x7531; const uint8_t index = (((x >> 3) & 6) | (x & 1)) << 1; vh ^= ((table >> index) & 0x3) << 28; diff --git a/xmrstak/backend/cpu/hwlocMemory.cpp b/xmrstak/backend/cpu/hwlocMemory.cpp index 94d2b53..089570f 100644 --- a/xmrstak/backend/cpu/hwlocMemory.cpp +++ b/xmrstak/backend/cpu/hwlocMemory.cpp @@ -30,7 +30,7 @@ void bindMemoryToNUMANode( size_t puId ) depth = hwloc_get_type_depth(topology, HWLOC_OBJ_PU); - for( size_t i = 0; + for( uint32_t i = 0; i < hwloc_get_nbobjs_by_depth(topology, depth); i++ ) { diff --git a/xmrstak/backend/cpu/minethd.cpp b/xmrstak/backend/cpu/minethd.cpp index ec3e145..263c83a 100644 --- a/xmrstak/backend/cpu/minethd.cpp +++ b/xmrstak/backend/cpu/minethd.cpp @@ -627,22 +627,22 @@ minethd::cn_hash_fun_multi minethd::func_multi_selector(size_t N, bool bHaveAes, void minethd::double_work_main() { - multiway_work_main<2>(); + multiway_work_main<2u>(); } void minethd::triple_work_main() { - multiway_work_main<3>(); + multiway_work_main<3u>(); } void minethd::quad_work_main() { - multiway_work_main<4>(); + multiway_work_main<4u>(); } void minethd::penta_work_main() { - multiway_work_main<5>(); + multiway_work_main<5u>(); } template @@ -656,7 +656,7 @@ void minethd::prep_multiway_work(uint8_t *bWorkBlob, uint32_t **piNonce) } } -template +template void minethd::multiway_work_main() { if(affinity >= 0) //-1 means no affinity diff --git a/xmrstak/backend/cpu/minethd.hpp b/xmrstak/backend/cpu/minethd.hpp index 59583b6..85a95d1 100644 --- a/xmrstak/backend/cpu/minethd.hpp +++ b/xmrstak/backend/cpu/minethd.hpp @@ -35,7 +35,7 @@ private: minethd(miner_work& pWork, size_t iNo, int iMultiway, bool no_prefetch, int64_t affinity); - template + template void multiway_work_main(); template diff --git a/xmrstak/misc/console.cpp b/xmrstak/misc/console.cpp index de5eed3..d961b71 100644 --- a/xmrstak/misc/console.cpp +++ b/xmrstak/misc/console.cpp @@ -225,7 +225,7 @@ void printer::print_str(const char* str) //Do a press any key for the windows folk. *insert any key joke here* #ifdef _WIN32 -void win_exit(size_t code) +void win_exit(int code) { size_t envSize = 0; getenv_s(&envSize, nullptr, 0, "XMRSTAK_NOWAIT"); @@ -238,7 +238,7 @@ void win_exit(size_t code) } #else -void win_exit(size_t code) +void win_exit(int code) { std::exit(code); } diff --git a/xmrstak/misc/console.hpp b/xmrstak/misc/console.hpp index cfbeddd..6717631 100644 --- a/xmrstak/misc/console.hpp +++ b/xmrstak/misc/console.hpp @@ -49,4 +49,4 @@ private: FILE* logfile; }; -void win_exit(size_t code = 1); +void win_exit(int code = 1); diff --git a/xmrstak/misc/executor.hpp b/xmrstak/misc/executor.hpp index 9e145c3..be5ee6c 100644 --- a/xmrstak/misc/executor.hpp +++ b/xmrstak/misc/executor.hpp @@ -64,7 +64,7 @@ private: inline bool is_dev_time() { //Add 2 seconds to compensate for connect - constexpr size_t dev_portion = double(iDevDonatePeriod) * fDevDonationLevel + 2; + constexpr size_t dev_portion = static_cast(double(iDevDonatePeriod) * fDevDonationLevel + 2.); if(dev_portion < 12) //No point in bothering with less than 10s return false; diff --git a/xmrstak/misc/telemetry.cpp b/xmrstak/misc/telemetry.cpp index 28fb522..a3a2a12 100644 --- a/xmrstak/misc/telemetry.cpp +++ b/xmrstak/misc/telemetry.cpp @@ -89,8 +89,8 @@ double telemetry::calc_telemetry_data(size_t iLastMilisec, size_t iThread) return nan(""); double fHashes, fTime; - fHashes = iLastestHashCnt - iEarliestHashCnt; - fTime = iLastestStamp - iEarliestStamp; + fHashes = static_cast(iLastestHashCnt - iEarliestHashCnt); + fTime = static_cast(iLastestStamp - iEarliestStamp); fTime /= 1000.0; return fHashes / fTime; diff --git a/xmrstak/net/socket.cpp b/xmrstak/net/socket.cpp index 7c58a8e..9bc608f 100644 --- a/xmrstak/net/socket.cpp +++ b/xmrstak/net/socket.cpp @@ -156,7 +156,8 @@ int plain_socket::recv(char* buf, unsigned int len) bool plain_socket::send(const char* buf) { - int pos = 0, slen = strlen(buf); + size_t pos = 0; + size_t slen = strlen(buf); while (pos != slen) { int ret = ::send(hSocket, buf + pos, slen - pos, 0); -- cgit v1.1