DolphinWX: Kill off sprintf calls in CheatsWindow.cpp

This commit is contained in:
Lioncash 2014-07-08 16:19:34 -04:00
parent 3bde3988eb
commit 54105a8bba
1 changed files with 4 additions and 6 deletions

View File

@ -32,6 +32,7 @@
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Common/StringUtil.h"
#include "Core/ActionReplay.h" #include "Core/ActionReplay.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
@ -332,17 +333,14 @@ void wxCheatsWindow::OnEvent_CheatsList_ItemSelected(wxCommandEvent& WXUNUSED (e
{ {
ARCode code = GetARCode(i); ARCode code = GetARCode(i);
m_Label_Codename->SetLabel(_("Name: ") + StrToWxStr(code.name)); m_Label_Codename->SetLabel(_("Name: ") + StrToWxStr(code.name));
char text[CHAR_MAX];
char* numcodes = text; std::string numcodes = StringFromFormat("Number of Codes: %lu", (unsigned long)code.ops.size());
sprintf(numcodes, "Number of Codes: %lu", (unsigned long)code.ops.size());
m_Label_NumCodes->SetLabel(StrToWxStr(numcodes)); m_Label_NumCodes->SetLabel(StrToWxStr(numcodes));
m_ListBox_CodesList->Clear(); m_ListBox_CodesList->Clear();
for (const AREntry& entry : code.ops) for (const AREntry& entry : code.ops)
{ {
char text2[CHAR_MAX]; std::string ops = StringFromFormat("%08x %08x", entry.cmd_addr, entry.value);
char* ops = text2;
sprintf(ops, "%08x %08x", entry.cmd_addr, entry.value);
m_ListBox_CodesList->Append(StrToWxStr(ops)); m_ListBox_CodesList->Append(StrToWxStr(ops));
} }
} }