modernize: use std::make_unique instead of std::unique_ptr

I didn't update GSdx and cdvdGigaherz because we need to pull
common include files
This commit is contained in:
Gregory Hainaut 2017-04-19 21:32:08 +02:00
parent 756176118b
commit b9e62be3c1
8 changed files with 12 additions and 12 deletions

View File

@ -576,7 +576,7 @@ void ScopedBusyCursor::SetManualBusyCursor(BusyCursorType busytype)
const wxCursor &MoreStockCursors::GetArrowWait()
{
if (!m_arrowWait)
m_arrowWait = std::unique_ptr<wxCursor>(new wxCursor(wxCURSOR_ARROWWAIT));
m_arrowWait = std::make_unique<wxCursor>(wxCURSOR_ARROWWAIT);
return *m_arrowWait;
}

View File

@ -62,7 +62,7 @@ void OutputIsoFile::Create(const wxString& filename, int version)
m_blockofs = 24;
m_blocksize = 2048;
m_outstream = std::unique_ptr<wxFileOutputStream>(new wxFileOutputStream(m_filename));
m_outstream = std::make_unique<wxFileOutputStream>(m_filename);
pxStream_OpenCheck( *m_outstream, m_filename, L"writing" );
Console.WriteLn("isoFile create ok: %s ", WX_STR(m_filename));

View File

@ -1127,7 +1127,7 @@ void SysCorePlugins::Load( PluginsEnum_t pid, const wxString& srcfile )
ScopedLock lock( m_mtx_PluginStatus );
pxAssert( (uint)pid < PluginId_Count );
m_info[pid] = std::unique_ptr<PluginStatus_t>(new PluginStatus_t(pid, srcfile));
m_info[pid] = std::make_unique<PluginStatus_t>(pid, srcfile);
Console.Indent().WriteLn(L"Bound %4s: %s [%s %s]", WX_STR(tbl_PluginInfo[pid].GetShortname()),
WX_STR(wxFileName(srcfile).GetFullName()), WX_STR(m_info[pid]->Name), WX_STR(m_info[pid]->Version));

View File

@ -297,7 +297,7 @@ template< typename CpuType >
CpuInitializer< CpuType >::CpuInitializer()
{
try {
MyCpu = std::unique_ptr<CpuType>(new CpuType());
MyCpu = std::make_unique<CpuType>();
MyCpu->Reserve();
}
catch( Exception::RuntimeError& ex )
@ -461,7 +461,7 @@ SysCpuProviderPack::SysCpuProviderPack()
Console.WriteLn( Color_StrongBlue, "Reserving memory for recompilers..." );
ConsoleIndentScope indent(1);
CpuProviders = std::unique_ptr<CpuInitializerSet>(new CpuInitializerSet());
CpuProviders = std::make_unique<CpuInitializerSet>();
try {
recCpu.Reserve();

View File

@ -1248,7 +1248,7 @@ static void LoadUiSettings()
ConLog_LoadSaveSettings( loader );
SysTraceLog_LoadSaveSettings( loader );
g_Conf = std::unique_ptr<AppConfig>(new AppConfig());
g_Conf = std::make_unique<AppConfig>();
g_Conf->LoadSave( loader );
if( !wxFile::Exists( g_Conf->CurrentIso ) )

View File

@ -424,7 +424,7 @@ int EnumeratePluginsInFolder(const wxDirName& searchpath, wxArrayString* dest)
wxArrayString* realdest = dest;
if (realdest == NULL)
{
placebo = std::unique_ptr<wxArrayString>(new wxArrayString());
placebo = std::make_unique<wxArrayString>();
realdest = placebo.get();
}
@ -562,7 +562,7 @@ void SysExecEvent_SaveSinglePlugin::InvokeEvent()
if( CoreThread.HasActiveMachine() )
{
Console.WriteLn( Color_Green, L"Suspending single plugin: " + tbl_PluginInfo[m_pid].GetShortname() );
plugstore = std::unique_ptr<VmStateBuffer>(new VmStateBuffer(L"StateCopy_SinglePlugin"));
plugstore = std::make_unique<VmStateBuffer>(L"StateCopy_SinglePlugin");
memSavingState save( plugstore.get() );
GetCorePlugins().Freeze( m_pid, save );
}

View File

@ -229,7 +229,7 @@ AppGameDatabase* Pcsx2App::GetGameDatabase()
ScopedLock lock( m_mtx_LoadingGameDB );
if( !res.GameDB )
{
res.GameDB = std::unique_ptr<AppGameDatabase>(new AppGameDatabase());
res.GameDB = std::make_unique<AppGameDatabase>();
res.GameDB->LoadFromFile();
}
return res.GameDB.get();

View File

@ -129,7 +129,7 @@ void Pcsx2App::AllocateCoreStuffs()
// FIXME : Some or all of SysCpuProviderPack should be run from the SysExecutor thread,
// so that the thread is safely blocked from being able to start emulation.
m_CpuProviders = std::unique_ptr<SysCpuProviderPack>(new SysCpuProviderPack());
m_CpuProviders = std::make_unique<SysCpuProviderPack>();
if( m_CpuProviders->HadSomeFailures( g_Conf->EmuOptions.Cpu.Recompiler ) )
{
@ -434,7 +434,7 @@ bool Pcsx2App::OnInit()
pxDoAssert = AppDoAssert;
pxDoOutOfMemory = SysOutOfMemory_EmergencyResponse;
g_Conf = std::unique_ptr<AppConfig>(new AppConfig());
g_Conf = std::make_unique<AppConfig>();
wxInitAllImageHandlers();
Console.WriteLn("Applying operating system default language...");
@ -481,7 +481,7 @@ bool Pcsx2App::OnInit()
// PCSX2 has a lot of event handling logistics, so we *cannot* depend on wxWidgets automatic event
// loop termination code. We have a much safer system in place that continues to process messages
// until all "important" threads are closed out -- not just until the main frame is closed(-ish).
m_timer_Termination = std::unique_ptr<wxTimer>(new wxTimer( this, wxID_ANY ));
m_timer_Termination = std::make_unique<wxTimer>( this, wxID_ANY );
Bind(wxEVT_TIMER, &Pcsx2App::OnScheduledTermination, this, m_timer_Termination->GetId());
SetExitOnFrameDelete( false );