From 540b223eabdb2d869073e5ef95ca17dc1ccdee3d Mon Sep 17 00:00:00 2001 From: XMRig Date: Thu, 9 Feb 2023 13:55:11 +0700 Subject: [PATCH] Cleanup. --- cmake/flags.cmake | 24 ++++++------------------ src/base/net/dns/DnsRecord.cpp | 8 ++++---- src/base/net/tls/TlsContext.h | 12 +++++------- src/base/tools/Object.h | 13 ++++++++----- 4 files changed, 23 insertions(+), 34 deletions(-) diff --git a/cmake/flags.cmake b/cmake/flags.cmake index 10386b174..f55ddcdc2 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -10,7 +10,7 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL "") endif() if (CMAKE_BUILD_TYPE STREQUAL "Release") - add_definitions(/DNDEBUG) + add_definitions(-DNDEBUG) endif() include(CheckSymbolExists) @@ -32,7 +32,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes") - add_definitions(/DHAVE_ROTR) + add_definitions(-DHAVE_ROTR) endif() if (WIN32) @@ -49,16 +49,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static") endif() - add_definitions(/D_GNU_SOURCE) - - if (${CMAKE_VERSION} VERSION_LESS "3.1.0") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - endif() - - #set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -gdwarf-2") - - add_definitions(/DHAVE_BUILTIN_CLEAR_CACHE) + add_definitions(-D_GNU_SOURCE -DHAVE_BUILTIN_CLEAR_CACHE) elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC) set(CMAKE_C_FLAGS_RELEASE "/MP /MT /O2 /Oi /DNDEBUG /GL") @@ -67,10 +58,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC) set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MP /Ob1 /Zi /DRELWITHDEBINFO") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MP /Ob1 /Zi /DRELWITHDEBINFO") - add_definitions(/D_CRT_SECURE_NO_WARNINGS) - add_definitions(/D_CRT_NONSTDC_NO_WARNINGS) - add_definitions(/DNOMINMAX) - add_definitions(/DHAVE_ROTR) + add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -DNOMINMAX -DHAVE_ROTR) elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) @@ -92,7 +80,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) check_symbol_exists("_rotr" "x86intrin.h" HAVE_ROTR) if (HAVE_ROTR) - add_definitions(/DHAVE_ROTR) + add_definitions(-DHAVE_ROTR) endif() endif() @@ -105,6 +93,6 @@ endif() if (NOT WIN32) check_symbol_exists("__builtin___clear_cache" "stdlib.h" HAVE_BUILTIN_CLEAR_CACHE) if (HAVE_BUILTIN_CLEAR_CACHE) - add_definitions(/DHAVE_BUILTIN_CLEAR_CACHE) + add_definitions(-DHAVE_BUILTIN_CLEAR_CACHE) endif() endif() diff --git a/src/base/net/dns/DnsRecord.cpp b/src/base/net/dns/DnsRecord.cpp index bfa84613a..3bf8f0975 100644 --- a/src/base/net/dns/DnsRecord.cpp +++ b/src/base/net/dns/DnsRecord.cpp @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2021 SChernykh - * Copyright (c) 2016-2021 XMRig , + * Copyright (c) 2018-2023 SChernykh + * Copyright (c) 2016-2023 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 @@ -46,11 +46,11 @@ xmrig::String xmrig::DnsRecord::ip() const if (m_type == AAAA) { buf = new char[45](); - uv_ip6_name(reinterpret_cast(m_data), buf, 45); + uv_ip6_name(reinterpret_cast(m_data), buf, 45); } else { buf = new char[16](); - uv_ip4_name(reinterpret_cast(m_data), buf, 16); + uv_ip4_name(reinterpret_cast(m_data), buf, 16); } return buf; diff --git a/src/base/net/tls/TlsContext.h b/src/base/net/tls/TlsContext.h index 9a9b3cb1c..0bb7eec3f 100644 --- a/src/base/net/tls/TlsContext.h +++ b/src/base/net/tls/TlsContext.h @@ -1,7 +1,7 @@ /* XMRig * Copyright (c) 2018 Lee Clagett - * Copyright (c) 2018-2021 SChernykh - * Copyright (c) 2016-2021 XMRig , + * Copyright (c) 2018-2023 SChernykh + * Copyright (c) 2016-2023 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 @@ -24,9 +24,6 @@ #include "base/tools/Object.h" -#include - - using SSL_CTX = struct ssl_ctx_st; @@ -60,6 +57,7 @@ private: }; -} /* namespace xmrig */ +} // namespace xmrig -#endif /* XMRIG_TLSCONTEXT_H */ + +#endif // XMRIG_TLSCONTEXT_H diff --git a/src/base/tools/Object.h b/src/base/tools/Object.h index 00bd9315a..f67464ab6 100644 --- a/src/base/tools/Object.h +++ b/src/base/tools/Object.h @@ -1,6 +1,6 @@ /* XMRig - * Copyright (c) 2018-2021 SChernykh - * Copyright (c) 2016-2021 XMRig , + * Copyright (c) 2018-2023 SChernykh + * Copyright (c) 2016-2023 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 @@ -20,7 +20,9 @@ #define XMRIG_OBJECT_H -#include +#include +#include +#include namespace xmrig { @@ -41,6 +43,7 @@ namespace xmrig { X &operator=(X &&other) = delete; -} /* namespace xmrig */ +} // namespace xmrig -#endif /* XMRIG_OBJECT_H */ + +#endif // XMRIG_OBJECT_H