prevent overflow becaus wxStrings aren't \0 terminated anymore

This commit is contained in:
Peter Tissen 2014-02-10 02:43:24 +01:00
parent b9abb1e075
commit 3f52a6aa50
8 changed files with 12 additions and 31 deletions

View File

@ -105,8 +105,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ribbon", "wxWidgets\build\m
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stc", "wxWidgets\build\msw\wx_vc10_stc.vcxproj", "{23E1C437-A951-5943-8639-A17F3CF2E606}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "webview", "wxWidgets\build\msw\wx_vc10_webview.vcxproj", "{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxscintilla", "wxWidgets\build\msw\wx_vc10_wxscintilla.vcxproj", "{74827EBD-93DC-5110-BA95-3F2AB029B6B0}"
EndProject
Global
@ -473,22 +471,6 @@ Global
{23E1C437-A951-5943-8639-A17F3CF2E606}.Release|Win32.Build.0 = Release|Win32
{23E1C437-A951-5943-8639-A17F3CF2E606}.Release|x64.ActiveCfg = Release|x64
{23E1C437-A951-5943-8639-A17F3CF2E606}.Release|x64.Build.0 = Release|x64
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.Debug|Win32.ActiveCfg = Debug|Win32
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.Debug|Win32.Build.0 = Debug|Win32
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.Debug|x64.ActiveCfg = Debug|x64
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.Debug|x64.Build.0 = Debug|x64
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.DLL Debug|Win32.ActiveCfg = DLL Debug|Win32
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.DLL Debug|Win32.Build.0 = DLL Debug|Win32
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.DLL Debug|x64.ActiveCfg = DLL Debug|x64
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.DLL Debug|x64.Build.0 = DLL Debug|x64
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.DLL Release|Win32.ActiveCfg = DLL Release|Win32
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.DLL Release|Win32.Build.0 = DLL Release|Win32
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.DLL Release|x64.ActiveCfg = DLL Release|x64
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.DLL Release|x64.Build.0 = DLL Release|x64
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.Release|Win32.ActiveCfg = Release|Win32
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.Release|Win32.Build.0 = Release|Win32
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.Release|x64.ActiveCfg = Release|x64
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E}.Release|x64.Build.0 = Release|x64
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug|Win32.ActiveCfg = Debug|Win32
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug|Win32.Build.0 = Debug|Win32
{74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug|x64.ActiveCfg = Debug|x64
@ -531,7 +513,6 @@ Global
{8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
{87B42A9C-3F5C-53D7-9017-2B1CAE39457D} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
{23E1C437-A951-5943-8639-A17F3CF2E606} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
{A8E8442A-078A-5FC5-B495-8D71BA77EE6E} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
{74827EBD-93DC-5110-BA95-3F2AB029B6B0} = {5812E712-6213-4372-B095-9EB9BAA1F2DF}
EndGlobalSection
EndGlobal

View File

@ -54,12 +54,12 @@ bool vfsLocalFile::Open(const wxString& path, vfsOpenMode mode)
bool vfsLocalFile::Create(const wxString& path)
{
ConLog.Warning("vfsLocalFile::Create('%s')", path.c_str());
for(uint p=1; path[p] != '\0'; p++)
for(uint p=1; p < path.Len() && path[p] != '\0' ; p++)
{
for(; path[p] != '\0'; p++)
for(; p < path.Len() && path[p] != '\0'; p++)
if(path[p] == '\\') break;
if(path[p] == '\0')
if(p == path.Len() || path[p] == '\0')
break;
const wxString& dir = path(0, p);

View File

@ -188,7 +188,7 @@ void Emulator::Load()
{
if(!wxFileExists(m_path)) return;
if(IsSelf(m_path.ToStdString()))
if(IsSelf((const char *)m_path.mb_str()))
{
std::string self_path = m_path;
std::string elf_path = wxFileName(m_path).GetPath().c_str();

View File

@ -187,7 +187,7 @@ void LogWriter::Error(const wxString fmt, ...)
va_end(list);
WriteToLog("E", frmt.ToStdString(), "Red");
WriteToLog("E", (const char *)frmt.mb_str(), "Red");
}
void LogWriter::Warning(const wxString fmt, ...)
@ -199,7 +199,7 @@ void LogWriter::Warning(const wxString fmt, ...)
va_end(list);
WriteToLog("W", frmt.ToStdString(), "Yellow");
WriteToLog("W", (const char *)frmt.mb_str(), "Yellow");
}
void LogWriter::Success(const wxString fmt, ...)
@ -211,7 +211,7 @@ void LogWriter::Success(const wxString fmt, ...)
va_end(list);
WriteToLog("S", frmt.ToStdString(), "Green");
WriteToLog("S", (const char *)frmt.mb_str(), "Green");
}
void LogWriter::SkipLn()

View File

@ -91,7 +91,7 @@ void GameViewer::DClick(wxListEvent& event)
const wxString& path = m_path + m_game_data[i].root;
Emu.Stop();
if(!Emu.BootGame(path.ToStdString()))
if(!Emu.BootGame((const char *)path.mb_str()))
{
ConLog.Error("Boot error: elf not found! [%s]", path.mb_str());
return;

View File

@ -192,7 +192,7 @@ void MainFrame::BootGame(wxCommandEvent& WXUNUSED(event))
Emu.Stop();
if(Emu.BootGame(ctrl.GetPath().ToStdString()))
if(Emu.BootGame((const char *)ctrl.GetPath().mb_str()))
{
ConLog.Success("Game: boot done.");
}
@ -250,7 +250,7 @@ void MainFrame::InstallPkg(wxCommandEvent& WXUNUSED(event))
//Refresh game list
m_game_viewer->Refresh();
if(Emu.BootGame(pkgDir.ToStdString()))
if(Emu.BootGame((const char*)pkgDir.mb_str()))
{
ConLog.Success("Game: boot done.");
}

View File

@ -336,7 +336,7 @@ bool ELF64Loader::LoadPhdrData(u64 offset)
stub.s_text = re(stub.s_text);
const wxString& module_name = Memory.ReadString(stub.s_modulename);
Module* module = GetModuleByName(module_name.ToStdString());
Module* module = GetModuleByName((const char*)module_name.mb_str());
if(module)
{
//module->SetLoaded();

View File

@ -37,7 +37,7 @@ struct PsfEntry
return FormatString();
case 0x0404:
return wxString::Format("0x%x", FormatInteger()).ToStdString();
return wxString::Format("0x%x", FormatInteger()).mb_str();
}
}