Fix Visual Studio warnings.
This commit is contained in:
parent
9975b4e4cd
commit
a07b0e5953
21 changed files with 43 additions and 39 deletions
|
@ -99,7 +99,7 @@ int64_t Client::send(char *data, size_t size)
|
|||
return -1;
|
||||
}
|
||||
|
||||
uv_buf_t buf = uv_buf_init(data, size ? size : strlen(data));
|
||||
uv_buf_t buf = uv_buf_init(data, (unsigned int) (size ? size : strlen(data)));
|
||||
|
||||
uv_write_t *req = new uv_write_t;
|
||||
req->data = buf.base;
|
||||
|
@ -464,7 +464,7 @@ void Client::reconnect()
|
|||
}
|
||||
|
||||
m_failures++;
|
||||
m_listener->onClose(this, m_failures);
|
||||
m_listener->onClose(this, (int) m_failures);
|
||||
|
||||
m_expire = uv_now(uv_default_loop()) + m_retryPause;
|
||||
}
|
||||
|
@ -501,7 +501,7 @@ void Client::onAllocBuffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t
|
|||
auto client = getClient(handle->data);
|
||||
|
||||
buf->base = &client->m_recvBuf.base[client->m_recvBufPos];
|
||||
buf->len = client->m_recvBuf.len - client->m_recvBufPos;
|
||||
buf->len = client->m_recvBuf.len - (ULONG) client->m_recvBufPos;
|
||||
}
|
||||
|
||||
|
||||
|
@ -548,7 +548,7 @@ void Client::onRead(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf)
|
|||
auto client = getClient(stream->data);
|
||||
if (nread < 0) {
|
||||
if (nread != UV_EOF && !client->m_quiet) {
|
||||
LOG_ERR("[%s:%u] read error: \"%s\"", client->m_url.host(), client->m_url.port(), uv_strerror(nread));
|
||||
LOG_ERR("[%s:%u] read error: \"%s\"", client->m_url.host(), client->m_url.port(), uv_strerror((int) nread));
|
||||
}
|
||||
|
||||
return client->close();;
|
||||
|
|
|
@ -82,7 +82,7 @@ bool Job::setBlob(const char *blob)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!fromHex(blob, m_size * 2, m_blob)) {
|
||||
if (!fromHex(blob, (int) m_size * 2, m_blob)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ public:
|
|||
inline const char *id() const { return m_id; }
|
||||
inline const uint8_t *blob() const { return m_blob; }
|
||||
inline int poolId() const { return m_poolId; }
|
||||
inline size_t size() const { return m_size; }
|
||||
inline uint32_t *nonce() { return reinterpret_cast<uint32_t*>(m_blob + 39); }
|
||||
inline uint32_t diff() const { return m_diff; }
|
||||
inline uint32_t size() const { return m_size; }
|
||||
inline uint32_t diff() const { return (uint32_t) m_diff; }
|
||||
inline uint64_t target() const { return m_target; }
|
||||
inline void setNicehash(bool nicehash) { m_nicehash = nicehash; }
|
||||
|
||||
|
@ -67,7 +67,7 @@ private:
|
|||
int m_poolId;
|
||||
VAR_ALIGN(16, char m_id[64]);
|
||||
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.
|
||||
uint32_t m_size;
|
||||
size_t m_size;
|
||||
uint64_t m_diff;
|
||||
uint64_t m_target;
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma warning(disable:4244)
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <memory>
|
||||
|
|
|
@ -121,7 +121,7 @@ bool Url::parse(const char *url)
|
|||
memcpy(m_host, base, size - 1);
|
||||
m_host[size - 1] = '\0';
|
||||
|
||||
m_port = strtol(port, nullptr, 10);
|
||||
m_port = (uint16_t) strtol(port, nullptr, 10);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ void FailoverStrategy::onResultAccepted(Client *client, int64_t seq, uint32_t di
|
|||
|
||||
void FailoverStrategy::add(const Url *url, const char *agent)
|
||||
{
|
||||
Client *client = new Client(m_pools.size(), agent, this);
|
||||
Client *client = new Client((int) m_pools.size(), agent, this);
|
||||
client->setUrl(url);
|
||||
client->setRetryPause(Options::i()->retryPause() * 1000);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue