ISOFile: Get rid of explicit deletes

This commit is contained in:
Lioncash 2015-11-21 21:05:31 -05:00
parent d42216e929
commit 35b02db39d
1 changed files with 15 additions and 18 deletions

View File

@ -93,28 +93,26 @@ GameListItem::GameListItem(const std::string& _rFileName, const std::unordered_m
} }
else else
{ {
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_rFileName); std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(_rFileName));
if (pVolume != nullptr) if (volume != nullptr)
{ {
m_Platform = pVolume->GetVolumeType(); m_Platform = volume->GetVolumeType();
m_names = pVolume->GetNames(true); m_names = volume->GetNames(true);
m_descriptions = pVolume->GetDescriptions(); m_descriptions = volume->GetDescriptions();
m_company = pVolume->GetCompany(); m_company = volume->GetCompany();
m_Country = pVolume->GetCountry(); m_Country = volume->GetCountry();
m_blob_type = pVolume->GetBlobType(); m_blob_type = volume->GetBlobType();
m_FileSize = pVolume->GetRawSize(); m_FileSize = volume->GetRawSize();
m_VolumeSize = pVolume->GetSize(); m_VolumeSize = volume->GetSize();
m_UniqueID = pVolume->GetUniqueID(); m_UniqueID = volume->GetUniqueID();
m_disc_number = pVolume->GetDiscNumber(); m_disc_number = volume->GetDiscNumber();
m_Revision = pVolume->GetRevision(); m_Revision = volume->GetRevision();
ReadVolumeBanner(*pVolume); ReadVolumeBanner(*volume);
delete pVolume;
m_Valid = true; m_Valid = true;
SaveToCache(); SaveToCache();
@ -330,7 +328,7 @@ std::vector<DiscIO::IVolume::ELanguage> GameListItem::GetLanguages() const
const std::string GameListItem::GetWiiFSPath() const const std::string GameListItem::GetWiiFSPath() const
{ {
DiscIO::IVolume *iso = DiscIO::CreateVolumeFromFilename(m_FileName); std::unique_ptr<DiscIO::IVolume> iso(DiscIO::CreateVolumeFromFilename(m_FileName));
std::string ret; std::string ret;
if (iso == nullptr) if (iso == nullptr)
@ -352,7 +350,6 @@ const std::string GameListItem::GetWiiFSPath() const
else else
ret = path; ret = path;
} }
delete iso;
return ret; return ret;
} }