Code cleanup based on Clang-Tidy.
This commit is contained in:
parent
3215403815
commit
c7ac314110
133 changed files with 437 additions and 833 deletions
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 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
|
||||
|
@ -16,7 +16,6 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "base/io/Console.h"
|
||||
#include "base/kernel/interfaces/IConsoleListener.h"
|
||||
#include "base/tools/Handle.h"
|
||||
|
@ -50,7 +49,7 @@ xmrig::Console::~Console()
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::Console::isSupported() const
|
||||
bool xmrig::Console::isSupported()
|
||||
{
|
||||
const uv_handle_type type = uv_guess_handle(0);
|
||||
return type == UV_TTY || type == UV_NAMED_PIPE;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 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:
|
|||
~Console();
|
||||
|
||||
private:
|
||||
bool isSupported() const;
|
||||
static bool isSupported();
|
||||
|
||||
static void onAllocBuffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf);
|
||||
static void onRead(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf);
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "base/io/Env.h"
|
||||
#include "base/kernel/Process.h"
|
||||
#include "version.h"
|
||||
|
@ -61,7 +60,7 @@ static void createVariables()
|
|||
variables.insert({ "XMRIG_DATA_DIR", Process::location(Process::DataLocation) });
|
||||
|
||||
String hostname = "HOSTNAME";
|
||||
if (!getenv(hostname)) {
|
||||
if (!getenv(hostname)) { // NOLINT(concurrency-mt-unsafe)
|
||||
variables.insert({ std::move(hostname), Env::hostname() });
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +136,7 @@ xmrig::String xmrig::Env::get(const String &name, const std::map<String, String>
|
|||
}
|
||||
# endif
|
||||
|
||||
return static_cast<const char *>(getenv(name));
|
||||
return static_cast<const char *>(getenv(name)); // NOLINT(concurrency-mt-unsafe)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 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
|
||||
|
@ -16,7 +16,6 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "base/io/json/Json.h"
|
||||
#include "3rdparty/rapidjson/document.h"
|
||||
|
||||
|
@ -30,7 +29,7 @@ namespace xmrig {
|
|||
|
||||
static const rapidjson::Value kNullValue;
|
||||
|
||||
}
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
bool xmrig::Json::getBool(const rapidjson::Value &obj, const char *key, bool defaultValue)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 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
|
||||
|
@ -16,7 +16,6 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "base/io/json/JsonChain.h"
|
||||
#include "3rdparty/rapidjson/error/en.h"
|
||||
#include "base/io/json/Json.h"
|
||||
|
@ -27,7 +26,7 @@ namespace xmrig {
|
|||
|
||||
static const rapidjson::Value kNullValue;
|
||||
|
||||
}
|
||||
} // namespace xmrig
|
||||
|
||||
|
||||
xmrig::JsonChain::JsonChain() = default;
|
||||
|
@ -58,8 +57,8 @@ bool xmrig::JsonChain::addFile(const char *fileName)
|
|||
if (doc.HasParseError()) {
|
||||
const size_t offset = doc.GetErrorOffset();
|
||||
|
||||
size_t line;
|
||||
size_t pos;
|
||||
size_t line = 0;
|
||||
size_t pos = 0;
|
||||
std::vector<std::string> s;
|
||||
|
||||
if (Json::convertOffset(fileName, offset, line, pos, s)) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 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
|
||||
|
@ -17,7 +17,6 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
# include <winsock2.h>
|
||||
# include <windows.h>
|
||||
|
@ -103,7 +102,7 @@ public:
|
|||
endl(size);
|
||||
|
||||
std::string txt(m_buf);
|
||||
size_t i;
|
||||
size_t i = 0;
|
||||
while ((i = txt.find(CSI)) != std::string::npos) {
|
||||
txt.erase(i, txt.find('m', i) - i + 1);
|
||||
}
|
||||
|
@ -232,7 +231,7 @@ void xmrig::Log::print(const char *fmt, ...)
|
|||
return;
|
||||
}
|
||||
|
||||
va_list args;
|
||||
va_list args = nullptr;
|
||||
va_start(args, fmt);
|
||||
|
||||
d->print(NONE, fmt, args);
|
||||
|
@ -247,7 +246,7 @@ void xmrig::Log::print(Level level, const char *fmt, ...)
|
|||
return;
|
||||
}
|
||||
|
||||
va_list args;
|
||||
va_list args = nullptr;
|
||||
va_start(args, fmt);
|
||||
|
||||
d->print(level, fmt, args);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 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
|
||||
|
@ -17,7 +17,6 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "base/io/log/backends/ConsoleLog.h"
|
||||
#include "base/io/log/Log.h"
|
||||
#include "base/kernel/config/Title.h"
|
||||
|
@ -47,7 +46,7 @@ xmrig::ConsoleLog::ConsoleLog(const Title &title)
|
|||
m_stream = reinterpret_cast<uv_stream_t*>(m_tty);
|
||||
|
||||
HANDLE handle = GetStdHandle(STD_INPUT_HANDLE);
|
||||
if (handle != INVALID_HANDLE_VALUE) {
|
||||
if (handle != INVALID_HANDLE_VALUE) { // NOLINT(cppcoreguidelines-pro-type-cstyle-cast, performance-no-int-to-ptr)
|
||||
DWORD mode = 0;
|
||||
if (GetConsoleMode(handle, &mode)) {
|
||||
mode &= ~ENABLE_QUICK_EDIT_MODE;
|
||||
|
@ -91,7 +90,7 @@ void xmrig::ConsoleLog::print(uint64_t, int, const char *line, size_t, size_t si
|
|||
}
|
||||
|
||||
|
||||
bool xmrig::ConsoleLog::isSupported() const
|
||||
bool xmrig::ConsoleLog::isSupported()
|
||||
{
|
||||
const uv_handle_type type = uv_guess_handle(1);
|
||||
return type == UV_TTY || type == UV_NAMED_PIPE;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* XMRig
|
||||
* Copyright (c) 2019 Spudz76 <https://github.com/Spudz76>
|
||||
* Copyright (c) 2018-2020 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2020 XMRig <https://github.com/xmrig>, <support@xmrig.com>
|
||||
* Copyright (c) 2018-2021 SChernykh <https://github.com/SChernykh>
|
||||
* Copyright (c) 2016-2021 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
|
||||
|
@ -47,7 +47,7 @@ protected:
|
|||
void print(uint64_t timestamp, int level, const char *line, size_t offset, size_t size, bool colors) override;
|
||||
|
||||
private:
|
||||
bool isSupported() const;
|
||||
static bool isSupported();
|
||||
|
||||
uv_tty_t *m_tty = nullptr;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue