From f9a3315d7570c5121efadc3c1fbcf54e329bec49 Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 14 Mar 2018 16:58:39 +0700 Subject: [PATCH] Fixes for 32 bit gcc builds. --- src/net/Id.h | 4 ++-- src/net/Job.cpp | 20 ++++++-------------- src/net/Job.h | 14 +------------- 3 files changed, 9 insertions(+), 29 deletions(-) diff --git a/src/net/Id.h b/src/net/Id.h index 5c77d1d4..5fb2db52 100644 --- a/src/net/Id.h +++ b/src/net/Id.h @@ -34,9 +34,9 @@ namespace xmrig { class Id { public: - inline Id() + inline Id() : + m_data() { - memset(m_data, 0, sizeof(m_data)); } diff --git a/src/net/Job.cpp b/src/net/Job.cpp index 8b1966aa..48e73a52 100644 --- a/src/net/Job.cpp +++ b/src/net/Job.cpp @@ -58,29 +58,31 @@ static inline char hf_bin2hex(unsigned char c) Job::Job() : m_nicehash(false), + m_coin(), m_algo(xmrig::ALGO_CRYPTONIGHT), m_poolId(-2), m_threadId(-1), m_variant(xmrig::VARIANT_AUTO), m_size(0), m_diff(0), - m_target(0) + m_target(0), + m_blob() { - memset(m_coin, 0, sizeof(m_coin)); } Job::Job(int poolId, bool nicehash, int algo, int variant) : m_nicehash(nicehash), + m_coin(), m_algo(algo), m_poolId(poolId), m_threadId(-1), m_variant(variant), m_size(0), m_diff(0), - m_target(0) + m_target(0), + m_blob() { - memset(m_coin, 0, sizeof(m_coin)); } @@ -113,11 +115,6 @@ bool Job::setBlob(const char *blob) m_nicehash = true; } -# ifdef XMRIG_PROXY_PROJECT - memset(m_rawBlob, 0, sizeof(m_rawBlob)); - memcpy(m_rawBlob, blob, m_size * 2); -# endif - return true; } @@ -154,11 +151,6 @@ bool Job::setTarget(const char *target) return false; } -# ifdef XMRIG_PROXY_PROJECT - memset(m_rawTarget, 0, sizeof(m_rawTarget)); - memcpy(m_rawTarget, target, len); -# endif - m_diff = toDiff(m_target); return true; } diff --git a/src/net/Job.h b/src/net/Job.h index 545eaa88..d981ed37 100644 --- a/src/net/Job.h +++ b/src/net/Job.h @@ -30,7 +30,6 @@ #include -#include "align.h" #include "net/Id.h" #include "xmrig.h" @@ -64,11 +63,6 @@ public: inline void setNicehash(bool nicehash) { m_nicehash = nicehash; } inline void setThreadId(int threadId) { m_threadId = threadId; } -# ifdef XMRIG_PROXY_PROJECT - inline char *rawBlob() { return m_rawBlob; } - inline const char *rawTarget() const { return m_rawTarget; } -# endif - static bool fromHex(const char* in, unsigned int len, unsigned char* out); static inline uint32_t *nonce(uint8_t *blob) { return reinterpret_cast(blob + 39); } static inline uint64_t toDiff(uint64_t target) { return 0xFFFFFFFFFFFFFFFFULL / target; } @@ -77,8 +71,6 @@ public: bool operator==(const Job &other) const; private: - VAR_ALIGN(16, uint8_t m_blob[84]); // Max blob size is 84 (75 fixed + 9 variable), aligned to 96. https://github.com/xmrig/xmrig/issues/1 Thanks fireice-uk. - bool m_nicehash; char m_coin[5]; int m_algo; @@ -88,12 +80,8 @@ private: size_t m_size; uint64_t m_diff; uint64_t m_target; + uint8_t m_blob[96]; // Max blob size is 84 (75 fixed + 9 variable), aligned to 96. https://github.com/xmrig/xmrig/issues/1 Thanks fireice-uk. xmrig::Id m_id; - -# ifdef XMRIG_PROXY_PROJECT - VAR_ALIGN(16, char m_rawBlob[169]); - VAR_ALIGN(16, char m_rawTarget[17]); -# endif }; #endif /* __JOB_H__ */