diff options
| author | Lioncash <mathew1800@gmail.com> | 2019-11-23 19:15:52 -0500 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2019-11-23 19:41:40 -0500 |
| commit | b28db1d4e69c0a1011375f308198fde8e2f67d13 (patch) | |
| tree | 6d33e27b3c20aadcb680badeb11bd45ace872668 /Source/Core/UICommon/GameFile.cpp | |
| parent | ec895f544cf23616483cea9fdb26a84d6264f844 (diff) | |
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.
Diffstat (limited to 'Source/Core/UICommon/GameFile.cpp')
| -rw-r--r-- | Source/Core/UICommon/GameFile.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
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 <utility> #include <vector> +#include <fmt/format.h> #include <pugixml.hpp> #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)); |
