Fix compile warning with recent gcc

This commit is contained in:
XMRig
2025-06-09 01:22:47 +07:00
parent 7c4d832938
commit 0ce742942c
7 changed files with 27 additions and 40 deletions

View File

@@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2024 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2024 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2025 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2025 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -33,11 +33,9 @@
#include "base/net/tools/NetBuffer.h"
#include "base/tools/Cvt.h"
#include "base/tools/Chrono.h"
#include "base/tools/Handle.h"
#include "net/JobResult.h"
#include "proxy/Counters.h"
#include "proxy/Error.h"
#include "proxy/Events.h"
#include "proxy/events/AcceptEvent.h"
#include "proxy/events/CloseEvent.h"
#include "proxy/events/LoginEvent.h"
@@ -257,10 +255,10 @@ bool xmrig::Miner::parseRequest(int64_t id, const char *method, const rapidjson:
SubmitEvent *event = SubmitEvent::create(this, id, Json::getString(params, "job_id"), Json::getString(params, "nonce"), Json::getString(params, "result"), algorithm, Json::getString(params, "sig"), m_signatureData, m_viewTag, m_extraNonce);
if (!event->request.isValid() || event->request.actualDiff() < diff()) {
event->reject(Error::LowDifficulty);
event->setError(Error::LowDifficulty);
}
else if (hasExtension(EXT_NICEHASH) && !event->request.isCompatible(m_fixedByte)) {
event->reject(Error::InvalidNonce);
event->setError(Error::InvalidNonce);
}
if (event->error() == Error::NoError && m_customDiff && event->request.actualDiff() < m_diff) {

View File

@@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2025 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2025 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,9 +26,6 @@
#define XMRIG_EVENT_H
#include <new>
#include "proxy/interfaces/IEvent.h"

View File

@@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2025 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2025 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ public:
inline bool isRejected() const override { return m_error != Error::NoError; }
inline const char *message() const { return Error::toString(m_error); }
inline Error::Code error() const { return m_error; }
inline void reject(Error::Code error) { m_error = error; }
inline void setError(Error::Code error) { m_error = error; }
protected:

View File

@@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2021 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2021 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2025 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2025 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -62,7 +62,7 @@ xmrig::DonateMapper::~DonateMapper()
void xmrig::DonateMapper::submit(SubmitEvent *event)
{
if (!isActive()) {
return event->reject(Error::BadGateway);
return event->setError(Error::BadGateway);
}
JobResult req = event->request;

View File

@@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2025 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2025 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,9 +22,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cinttypes>
#include <memory>
#include <cstring>
@@ -37,7 +35,6 @@
#include "core/Controller.h"
#include "net/JobResult.h"
#include "net/strategies/DonateStrategy.h"
#include "proxy/Counters.h"
#include "proxy/Error.h"
#include "proxy/events/AcceptEvent.h"
#include "proxy/events/SubmitEvent.h"
@@ -122,15 +119,15 @@ void xmrig::ExtraNonceMapper::start()
void xmrig::ExtraNonceMapper::submit(SubmitEvent *event)
{
if (!m_storage->isActive()) {
return event->reject(Error::BadGateway);
return event->setError(Error::BadGateway);
}
if (!m_storage->isValidJobId(event->request.jobId)) {
return event->reject(Error::InvalidJobId);
return event->setError(Error::InvalidJobId);
}
if (event->request.algorithm.isValid() && event->request.algorithm != m_storage->job().algorithm()) {
return event->reject(Error::IncorrectAlgorithm);
return event->setError(Error::IncorrectAlgorithm);
}
JobResult req = event->request;

View File

@@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2025 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2025 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,9 +22,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cinttypes>
#include <memory>
#include <cstring>
@@ -37,7 +35,6 @@
#include "core/Controller.h"
#include "net/JobResult.h"
#include "net/strategies/DonateStrategy.h"
#include "proxy/Counters.h"
#include "proxy/Error.h"
#include "proxy/events/AcceptEvent.h"
#include "proxy/events/SubmitEvent.h"
@@ -132,15 +129,15 @@ void xmrig::NonceMapper::start()
void xmrig::NonceMapper::submit(SubmitEvent *event)
{
if (!m_storage->isActive()) {
return event->reject(Error::BadGateway);
return event->setError(Error::BadGateway);
}
if (!m_storage->isValidJobId(event->request.jobId)) {
return event->reject(Error::InvalidJobId);
return event->setError(Error::InvalidJobId);
}
if (event->request.algorithm.isValid() && event->request.algorithm != m_storage->job().algorithm()) {
return event->reject(Error::IncorrectAlgorithm);
return event->setError(Error::IncorrectAlgorithm);
}
JobResult req = event->request;

View File

@@ -5,8 +5,8 @@
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <jayddee246@gmail.com>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2020 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
* Copyright 2018-2025 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2025 XMRig <https://github.com/xmrig>, <support@xmrig.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -39,8 +39,6 @@
#include <cinttypes>
#include <memory>
#include <cstring>
xmrig::SimpleMapper::SimpleMapper(uint64_t id, xmrig::Controller *controller) :
@@ -112,15 +110,15 @@ void xmrig::SimpleMapper::stop()
void xmrig::SimpleMapper::submit(SubmitEvent *event)
{
if (!isActive()) {
return event->reject(Error::BadGateway);
return event->setError(Error::BadGateway);
}
if (!isValidJobId(event->request.jobId)) {
return event->reject(Error::InvalidJobId);
return event->setError(Error::InvalidJobId);
}
if (event->request.algorithm.isValid() && event->request.algorithm != m_job.algorithm()) {
return event->reject(Error::IncorrectAlgorithm);
return event->setError(Error::IncorrectAlgorithm);
}
JobResult req = event->request;