cdvd: Replace ScopedPtr with unique_ptr

This commit is contained in:
Jonathan Li 2016-01-26 22:07:52 +00:00
parent 5b74374bb2
commit 115b14bc94
5 changed files with 9 additions and 7 deletions

View File

@ -199,6 +199,7 @@ public:
#include <vector>
#include <list>
#include <algorithm>
#include <memory>
#include "Pcsx2Defs.h"

View File

@ -17,6 +17,7 @@
#include "IopCommon.h"
#include "AppConfig.h"
#include <memory>
#include <ctype.h>
#include <wx/datetime.h>
@ -341,8 +342,6 @@ static __fi ElfObject* loadElf( const wxString filename )
static __fi void _reloadElfInfo(wxString elfpath)
{
ScopedPtr<ElfObject> elfptr;
// Now's a good time to reload the ELF info...
ScopedLock locker( Mutex_NewDiskCB );
@ -357,7 +356,7 @@ static __fi void _reloadElfInfo(wxString elfpath)
if (fname.Matches(L"????_???.??*"))
DiscSerial = fname(0,4) + L"-" + fname(5,3) + fname(9,2);
elfptr = loadElf(elfpath);
std::unique_ptr<ElfObject> elfptr(loadElf(elfpath));
elfptr->loadHeaders();
ElfCRC = elfptr->getCRC();

View File

@ -18,6 +18,7 @@
#include "IsoFS.h"
#include "IsoFile.h"
#include <memory>
//////////////////////////////////////////////////////////////////////////
// IsoDirectory
@ -172,7 +173,7 @@ IsoFileDescriptor IsoDirectory::FindFile(const wxString& filePath) const
wxFileName parts( filePath, wxPATH_DOS );
IsoFileDescriptor info;
const IsoDirectory* dir = this;
ScopedPtr<IsoDirectory> deleteme;
std::unique_ptr<IsoDirectory> deleteme;
// walk through path ("." and ".." entries are in the directories themselves, so even if the
// path included . and/or .., it still works)
@ -182,7 +183,8 @@ IsoFileDescriptor IsoDirectory::FindFile(const wxString& filePath) const
info = dir->GetEntry(parts.GetDirs()[i]);
if(info.IsFile()) throw Exception::FileNotFound( filePath );
dir = deleteme = new IsoDirectory(internalReader, info);
deleteme.reset(new IsoDirectory(internalReader, info));
dir = deleteme.get();
}
if( !parts.GetFullName().IsEmpty() )

View File

@ -117,7 +117,7 @@ protected:
std::unique_ptr<u32[]> m_dtable;
int m_dtablesize;
ScopedPtr<wxFileOutputStream> m_outstream;
std::unique_ptr<wxFileOutputStream> m_outstream;
public:
OutputIsoFile();

View File

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