From 0ce742942c137d6106b7283701b167f4f83565c9 Mon Sep 17 00:00:00 2001 From: XMRig Date: Mon, 9 Jun 2025 01:22:47 +0700 Subject: [PATCH] Fix compile warning with recent gcc --- src/proxy/Miner.cpp | 10 ++++------ src/proxy/events/Event.h | 7 ++----- src/proxy/events/SubmitEvent.h | 6 +++--- src/proxy/splitters/donate/DonateMapper.cpp | 6 +++--- .../splitters/extra_nonce/ExtraNonceMapper.cpp | 13 +++++-------- src/proxy/splitters/nicehash/NonceMapper.cpp | 13 +++++-------- src/proxy/splitters/simple/SimpleMapper.cpp | 12 +++++------- 7 files changed, 27 insertions(+), 40 deletions(-) diff --git a/src/proxy/Miner.cpp b/src/proxy/Miner.cpp index 6b7ecb1..4e1cc35 100644 --- a/src/proxy/Miner.cpp +++ b/src/proxy/Miner.cpp @@ -5,8 +5,8 @@ * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2024 SChernykh - * Copyright 2016-2024 XMRig , + * Copyright 2018-2025 SChernykh + * Copyright 2016-2025 XMRig , * * 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) { diff --git a/src/proxy/events/Event.h b/src/proxy/events/Event.h index 7949dac..e53b6a1 100644 --- a/src/proxy/events/Event.h +++ b/src/proxy/events/Event.h @@ -5,8 +5,8 @@ * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2019 SChernykh - * Copyright 2016-2019 XMRig , + * Copyright 2018-2025 SChernykh + * Copyright 2016-2025 XMRig , * * 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 - - #include "proxy/interfaces/IEvent.h" diff --git a/src/proxy/events/SubmitEvent.h b/src/proxy/events/SubmitEvent.h index cf5fd05..3916494 100644 --- a/src/proxy/events/SubmitEvent.h +++ b/src/proxy/events/SubmitEvent.h @@ -5,8 +5,8 @@ * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright 2018-2025 SChernykh + * Copyright 2016-2025 XMRig , * * 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: diff --git a/src/proxy/splitters/donate/DonateMapper.cpp b/src/proxy/splitters/donate/DonateMapper.cpp index f503747..5610293 100644 --- a/src/proxy/splitters/donate/DonateMapper.cpp +++ b/src/proxy/splitters/donate/DonateMapper.cpp @@ -5,8 +5,8 @@ * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2021 SChernykh - * Copyright 2016-2021 XMRig , + * Copyright 2018-2025 SChernykh + * Copyright 2016-2025 XMRig , * * 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; diff --git a/src/proxy/splitters/extra_nonce/ExtraNonceMapper.cpp b/src/proxy/splitters/extra_nonce/ExtraNonceMapper.cpp index e4b77d1..1a40775 100644 --- a/src/proxy/splitters/extra_nonce/ExtraNonceMapper.cpp +++ b/src/proxy/splitters/extra_nonce/ExtraNonceMapper.cpp @@ -5,8 +5,8 @@ * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright 2018-2025 SChernykh + * Copyright 2016-2025 XMRig , * * 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 . */ - #include -#include #include @@ -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; diff --git a/src/proxy/splitters/nicehash/NonceMapper.cpp b/src/proxy/splitters/nicehash/NonceMapper.cpp index b5458c0..afcfa5a 100644 --- a/src/proxy/splitters/nicehash/NonceMapper.cpp +++ b/src/proxy/splitters/nicehash/NonceMapper.cpp @@ -5,8 +5,8 @@ * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright 2018-2025 SChernykh + * Copyright 2016-2025 XMRig , * * 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 . */ - #include -#include #include @@ -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; diff --git a/src/proxy/splitters/simple/SimpleMapper.cpp b/src/proxy/splitters/simple/SimpleMapper.cpp index ce8bc38..74b46ef 100644 --- a/src/proxy/splitters/simple/SimpleMapper.cpp +++ b/src/proxy/splitters/simple/SimpleMapper.cpp @@ -5,8 +5,8 @@ * Copyright 2014-2016 Wolf9466 * Copyright 2016 Jay D Dee * Copyright 2017-2018 XMR-Stak , - * Copyright 2018-2020 SChernykh - * Copyright 2016-2020 XMRig , + * Copyright 2018-2025 SChernykh + * Copyright 2016-2025 XMRig , * * 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 -#include -#include 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;