Skip to content

Commit

Permalink
Merge pull request #1986 from lioncash/unique
Browse files Browse the repository at this point in the history
Use unique_ptr for some IVolume instances
  • Loading branch information
degasus committed Jan 30, 2015
2 parents b92eb03 + b1547b9 commit 92294bf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
8 changes: 3 additions & 5 deletions Source/Core/Core/Boot/Boot.cpp
Expand Up @@ -210,7 +210,7 @@ bool CBoot::BootUp()
// GCM and Wii
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)
break;

Expand Down Expand Up @@ -267,13 +267,11 @@ bool CBoot::BootUp()
}
}

/* Try to load the symbol map if there is one, and then scan it for
and eventually replace code */
// Try to load the symbol map if there is one, and then scan it for
// and eventually replace code
if (LoadMapFromFilename())
HLE::PatchFunctions();

// We don't need the volume any more
delete pVolume;
break;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Boot/Boot_WiiWAD.cpp
Expand Up @@ -120,7 +120,7 @@ bool CBoot::Boot_WiiWAD(const std::string& _pFilename)
Memory::Write_U32(Memory::Read_U32(0x00003140), 0x00003188);

// 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)
PatchEngine::LoadPatches();

Expand Down
3 changes: 1 addition & 2 deletions Source/Core/DolphinQt/GameList/GameFile.cpp
Expand Up @@ -299,7 +299,7 @@ QString GameFile::GetName(int index) 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;

if (volume == nullptr)
Expand All @@ -323,7 +323,6 @@ const QString GameFile::GetWiiFSPath() const
else
ret = QString::fromStdString(path);
}
delete volume;

return ret;
}

0 comments on commit 92294bf

Please sign in to comment.