2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 15:44:56 +00:00

hecl: Correct fmt formatting specifiers

These should be using {}-style formatting specifiers instead of printf
style. While we're at it, std::move the std::string instances where
applicable to potentially avoid reallocations.
This commit is contained in:
Lioncash
2019-08-24 03:17:58 -04:00
parent e12e0057c3
commit 7088235bc4
3 changed files with 13 additions and 13 deletions

View File

@@ -368,8 +368,8 @@ void Console::LogVisorAdapter::report(const char* modName, logvisor::Level sever
auto tmp = fmt::internal::vformat(format, args);
std::vector<std::string> lines = athena::utility::split(tmp, '\n');
for (const std::string& line : lines) {
auto v = fmt::format(fmt("[%s] %s"), modName, line.c_str());
m_con->m_log.emplace_back(v, Console::Level(severity));
auto v = fmt::format(fmt("[{}] {}"), modName, line);
m_con->m_log.emplace_back(std::move(v), Console::Level(severity));
}
}
@@ -378,16 +378,16 @@ void Console::LogVisorAdapter::report(const char* modName, logvisor::Level sever
auto tmp = fmt::internal::vformat(format, args);
std::vector<std::string> lines = athena::utility::split(athena::utility::wideToUtf8(tmp), '\n');
for (const std::string& line : lines) {
auto v = fmt::format(fmt("[%s] %s"), modName, line.c_str());
m_con->m_log.emplace_back(v, Console::Level(severity));
auto v = fmt::format(fmt("[{}] {}"), modName, line);
m_con->m_log.emplace_back(std::move(v), Console::Level(severity));
}
}
void Console::LogVisorAdapter::reportSource(const char* modName, logvisor::Level severity, const char* file,
unsigned linenum, fmt::string_view format, fmt::format_args args) {
auto tmp = fmt::internal::vformat(format, args);
auto v = fmt::format(fmt("[%s] %s %s:%i"), modName, tmp, file, linenum);
m_con->m_log.emplace_back(v, Console::Level(severity));
auto v = fmt::format(fmt("[{}] {} {}:{}"), modName, tmp, file, linenum);
m_con->m_log.emplace_back(std::move(v), Console::Level(severity));
}
void Console::LogVisorAdapter::reportSource(const char* modName, logvisor::Level severity, const char* file,
@@ -395,8 +395,8 @@ void Console::LogVisorAdapter::reportSource(const char* modName, logvisor::Level
auto tmp = fmt::internal::vformat(format, args);
std::vector<std::string> lines = athena::utility::split(athena::utility::wideToUtf8(tmp), '\n');
for (const std::string& line : lines) {
auto v = fmt::format(fmt("[%s] %s %s:%i"), modName, line.c_str(), file, linenum);
m_con->m_log.emplace_back(v, Console::Level(severity));
auto v = fmt::format(fmt("[{}] {} {}:{}"), modName, line, file, linenum);
m_con->m_log.emplace_back(std::move(v), Console::Level(severity));
}
}

View File

@@ -779,7 +779,7 @@ int RunProcess(const SystemChar* path, const SystemChar* const args[]) {
// Display the character read on the screen.
auto lk = logvisor::LockLog();
if (!WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), lpBuffer, nBytesRead, &nCharsWritten, NULL)) {
// LogModule.report(logvisor::Error, fmt("Error with WriteConsole: %08X"), GetLastError());
// LogModule.report(logvisor::Error, fmt("Error with WriteConsole: {:08X}"), GetLastError());
}
}