From b28db1d4e69c0a1011375f308198fde8e2f67d13 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 23 Nov 2019 19:15:52 -0500 Subject: UICommon: Make use of fmt where applicable Continues the migration to using fmt. Notably, this allows safely converting a map within USBUtils over to containing string view instances, rather than std::string instances, as fmt safely handles the formatting of string views. --- Source/Core/UICommon/GameFile.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'Source/Core/UICommon/GameFile.cpp') diff --git a/Source/Core/UICommon/GameFile.cpp b/Source/Core/UICommon/GameFile.cpp index 53b993a676..8499d270f4 100644 --- a/Source/Core/UICommon/GameFile.cpp +++ b/Source/Core/UICommon/GameFile.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include "Common/ChunkFile.h" @@ -45,8 +46,6 @@ namespace UICommon { namespace { -constexpr char COVER_URL[] = "https://art.gametdb.com/wii/cover/%s/%s.png"; - const std::string EMPTY_STRING; } // Anonymous namespace @@ -241,8 +240,8 @@ void GameFile::DownloadDefaultCover() } Common::HttpRequest request; - const auto response = - request.Get(StringFromFormat(COVER_URL, region_code.c_str(), m_gametdb_id.c_str())); + constexpr char cover_url[] = "https://art.gametdb.com/wii/cover/{}/{}.png"; + const auto response = request.Get(fmt::format(cover_url, region_code, m_gametdb_id)); if (!response) return; @@ -541,8 +540,8 @@ std::string GameFile::GetUniqueIdentifier() const std::string lower_name = name; std::transform(lower_name.begin(), lower_name.end(), lower_name.begin(), ::tolower); if (disc_number > 1 && - lower_name.find(StringFromFormat("disc %i", disc_number)) == std::string::npos && - lower_name.find(StringFromFormat("disc%i", disc_number)) == std::string::npos) + lower_name.find(fmt::format("disc {}", disc_number)) == std::string::npos && + lower_name.find(fmt::format("disc{}", disc_number)) == std::string::npos) { std::string disc_text = "Disc "; info.push_back(disc_text + std::to_string(disc_number)); -- cgit v1.2.3