From d100c1dc37596bce348d93e376b00d4a56458613 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 14 Oct 2020 18:34:45 +0200 Subject: DiscIO: Make use of fmt where applicable Once nice benefit of fmt is that we can use positional arguments in localizable strings. This a feature which has been requested for the Korean translation of strings like "Errors were found in %zu blocks in the %s partition." and which will no doubt be useful for other languages too. --- Source/Core/DiscIO/NANDImporter.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Source/Core/DiscIO/NANDImporter.cpp') diff --git a/Source/Core/DiscIO/NANDImporter.cpp b/Source/Core/DiscIO/NANDImporter.cpp index 9c161bcc02..beb84e8357 100644 --- a/Source/Core/DiscIO/NANDImporter.cpp +++ b/Source/Core/DiscIO/NANDImporter.cpp @@ -9,12 +9,13 @@ #include #include +#include + #include "Common/Crypto/AES.h" #include "Common/File.h" #include "Common/FileUtil.h" #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" -#include "Common/StringUtil.h" #include "Common/Swap.h" #include "Core/IOS/ES/Formats.h" @@ -132,9 +133,10 @@ std::string NANDImporter::GetPath(const NANDFSTEntry& entry, const std::string& std::string NANDImporter::FormatDebugString(const NANDFSTEntry& entry) { - return StringFromFormat("%12.12s 0x%02x 0x%02x 0x%04x 0x%04x 0x%08x 0x%04x 0x%04x 0x%04x 0x%08x", - entry.name, entry.mode, entry.attr, entry.sub, entry.sib, entry.size, - entry.x1, entry.uid, entry.gid, entry.x3); + return fmt::format( + "{:12.12} {:#04x} {:#04x} {:#06x} {:#06x} {:#010x} {:#06x} {:#06x} {:#06x} {:#010x}", + entry.name, entry.mode, entry.attr, entry.sub, entry.sib, entry.size, entry.x1, entry.uid, + entry.gid, entry.x3); } void NANDImporter::ProcessEntry(u16 entry_number, const std::string& parent_path) @@ -216,7 +218,7 @@ bool NANDImporter::ExtractCertificates(const std::string& nand_root) return false; } - File::IOFile content_file(content_dir + StringFromFormat("%08x.app", content_metadata.id), "rb"); + File::IOFile content_file(content_dir + fmt::format("{:08x}.app", content_metadata.id), "rb"); std::vector content_bytes(content_file.GetSize()); if (!content_file.ReadBytes(content_bytes.data(), content_bytes.size())) { -- cgit v1.2.3