diff options
| author | get <45425365+Minty-Meeo@users.noreply.github.com> | 2023-06-16 18:59:30 -0500 |
|---|---|---|
| committer | get <45425365+Minty-Meeo@users.noreply.github.com> | 2023-06-16 21:45:59 -0500 |
| commit | 410c4ffe7506ed7c49ce5dc9741689d69df333b0 (patch) | |
| tree | 4f7b9ab04636dc301ef669c3315e9e17941bb3af /Source/Core/DolphinTool/VerifyCommand.cpp | |
| parent | 5029924ba104fdc5bc78a804fb35cdb5d7418a8f (diff) | |
DolphinTool: Use {fmt} library
Diffstat (limited to 'Source/Core/DolphinTool/VerifyCommand.cpp')
| -rw-r--r-- | Source/Core/DolphinTool/VerifyCommand.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
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 <vector> #include <OptionParser.h> +#include <fmt/format.h> +#include <fmt/ostream.h> #include "Common/StringUtil.h" #include "DiscIO/VolumeDisc.h" @@ -30,46 +32,44 @@ static std::string HashToHexString(const std::vector<u8>& 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<std::string>& args) const std::string input_file_path = static_cast<const char*>(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<std::string>& 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<std::string>& args) const std::unique_ptr<DiscIO::VolumeDisc> 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<std::string>& 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; } } |
