commit 207630becc0739a818b4693d0c7924c915c6237a parent 070be16c5bc18461bae53c55a2b774ea4158f2fb Author: yao-msft <50888816+yao-msft@users.noreply.github.com> Date: Sat, 25 Jan 2020 11:06:29 -0800 Fix debug build warnings (#23) Diffstat:
8 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/src/AppInstallerCLICore/Command.cpp b/src/AppInstallerCLICore/Command.cpp @@ -189,6 +189,8 @@ namespace AppInstaller::CLI void Command::ExecuteInternal(Invocation&, std::ostream& out, std::istream& in) const { + UNREFERENCED_PARAMETER(in); + out << LOCME("Oops, we forgot to do this...") << std::endl; THROW_HR(E_NOTIMPL); } diff --git a/src/AppInstallerCLICore/Commands/RootCommand.cpp b/src/AppInstallerCLICore/Commands/RootCommand.cpp @@ -27,6 +27,8 @@ namespace AppInstaller::CLI void RootCommand::ExecuteInternal(Invocation&, std::ostream& out, std::istream& in) const { + UNREFERENCED_PARAMETER(in); + OutputHelp(out); } } diff --git a/src/AppInstallerCLICore/Workflows/InstallFlow.cpp b/src/AppInstallerCLICore/Workflows/InstallFlow.cpp @@ -136,7 +136,8 @@ namespace AppInstaller::Workflow { SHELLEXECUTEINFOA execInfo = { 0 }; execInfo.cbSize = sizeof(SHELLEXECUTEINFO); execInfo.fMask = SEE_MASK_NOCLOSEPROCESS; - execInfo.lpFile = Utility::ConvertToUTF8(filePath.c_str()).c_str(); + std::string filePathUTF8Str = Utility::ConvertToUTF8(filePath.c_str()); + execInfo.lpFile = filePathUTF8Str.c_str(); execInfo.lpParameters = args.c_str(); execInfo.nShow = SW_SHOW; if (!ShellExecuteExA(&execInfo) || !execInfo.hProcess) diff --git a/src/AppInstallerCLICore/Workflows/ManifestComparator.cpp b/src/AppInstallerCLICore/Workflows/ManifestComparator.cpp @@ -23,6 +23,8 @@ namespace AppInstaller::Workflow bool LocalizationComparator::operator() (const ManifestLocalization& loc1, const ManifestLocalization& loc2) { + UNREFERENCED_PARAMETER(loc2); + // Todo: Compare simple language for now. Need more work and spec. std::string userPreferredLocale = std::locale("").name(); @@ -38,7 +40,7 @@ namespace AppInstaller::Workflow ManifestInstaller ManifestComparator::GetPreferredInstaller(const std::locale& preferredLocale) { - AICLI_LOG(CLI, Info, << "Starting installer selection."); + AICLI_LOG(CLI, Info, << "Starting installer selection. Preferred locale: " << preferredLocale.name()); // Sorting the list of availlable installers according to rules defined in InstallerComparator. std::sort(m_manifestRef.Installers.begin(), m_manifestRef.Installers.end(), InstallerComparator()); @@ -64,7 +66,7 @@ namespace AppInstaller::Workflow ManifestLocalization ManifestComparator::GetPreferredLocalization(const std::locale& preferredLocale) { - AICLI_LOG(CLI, Info, << "Starting localization selection."); + AICLI_LOG(CLI, Info, << "Starting localization selection. Preferred locale: " << preferredLocale.name()); ManifestLocalization selectedLocalization; diff --git a/src/AppInstallerCLICore/Workflows/WorkflowReporter.cpp b/src/AppInstallerCLICore/Workflows/WorkflowReporter.cpp @@ -50,6 +50,8 @@ namespace AppInstaller::Workflow bool WorkflowReporter::PromptForBoolResponse(Level level, const std::string& msg) { + UNREFERENCED_PARAMETER(level); + out << msg << " (Y|N)" << std::endl; char response; @@ -60,6 +62,8 @@ namespace AppInstaller::Workflow void WorkflowReporter::ShowMsg(Level level, const std::string& msg) { + UNREFERENCED_PARAMETER(level); + // Todo: color output using level and possibly other factors. out << msg << std::endl; } diff --git a/src/AppInstallerCommonCore/AppInstallerStrings.cpp b/src/AppInstallerCommonCore/AppInstallerStrings.cpp @@ -39,7 +39,7 @@ namespace AppInstaller::Utility { std::string result(in); std::transform(result.begin(), result.end(), result.begin(), - [](unsigned char c) { return std::tolower(c); }); + [](unsigned char c) { return static_cast<char>(std::tolower(c)); }); return result; } } diff --git a/src/AppInstallerCommonCore/Architecture.cpp b/src/AppInstallerCommonCore/Architecture.cpp @@ -79,7 +79,7 @@ namespace AppInstaller::Utility if (it != applicableArchs.end()) { - return std::distance(it, applicableArchs.end()); + return static_cast<int>(std::distance(it, applicableArchs.end())); } else { diff --git a/src/AppInstallerCommonCore/SHA256.cpp b/src/AppInstallerCommonCore/SHA256.cpp @@ -22,7 +22,6 @@ namespace AppInstaller::Utility { { BCRYPT_ALG_HANDLE algHandleT{}; BCRYPT_HASH_HANDLE hashHandleT; - DWORD hashLength = 0; DWORD resultLength = 0; // Open an algorithm handle @@ -99,9 +98,9 @@ namespace AppInstaller::Utility { char resultBuffer[65]; - for (int i = 0; i < hashBuffer.size(); i++) + for (int i = 0; i < 32; i++) { - sprintf(resultBuffer + i * 2, "%02x", resultBuffer[i]); + sprintf_s(resultBuffer + i * 2, 3, "%02x", hashBuffer[i]); } resultBuffer[64] = '\0'; @@ -123,7 +122,7 @@ namespace AppInstaller::Utility { for (int i = 0; i < 32; i++) { - sscanf(hashCStr + 2 * i, "%02x", &resultBuffer[i]); + sscanf_s(hashCStr + 2 * i, "%02hhx", &resultBuffer[i]); } return resultBuffer;