Kill some unnecessary c_str and use StrToWxStr in a few places that I missed.

This commit is contained in:
Jordan Woyak 2013-02-28 02:39:06 -06:00
parent 56f09d3b91
commit 03ec9a2e08
20 changed files with 53 additions and 52 deletions

View File

@ -63,7 +63,7 @@ AboutDolphin::AboutDolphin(wxWindow *parent, wxWindowID id,
"and should not be used to play games you do\n"
"not legally own.";
wxStaticText* const Message = new wxStaticText(this, wxID_ANY,
StrToWxStr(Text.c_str()));
StrToWxStr(Text));
Message->Wrap(GetSize().GetWidth());
wxBoxSizer* const sInfo = new wxBoxSizer(wxVERTICAL);

View File

@ -348,7 +348,7 @@ void wxCheatsWindow::OnEvent_ButtonUpdateLog_Press(wxCommandEvent& WXUNUSED (eve
const std::vector<std::string> &arLog = ActionReplay::GetSelfLog();
for (u32 i = 0; i < arLog.size(); i++)
{
m_TextCtrl_Log->AppendText(StrToWxStr(arLog[i].c_str()));
m_TextCtrl_Log->AppendText(StrToWxStr(arLog[i]));
}
}

View File

@ -982,9 +982,9 @@ void CConfigMain::AddAudioBackends()
for (std::vector<std::string>::const_iterator iter = backends.begin();
iter != backends.end(); ++iter)
{
BackendSelection->Append(StrToWxStr((*iter).c_str()));
BackendSelection->Append(StrToWxStr(*iter));
int num = BackendSelection->\
FindString(StrToWxStr(SConfig::GetInstance().sBackend.c_str()));
FindString(StrToWxStr(SConfig::GetInstance().sBackend));
BackendSelection->SetSelection(num);
}
}
@ -1269,8 +1269,9 @@ void CConfigMain::ApploaderPathChanged(wxFileDirPickerEvent& WXUNUSED (event))
void CConfigMain::NANDRootChanged(wxFileDirPickerEvent& WXUNUSED (event))
{
std::string NANDPath =
SConfig::GetInstance().m_NANDPath = File::GetUserPath(D_WIIROOT_IDX, WxStrToStr(NANDRoot->GetPath()));
NANDRoot->SetPath(wxString(NANDPath));
SConfig::GetInstance().m_NANDPath =
File::GetUserPath(D_WIIROOT_IDX, WxStrToStr(NANDRoot->GetPath()));
NANDRoot->SetPath(StrToWxStr(NANDPath));
SConfig::GetInstance().m_SYSCONF->UpdateLocation();
DiscIO::cUIDsys::AccessInstance().UpdateLocation();
DiscIO::CSharedContent::AccessInstance().UpdateLocation();

View File

@ -253,7 +253,7 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
debugger->disasm(addr, disasm, 256);
text = text + StringFromFormat("%08x: ", addr) + disasm + "\r\n";
}
wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(text.c_str())));
wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(text)));
}
}
break;
@ -300,7 +300,7 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
{
wxTextEntryDialog input_symbol(this, StrToWxStr("Rename symbol:"),
wxGetTextFromUserPromptStr,
StrToWxStr(symbol->name.c_str()));
StrToWxStr(symbol->name));
if (input_symbol.ShowModal() == wxID_OK)
{
symbol->name = WxStrToStr(input_symbol.GetValue());

View File

@ -345,7 +345,7 @@ void CCodeWindow::UpdateCallstack()
for (size_t i = 0; i < stack.size(); i++)
{
int idx = callstack->Append(StrToWxStr(stack[i].Name.c_str()));
int idx = callstack->Append(StrToWxStr(stack[i].Name));
callstack->SetClientData(idx, (void*)(u64)stack[i].vAddress);
}

View File

@ -66,7 +66,7 @@ void CCodeWindow::Load()
std::string fontDesc;
ini.Get("General", "DebuggerFont", &fontDesc);
if (!fontDesc.empty())
DebuggerFont.SetNativeFontInfoUserDesc(StrToWxStr(fontDesc.c_str()));
DebuggerFont.SetNativeFontInfoUserDesc(StrToWxStr(fontDesc));
// Boot to pause or not
ini.Get("General", "AutomaticStart", &bAutomaticStart, false);
@ -366,7 +366,7 @@ void CCodeWindow::NotifyMapLoaded()
symbols->Clear();
for (PPCSymbolDB::XFuncMap::iterator iter = g_symbolDB.GetIterator(); iter != g_symbolDB.End(); ++iter)
{
int idx = symbols->Append(StrToWxStr(iter->second.name.c_str()));
int idx = symbols->Append(StrToWxStr(iter->second.name));
symbols->SetClientData(idx, (void*)&iter->second);
}
symbols->Thaw();

View File

@ -221,7 +221,7 @@ void DSPDebuggerLLE::UpdateSymbolMap()
for (SymbolDB::XFuncMap::iterator iter = DSPSymbols::g_dsp_symbol_db.GetIterator();
iter != DSPSymbols::g_dsp_symbol_db.End(); ++iter)
{
int idx = m_SymbolList->Append(StrToWxStr(iter->second.name.c_str()));
int idx = m_SymbolList->Append(StrToWxStr(iter->second.name));
m_SymbolList->SetClientData(idx, (void*)&iter->second);
}
m_SymbolList->Thaw();

View File

@ -120,9 +120,9 @@ void CJitWindow::Compare(u32 em_address)
}
// Do not merge this "if" with the above - block_num changes inside it.
if (block_num < 0) {
ppc_box->SetValue(wxString::FromAscii(StringFromFormat("(non-code address: %08x)",
em_address).c_str()));
x86_box->SetValue(wxString::FromAscii(StringFromFormat("(no translation)").c_str()));
ppc_box->SetValue(StrToWxStr(StringFromFormat("(non-code address: %08x)",
em_address)));
x86_box->SetValue(StrToWxStr(StringFromFormat("(no translation)")));
delete[] xDis;
return;
}
@ -151,7 +151,7 @@ void CJitWindow::Compare(u32 em_address)
*sptr++ = 10;
num_x86_instructions++;
}
x86_box->SetValue(wxString::FromAscii((char*)xDis));
x86_box->SetValue(StrToWxStr((char*)xDis));
// == Fill in ppc box
u32 ppc_addr = block->originalAddress;
@ -190,11 +190,11 @@ void CJitWindow::Compare(u32 em_address)
sptr += sprintf(sptr, "Num bytes: PPC: %i x86: %i (blowup: %i%%)\n",
size * 4, block->codeSize, 100 * (block->codeSize / (4 * size) - 1));
ppc_box->SetValue(wxString::FromAscii((char*)xDis));
ppc_box->SetValue(StrToWxStr((char*)xDis));
} else {
ppc_box->SetValue(wxString::FromAscii(StringFromFormat(
"(non-code address: %08x)", em_address).c_str()));
x86_box->SetValue(wxString::FromAscii("---"));
ppc_box->SetValue(StrToWxStr(StringFromFormat(
"(non-code address: %08x)", em_address)));
x86_box->SetValue("---");
}
delete[] xDis;

View File

@ -549,7 +549,7 @@ void CFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& event)
for (u32 i = 0; i < Perspectives.size(); i++)
{
wxMenuItem* mItem = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_0 + i,
StrToWxStr(Perspectives[i].Name.c_str()),
StrToWxStr(Perspectives[i].Name),
wxT(""), wxITEM_CHECK);
menuPopup->Append(mItem);
if (i == ActivePerspective) mItem->Check(true);
@ -871,7 +871,7 @@ void CFrame::LoadIniPerspectives()
ini.Get(_Section.c_str(), "Width", &_Width, "70,25");
ini.Get(_Section.c_str(), "Height", &_Height, "80,80");
Tmp.Perspective = StrToWxStr(_Perspective.c_str());
Tmp.Perspective = StrToWxStr(_Perspective);
SplitString(_Width, ',', _SWidth);
SplitString(_Height, ',', _SHeight);

View File

@ -101,7 +101,7 @@ void CFrame::CreateMenu()
drives = cdio_get_devices();
// Windows Limitation of 24 character drives
for (unsigned int i = 0; i < drives.size() && i < 24; i++) {
externalDrive->Append(IDM_DRIVE1 + i, StrToWxStr(drives[i].c_str()));
externalDrive->Append(IDM_DRIVE1 + i, StrToWxStr(drives[i]));
}
fileMenu->AppendSeparator();

View File

@ -614,7 +614,7 @@ void CGameListCtrl::ScanForISOs()
// Update with the progress (i) and the message
dialog.Update(i, wxString::Format(_("Scanning %s"),
StrToWxStr(FileName).c_str()));
StrToWxStr(FileName)));
if (dialog.WasCancelled())
break;
@ -1173,10 +1173,10 @@ void CGameListCtrl::CompressSelection(bool _compress)
WxStrToStr(browseDialog.GetPath()),
FileName);
if (wxFileExists(StrToWxStr(OutputFileName.c_str())) &&
if (wxFileExists(StrToWxStr(OutputFileName)) &&
wxMessageBox(
wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"),
StrToWxStr(OutputFileName).c_str()),
StrToWxStr(OutputFileName)),
_("Confirm File Overwrite"),
wxYES_NO) == wxNO)
continue;
@ -1201,10 +1201,10 @@ void CGameListCtrl::CompressSelection(bool _compress)
WxStrToStr(browseDialog.GetPath()),
FileName);
if (wxFileExists(StrToWxStr(OutputFileName.c_str())) &&
if (wxFileExists(StrToWxStr(OutputFileName)) &&
wxMessageBox(
wxString::Format(_("The file %s already exists.\nDo you wish to replace it?"),
StrToWxStr(OutputFileName).c_str()),
StrToWxStr(OutputFileName)),
_("Confirm File Overwrite"),
wxYES_NO) == wxNO)
continue;

View File

@ -728,7 +728,7 @@ void CISOProperties::ExportDir(const char* _rFullPath, const char* _rExportFolde
(u32)(((float)(i - index[0]) / (float)(index[1] - index[0])) * 100)));
dialog.Update(i, wxString::Format(_("Extracting %s"),
StrToWxStr(fst[i]->m_FullPath).c_str()));
StrToWxStr(fst[i]->m_FullPath)));
if (dialog.WasCancelled())
break;
@ -990,7 +990,7 @@ void CISOProperties::LoadGameConfig()
GameIni.Get("EmuState", "EmulationIssues", &sTemp);
if (!sTemp.empty())
{
EmuIssues->SetValue(StrToWxStr(sTemp.c_str()));
EmuIssues->SetValue(StrToWxStr(sTemp));
}
EmuIssues->Enable(EmuState->GetSelection() != 0);
@ -1157,7 +1157,7 @@ void CISOProperties::PatchList_Load()
for (std::vector<PatchEngine::Patch>::const_iterator it = onFrame.begin(); it != onFrame.end(); ++it)
{
PatchEngine::Patch p = *it;
Patches->Append(StrToWxStr(p.name.c_str()));
Patches->Append(StrToWxStr(p.name));
Patches->Check(index, p.active);
++index;
}
@ -1366,5 +1366,5 @@ void CISOProperties::ChangeBannerDetails(int lang)
SplitPath(OpenGameListItem->GetFileName(), 0, &filename, &extension);
// Also sets the window's title
SetTitle(StrToWxStr(StringFromFormat("%s%s: %s - ", filename.c_str(),
extension.c_str(), OpenGameListItem->GetUniqueID().c_str()).c_str()) + shortName);
extension.c_str(), OpenGameListItem->GetUniqueID().c_str())) + shortName);
}

View File

@ -34,7 +34,7 @@ void GamepadPage::ConfigExtension(wxCommandEvent& event)
if (ex->switch_extension)
{
wxDialog dlg(this, -1,
StrToWxStr(ex->attachments[ex->switch_extension]->GetName().c_str()),
StrToWxStr(ex->attachments[ex->switch_extension]->GetName()),
wxDefaultPosition, wxDefaultSize);
wxBoxSizer* const main_szr = new wxBoxSizer(wxVERTICAL);
@ -64,7 +64,7 @@ PadSettingExtension::PadSettingExtension(wxWindow* const parent, ControllerEmu::
e = extension->attachments.end();
for (; i!=e; ++i)
((wxChoice*)wxcontrol)->Append(StrToWxStr((*i)->GetName().c_str()));
((wxChoice*)wxcontrol)->Append(StrToWxStr((*i)->GetName()));
UpdateGUI();
}
@ -612,7 +612,7 @@ void GamepadPage::DeleteProfile(wxCommandEvent&)
if (File::Exists(fnamecstr) &&
AskYesNoT("Are you sure you want to delete \"%s\"?",
WxStrToStr(profile_cbox->GetValue()).c_str()))
WxStrToStr(profile_cbox->GetValue())))
{
File::Delete(fnamecstr);
@ -952,7 +952,7 @@ GamepadPage::GamepadPage(wxWindow* parent, InputPlugin& plugin, const unsigned i
InputConfigDialog::InputConfigDialog(wxWindow* const parent, InputPlugin& plugin, const std::string& name, const int tab_num)
: wxDialog(parent, wxID_ANY, StrToWxStr(name.c_str()), wxPoint(128,-1), wxDefaultSize)
: wxDialog(parent, wxID_ANY, StrToWxStr(name), wxPoint(128,-1), wxDefaultSize)
, m_plugin(plugin)
{
m_pad_notebook = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize, wxNB_DEFAULT);

View File

@ -228,7 +228,7 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
// text
const char* const name = (*g)->control_group->controls[n]->name;
// bit of hax so ZL, ZR show up as L, R
dc.DrawText(StrToWxStr((name[1] && name[1] < 'a') ? name[1] : name[0]), n*12 + 2, 1);
dc.DrawText(StrToWxStr(std::string(1, (name[1] && name[1] < 'a') ? name[1] : name[0])), n*12 + 2, 1);
}
delete[] bitmasks;
@ -300,7 +300,7 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event))
// text
dc.DrawText(StrToWxStr((*g)->control_group->controls[n+trigger_count]->name), 3, n*12 + 1);
dc.DrawText(StrToWxStr((*g)->control_group->controls[n]->name[0]), 64 + 3, n*12 + 1);
dc.DrawText(StrToWxStr(std::string(1, (*g)->control_group->controls[n]->name[0])), 64 + 3, n*12 + 1);
}
// threshold box

View File

@ -73,7 +73,7 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl*
std::string address;
netplay_section.Get("Address", &address, "localhost");
m_connect_ip_text = new wxTextCtrl(connect_tab, wxID_ANY, StrToWxStr(address.c_str()));
m_connect_ip_text = new wxTextCtrl(connect_tab, wxID_ANY, StrToWxStr(address));
wxStaticText* const port_lbl = new wxStaticText(connect_tab, wxID_ANY, _("Port :"),
wxDefaultPosition, wxDefaultSize);
@ -81,7 +81,7 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl*
// string? w/e
std::string port;
netplay_section.Get("ConnectPort", &port, "2626");
m_connect_port_text = new wxTextCtrl(connect_tab, wxID_ANY, StrToWxStr(port.c_str()));
m_connect_port_text = new wxTextCtrl(connect_tab, wxID_ANY, StrToWxStr(port));
wxButton* const connect_btn = new wxButton(connect_tab, wxID_ANY, _("Connect"));
connect_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &NetPlaySetupDiag::OnJoin, this);
@ -114,7 +114,7 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl*
// string? w/e
std::string port;
netplay_section.Get("HostPort", &port, "2626");
m_host_port_text = new wxTextCtrl(host_tab, wxID_ANY, StrToWxStr(port.c_str()));
m_host_port_text = new wxTextCtrl(host_tab, wxID_ANY, StrToWxStr(port));
wxButton* const host_btn = new wxButton(host_tab, wxID_ANY, _("Host"));
host_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &NetPlaySetupDiag::OnHost, this);

View File

@ -49,7 +49,7 @@ void CPatchAddEdit::CreateGUIControls(int _selection)
}
else
{
currentName = StrToWxStr(onFrame.at(_selection).name.c_str());
currentName = StrToWxStr(onFrame.at(_selection).name);
tempEntries = onFrame.at(_selection).entries;
}

View File

@ -212,9 +212,9 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
it = g_available_video_backends.begin(),
itend = g_available_video_backends.end();
for (; it != itend; ++it)
choice_backend->AppendString(wxGetTranslation(StrToWxStr((*it)->GetName().c_str())));
choice_backend->AppendString(wxGetTranslation(StrToWxStr((*it)->GetName())));
choice_backend->SetStringSelection(wxGetTranslation(StrToWxStr(g_video_backend->GetName().c_str())));
choice_backend->SetStringSelection(wxGetTranslation(StrToWxStr(g_video_backend->GetName())));
choice_backend->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &VideoConfigDiag::Event_Backend, this);
szr_basic->Add(label_backend, 1, wxALIGN_CENTER_VERTICAL, 5);
@ -236,7 +236,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
it = vconfig.backend_info.Adapters.begin(),
itend = vconfig.backend_info.Adapters.end();
for (; it != itend; ++it)
choice_adapter->AppendString(StrToWxStr(it->c_str()));
choice_adapter->AppendString(StrToWxStr(*it));
choice_adapter->Select(vconfig.iAdapter);
@ -259,7 +259,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
RegisterControl(choice_display_resolution, wxGetTranslation(display_res_desc));
choice_display_resolution->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &VideoConfigDiag::Event_DisplayResolution, this);
choice_display_resolution->SetStringSelection(StrToWxStr(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str()));
choice_display_resolution->SetStringSelection(StrToWxStr(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution));
szr_display->Add(label_display_resolution, 1, wxALIGN_CENTER_VERTICAL, 0);
szr_display->Add(choice_display_resolution);
@ -355,7 +355,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
it = vconfig.backend_info.AAModes.begin(),
itend = vconfig.backend_info.AAModes.end();
for (; it != itend; ++it)
choice_aamode->AppendString(wxGetTranslation(StrToWxStr(it->c_str())));
choice_aamode->AppendString(wxGetTranslation(StrToWxStr(*it)));
choice_aamode->Select(vconfig.iMultisampleMode);
szr_enh->Add(text_aamode, 1, wxALIGN_CENTER_VERTICAL, 0);
@ -380,12 +380,12 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
it = vconfig.backend_info.PPShaders.begin(),
itend = vconfig.backend_info.PPShaders.end();
for (; it != itend; ++it)
choice_ppshader->AppendString(StrToWxStr(it->c_str()));
choice_ppshader->AppendString(StrToWxStr(*it));
if (vconfig.sPostProcessingShader.empty())
choice_ppshader->Select(0);
else
choice_ppshader->SetStringSelection(StrToWxStr(vconfig.sPostProcessingShader.c_str()));
choice_ppshader->SetStringSelection(StrToWxStr(vconfig.sPostProcessingShader));
choice_ppshader->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &VideoConfigDiag::Event_PPShader, this);

View File

@ -100,7 +100,7 @@ protected:
else
{
// Select current backend again
choice_backend->SetStringSelection(StrToWxStr(g_video_backend->GetName().c_str()));
choice_backend->SetStringSelection(StrToWxStr(g_video_backend->GetName()));
}
}

View File

@ -1539,7 +1539,7 @@ void TakeScreenshot(ScrStrct* threadStruct)
// Save the screenshot and finally kill the wxImage object
// This is really expensive when saving to PNG, but not at all when using BMP
threadStruct->img->SaveFile(StrToWxStr(threadStruct->filename.c_str()),
threadStruct->img->SaveFile(StrToWxStr(threadStruct->filename),
wxBITMAP_TYPE_PNG);
threadStruct->img->Destroy();

View File

@ -34,7 +34,7 @@ IntegerSetting<T>::IntegerSetting(wxWindow* parent, const wxString& label, T& se
VideoConfigDialog::VideoConfigDialog(wxWindow* parent, const std::string& title, const std::string& _ininame) :
wxDialog(parent, -1,
wxString(wxT("Dolphin ")).append(StrToWxStr(title.c_str())).append(wxT(" Graphics Configuration")),
wxString(wxT("Dolphin ")).append(StrToWxStr(title)).append(wxT(" Graphics Configuration")),
wxDefaultPosition, wxDefaultSize),
vconfig(g_SWVideoConfig),
ininame(_ininame)