Fixed GCC warnings

This commit is contained in:
SChernykh 2021-06-19 14:54:03 +02:00
parent e3fc78a66c
commit 3f3f9b0661
3 changed files with 11 additions and 9 deletions

View file

@ -445,9 +445,9 @@ bool xmrig::Client::parseJob(const rapidjson::Value &params, int *code)
if (Cvt::fromHex(signatureKeyBuf, sizeof(signatureKeyBuf), Json::getValue(params, "sig_key"))) { if (Cvt::fromHex(signatureKeyBuf, sizeof(signatureKeyBuf), Json::getValue(params, "sig_key"))) {
job.setEphemeralKeys(signatureKeyBuf, signatureKeyBuf + 32); job.setEphemeralKeys(signatureKeyBuf, signatureKeyBuf + 32);
uint8_t major_version; uint8_t major_version = 0;
uint8_t minor_version; uint8_t minor_version = 0;
uint64_t timestamp; uint64_t timestamp = 0;
CBlobReader ar(job.blob(), job.size()); CBlobReader ar(job.blob(), job.size());
ar(major_version); ar(major_version);

View file

@ -39,8 +39,8 @@ bool WalletAddress::Decode(const String& address)
int8_t reverse_alphabet[256]; int8_t reverse_alphabet[256];
memset(reverse_alphabet, -1, sizeof(reverse_alphabet)); memset(reverse_alphabet, -1, sizeof(reverse_alphabet));
for (int i = 0; i < alphabet_size; ++i) { for (size_t i = 0; i < alphabet_size; ++i) {
reverse_alphabet[alphabet[i]] = i; reverse_alphabet[static_cast<int>(alphabet[i])] = i;
} }
const int len = static_cast<int>(address.size()); const int len = static_cast<int>(address.size());
@ -49,7 +49,7 @@ bool WalletAddress::Decode(const String& address)
int last_block_size_index = -1; int last_block_size_index = -1;
for (int i = 0; i < block_sizes.size(); ++i) { for (size_t i = 0; i < block_sizes.size(); ++i) {
if (block_sizes[i] == last_block_size) { if (block_sizes[i] == last_block_size) {
last_block_size_index = i; last_block_size_index = i;
break; break;
@ -70,7 +70,7 @@ bool WalletAddress::Decode(const String& address)
uint64_t order = 1; uint64_t order = 1;
for (int j = ((i < num_full_blocks) ? block_sizes.back() : last_block_size) - 1; j >= 0; --j) { for (int j = ((i < num_full_blocks) ? block_sizes.back() : last_block_size) - 1; j >= 0; --j) {
const int digit = reverse_alphabet[address_data[j]]; const int digit = reverse_alphabet[static_cast<int>(address_data[j])];
if (digit < 0) { if (digit < 0) {
return false; return false;
} }

View file

@ -46,14 +46,16 @@ struct RawSMBIOSData {
bool xmrig::DmiReader::read() bool xmrig::DmiReader::read()
{ {
const uint32_t size = GetSystemFirmwareTable('RSMB', 0, nullptr, 0); constexpr uint32_t RSMB = 0x52534D42;
const uint32_t size = GetSystemFirmwareTable(RSMB, 0, nullptr, 0);
auto smb = reinterpret_cast<RawSMBIOSData *>(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size)); auto smb = reinterpret_cast<RawSMBIOSData *>(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size));
if (!smb) { if (!smb) {
return false; return false;
} }
if (GetSystemFirmwareTable('RSMB', 0, smb, size) != size) { if (GetSystemFirmwareTable(RSMB, 0, smb, size) != size) {
HeapFree(GetProcessHeap(), 0, smb); HeapFree(GetProcessHeap(), 0, smb);
return false; return false;