Fix warnings

This commit is contained in:
badaix 2022-09-08 11:40:21 +02:00
parent 6b24ec6a3d
commit d4bdbc3844
2 changed files with 10 additions and 10 deletions

View file

@ -1,6 +1,6 @@
---
# Checks: '*,clang-diagnostic-*,clang-analyzer-*'
Checks: '*,-llvmlibc-*,-readability-braces-around-statements,-hicpp-braces-around-statements,-google-readability-braces-around-statements,-hicpp-no-array-decay,-fuchsia-default-arguments-calls,-modernize-use-trailing-return-type,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-bugprone-lambda-function-name,-hicpp-signed-bitwise,-cert-err60-cpp,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-init-variables,-cppcoreguidelines-no-malloc,-hicpp-no-malloc,-google-readability-todo,-modernize-pass-by-value,-cppcoreguidelines-pro-type-member-init,-hicpp-member-init,-hicpp-avoid-c-arrays,-cppcoreguidelines-avoid-c-arrays,-modernize-avoid-c-arrays,-abseil-string-find-startswith,-google-build-using-namespace,-cppcoreguidelines-owning-memory,-readability-else-after-return,-cppcoreguidelines-pro-type-vararg,-hicpp-vararg,-readability-isolate-declaration'
Checks: '*,-llvmlibc-*,-readability-braces-around-statements,-hicpp-braces-around-statements,-google-readability-braces-around-statements,-hicpp-no-array-decay,-fuchsia-default-arguments-calls,-modernize-use-trailing-return-type,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-bugprone-lambda-function-name,-hicpp-signed-bitwise,-cert-err60-cpp,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-init-variables,-cppcoreguidelines-no-malloc,-hicpp-no-malloc,-google-readability-todo,-modernize-pass-by-value,-cppcoreguidelines-pro-type-member-init,-hicpp-member-init,-hicpp-avoid-c-arrays,-cppcoreguidelines-avoid-c-arrays,-modernize-avoid-c-arrays,-abseil-string-find-startswith,-google-build-using-namespace,-cppcoreguidelines-owning-memory,-readability-else-after-return,-cppcoreguidelines-pro-type-vararg,-hicpp-vararg,-readability-isolate-declaration,-cert-env33-c,-abseil-*'
# Checks: '*,clang-diagnostic-*,clang-analyzer-*'
# Checks: '*,-llvmlibc-restrict-system-libc-headers,-readability-braces-around-statements,-hicpp-braces-around-statements,-google-readability-braces-around-statements,-hicpp-no-array-decay,-fuchsia-default-arguments-calls,-modernize-use-trailing-return-type,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-bugprone-lambda-function-name,-hicpp-signed-bitwise,-cert-err60-cpp,-cppcoreguidelines-pro-type-reinterpret-cast,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-init-variables,-cppcoreguidelines-no-malloc,-hicpp-no-malloc,-google-readability-todo,-modernize-pass-by-value,-cppcoreguidelines-pro-type-member-init,-hicpp-member-init,-hicpp-avoid-c-arrays,-cppcoreguidelines-avoid-c-arrays,-modernize-avoid-c-arrays,-abseil-string-find-startswith,-google-build-using-namespace,-cppcoreguidelines-owning-memory,-readability-else-after-return,-cppcoreguidelines-pro-type-vararg,-hicpp-vararg,-readability-isolate-declaration'
WarningsAsErrors: ''

View file

@ -75,14 +75,14 @@ static std::string execGetOutput(const std::string& cmd)
std::shared_ptr<::FILE> pipe(popen((cmd + " 2> /dev/null").c_str(), "r"),
[](::FILE* stream)
{
if (stream)
if (stream != nullptr)
pclose(stream);
});
if (!pipe)
return "";
char buffer[1024];
std::string result = "";
while (!feof(pipe.get()))
std::string result;
while (feof(pipe.get()) == 0)
{
if (fgets(buffer, 1024, pipe.get()) != nullptr)
result += buffer;
@ -106,7 +106,7 @@ static std::string getProp(const std::string& key, const std::string& def = "")
static std::string getOS()
{
static std::string os("");
static std::string os;
if (!os.empty())
return os;
@ -142,17 +142,17 @@ static std::string getOS()
os = "Unknown Windows";
#else
os = execGetOutput("lsb_release -d");
if ((os.find(":") != std::string::npos) && (os.find("lsb_release") == std::string::npos))
os = strutils::trim_copy(os.substr(os.find(":") + 1));
if ((os.find(':') != std::string::npos) && (os.find("lsb_release") == std::string::npos))
os = strutils::trim_copy(os.substr(os.find(':') + 1));
#endif
#ifndef WINDOWS
if (os.empty())
{
os = strutils::trim_copy(execGetOutput("grep /etc/os-release /etc/openwrt_release -e PRETTY_NAME -e DISTRIB_DESCRIPTION"));
if (os.find("=") != std::string::npos)
if (os.find('=') != std::string::npos)
{
os = strutils::trim_copy(os.substr(os.find("=") + 1));
os = strutils::trim_copy(os.substr(os.find('=') + 1));
os.erase(std::remove(os.begin(), os.end(), '"'), os.end());
os.erase(std::remove(os.begin(), os.end(), '\''), os.end());
}
@ -422,7 +422,7 @@ static std::string getMacAddress(const std::string& address)
}
#endif
static std::string getHostId(const std::string defaultId = "")
static std::string getHostId(const std::string& defaultId = "")
{
std::string result = strutils::trim_copy(defaultId);