Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Replace usages of StringFromFormat with fmt where applicable #8418

Open
wants to merge 2 commits into
base: master
from

Conversation

@lioncash
Copy link
Member

lioncash commented Oct 20, 2019

Migrates usages of StringFromFormat over to fmt.

@lioncash lioncash force-pushed the lioncash:core-fmt branch from 32f7e70 to db7ca26 Oct 20, 2019
Copy link
Member

jordan-woyak left a comment

Looks good from skimming the code. Untested.

@@ -627,15 +628,14 @@ void GCMemcardDirectory::FlushToFile()

if (gci.IsGood())
{
Core::DisplayMessage(
StringFromFormat("Wrote save contents to %s", m_saves[i].m_filename.c_str()), 4000);
Core::DisplayMessage(fmt::format("Wrote save contents to %s", m_saves[i].m_filename),

This comment has been minimized.

Copy link
@jordan-woyak
{
core->Get(StringFromFormat("SIDevice%i", i), (u32*)&m_SIDevice[i],
core->Get(fmt::format("SIDevice{}", i), (u32*)&m_SIDevice[i],

This comment has been minimized.

Copy link
@Warepire

Warepire Oct 20, 2019

Since you already edited this line, there's an old-school C-cast here.

This comment has been minimized.

Copy link
@lioncash

lioncash Oct 20, 2019

Author Member

Done, I've added code that allows removing the cast entirely.

Source/Core/Core/Analytics.cpp Show resolved Hide resolved
@@ -396,8 +396,7 @@ std::string GetScheduledEventsSummary()
std::sort(clone.begin(), clone.end());
for (const Event& ev : clone)
{
text += StringFromFormat("%s : %" PRIi64 " %016" PRIx64 "\n", ev.type->name->c_str(), ev.time,

This comment has been minimized.

Copy link
@BhaaLseN

BhaaLseN Oct 20, 2019

Member

Same down here for cinttypes

This comment has been minimized.

Copy link
@lioncash

lioncash Oct 20, 2019

Author Member

Yes, it's still necessary for log calls within LogPendingEvents

@lioncash lioncash force-pushed the lioncash:core-fmt branch 2 times, most recently from e6fee6b to 88a2ac4 Oct 20, 2019
m_settings.m_SaveDataRegion + ".raw";
layer->Set(Config::MAIN_MEMCARD_A_PATH, StringFromFormat(file.c_str(), 'A'));
layer->Set(Config::MAIN_MEMCARD_B_PATH, StringFromFormat(file.c_str(), 'B'));
const std::string file = fmt::format("{}{}{}.{{}}.raw", File::GetUserPath(D_GCUSER_IDX),

This comment has been minimized.

Copy link
@leoetlino

leoetlino Nov 8, 2019

Member

I think this should be

Suggested change
const std::string file = fmt::format("{}{}{}.{{}}.raw", File::GetUserPath(D_GCUSER_IDX),
const std::string file = fmt::format("{}{}{{}}.{}.raw", File::GetUserPath(D_GCUSER_IDX),

instead?

(IMO this is a bit hard to read... Any thoughts on having a small function/lambda that takes the memcard letter and returns the whole path?)

This comment has been minimized.

Copy link
@lioncash

lioncash Nov 11, 2019

Author Member

Done

lioncash added 2 commits Oct 20, 2019
Migrates usages of StringFromFormat over to using fmt.
…s enum

Allows the enumeration to be safely used with our type parsing
functions.
@lioncash lioncash force-pushed the lioncash:core-fmt branch from 88a2ac4 to cfbabd4 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
5 participants
You can’t perform that action at this time.