summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinTool/HeaderCommand.cpp
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2023-06-17 14:18:21 +0200
committerGitHub <noreply@github.com>2023-06-17 14:18:21 +0200
commit79d5850e6a9a015118bf40a5e22541d527c2ad45 (patch)
treef97860deca3f69ecfeef528c78bfed85f0b9a89b /Source/Core/DolphinTool/HeaderCommand.cpp
parentb8242c362e2c30f4c909db1f9e31dffaf295abe7 (diff)
parent410c4ffe7506ed7c49ce5dc9741689d69df333b0 (diff)
Merge pull request #11960 from Minty-Meeo/dolphin-tool-code-review-4
DolphinTool: Use {fmt} library
Diffstat (limited to 'Source/Core/DolphinTool/HeaderCommand.cpp')
-rw-r--r--Source/Core/DolphinTool/HeaderCommand.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/Source/Core/DolphinTool/HeaderCommand.cpp b/Source/Core/DolphinTool/HeaderCommand.cpp
index 96099d94d4..cebb202ce6 100644
--- a/Source/Core/DolphinTool/HeaderCommand.cpp
+++ b/Source/Core/DolphinTool/HeaderCommand.cpp
@@ -9,6 +9,8 @@
#include <vector>
#include <OptionParser.h>
+#include <fmt/format.h>
+#include <fmt/ostream.h>
#include "DiscIO/Blob.h"
#include "DiscIO/Volume.h"
@@ -46,7 +48,7 @@ int HeaderCommand(const std::vector<std::string>& args)
const std::string& input_file_path = options["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;
}
@@ -58,7 +60,7 @@ int HeaderCommand(const std::vector<std::string>& args)
const std::unique_ptr<DiscIO::BlobReader> blob_reader = DiscIO::CreateBlobReader(input_file_path);
if (!blob_reader)
{
- std::cerr << "Error: Unable to open disc image" << std::endl;
+ fmt::print(std::cerr, "Error: Unable to open disc image\n");
return EXIT_FAILURE;
}
@@ -68,25 +70,25 @@ int HeaderCommand(const std::vector<std::string>& args)
{
const auto block_size = blob_reader->GetBlockSize();
if (block_size == 0)
- std::cout << "N/A" << std::endl;
+ fmt::print(std::cout, "N/A\n");
else
- std::cout << block_size << std::endl;
+ fmt::print(std::cout, "{}\n", block_size);
}
if (enable_compression_method)
{
const auto compression_method = blob_reader->GetCompressionMethod();
if (compression_method == "")
- std::cout << "N/A" << std::endl;
+ fmt::print(std::cout, "N/A\n");
else
- std::cout << compression_method << std::endl;
+ fmt::print(std::cout, "{}\n", compression_method);
}
if (enable_compression_level)
{
const auto compression_level_o = blob_reader->GetCompressionLevel();
if (compression_level_o == std::nullopt)
- std::cout << "N/A" << std::endl;
+ fmt::print(std::cout, "N/A\n");
else
- std::cout << compression_level_o.value() << std::endl;
+ fmt::print(std::cout, "{}\n", compression_level_o.value());
}
}
else
@@ -94,14 +96,14 @@ int HeaderCommand(const std::vector<std::string>& args)
const auto blob_type = blob_reader->GetBlobType();
if (blob_type == DiscIO::BlobType::GCZ)
{
- std::cout << "Block Size: " << blob_reader->GetBlockSize() << std::endl;
- std::cout << "Compression Method: " << blob_reader->GetCompressionMethod() << std::endl;
+ fmt::print(std::cout, "Block Size: {}\nCompression Method: {}\n", blob_reader->GetBlockSize(),
+ blob_reader->GetCompressionMethod());
}
if (blob_type == DiscIO::BlobType::WIA || blob_type == DiscIO::BlobType::RVZ)
{
- std::cout << "Block Size: " << blob_reader->GetBlockSize() << std::endl;
- std::cout << "Compression Method: " << blob_reader->GetCompressionMethod() << std::endl;
- std::cout << "Compression Level: " << blob_reader->GetCompressionLevel().value() << std::endl;
+ fmt::print(std::cout, "Block Size: {}\nCompression Method: {}\nCompression Level: {}\n",
+ blob_reader->GetBlockSize(), blob_reader->GetCompressionMethod(),
+ blob_reader->GetCompressionLevel().value());
}
}