Change our auto_ptr's to unique_ptr's.

auto_ptr is deprecated in c++11.
This commit is contained in:
Jason Felds
2013-05-04 14:11:47 -04:00
parent a8fe2634ca
commit 25c3c7d4f1
9 changed files with 472 additions and 472 deletions
+1 -1
View File
@@ -210,7 +210,7 @@ Actor* ActorUtil::MakeActor( const RString &sPath_, Actor *pParentActor )
{
case FT_Lua:
{
auto_ptr<XNode> pNode( LoadXNodeFromLuaShowErrors(sPath) );
unique_ptr<XNode> pNode( LoadXNodeFromLuaShowErrors(sPath) );
if( pNode.get() == nullptr )
{
// XNode will warn about the error
+3 -3
View File
@@ -23,13 +23,13 @@ LuaXType( Difficulty );
const RString &CourseDifficultyToLocalizedString( CourseDifficulty x )
{
static auto_ptr<LocalizedString> g_CourseDifficultyName[NUM_Difficulty];
static unique_ptr<LocalizedString> g_CourseDifficultyName[NUM_Difficulty];
if( g_CourseDifficultyName[0].get() == nullptr )
{
FOREACH_ENUM( Difficulty,i)
{
auto_ptr<LocalizedString> ap( new LocalizedString("CourseDifficulty", DifficultyToString(i)) );
g_CourseDifficultyName[i] = ap;
unique_ptr<LocalizedString> ap( new LocalizedString("CourseDifficulty", DifficultyToString(i)) );
g_CourseDifficultyName[i] = move(ap);
}
}
return g_CourseDifficultyName[x]->GetValue();
+5 -5
View File
@@ -51,18 +51,18 @@ int CheckEnum( lua_State *L, LuaReference &table, int iPos, int iInvalid, const
}
// szNameArray is of size iMax; pNameCache is of size iMax+2.
const RString &EnumToString( int iVal, int iMax, const char **szNameArray, auto_ptr<RString> *pNameCache )
const RString &EnumToString( int iVal, int iMax, const char **szNameArray, unique_ptr<RString> *pNameCache )
{
if( unlikely(pNameCache[0].get() == nullptr) )
{
for( int i = 0; i < iMax; ++i )
{
auto_ptr<RString> ap( new RString( szNameArray[i] ) );
pNameCache[i] = ap;
unique_ptr<RString> ap( new RString( szNameArray[i] ) );
pNameCache[i] = move(ap);
}
auto_ptr<RString> ap( new RString );
pNameCache[iMax+1] = ap;
unique_ptr<RString> ap( new RString );
pNameCache[iMax+1] = move(ap);
}
// iMax+1 is "Invalid". iMax+0 is the NUM_ size value, which can not be converted
+5 -5
View File
@@ -64,14 +64,14 @@ namespace Enum
void SetMetatable( lua_State *L, LuaReference &EnumTable, LuaReference &EnumIndexTable, const char *szName );
};
const RString &EnumToString( int iVal, int iMax, const char **szNameArray, auto_ptr<RString> *pNameCache ); // XToString helper
const RString &EnumToString( int iVal, int iMax, const char **szNameArray, unique_ptr<RString> *pNameCache ); // XToString helper
#define XToString(X) \
const RString& X##ToString(X x); \
COMPILE_ASSERT( NUM_##X == ARRAYLEN(X##Names) ); \
const RString& X##ToString( X x ) \
{ \
static auto_ptr<RString> as_##X##Name[NUM_##X+2]; \
static unique_ptr<RString> as_##X##Name[NUM_##X+2]; \
return EnumToString( x, NUM_##X, X##Names, as_##X##Name ); \
} \
namespace StringConversion { template<> RString ToString<X>( const X &value ) { return X##ToString(value); } }
@@ -80,12 +80,12 @@ namespace StringConversion { template<> RString ToString<X>( const X &value ) {
const RString &X##ToLocalizedString(X x); \
const RString &X##ToLocalizedString( X x ) \
{ \
static auto_ptr<LocalizedString> g_##X##Name[NUM_##X]; \
static unique_ptr<LocalizedString> g_##X##Name[NUM_##X]; \
if( g_##X##Name[0].get() == nullptr ) { \
for( unsigned i = 0; i < NUM_##X; ++i ) \
{ \
auto_ptr<LocalizedString> ap( new LocalizedString(#X, X##ToString((X)i)) ); \
g_##X##Name[i] = ap; \
unique_ptr<LocalizedString> ap( new LocalizedString(#X, X##ToString((X)i)) ); \
g_##X##Name[i] = move(ap); \
} \
} \
return g_##X##Name[x]->GetValue(); \
+1 -1
View File
@@ -406,7 +406,7 @@ Actor *NoteSkinManager::LoadActor( const RString &sButton, const RString &sEleme
return new Actor;
}
auto_ptr<XNode> pNode( XmlFileUtil::XNodeFromTable(L) );
unique_ptr<XNode> pNode( XmlFileUtil::XNodeFromTable(L) );
if( pNode.get() == nullptr )
{
// XNode will warn about the error
+4 -4
View File
@@ -801,7 +801,7 @@ ProfileLoadResult Profile::LoadAllFromDir( RString sDir, bool bRequireSignature
}
int iError;
auto_ptr<RageFileBasic> pFile( FILEMAN->Open(fn, RageFile::READ, iError) );
unique_ptr<RageFileBasic> pFile( FILEMAN->Open(fn, RageFile::READ, iError) );
if( pFile.get() == nullptr )
{
LOG->Trace( "Error opening %s: %s", fn.c_str(), strerror(iError) );
@@ -943,7 +943,7 @@ XNode *Profile::SaveStatsXmlCreateNode() const
bool Profile::SaveStatsXmlToDir( RString sDir, bool bSignData ) const
{
LOG->Trace( "SaveStatsXmlToDir: %s", sDir.c_str() );
auto_ptr<XNode> xml( SaveStatsXmlCreateNode() );
unique_ptr<XNode> xml( SaveStatsXmlCreateNode() );
// Save stats.xml
RString fn = sDir + (g_bProfileDataCompress? STATS_XML_GZ:STATS_XML);
@@ -1765,7 +1765,7 @@ void Profile::SaveStepsRecentScore( const Song* pSong, const Steps* pSteps, High
ASSERT( h.stepsID.IsValid() );
h.hs = hs;
auto_ptr<XNode> xml( new XNode("Stats") );
unique_ptr<XNode> xml( new XNode("Stats") );
xml->AppendChild( "MachineGuid", PROFILEMAN->GetMachineProfile()->m_sGuid );
XNode *recent = xml->AppendChild( new XNode("RecentSongScores") );
recent->AppendChild( h.CreateNode() );
@@ -1792,7 +1792,7 @@ void Profile::SaveCourseRecentScore( const Course* pCourse, const Trail* pTrail,
h.trailID.FromTrail( pTrail );
h.hs = hs;
auto_ptr<XNode> xml( new XNode("Stats") );
unique_ptr<XNode> xml( new XNode("Stats") );
xml->AppendChild( "MachineGuid", PROFILEMAN->GetMachineProfile()->m_sGuid );
XNode *recent = xml->AppendChild( new XNode("RecentCourseScores") );
recent->AppendChild( h.CreateNode() );
+1 -1
View File
@@ -303,7 +303,7 @@ int RageFileObjDeflate::FlushInternal()
*/
RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t *iCRC32 )
{
auto_ptr<RageFileBasic> pFile(pFile_);
unique_ptr<RageFileBasic> pFile(pFile_);
sError = "";
+1 -1
View File
@@ -257,7 +257,7 @@ void StatsManager::CommitStatsToProfiles( const StageStats *pSS )
// Save recent scores
{
auto_ptr<XNode> xml( new XNode("Stats") );
unique_ptr<XNode> xml( new XNode("Stats") );
xml->AppendChild( "MachineGuid", PROFILEMAN->GetMachineProfile()->m_sGuid );
XNode *recent = nullptr;