Minor changes, based on https://github.com/xmrig/xmrig-nvidia/pull/305
This commit is contained in:
parent
921abd4623
commit
d224c0e7d8
2 changed files with 7 additions and 7 deletions
|
@ -179,13 +179,13 @@ void xmrig::Api::genId(const String &id)
|
||||||
if (!interfaces[i].is_internal && interfaces[i].address.address4.sin_family == AF_INET) {
|
if (!interfaces[i].is_internal && interfaces[i].address.address4.sin_family == AF_INET) {
|
||||||
uint8_t hash[200];
|
uint8_t hash[200];
|
||||||
const size_t addrSize = sizeof(interfaces[i].phys_addr);
|
const size_t addrSize = sizeof(interfaces[i].phys_addr);
|
||||||
const size_t inSize = strlen(APP_KIND) + addrSize + sizeof(uint16_t);
|
const size_t inSize = (sizeof(APP_KIND) - 1) + addrSize + sizeof(uint16_t);
|
||||||
const uint16_t port = static_cast<uint16_t>(m_base->config()->http().port());
|
const uint16_t port = static_cast<uint16_t>(m_base->config()->http().port());
|
||||||
|
|
||||||
uint8_t *input = new uint8_t[inSize]();
|
uint8_t *input = new uint8_t[inSize]();
|
||||||
memcpy(input, &port, sizeof(uint16_t));
|
memcpy(input, &port, sizeof(uint16_t));
|
||||||
memcpy(input + sizeof(uint16_t), interfaces[i].phys_addr, addrSize);
|
memcpy(input + sizeof(uint16_t), interfaces[i].phys_addr, addrSize);
|
||||||
memcpy(input + sizeof(uint16_t) + addrSize, APP_KIND, strlen(APP_KIND));
|
memcpy(input + sizeof(uint16_t) + addrSize, APP_KIND, (sizeof(APP_KIND) - 1));
|
||||||
|
|
||||||
keccak(input, inSize, hash);
|
keccak(input, inSize, hash);
|
||||||
Buffer::toHex(hash, 8, m_id);
|
Buffer::toHex(hash, 8, m_id);
|
||||||
|
|
|
@ -60,17 +60,17 @@ void xmrig::Arguments::add(const char *arg)
|
||||||
|
|
||||||
const size_t size = strlen(arg);
|
const size_t size = strlen(arg);
|
||||||
if (size > 4 && arg[0] == '-' && arg[1] == '-') {
|
if (size > 4 && arg[0] == '-' && arg[1] == '-') {
|
||||||
const char *p = strstr(arg, "=");
|
const char *p = strchr(arg, '=');
|
||||||
|
|
||||||
if (p) {
|
if (p) {
|
||||||
const size_t keySize = static_cast<size_t>(p - arg);
|
const auto keySize = static_cast<size_t>(p - arg);
|
||||||
|
|
||||||
m_data.push_back(String(arg, keySize));
|
m_data.emplace_back(arg, keySize);
|
||||||
m_data.push_back(arg + keySize + 1);
|
m_data.emplace_back(arg + keySize + 1);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_data.push_back(arg);
|
m_data.emplace_back(arg);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue