From 410c4ffe7506ed7c49ce5dc9741689d69df333b0 Mon Sep 17 00:00:00 2001 From: get <45425365+Minty-Meeo@users.noreply.github.com> Date: Fri, 16 Jun 2023 18:59:30 -0500 Subject: DolphinTool: Use {fmt} library --- Source/Core/DolphinTool/VerifyCommand.cpp | 44 +++++++++++++++---------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'Source/Core/DolphinTool/VerifyCommand.cpp') diff --git a/Source/Core/DolphinTool/VerifyCommand.cpp b/Source/Core/DolphinTool/VerifyCommand.cpp index 3c3af0d358..b000bbda52 100644 --- a/Source/Core/DolphinTool/VerifyCommand.cpp +++ b/Source/Core/DolphinTool/VerifyCommand.cpp @@ -8,6 +8,8 @@ #include #include +#include +#include #include "Common/StringUtil.h" #include "DiscIO/VolumeDisc.h" @@ -30,46 +32,44 @@ static std::string HashToHexString(const std::vector& hash) static void PrintFullReport(const DiscIO::VolumeVerifier::Result& result) { if (!result.hashes.crc32.empty()) - std::cout << "CRC32: " << HashToHexString(result.hashes.crc32) << std::endl; + fmt::print(std::cout, "CRC32: {}\n", HashToHexString(result.hashes.crc32)); else - std::cout << "CRC32 not computed" << std::endl; + fmt::print(std::cout, "CRC32 not computed\n"); if (!result.hashes.md5.empty()) - std::cout << "MD5: " << HashToHexString(result.hashes.md5) << std::endl; + fmt::print(std::cout, "MD5: {}\n", HashToHexString(result.hashes.md5)); else - std::cout << "MD5 not computed" << std::endl; + fmt::print(std::cout, "MD5 not computed\n"); if (!result.hashes.sha1.empty()) - std::cout << "SHA1: " << HashToHexString(result.hashes.sha1) << std::endl; + fmt::print(std::cout, "SHA1: {}\n", HashToHexString(result.hashes.sha1)); else - std::cout << "SHA1 not computed" << std::endl; + fmt::print(std::cout, "SHA1 not computed\n"); - std::cout << "Problems Found: " << (result.problems.empty() ? "No" : "Yes") << std::endl; + fmt::print(std::cout, "Problems Found: {}\n", result.problems.empty() ? "No" : "Yes"); for (const auto& problem : result.problems) { - std::cout << std::endl << "Severity: "; + fmt::print(std::cout, "\nSeverity: "); switch (problem.severity) { case DiscIO::VolumeVerifier::Severity::Low: - std::cout << "Low"; + fmt::print(std::cout, "Low"); break; case DiscIO::VolumeVerifier::Severity::Medium: - std::cout << "Medium"; + fmt::print(std::cout, "Medium"); break; case DiscIO::VolumeVerifier::Severity::High: - std::cout << "High"; + fmt::print(std::cout, "High"); break; case DiscIO::VolumeVerifier::Severity::None: - std::cout << "None"; + fmt::print(std::cout, "None"); break; default: ASSERT(false); break; } - std::cout << std::endl; - - std::cout << "Summary: " << problem.text << std::endl << std::endl; + fmt::print(std::cout, "\nSummary: {}\n\n", problem.text); } } @@ -112,7 +112,7 @@ int VerifyCommand(const std::vector& args) const std::string input_file_path = static_cast(options.get("input")); if (input_file_path.empty()) { - std::cerr << "Error: No input set" << std::endl; + fmt::print(std::cerr, "Error: No input set\n"); return EXIT_FAILURE; } @@ -136,7 +136,7 @@ int VerifyCommand(const std::vector& args) if (!hashes_to_calculate.crc32 && !hashes_to_calculate.md5 && !hashes_to_calculate.sha1) { // optparse should protect from this - std::cerr << "Error: No algorithms selected for the operation" << std::endl; + fmt::print(std::cerr, "Error: No algorithms selected for the operation\n"); return EXIT_FAILURE; } @@ -144,7 +144,7 @@ int VerifyCommand(const std::vector& args) const std::unique_ptr volume = DiscIO::CreateDisc(input_file_path); if (!volume) { - std::cerr << "Error: Unable to open disc image" << std::endl; + fmt::print(std::cerr, "Error: Unable to open disc image\n"); return EXIT_FAILURE; } @@ -166,14 +166,14 @@ int VerifyCommand(const std::vector& args) else { if (hashes_to_calculate.crc32 && !result.hashes.crc32.empty()) - std::cout << HashToHexString(result.hashes.crc32) << std::endl; + fmt::print(std::cout, "{}\n", HashToHexString(result.hashes.crc32)); else if (hashes_to_calculate.md5 && !result.hashes.md5.empty()) - std::cout << HashToHexString(result.hashes.md5) << std::endl; + fmt::print(std::cout, "{}\n", HashToHexString(result.hashes.md5)); else if (hashes_to_calculate.sha1 && !result.hashes.sha1.empty()) - std::cout << HashToHexString(result.hashes.sha1) << std::endl; + fmt::print(std::cout, "{}\n", HashToHexString(result.hashes.sha1)); else { - std::cerr << "Error: No hash computed" << std::endl; + fmt::print(std::cerr, "Error: No hash computed\n"); return EXIT_FAILURE; } } -- cgit v1.2.3