Merge pull request #1986 from lioncash/unique

Use unique_ptr for some IVolume instances
This commit is contained in:
Markus Wick 2015-01-30 12:40:10 +01:00
commit 92294bf8be
3 changed files with 5 additions and 8 deletions

View File

@ -210,7 +210,7 @@ bool CBoot::BootUp()
// GCM and Wii // GCM and Wii
case SCoreStartupParameter::BOOT_ISO: case SCoreStartupParameter::BOOT_ISO:
{ {
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_StartupPara.m_strFilename); std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(_StartupPara.m_strFilename));
if (pVolume == nullptr) if (pVolume == nullptr)
break; break;
@ -267,13 +267,11 @@ bool CBoot::BootUp()
} }
} }
/* Try to load the symbol map if there is one, and then scan it for // Try to load the symbol map if there is one, and then scan it for
and eventually replace code */ // and eventually replace code
if (LoadMapFromFilename()) if (LoadMapFromFilename())
HLE::PatchFunctions(); HLE::PatchFunctions();
// We don't need the volume any more
delete pVolume;
break; break;
} }

View File

@ -120,7 +120,7 @@ bool CBoot::Boot_WiiWAD(const std::string& _pFilename)
Memory::Write_U32(Memory::Read_U32(0x00003140), 0x00003188); Memory::Write_U32(Memory::Read_U32(0x00003140), 0x00003188);
// Load patches and run startup patches // Load patches and run startup patches
const DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_pFilename); const std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(_pFilename));
if (pVolume != nullptr) if (pVolume != nullptr)
PatchEngine::LoadPatches(); PatchEngine::LoadPatches();

View File

@ -299,7 +299,7 @@ QString GameFile::GetName(int index) const
const QString GameFile::GetWiiFSPath() const const QString GameFile::GetWiiFSPath() const
{ {
DiscIO::IVolume* volume = DiscIO::CreateVolumeFromFilename(m_file_name.toStdString()); std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(m_file_name.toStdString()));
QString ret; QString ret;
if (volume == nullptr) if (volume == nullptr)
@ -323,7 +323,6 @@ const QString GameFile::GetWiiFSPath() const
else else
ret = QString::fromStdString(path); ret = QString::fromStdString(path);
} }
delete volume;
return ret; return ret;
} }