From a6b52ed151e5bced8dea7d4a67bbfaa92a03d144 Mon Sep 17 00:00:00 2001 From: silverqx Date: Sat, 16 Jul 2022 19:39:14 +0200 Subject: [PATCH] fixed vstudio analyzer warnings --- src/orm/schema/grammars/postgresschemagrammar.cpp | 4 ++-- src/orm/tiny/utils/string.cpp | 2 +- tom/include/tom/concerns/callscommands.hpp | 2 +- tom/include/tom/concerns/interactswithio.hpp | 7 +++++++ tom/src/tom/commands/completecommand.cpp | 5 ++--- tom/src/tom/commands/integratecommand.cpp | 8 ++++---- tom/src/tom/terminal.cpp | 2 +- 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/orm/schema/grammars/postgresschemagrammar.cpp b/src/orm/schema/grammars/postgresschemagrammar.cpp index 0751785f2..00f1d87fb 100644 --- a/src/orm/schema/grammars/postgresschemagrammar.cpp +++ b/src/orm/schema/grammars/postgresschemagrammar.cpp @@ -47,7 +47,7 @@ PostgresSchemaGrammar::compileGetAllTables(const QVector &databases) co { return QStringLiteral("select tablename from pg_catalog.pg_tables " "where schemaname in (%1)") - .arg(quoteString(std::move(databases))); + .arg(quoteString(databases)); } QString @@ -55,7 +55,7 @@ PostgresSchemaGrammar::compileGetAllViews(const QVector &databases) con { return QStringLiteral("select viewname from pg_catalog.pg_views " "where schemaname in (%1)") - .arg(quoteString(std::move(databases))); + .arg(quoteString(databases)); } QString PostgresSchemaGrammar::compileEnableForeignKeyConstraints() const diff --git a/src/orm/tiny/utils/string.cpp b/src/orm/tiny/utils/string.cpp index 68445623c..e3e625404 100644 --- a/src/orm/tiny/utils/string.cpp +++ b/src/orm/tiny/utils/string.cpp @@ -46,7 +46,7 @@ QString String::snake(QString string, const QChar delimiter) std::vector positions; positions.reserve(static_cast(string.size() / 2) + 2); - for (auto i = 0; i < string.size(); ++i) { + for (QString::size_type i = 0; i < string.size(); ++i) { const auto ch = string.at(i); if (i > 0 && ch >= QChar('A') && ch <= QChar('Z')) { diff --git a/tom/include/tom/concerns/callscommands.hpp b/tom/include/tom/concerns/callscommands.hpp index 1acfd67b5..ecfd967ec 100644 --- a/tom/include/tom/concerns/callscommands.hpp +++ b/tom/include/tom/concerns/callscommands.hpp @@ -56,7 +56,7 @@ namespace Concerns int CallsCommands::call(const QString &command, QStringList &&arguments) const { - return runCommand(std::move(command), std::move(arguments)); + return runCommand(command, std::move(arguments)); } } // namespace Concerns diff --git a/tom/include/tom/concerns/interactswithio.hpp b/tom/include/tom/concerns/interactswithio.hpp index a40ae8342..b7a977200 100644 --- a/tom/include/tom/concerns/interactswithio.hpp +++ b/tom/include/tom/concerns/interactswithio.hpp @@ -205,6 +205,10 @@ namespace Concerns return m_verbosity; } +#if defined(_MSC_VER) && !defined(__clang__) +#pragma warning(push) +#pragma warning(disable : C26813) +#endif bool InteractsWithIO::isQuietVerbosity() const noexcept { return m_verbosity == Quiet; @@ -229,6 +233,9 @@ namespace Concerns { return m_verbosity == Debug; } +#if defined(_MSC_VER) && !defined(__clang__) +#pragma warning(pop) +#endif } // namespace Concerns } // namespace Tom diff --git a/tom/src/tom/commands/completecommand.cpp b/tom/src/tom/commands/completecommand.cpp index fe1ca6f78..44a8c0ac9 100644 --- a/tom/src/tom/commands/completecommand.cpp +++ b/tom/src/tom/commands/completecommand.cpp @@ -367,9 +367,8 @@ int CompleteCommand::printEnvironmentNames(const QString &environmentName) const if (environment.startsWith(environmentName)) environmentNames << QStringLiteral("%1;%2").arg( - NOSPACE.arg(LongOption.arg(Env).append(EQ_C), - environment), - std::move(environment)); + NOSPACE.arg(LongOption.arg(Env).append(EQ_C), environment), + environment); // Print note(environmentNames.join(NEWLINE)); diff --git a/tom/src/tom/commands/integratecommand.cpp b/tom/src/tom/commands/integratecommand.cpp index 19d496a07..6be76bf62 100644 --- a/tom/src/tom/commands/integratecommand.cpp +++ b/tom/src/tom/commands/integratecommand.cpp @@ -116,8 +116,8 @@ namespace if (!pwshProfileFile.open(openMode)) throw Exceptions::RuntimeError( QStringLiteral("Can not open '%1' file in openPwshProfileFile().") - .arg(QStringLiteral("%1/%2").arg(std::move(pwshProfileFolder), - std::move(profileFileRelative)))); + .arg(QStringLiteral("%1/%2").arg(pwshProfileFolder, + profileFileRelative))); } /*! Detect whether PowerShell profile folder already exists and create it @@ -137,8 +137,8 @@ namespace throw Exceptions::RuntimeError( QStringLiteral("Can not create '%1' directory " "in preparePowerShellFolder().") - .arg(QStringLiteral("%1/%2").arg(std::move(documentsFolder), - std::move(powershellFolder)))); + .arg(QStringLiteral("%1/%2").arg(documentsFolder, + powershellFolder))); } /*! Template string for tab-completion installed successfully. */ diff --git a/tom/src/tom/terminal.cpp b/tom/src/tom/terminal.cpp index f8d5a0138..562951d9c 100644 --- a/tom/src/tom/terminal.cpp +++ b/tom/src/tom/terminal.cpp @@ -232,7 +232,7 @@ void Terminal::enableUtf8ConsoleEncoding() unicode to utf8, eg. by QString::fromStdWString(), WideCharToMultiByte(), or std::codecvt(). It also works with msys2 ucrt64 gcc/clang. */ SetConsoleCP(CP_UTF8); - _setmode(_fileno(stdin), _O_WTEXT); + std::ignore = _setmode(_fileno(stdin), _O_WTEXT); // std::ignore to suppress C6031 } #endif