mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Use std::make_unique where it makes sense to
(and improve some other unique_ptr initializations). Adapted from delroth's pull request.
This commit is contained in:
@ -44,6 +44,7 @@
|
||||
#include "Common/FileSearch.h"
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/MathUtil.h"
|
||||
#include "Common/StdMakeUnique.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "Common/SysConf.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
@ -555,14 +556,13 @@ void CGameListCtrl::ScanForISOs()
|
||||
if (dialog.WasCancelled())
|
||||
break;
|
||||
|
||||
std::unique_ptr<GameListItem> iso_file(new GameListItem(rFilenames[i]));
|
||||
const GameListItem& ISOFile = *iso_file;
|
||||
auto iso_file = std::make_unique<GameListItem>(rFilenames[i]);
|
||||
|
||||
if (ISOFile.IsValid())
|
||||
if (iso_file->IsValid())
|
||||
{
|
||||
bool list = true;
|
||||
|
||||
switch (ISOFile.GetPlatform())
|
||||
switch(iso_file->GetPlatform())
|
||||
{
|
||||
case GameListItem::WII_DISC:
|
||||
if (!SConfig::GetInstance().m_ListWii)
|
||||
@ -578,7 +578,7 @@ void CGameListCtrl::ScanForISOs()
|
||||
break;
|
||||
}
|
||||
|
||||
switch (ISOFile.GetCountry())
|
||||
switch(iso_file->GetCountry())
|
||||
{
|
||||
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
||||
if (!SConfig::GetInstance().m_ListTaiwan)
|
||||
@ -621,7 +621,7 @@ void CGameListCtrl::ScanForISOs()
|
||||
|
||||
for (const auto& drive : drives)
|
||||
{
|
||||
std::unique_ptr<GameListItem> gli(new GameListItem(drive));
|
||||
auto gli = std::make_unique<GameListItem>(drive);
|
||||
|
||||
if (gli->IsValid())
|
||||
m_ISOFiles.push_back(gli.release());
|
||||
|
Reference in New Issue
Block a user