Core: Replace usages of StringFromFormat with fmt where applicable

Migrates usages of StringFromFormat over to using fmt.
This commit is contained in:
Lioncash
2019-10-20 07:35:11 -04:00
parent 6282b0d83e
commit febd1c3dba
30 changed files with 192 additions and 165 deletions

View File

@ -17,6 +17,8 @@
#include <utility>
#include <vector>
#include <fmt/format.h>
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/StringUtil.h"
@ -91,7 +93,7 @@ void DSPAssembler::ShowError(AssemblerError err_code, const char* extra_info)
if (!m_settings.force)
m_failed = true;
std::string error = StringFromFormat("%u : %s ", m_code_line, m_cur_line.c_str());
std::string error = fmt::format("{} : {} ", m_code_line, m_cur_line);
if (!extra_info)
extra_info = "-";
@ -99,12 +101,12 @@ void DSPAssembler::ShowError(AssemblerError err_code, const char* extra_info)
if (m_current_param == 0)
{
error += StringFromFormat("ERROR: %s Line: %u : %s\n", error_string, m_code_line, extra_info);
error += fmt::format("ERROR: {} Line: {} : {}\n", error_string, m_code_line, extra_info);
}
else
{
error += StringFromFormat("ERROR: %s Line: %u Param: %d : %s\n", error_string, m_code_line,
m_current_param, extra_info);
error += fmt::format("ERROR: {} Line: {} Param: {} : {}\n", error_string, m_code_line,
m_current_param, extra_info);
}
m_last_error_str = std::move(error);
@ -958,8 +960,8 @@ bool DSPAssembler::AssemblePass(const std::string& text, int pass)
{
if (m_cur_addr > params[0].val)
{
std::string msg = StringFromFormat("WARNPC at 0x%04x, expected 0x%04x or less",
m_cur_addr, params[0].val);
const std::string msg = fmt::format("WARNPC at 0x{:04x}, expected 0x{:04x} or less",
m_cur_addr, params[0].val);
ShowError(AssemblerError::PCOutOfRange, msg.c_str());
}
}