Remove most uses of StringFromFormat in favor of fmt

This commit is contained in:
Pokechu22
2022-10-11 19:21:51 -07:00
parent a5fa95adfd
commit f9fe25291d
12 changed files with 105 additions and 89 deletions

View File

@ -6,6 +6,8 @@
#include <algorithm>
#include <cmath>
#include <fmt/format.h>
#include <QApplication>
#include <QClipboard>
#include <QHeaderView>
@ -656,7 +658,7 @@ void CodeViewWidget::OnCopyFunction()
for (u32 addr = start; addr != end; addr += 4)
{
const std::string disasm = PowerPC::debug_interface.Disassemble(addr);
text += StringFromFormat("%08x: ", addr) + disasm + "\r\n";
fmt::format_to(std::back_inserter(text), "{:08x}: {}\r\n", addr, disasm);
}
QApplication::clipboard()->setText(QString::fromStdString(text));

View File

@ -5,6 +5,8 @@
#include <chrono>
#include <fmt/format.h>
#include <QGridLayout>
#include <QGroupBox>
#include <QLabel>
@ -16,7 +18,6 @@
#include <QWidget>
#include "Common/Event.h"
#include "Common/StringUtil.h"
#include "Core/Core.h"
#include "Core/Debugger/Debugger_SymbolMap.h"
#include "Core/HW/CPU.h"
@ -389,7 +390,7 @@ void CodeWidget::UpdateFunctionCalls(const Common::Symbol* symbol)
if (call_symbol)
{
const QString name =
QString::fromStdString(StringFromFormat("> %s (%08x)", call_symbol->name.c_str(), addr));
QString::fromStdString(fmt::format("> {} ({:08x})", call_symbol->name, addr));
if (name.toUpper().indexOf(filter.toUpper()) == -1)
continue;
@ -413,8 +414,8 @@ void CodeWidget::UpdateFunctionCallers(const Common::Symbol* symbol)
if (caller_symbol)
{
const QString name = QString::fromStdString(
StringFromFormat("< %s (%08x)", caller_symbol->name.c_str(), addr));
const QString name =
QString::fromStdString(fmt::format("< {} ({:08x})", caller_symbol->name, addr));
if (name.toUpper().indexOf(filter.toUpper()) == -1)
continue;

View File

@ -9,8 +9,9 @@
#include <QTextBrowser>
#include <QVBoxLayout>
#include <fmt/format.h>
#include "Common/GekkoDisassembler.h"
#include "Common/StringUtil.h"
#include "Core/PowerPC/PPCAnalyst.h"
#include "UICommon/Disassembler.h"
@ -214,7 +215,7 @@ void JITWidget::Update()
{
m_host_asm_widget->setHtml(
QStringLiteral("<pre>%1</pre>")
.arg(QString::fromStdString(StringFromFormat("(non-code address: %08x)", m_address))));
.arg(QString::fromStdString(fmt::format("(non-code address: {:08x})", m_address))));
m_ppc_asm_widget->setHtml(QStringLiteral("<i>---</i>"));
}
}