mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 09:09:52 -06:00
Wrapped fopen/close/read/write functions inside a simple "IOFile" class. Reading, writing, and error checking became simpler in most cases. It should be near impossible to forget to close a file now that the destructor takes care of it. (I hope this fixes Issue 3635) I have tested the functionality of most things, but it is possible I broke something. :p
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7328 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -280,34 +280,33 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
|
||||
|
||||
case IDM_RENAME_SYMBOLS:
|
||||
{
|
||||
wxString path = wxFileSelector(
|
||||
const wxString path = wxFileSelector(
|
||||
_("Apply signature file"), wxEmptyString,
|
||||
wxEmptyString, wxEmptyString,
|
||||
_T("Dolphin Symbol Rename File (*.sym)|*.sym"),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
|
||||
if (! path.IsEmpty())
|
||||
{
|
||||
FILE *f = fopen(path.mb_str(), "r");
|
||||
if (!f)
|
||||
return;
|
||||
|
||||
while (!feof(f))
|
||||
if (!path.IsEmpty())
|
||||
{
|
||||
std::ifstream f(path.mb_str());
|
||||
|
||||
std::string line;
|
||||
while (std::getline(f, line))
|
||||
{
|
||||
char line[512];
|
||||
fgets(line, 511, f);
|
||||
if (strlen(line) < 4)
|
||||
if (line.length() < 12)
|
||||
continue;
|
||||
|
||||
u32 address, type;
|
||||
char name[512];
|
||||
sscanf(line, "%08x %02i %s", &address, &type, name);
|
||||
std::string name;
|
||||
|
||||
std::istringstream ss(line);
|
||||
ss >> std::hex >> address >> std::dec >> type >> name;
|
||||
|
||||
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(address);
|
||||
if (symbol) {
|
||||
symbol->name = line+12;
|
||||
}
|
||||
if (symbol)
|
||||
symbol->name = line.substr(12);
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
Host_NotifyMapLoaded();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user