Code cleanup based on Clang-Tidy.

This commit is contained in:
XMRig 2021-08-25 18:45:15 +07:00
parent 3215403815
commit c7ac314110
No known key found for this signature in database
GPG key ID: 446A53638BE94409
133 changed files with 437 additions and 833 deletions

View file

@ -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);

View file

@ -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

View file

@ -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;

View file

@ -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;