The big NULL replacement party part 3.

Getting there I think.
This commit is contained in:
Jason Felds
2013-05-03 23:16:39 -04:00
parent ba59dd1656
commit a3f37dc2b4
73 changed files with 1880 additions and 1880 deletions
+1 -1
View File
@@ -1256,7 +1256,7 @@ const apActorCommands *Actor::GetCommand( const RString &sCommandName ) const
{ {
map<RString, apActorCommands>::const_iterator it = m_mapNameToCommands.find( sCommandName ); map<RString, apActorCommands>::const_iterator it = m_mapNameToCommands.find( sCommandName );
if( it == m_mapNameToCommands.end() ) if( it == m_mapNameToCommands.end() )
return NULL; return nullptr;
return &it->second; return &it->second;
} }
+1 -1
View File
@@ -172,7 +172,7 @@ Actor* ActorFrame::GetChild( const RString &sName )
if( a->GetName() == sName ) if( a->GetName() == sName )
return a; return a;
} }
return NULL; return nullptr;
} }
void ActorFrame::RemoveAllChildren() void ActorFrame::RemoveAllChildren()
+3 -3
View File
@@ -111,7 +111,7 @@ Actor* ActorUtil::LoadFromNode( const XNode* pNode, Actor *pParentActor )
{ {
bool bCond; bool bCond;
if( pNode->GetAttrValue("Condition", bCond) && !bCond ) if( pNode->GetAttrValue("Condition", bCond) && !bCond )
return NULL; return nullptr;
} }
RString sClass; RString sClass;
@@ -145,7 +145,7 @@ namespace
{ {
RString sScript; RString sScript;
if( !GetFileContents(sFile, sScript) ) if( !GetFileContents(sFile, sScript) )
return NULL; return nullptr;
Lua *L = LUA->Get(); Lua *L = LUA->Get();
@@ -155,7 +155,7 @@ namespace
LUA->Release( L ); LUA->Release( L );
sError = ssprintf( "Lua runtime error: %s", sError.c_str() ); sError = ssprintf( "Lua runtime error: %s", sError.c_str() );
Dialog::OK( sError, "LUA_ERROR" ); Dialog::OK( sError, "LUA_ERROR" );
return NULL; return nullptr;
} }
XNode *pRet = NULL; XNode *pRet = NULL;
+1 -1
View File
@@ -40,7 +40,7 @@ void AutoActor::Load( const RString &sPath )
Unload(); Unload();
m_pActor = ActorUtil::MakeActor( sPath ); m_pActor = ActorUtil::MakeActor( sPath );
// If a Condition is false, MakeActor will return NULL. // If a Condition is false, MakeActor will return nullptr.
if( m_pActor == nullptr ) if( m_pActor == nullptr )
m_pActor = new Actor; m_pActor = new Actor;
} }
+1 -1
View File
@@ -18,7 +18,7 @@ public:
void FinishLoading(); void FinishLoading();
RageSound *GetSound() { return &m_sSound; } RageSound *GetSound() { return &m_sSound; }
RageSoundReader *GetSharedSound() { return m_pSharedSound; } RageSoundReader *GetSharedSound() { return m_pSharedSound; }
RageSoundReader *GetPlayerSound( PlayerNumber pn ) { if( pn == PLAYER_INVALID ) return NULL; return m_pPlayerSounds[pn]; } RageSoundReader *GetPlayerSound( PlayerNumber pn ) { if( pn == PLAYER_INVALID ) return nullptr; return m_pPlayerSounds[pn]; }
protected: protected:
void LoadAutoplaySoundsInto( RageSoundReader_Chain *pChain ); void LoadAutoplaySoundsInto( RageSoundReader_Chain *pChain );
+2 -2
View File
@@ -90,7 +90,7 @@ Character* CharacterManager::GetDefaultCharacter()
/* We always have the default character. */ /* We always have the default character. */
FAIL_M("There must be a default character available!"); FAIL_M("There must be a default character available!");
return NULL; return nullptr;
} }
void CharacterManager::DemandGraphics() void CharacterManager::DemandGraphics()
@@ -113,7 +113,7 @@ Character* CharacterManager::GetCharacterFromID( RString sCharacterID )
return m_pCharacters[i]; return m_pCharacters[i];
} }
return NULL; return nullptr;
} }
+3 -3
View File
@@ -313,7 +313,7 @@ Trail* Course::GetTrail( StepsType st, CourseDifficulty cd ) const
{ {
CacheData &cache = it->second; CacheData &cache = it->second;
if( cache.null ) if( cache.null )
return NULL; return nullptr;
return &cache.trail; return &cache.trail;
} }
} }
@@ -331,7 +331,7 @@ Trail* Course::GetTrailForceRegenCache( StepsType st, CourseDifficulty cd ) cons
{ {
// This course difficulty doesn't exist. // This course difficulty doesn't exist.
cache.null = true; cache.null = true;
return NULL; return nullptr;
} }
// If we have cached RadarValues for this trail, insert them. // If we have cached RadarValues for this trail, insert them.
@@ -738,7 +738,7 @@ const Style *Course::GetCourseStyle( const Game *pGame, int iNumPlayers ) const
return pStyle; return pStyle;
} }
} }
return NULL; return nullptr;
} }
void Course::InvalidateTrailCache() void Course::InvalidateTrailCache()
+1 -1
View File
@@ -226,7 +226,7 @@ const wchar_t *FontCharmaps::get_char_map(RString name)
map<RString,const wchar_t*>::const_iterator i = charmaps.find(name); map<RString,const wchar_t*>::const_iterator i = charmaps.find(name);
if(i == charmaps.end()) if(i == charmaps.end())
return NULL; return nullptr;
return i->second; return i->second;
} }
+4 -4
View File
@@ -2921,7 +2921,7 @@ const Style* GameManager::GetEditorStyleForStepsType( StepsType st )
} }
ASSERT_M(0, ssprintf("The current game cannot use this Style with the editor!")); ASSERT_M(0, ssprintf("The current game cannot use this Style with the editor!"));
return NULL; return nullptr;
} }
@@ -3012,7 +3012,7 @@ const Style *GameManager::GetFirstCompatibleStyle( const Game *pGame, int iNumPl
return s; return s;
FAIL_M( ssprintf("No compatible styles for %s - %s with %d player%s.", pGame->m_szName, FAIL_M( ssprintf("No compatible styles for %s - %s with %d player%s.", pGame->m_szName,
GetStepsTypeInfo(st).szName, iNumPlayers, iNumPlayers==1?"":"s") ); GetStepsTypeInfo(st).szName, iNumPlayers, iNumPlayers==1?"":"s") );
return NULL; return nullptr;
} }
@@ -3100,7 +3100,7 @@ const Game* GameManager::StringToGame( RString sGame )
if( !sGame.CompareNoCase(g_Games[i]->m_szName) ) if( !sGame.CompareNoCase(g_Games[i]->m_szName) )
return g_Games[i]; return g_Games[i];
return NULL; return nullptr;
} }
@@ -3113,7 +3113,7 @@ const Style* GameManager::GameAndStringToStyle( const Game *game, RString sStyle
return style; return style;
} }
return NULL; return nullptr;
} }
// lua start // lua start
+1 -1
View File
@@ -2072,7 +2072,7 @@ bool GameState::PlayerIsUsingModifier( PlayerNumber pn, const RString &sModifier
Profile* GameState::GetEditLocalProfile() Profile* GameState::GetEditLocalProfile()
{ {
if( m_sEditLocalProfileID.Get().empty() ) if( m_sEditLocalProfileID.Get().empty() )
return NULL; return nullptr;
return PROFILEMAN->GetLocalProfile( m_sEditLocalProfileID ); return PROFILEMAN->GetLocalProfile( m_sEditLocalProfileID );
} }
+1 -1
View File
@@ -336,7 +336,7 @@ const T *FindItemBinarySearch( IT begin, IT end, const T &i )
{ {
IT it = lower_bound( begin, end, i ); IT it = lower_bound( begin, end, i );
if( it == end || *it != i ) if( it == end || *it != i )
return NULL; return nullptr;
return &*it; return &*it;
} }
+1 -1
View File
@@ -326,7 +326,7 @@ void *LuaBinding::GetPointerFromStack( Lua *L, const RString &sType, int iArg )
return *pData; return *pData;
} }
else else
return NULL; return nullptr;
} }
/* Tricky: when an instance table is copied, we want to do a deep /* Tricky: when an instance table is copied, we want to do a deep
+1 -1
View File
@@ -131,7 +131,7 @@ void AnimatedTexture::Update( float fDelta )
RageTexture* AnimatedTexture::GetCurrentTexture() RageTexture* AnimatedTexture::GetCurrentTexture()
{ {
if( vFrames.empty() ) if( vFrames.empty() )
return NULL; return nullptr;
ASSERT( m_iCurState < (int)vFrames.size() ); ASSERT( m_iCurState < (int)vFrames.size() );
return vFrames[m_iCurState].pTexture; return vFrames[m_iCurState].pTexture;
} }
+2 -2
View File
@@ -1323,7 +1323,7 @@ OptionRowHandler* OptionRowHandlerUtil::Make( const Commands &cmds )
OptionRowHandler* pHand = NULL; OptionRowHandler* pHand = NULL;
if( cmds.v.size() == 0 ) if( cmds.v.size() == 0 )
return NULL; return nullptr;
const RString &name = cmds.v[0].GetName(); const RString &name = cmds.v[0].GetName();
@@ -1335,7 +1335,7 @@ OptionRowHandler* OptionRowHandlerUtil::Make( const Commands &cmds )
const Command &command = cmds.v[0]; const Command &command = cmds.v[0];
RString sParam = command.GetArg(1).s; RString sParam = command.GetArg(1).s;
if( command.m_vsArgs.size() != 2 || !sParam.size() ) if( command.m_vsArgs.size() != 2 || !sParam.size() )
return NULL; return nullptr;
if( sParam.CompareNoCase("NoteSkins")==0 ) MAKE( OptionRowHandlerListNoteSkins ) if( sParam.CompareNoCase("NoteSkins")==0 ) MAKE( OptionRowHandlerListNoteSkins )
else if( sParam.CompareNoCase("Steps")==0 ) MAKE( OptionRowHandlerListSteps ) else if( sParam.CompareNoCase("Steps")==0 ) MAKE( OptionRowHandlerListSteps )
+1 -1
View File
@@ -29,7 +29,7 @@ IPreference *IPreference::GetPreferenceByName( const RString &sName )
return p; return p;
} }
return NULL; return nullptr;
} }
void IPreference::LoadAllDefaults() void IPreference::LoadAllDefaults()
+2 -2
View File
@@ -1804,7 +1804,7 @@ const Profile::HighScoresForASong *Profile::GetHighScoresForASong( const SongID&
map<SongID,HighScoresForASong>::const_iterator it; map<SongID,HighScoresForASong>::const_iterator it;
it = m_SongHighScores.find( songID ); it = m_SongHighScores.find( songID );
if( it == m_SongHighScores.end() ) if( it == m_SongHighScores.end() )
return NULL; return nullptr;
return &it->second; return &it->second;
} }
@@ -1813,7 +1813,7 @@ const Profile::HighScoresForACourse *Profile::GetHighScoresForACourse( const Cou
map<CourseID,HighScoresForACourse>::const_iterator it; map<CourseID,HighScoresForACourse>::const_iterator it;
it = m_CourseHighScores.find( courseID ); it = m_CourseHighScores.find( courseID );
if( it == m_CourseHighScores.end() ) if( it == m_CourseHighScores.end() )
return NULL; return nullptr;
return &it->second; return &it->second;
} }
+1 -1
View File
@@ -416,7 +416,7 @@ const Profile *ProfileManager::GetLocalProfile( const RString &sProfileID ) cons
return &dap.profile; return &dap.profile;
} }
return NULL; return nullptr;
} }
bool ProfileManager::CreateLocalProfile( RString sName, RString &sProfileIDOut ) bool ProfileManager::CreateLocalProfile( RString sName, RString &sProfileIDOut )
+2 -2
View File
@@ -224,7 +224,7 @@ public:
virtual void DeleteTexture( unsigned iTexHandle ) = 0; virtual void DeleteTexture( unsigned iTexHandle ) = 0;
/* Return an object to lock pixels for streaming. If not supported, returns NULL. /* Return an object to lock pixels for streaming. If not supported, returns NULL.
* Delete the object normally. */ * Delete the object normally. */
virtual RageTextureLock *CreateTextureLock() { return NULL; } virtual RageTextureLock *CreateTextureLock() { return nullptr; }
virtual void ClearAllTextures() = 0; virtual void ClearAllTextures() = 0;
virtual int GetNumTextureUnits() = 0; virtual int GetNumTextureUnits() = 0;
virtual void SetTexture( TextureUnit, unsigned /* iTexture */ ) = 0; virtual void SetTexture( TextureUnit, unsigned /* iTexture */ ) = 0;
@@ -313,7 +313,7 @@ public:
virtual RString GetTextureDiagnostics( unsigned /* id */ ) const { return RString(); } virtual RString GetTextureDiagnostics( unsigned /* id */ ) const { return RString(); }
virtual RageSurface* CreateScreenshot() = 0; // allocates a surface. Caller must delete it. virtual RageSurface* CreateScreenshot() = 0; // allocates a surface. Caller must delete it.
virtual RageSurface *GetTexture( unsigned /* iTexture */ ) { return NULL; } // allocates a surface. Caller must delete it. virtual RageSurface *GetTexture( unsigned /* iTexture */ ) { return nullptr; } // allocates a surface. Caller must delete it.
protected: protected:
virtual void DrawQuadsInternal( const RageSpriteVertex v[], int iNumVerts ) = 0; virtual void DrawQuadsInternal( const RageSpriteVertex v[], int iNumVerts ) = 0;
+2 -2
View File
@@ -835,7 +835,7 @@ RageSurface* RageDisplay_Legacy::CreateScreenshot()
RageSurface *RageDisplay_Legacy::GetTexture( unsigned iTexture ) RageSurface *RageDisplay_Legacy::GetTexture( unsigned iTexture )
{ {
if (iTexture == 0) if (iTexture == 0)
return NULL; // XXX return nullptr; // XXX
FlushGLErrors(); FlushGLErrors();
@@ -2277,7 +2277,7 @@ private:
RageTextureLock *RageDisplay_Legacy::CreateTextureLock() RageTextureLock *RageDisplay_Legacy::CreateTextureLock()
{ {
if (!GLEW_ARB_pixel_buffer_object) if (!GLEW_ARB_pixel_buffer_object)
return NULL; return nullptr;
return new RageTextureLock_OGL; return new RageTextureLock_OGL;
} }
+1 -1
View File
@@ -87,7 +87,7 @@ RageFileDriver *MakeFileDriver( const RString &sType, const RString &sRoot )
for( const FileDriverEntry *p = g_pFileDriverList; p; p = p->m_pLink ) for( const FileDriverEntry *p = g_pFileDriverList; p; p = p->m_pLink )
if( !p->m_sType.CompareNoCase(sType) ) if( !p->m_sType.CompareNoCase(sType) )
return p->Create( sRoot ); return p->Create( sRoot );
return NULL; return nullptr;
} }
/* /*
+9 -9
View File
@@ -314,12 +314,12 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
char magic[2]; char magic[2];
FileReading::ReadBytes( *pFile, magic, 2, sError ); FileReading::ReadBytes( *pFile, magic, 2, sError );
if( sError != "" ) if( sError != "" )
return NULL; return nullptr;
if( magic[0] != '\x1f' || magic[1] != '\x8b' ) if( magic[0] != '\x1f' || magic[1] != '\x8b' )
{ {
sError = "Not a gzipped file"; sError = "Not a gzipped file";
return NULL; return nullptr;
} }
} }
@@ -329,7 +329,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
FileReading::read_8( *pFile, sError ); /* xfl */ FileReading::read_8( *pFile, sError ); /* xfl */
FileReading::read_8( *pFile, sError ); /* os */ FileReading::read_8( *pFile, sError ); /* os */
if( sError != "" ) if( sError != "" )
return NULL; return nullptr;
#define FTEXT 1<<0 #define FTEXT 1<<0
#define FHCRC 1<<1 #define FHCRC 1<<1
@@ -340,7 +340,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
if( iCompressionMethod != 8 ) if( iCompressionMethod != 8 )
{ {
sError = ssprintf( "Unsupported compression: %i", iCompressionMethod ); sError = ssprintf( "Unsupported compression: %i", iCompressionMethod );
return NULL; return nullptr;
} }
/* Warning: flags other than FNAME are untested, since gzip doesn't /* Warning: flags other than FNAME are untested, since gzip doesn't
@@ -348,7 +348,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
if( iFlags & UNSUPPORTED_MASK ) if( iFlags & UNSUPPORTED_MASK )
{ {
sError = ssprintf( "Unsupported flags: %x", iFlags ); sError = ssprintf( "Unsupported flags: %x", iFlags );
return NULL; return nullptr;
} }
if( iFlags & FEXTRA ) if( iFlags & FEXTRA )
@@ -375,12 +375,12 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
uint16_t iExpectedCRC16 = FileReading::read_u16_le( *pFile, sError ); uint16_t iExpectedCRC16 = FileReading::read_u16_le( *pFile, sError );
uint16_t iActualCRC16 = int16_t( iActualCRC32 & 0xFFFF ); uint16_t iActualCRC16 = int16_t( iActualCRC32 & 0xFFFF );
if( sError != "" ) if( sError != "" )
return NULL; return nullptr;
if( iActualCRC16 != iExpectedCRC16 ) if( iActualCRC16 != iExpectedCRC16 )
{ {
sError = "Header CRC error"; sError = "Header CRC error";
return NULL; return nullptr;
} }
} }
@@ -389,7 +389,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
pFile->EnableCRC32( false ); pFile->EnableCRC32( false );
if( sError != "" ) if( sError != "" )
return NULL; return nullptr;
int iDataPos = pFile->Tell(); int iDataPos = pFile->Tell();
@@ -406,7 +406,7 @@ RageFileObjInflate *GunzipFile( RageFileBasic *pFile_, RString &sError, uint32_t
FileReading::Seek( *pFile, iDataPos, sError ); FileReading::Seek( *pFile, iDataPos, sError );
if( sError != "" ) if( sError != "" )
return NULL; return nullptr;
RageFileDriverSlice *pSliceFile = new RageFileDriverSlice( pFile.release(), iDataPos, iFooterPos-iDataPos ); RageFileDriverSlice *pSliceFile = new RageFileDriverSlice( pFile.release(), iDataPos, iFooterPos-iDataPos );
pSliceFile->DeleteFileWhenFinished(); pSliceFile->DeleteFileWhenFinished();
+3 -3
View File
@@ -76,7 +76,7 @@ static RageFileObjDirect *MakeFileObjDirect( RString sPath, int iMode, int &iErr
if( iFD == -1 ) if( iFD == -1 )
{ {
iError = errno; iError = errno;
return NULL; return nullptr;
} }
#if defined(UNIX) #if defined(UNIX)
@@ -85,7 +85,7 @@ static RageFileObjDirect *MakeFileObjDirect( RString sPath, int iMode, int &iErr
{ {
iError = EISDIR; iError = EISDIR;
close( iFD ); close( iFD );
return NULL; return nullptr;
} }
#endif #endif
@@ -207,7 +207,7 @@ RageFileBasic *RageFileDriverDirectReadOnly::Open( const RString &sPath, int iMo
if( iMode & RageFile::WRITE ) if( iMode & RageFile::WRITE )
{ {
iError = EROFS; iError = EROFS;
return NULL; return nullptr;
} }
return RageFileDriverDirect::Open( sPath, iMode, iError ); return RageFileDriverDirect::Open( sPath, iMode, iError );
+1 -1
View File
@@ -150,7 +150,7 @@ RageFileBasic *RageFileDriverMem::Open( const RString &sPath, int mode, int &err
if( pFile == nullptr ) if( pFile == nullptr )
{ {
err = ENOENT; err = ENOENT;
return NULL; return nullptr;
} }
return new RageFileObjMem( pFile ); return new RageFileObjMem( pFile );
+9 -9
View File
@@ -299,14 +299,14 @@ RageFileBasic *ThreadedFileWorker::Open( const RString &sPath, int iMode, int &i
if( m_pChildDriver == nullptr ) if( m_pChildDriver == nullptr )
{ {
iErr = ENODEV; iErr = ENODEV;
return NULL; return nullptr;
} }
/* If we're currently in a timed-out state, fail. */ /* If we're currently in a timed-out state, fail. */
if( IsTimedOut() ) if( IsTimedOut() )
{ {
iErr = EFAULT; /* Win32 has no ETIMEDOUT */ iErr = EFAULT; /* Win32 has no ETIMEDOUT */
return NULL; return nullptr;
} }
m_sRequestPath = sPath; m_sRequestPath = sPath;
@@ -316,7 +316,7 @@ RageFileBasic *ThreadedFileWorker::Open( const RString &sPath, int iMode, int &i
{ {
LOG->Trace( "Open(%s) timed out", sPath.c_str() ); LOG->Trace( "Open(%s) timed out", sPath.c_str() );
iErr = EFAULT; /* Win32 has no ETIMEDOUT */ iErr = EFAULT; /* Win32 has no ETIMEDOUT */
return NULL; return nullptr;
} }
iErr = m_iResultRequest; iErr = m_iResultRequest;
@@ -574,7 +574,7 @@ RageFileBasic *ThreadedFileWorker::Copy( RageFileBasic *&pFile, RString &sError
if( pFile == nullptr ) if( pFile == nullptr )
{ {
sError = "Operation timed out"; sError = "Operation timed out";
return NULL; return nullptr;
} }
m_pRequestFile = pFile; m_pRequestFile = pFile;
@@ -583,7 +583,7 @@ RageFileBasic *ThreadedFileWorker::Copy( RageFileBasic *&pFile, RString &sError
/* If we time out, we can no longer access pFile. */ /* If we time out, we can no longer access pFile. */
sError = "Operation timed out"; sError = "Operation timed out";
pFile = NULL; pFile = NULL;
return NULL; return nullptr;
} }
RageFileBasic *pRet = m_pResultFile; RageFileBasic *pRet = m_pResultFile;
@@ -747,13 +747,13 @@ public:
if( m_pFile == nullptr ) if( m_pFile == nullptr )
{ {
// SetError( "Operation timed out" ); // SetError( "Operation timed out" );
return NULL; return nullptr;
} }
if( pCopy == nullptr ) if( pCopy == nullptr )
{ {
// SetError( sError ); // SetError( sError );
return NULL; return nullptr;
} }
return new RageFileObjTimeout( m_pWorker, pCopy, m_iFileSize, m_iMode ); return new RageFileObjTimeout( m_pWorker, pCopy, m_iFileSize, m_iMode );
@@ -879,7 +879,7 @@ RageFileBasic *RageFileDriverTimeout::Open( const RString &sPath, int iMode, int
{ {
RageFileBasic *pChildFile = m_pWorker->Open( sPath, iMode, iErr ); RageFileBasic *pChildFile = m_pWorker->Open( sPath, iMode, iErr );
if( pChildFile == nullptr ) if( pChildFile == nullptr )
return NULL; return nullptr;
/* RageBasicFile::GetFileSize isn't allowed to fail, but we are; grab the file /* RageBasicFile::GetFileSize isn't allowed to fail, but we are; grab the file
* size now and store it. */ * size now and store it. */
@@ -892,7 +892,7 @@ RageFileBasic *RageFileDriverTimeout::Open( const RString &sPath, int iMode, int
/* When m_pWorker->GetFileSize fails, it takes ownership of pChildFile. */ /* When m_pWorker->GetFileSize fails, it takes ownership of pChildFile. */
ASSERT( pChildFile == nullptr ); ASSERT( pChildFile == nullptr );
iErr = EFAULT; iErr = EFAULT;
return NULL; return nullptr;
} }
} }
+4 -4
View File
@@ -296,14 +296,14 @@ RageFileBasic *RageFileDriverZip::Open( const RString &sPath, int iMode, int &iE
if( iMode & RageFile::WRITE ) if( iMode & RageFile::WRITE )
{ {
iErr = ERROR_WRITING_NOT_SUPPORTED; iErr = ERROR_WRITING_NOT_SUPPORTED;
return NULL; return nullptr;
} }
FileInfo *info = (FileInfo *) FDB->GetFilePriv( sPath ); FileInfo *info = (FileInfo *) FDB->GetFilePriv( sPath );
if( info == nullptr ) if( info == nullptr )
{ {
iErr = ENOENT; iErr = ENOENT;
return NULL; return nullptr;
} }
m_Mutex.Lock(); m_Mutex.Lock();
@@ -314,7 +314,7 @@ RageFileBasic *RageFileDriverZip::Open( const RString &sPath, int iMode, int &iE
if( !ReadLocalFileHeader(*info) ) if( !ReadLocalFileHeader(*info) )
{ {
m_Mutex.Unlock(); m_Mutex.Unlock();
return NULL; return nullptr;
} }
} }
@@ -338,7 +338,7 @@ RageFileBasic *RageFileDriverZip::Open( const RString &sPath, int iMode, int &iE
default: default:
/* unknown compression method */ /* unknown compression method */
iErr = ENOSYS; iErr = ENOSYS;
return NULL; return nullptr;
} }
} }
+3 -3
View File
@@ -154,7 +154,7 @@ public:
RageFileBasic *Open( const RString &sPath, int iMode, int &iError ) RageFileBasic *Open( const RString &sPath, int iMode, int &iError )
{ {
iError = (iMode == RageFile::WRITE)? ERROR_WRITING_NOT_SUPPORTED:ENOENT; iError = (iMode == RageFile::WRITE)? ERROR_WRITING_NOT_SUPPORTED:ENOENT;
return NULL; return nullptr;
} }
/* Never flush FDB, except in LoadFromDrivers. */ /* Never flush FDB, except in LoadFromDrivers. */
void FlushDirCache( const RString &sPath ) { } void FlushDirCache( const RString &sPath ) { }
@@ -855,7 +855,7 @@ RageFileBasic *RageFileManager::OpenForReading( const RString &sPath, int mode,
} }
UnreferenceAllDrivers( apDriverList ); UnreferenceAllDrivers( apDriverList );
return NULL; return nullptr;
} }
RageFileBasic *RageFileManager::OpenForWriting( const RString &sPath, int mode, int &iError ) RageFileBasic *RageFileManager::OpenForWriting( const RString &sPath, int mode, int &iError )
@@ -936,7 +936,7 @@ RageFileBasic *RageFileManager::OpenForWriting( const RString &sPath, int mode,
UnreferenceAllDrivers( apDriverList ); UnreferenceAllDrivers( apDriverList );
return NULL; return nullptr;
} }
bool RageFileManager::IsAFile( const RString &sPath ) { return GetFileType(sPath) == TYPE_FILE; } bool RageFileManager::IsAFile( const RString &sPath ) { return GetFileType(sPath) == TYPE_FILE; }
+1 -1
View File
@@ -118,7 +118,7 @@ InputHandler *RageInput::GetHandlerForDevice( const InputDevice id )
{ {
map<InputDevice, InputHandler *>::iterator it = g_mapDeviceToHandler.find(id); map<InputDevice, InputHandler *>::iterator it = g_mapDeviceToHandler.find(id);
if( it == g_mapDeviceToHandler.end() ) if( it == g_mapDeviceToHandler.end() )
return NULL; return nullptr;
return it->second; return it->second;
} }
+1 -1
View File
@@ -353,7 +353,7 @@ void RageLog::AddToRecentLogs( const RString &str )
const char *RageLog::GetRecentLog( int n ) const char *RageLog::GetRecentLog( int n )
{ {
if( n >= BACKLOG_LINES || n >= backlog_cnt ) if( n >= BACKLOG_LINES || n >= backlog_cnt )
return NULL; return nullptr;
if( backlog_cnt == BACKLOG_LINES ) if( backlog_cnt == BACKLOG_LINES )
{ {
+2 -2
View File
@@ -138,7 +138,7 @@ int RageSoundManager::GetDriverSampleRate() const
return m_pDriver->GetSampleRate(); return m_pDriver->GetSampleRate();
} }
/* If the given path is loaded, return a copy; otherwise return NULL. /* If the given path is loaded, return a copy; otherwise return nullptr.
* It's the caller's responsibility to delete the result. */ * It's the caller's responsibility to delete the result. */
RageSoundReader *RageSoundManager::GetLoadedSound( const RString &sPath_ ) RageSoundReader *RageSoundManager::GetLoadedSound( const RString &sPath_ )
{ {
@@ -149,7 +149,7 @@ RageSoundReader *RageSoundManager::GetLoadedSound( const RString &sPath_ )
map<RString, RageSoundReader_Preload *>::const_iterator it; map<RString, RageSoundReader_Preload *>::const_iterator it;
it = m_mapPreloadedSounds.find( sPath ); it = m_mapPreloadedSounds.find( sPath );
if( it == m_mapPreloadedSounds.end() ) if( it == m_mapPreloadedSounds.end() )
return NULL; return nullptr;
return it->second->Copy(); return it->second->Copy();
} }
+1 -1
View File
@@ -15,7 +15,7 @@ public:
virtual int GetSampleRate() const = 0; virtual int GetSampleRate() const = 0;
virtual unsigned GetNumChannels() const = 0; virtual unsigned GetNumChannels() const = 0;
virtual bool SetProperty( const RString & /* sProperty */, float /* fValue */ ) { return false; } virtual bool SetProperty( const RString & /* sProperty */, float /* fValue */ ) { return false; }
virtual RageSoundReader *GetSource() { return NULL; } virtual RageSoundReader *GetSource() { return nullptr; }
/* Return values for Read(). */ /* Return values for Read(). */
enum { enum {
+5 -5
View File
@@ -35,7 +35,7 @@ RageSoundReader_FileReader *RageSoundReader_FileReader::TryOpenFile( RageFileBas
#endif #endif
if( !Sample ) if( !Sample )
return NULL; return nullptr;
OpenResult ret = Sample->Open( pFile ); OpenResult ret = Sample->Open( pFile );
pFile = NULL; // Sample owns it now pFile = NULL; // Sample owns it now
@@ -81,7 +81,7 @@ RageSoundReader_FileReader *RageSoundReader_FileReader::TryOpenFile( RageFileBas
default: break; default: break;
} }
return NULL; return nullptr;
} }
#include "RageFileDriverMemory.h" #include "RageFileDriverMemory.h"
@@ -95,7 +95,7 @@ RageSoundReader_FileReader *RageSoundReader_FileReader::OpenFile( RString filena
{ {
error = pFileOpen->GetError(); error = pFileOpen->GetError();
delete pFileOpen; delete pFileOpen;
return NULL; return nullptr;
} }
pFile = pFileOpen; pFile = pFileOpen;
} }
@@ -109,7 +109,7 @@ RageSoundReader_FileReader *RageSoundReader_FileReader::OpenFile( RString filena
if( !bRet ) if( !bRet )
{ {
delete pMem; delete pMem;
return NULL; return nullptr;
} }
pFile = pMem; pFile = pMem;
@@ -153,7 +153,7 @@ RageSoundReader_FileReader *RageSoundReader_FileReader::OpenFile( RString filena
} }
} }
return NULL; return nullptr;
} }
/* /*
+1 -1
View File
@@ -27,7 +27,7 @@ public:
virtual unsigned GetNumChannels() const { return m_iChannels; } virtual unsigned GetNumChannels() const { return m_iChannels; }
virtual bool SetProperty( const RString &sProperty, float fValue ); virtual bool SetProperty( const RString &sProperty, float fValue );
virtual float GetStreamToSourceRatio() const; virtual float GetStreamToSourceRatio() const;
virtual RageSoundReader *GetSource() { return NULL; } virtual RageSoundReader *GetSource() { return nullptr; }
/* Enable and disable threaded buffering. Disable buffering before accessing /* Enable and disable threaded buffering. Disable buffering before accessing
* the underlying sound. DisableBuffering returns true if buffering was enabled. */ * the underlying sound. DisableBuffering returns true if buffering was enabled. */
+6 -6
View File
@@ -772,20 +772,20 @@ RageSurface *RageSurfaceUtils::LoadSurface( RString file )
{ {
RageFile f; RageFile f;
if( !f.Open( file ) ) if( !f.Open( file ) )
return NULL; return nullptr;
SurfaceHeader h; SurfaceHeader h;
if( f.Read( &h, sizeof(h) ) != sizeof(h) ) if( f.Read( &h, sizeof(h) ) != sizeof(h) )
return NULL; return nullptr;
RageSurfacePalette palette; RageSurfacePalette palette;
if( h.bpp == 8 ) if( h.bpp == 8 )
{ {
if( f.Read( &palette.ncolors, sizeof(palette.ncolors) ) != sizeof(palette.ncolors) ) if( f.Read( &palette.ncolors, sizeof(palette.ncolors) ) != sizeof(palette.ncolors) )
return NULL; return nullptr;
ASSERT_M( palette.ncolors <= 256, ssprintf("%i", palette.ncolors) ); ASSERT_M( palette.ncolors <= 256, ssprintf("%i", palette.ncolors) );
if( f.Read( palette.colors, palette.ncolors * sizeof(RageSurfaceColor) ) != int(palette.ncolors * sizeof(RageSurfaceColor)) ) if( f.Read( palette.colors, palette.ncolors * sizeof(RageSurfaceColor) ) != int(palette.ncolors * sizeof(RageSurfaceColor)) )
return NULL; return nullptr;
} }
// Create the surface. // Create the surface.
@@ -801,13 +801,13 @@ RageSurface *RageSurfaceUtils::LoadSurface( RString file )
LOG->Trace( "Error loading \"%s\": expected pitch %i, got %i (%ibpp, %i width)", LOG->Trace( "Error loading \"%s\": expected pitch %i, got %i (%ibpp, %i width)",
file.c_str(), h.pitch, img->pitch, h.bpp, h.width ); file.c_str(), h.pitch, img->pitch, h.bpp, h.width );
delete img; delete img;
return NULL; return nullptr;
} }
if( f.Read( img->pixels, h.height * h.pitch ) != h.height * h.pitch ) if( f.Read( img->pixels, h.height * h.pitch ) != h.height * h.pitch )
{ {
delete img; delete img;
return NULL; return nullptr;
} }
// Set the palette. // Set the palette.
+1 -1
View File
@@ -565,7 +565,7 @@ static acolorhist_item *pam_computeacolorhist( const RageSurface *src, int maxac
{ {
acolorhash_hash acht; acolorhash_hash acht;
if ( !pam_computeacolorhash( src, maxacolors, acolorsP, acht ) ) if ( !pam_computeacolorhash( src, maxacolors, acolorsP, acht ) )
return NULL; return nullptr;
acolorhist_item *achv = pam_acolorhashtoacolorhist( acht, *acolorsP ); acolorhist_item *achv = pam_acolorhashtoacolorhist( acht, *acolorsP );
return achv; return achv;
+4 -4
View File
@@ -26,7 +26,7 @@ static RageSurface *TryOpenFile( RString sPath, bool bHeaderOnly, RString &error
{ {
error = "Unsupported format"; error = "Unsupported format";
bKeepTrying = true; bKeepTrying = true;
return NULL; return nullptr;
} }
if( result == RageSurfaceUtils::OPEN_OK ) if( result == RageSurfaceUtils::OPEN_OK )
@@ -70,7 +70,7 @@ static RageSurface *TryOpenFile( RString sPath, bool bHeaderOnly, RString &error
default: break; default: break;
} }
return NULL; return nullptr;
} }
RageSurface *RageSurfaceUtils::LoadFile( const RString &sPath, RString &error, bool bHeaderOnly ) RageSurface *RageSurfaceUtils::LoadFile( const RString &sPath, RString &error, bool bHeaderOnly )
@@ -80,7 +80,7 @@ RageSurface *RageSurfaceUtils::LoadFile( const RString &sPath, RString &error, b
if( !TestOpen.Open( sPath ) ) if( !TestOpen.Open( sPath ) )
{ {
error = TestOpen.GetError(); error = TestOpen.GetError();
return NULL; return nullptr;
} }
} }
@@ -115,7 +115,7 @@ RageSurface *RageSurfaceUtils::LoadFile( const RString &sPath, RString &error, b
} }
} }
return NULL; return nullptr;
} }
/* /*
+2 -2
View File
@@ -399,14 +399,14 @@ static RageSurface *ReadImage( RageFile &f, int len, int height,
if( !state.Init(f) ) if( !state.Init(f) )
{ {
// RWSetMsg("error reading image"); // RWSetMsg("error reading image");
return NULL; return nullptr;
} }
/* If this is an "uninteresting picture" ignore it. */ /* If this is an "uninteresting picture" ignore it. */
if( ignore ) if( ignore )
{ {
while( state.ReadByte(f) >= 0 ) while( state.ReadByte(f) >= 0 )
; ;
return NULL; return nullptr;
} }
RageSurface *image = CreateSurface( len, height, 8, 0, 0, 0, 0 ); RageSurface *image = CreateSurface( len, height, 8, 0, 0, 0, 0 );
+2 -2
View File
@@ -132,7 +132,7 @@ static RageSurface *RageSurface_Load_JPEG( RageFile *f, const char *fn, char err
jpeg_destroy_decompress( &cinfo ); jpeg_destroy_decompress( &cinfo );
delete img; delete img;
return NULL; return nullptr;
} }
/* Now we can initialize the JPEG decompression object. */ /* Now we can initialize the JPEG decompression object. */
@@ -161,7 +161,7 @@ static RageSurface *RageSurface_Load_JPEG( RageFile *f, const char *fn, char err
case JCS_CMYK: case JCS_CMYK:
sprintf( errorbuf, "Color format \"%s\" not supported", cinfo.jpeg_color_space == JCS_YCCK? "YCCK":"CMYK" ); sprintf( errorbuf, "Color format \"%s\" not supported", cinfo.jpeg_color_space == JCS_YCCK? "YCCK":"CMYK" );
jpeg_destroy_decompress( &cinfo ); jpeg_destroy_decompress( &cinfo );
return NULL; return nullptr;
default: default:
cinfo.out_color_space = JCS_RGB; cinfo.out_color_space = JCS_RGB;
+3 -3
View File
@@ -74,7 +74,7 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
if( png == nullptr ) if( png == nullptr )
{ {
sprintf( errorbuf, "creating png_create_read_struct failed"); sprintf( errorbuf, "creating png_create_read_struct failed");
return NULL; return nullptr;
} }
png_info *info_ptr = png_create_info_struct(png); png_info *info_ptr = png_create_info_struct(png);
@@ -82,7 +82,7 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
{ {
png_destroy_read_struct( &png, NULL, NULL ); png_destroy_read_struct( &png, NULL, NULL );
sprintf( errorbuf, "creating png_create_info_struct failed"); sprintf( errorbuf, "creating png_create_info_struct failed");
return NULL; return nullptr;
} }
RageSurface *volatile img = NULL; RageSurface *volatile img = NULL;
@@ -91,7 +91,7 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
{ {
png_destroy_read_struct( &png, &info_ptr, NULL ); png_destroy_read_struct( &png, &info_ptr, NULL );
delete img; delete img;
return NULL; return nullptr;
} }
CHECKPOINT; CHECKPOINT;
+5 -5
View File
@@ -11,7 +11,7 @@
#define CheckLine() \ #define CheckLine() \
if( xpm[line] == nullptr ) { \ if( xpm[line] == nullptr ) { \
error = "short file"; \ error = "short file"; \
return NULL; \ return nullptr; \
} }
RageSurface *RageSurface_Load_XPM( char * const *xpm, RString &error ) RageSurface *RageSurface_Load_XPM( char * const *xpm, RString &error )
@@ -24,13 +24,13 @@ RageSurface *RageSurface_Load_XPM( char * const *xpm, RString &error )
if( sscanf( xpm[line++], "%i %i %i %i", &width, &height, &num_colors, &color_length ) != 4 ) if( sscanf( xpm[line++], "%i %i %i %i", &width, &height, &num_colors, &color_length ) != 4 )
{ {
error = "parse error reading specs"; error = "parse error reading specs";
return NULL; return nullptr;
} }
if( width > 2048 || height > 2048 || num_colors > 1024*16 || color_length > 4 ) if( width > 2048 || height > 2048 || num_colors > 1024*16 || color_length > 4 )
{ {
error = "spec error"; error = "spec error";
return NULL; return nullptr;
} }
vector<RageSurfaceColor> colors; vector<RageSurfaceColor> colors;
@@ -85,7 +85,7 @@ RageSurface *RageSurface_Load_XPM( char * const *xpm, RString &error )
{ {
error = ssprintf( "row %i is not expected length (%i != %i)", y, int(row.size()), width*color_length ); error = ssprintf( "row %i is not expected length (%i != %i)", y, int(row.size()), width*color_length );
delete img; delete img;
return NULL; return nullptr;
} }
int8_t *p = (int8_t *) img->pixels; int8_t *p = (int8_t *) img->pixels;
@@ -100,7 +100,7 @@ RageSurface *RageSurface_Load_XPM( char * const *xpm, RString &error )
{ {
error = ssprintf( "%ix%i is unknown color \"%s\"", x, y, color_name.c_str() ); error = ssprintf( "%ix%i is unknown color \"%s\"", x, y, color_name.c_str() );
delete img; delete img;
return NULL; return nullptr;
} }
if( colors.size() <= 256 ) if( colors.size() <= 256 )
+5 -5
View File
@@ -109,7 +109,7 @@ void ThreadSlot::ThreadCheckpoint::Set( const char *szFile, int iLine, const cha
const char *ThreadSlot::ThreadCheckpoint::GetFormattedCheckpoint() const char *ThreadSlot::ThreadCheckpoint::GetFormattedCheckpoint()
{ {
if( m_szFile == nullptr ) if( m_szFile == nullptr )
return NULL; return nullptr;
/* Make sure it's terminated: */ /* Make sure it's terminated: */
m_szFormattedBuf[ sizeof(m_szFormattedBuf)-1 ] = 0; m_szFormattedBuf[ sizeof(m_szFormattedBuf)-1 ] = 0;
@@ -120,7 +120,7 @@ const char *ThreadSlot::ThreadCheckpoint::GetFormattedCheckpoint()
const char *ThreadSlot::GetFormattedCheckpoint( int lineno ) const char *ThreadSlot::GetFormattedCheckpoint( int lineno )
{ {
if( lineno >= CHECKPOINT_COUNT || lineno >= m_iNumCheckpoints ) if( lineno >= CHECKPOINT_COUNT || lineno >= m_iNumCheckpoints )
return NULL; return nullptr;
if( m_iNumCheckpoints == CHECKPOINT_COUNT ) if( m_iNumCheckpoints == CHECKPOINT_COUNT )
{ {
@@ -194,7 +194,7 @@ static ThreadSlot *GetThreadSlotFromID( uint64_t iID )
if( g_ThreadSlots[entry].m_iID == iID ) if( g_ThreadSlots[entry].m_iID == iID )
return &g_ThreadSlots[entry]; return &g_ThreadSlots[entry];
} }
return NULL; return nullptr;
} }
static ThreadSlot *GetCurThreadSlot() static ThreadSlot *GetCurThreadSlot()
@@ -406,11 +406,11 @@ static const char *GetCheckpointLog( int slotno, int lineno )
{ {
ThreadSlot &slot = g_ThreadSlots[slotno]; ThreadSlot &slot = g_ThreadSlots[slotno];
if( !slot.m_bUsed ) if( !slot.m_bUsed )
return NULL; return nullptr;
/* Only show the "Unknown thread" entry if it has at least one checkpoint. */ /* Only show the "Unknown thread" entry if it has at least one checkpoint. */
if( &slot == g_pUnknownThreadSlot && slot.GetFormattedCheckpoint(0) == nullptr ) if( &slot == g_pUnknownThreadSlot && slot.GetFormattedCheckpoint(0) == nullptr )
return NULL; return nullptr;
if( lineno != 0 ) if( lineno != 0 )
return slot.GetFormattedCheckpoint( lineno-1 ); return slot.GetFormattedCheckpoint( lineno-1 );
+1 -1
View File
@@ -658,7 +658,7 @@ const LanguageInfo *GetLanguageInfo( const RString &sIsoCode )
return &g_langs[i]; return &g_langs[i];
} }
return NULL; return nullptr;
} }
RString join( const RString &sDeliminator, const vector<RString> &sSource) RString join( const RString &sDeliminator, const vector<RString> &sSource)
+1 -1
View File
@@ -605,7 +605,7 @@ struct char_traits_char_nocase: public char_traits<char>
if(fasttoupper(*s) == a) if(fasttoupper(*s) == a)
return s; return s;
return NULL; return nullptr;
} }
}; };
typedef basic_string<char,char_traits_char_nocase> istring; typedef basic_string<char,char_traits_char_nocase> istring;
+2 -2
View File
@@ -291,7 +291,7 @@ FileSet *FilenameDB::GetFileSet( const RString &sDir_, bool bCreate )
if( !bCreate ) if( !bCreate )
{ {
if( i == dirs.end() ) if( i == dirs.end() )
return NULL; return nullptr;
return i->second; return i->second;
} }
@@ -548,7 +548,7 @@ const File *FilenameDB::GetFile( const RString &sPath )
set<File>::iterator it; set<File>::iterator it;
it = fs->files.find( File(Name) ); it = fs->files.find( File(Name) );
if( it == fs->files.end() ) if( it == fs->files.end() )
return NULL; return nullptr;
return &*it; return &*it;
} }
+2 -2
View File
@@ -2727,7 +2727,7 @@ PlayerInfo *ScreenGameplay::GetPlayerInfo( PlayerNumber pn )
if( pi->m_pn == pn ) if( pi->m_pn == pn )
return &*pi; return &*pi;
} }
return NULL; return nullptr;
} }
PlayerInfo *ScreenGameplay::GetDummyPlayerInfo( int iDummyIndex ) PlayerInfo *ScreenGameplay::GetDummyPlayerInfo( int iDummyIndex )
@@ -2737,7 +2737,7 @@ PlayerInfo *ScreenGameplay::GetDummyPlayerInfo( int iDummyIndex )
if( pi->m_bIsDummy && pi->m_iDummyIndex == iDummyIndex ) if( pi->m_bIsDummy && pi->m_iDummyIndex == iDummyIndex )
return &*pi; return &*pi;
} }
return NULL; return nullptr;
} }
void ScreenGameplay::SaveReplay() void ScreenGameplay::SaveReplay()
+2 -2
View File
@@ -332,14 +332,14 @@ void ScreenManager::ReloadOverlayScreens()
Screen *ScreenManager::GetTopScreen() Screen *ScreenManager::GetTopScreen()
{ {
if( g_ScreenStack.empty() ) if( g_ScreenStack.empty() )
return NULL; return nullptr;
return g_ScreenStack[g_ScreenStack.size()-1].m_pScreen; return g_ScreenStack[g_ScreenStack.size()-1].m_pScreen;
} }
Screen *ScreenManager::GetScreen( int iPosition ) Screen *ScreenManager::GetScreen( int iPosition )
{ {
if( iPosition >= (int) g_ScreenStack.size() ) if( iPosition >= (int) g_ScreenStack.size() )
return NULL; return nullptr;
return g_ScreenStack[iPosition].m_pScreen; return g_ScreenStack[iPosition].m_pScreen;
} }
+1 -1
View File
@@ -429,7 +429,7 @@ Song *ScreenOptionsEditCourse::GetSongForEntry( int iEntryIndex )
int index = row.GetOneSharedSelection(); int index = row.GetOneSharedSelection();
if( index == 0 ) if( index == 0 )
return NULL; return nullptr;
return m_vpSongs[ index - 1 ]; return m_vpSongs[ index - 1 ];
} }
+2 -2
View File
@@ -262,9 +262,9 @@ Course *ScreenOptionsManageCourses::GetCourseWithFocus() const
{ {
int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
if( iCurRow == 0 ) if( iCurRow == 0 )
return NULL; return nullptr;
else if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit ) else if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit )
return NULL; return nullptr;
// a course // a course
int index = iCurRow - 1; int index = iCurRow - 1;
+2 -2
View File
@@ -294,9 +294,9 @@ Steps *ScreenOptionsManageEditSteps::GetStepsWithFocus() const
{ {
int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
if( iCurRow == 0 ) if( iCurRow == 0 )
return NULL; return nullptr;
else if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit ) else if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit )
return NULL; return nullptr;
// a Steps // a Steps
int iStepsIndex = iCurRow - 1; int iStepsIndex = iCurRow - 1;
+1 -1
View File
@@ -785,7 +785,7 @@ ConfOption *ConfOption::Find( RString name )
return opt; return opt;
} }
return NULL; return nullptr;
} }
void ConfOption::UpdateAvailableOptions() void ConfOption::UpdateAvailableOptions()
+13 -13
View File
@@ -1242,7 +1242,7 @@ void SongManager::GetExtraStageInfo( bool bExtra2, const Style *sd, Song*& pSong
Song* SongManager::GetRandomSong() Song* SongManager::GetRandomSong()
{ {
if( m_pShuffledSongs.empty() ) if( m_pShuffledSongs.empty() )
return NULL; return nullptr;
static int i = 0; static int i = 0;
@@ -1258,13 +1258,13 @@ Song* SongManager::GetRandomSong()
return pSong; return pSong;
} }
return NULL; return nullptr;
} }
Course* SongManager::GetRandomCourse() Course* SongManager::GetRandomCourse()
{ {
if( m_pShuffledCourses.empty() ) if( m_pShuffledCourses.empty() )
return NULL; return nullptr;
static int i = 0; static int i = 0;
@@ -1282,7 +1282,7 @@ Course* SongManager::GetRandomCourse()
return pCourse; return pCourse;
} }
return NULL; return nullptr;
} }
Song* SongManager::GetSongFromDir( RString sDir ) const Song* SongManager::GetSongFromDir( RString sDir ) const
@@ -1296,13 +1296,13 @@ Song* SongManager::GetSongFromDir( RString sDir ) const
if( sDir.EqualsNoCase(s->GetSongDir()) ) if( sDir.EqualsNoCase(s->GetSongDir()) )
return s; return s;
return NULL; return nullptr;
} }
Course* SongManager::GetCourseFromPath( RString sPath ) const Course* SongManager::GetCourseFromPath( RString sPath ) const
{ {
if( sPath == "" ) if( sPath == "" )
return NULL; return nullptr;
for (Course *c : m_pCourses) for (Course *c : m_pCourses)
{ {
@@ -1310,19 +1310,19 @@ Course* SongManager::GetCourseFromPath( RString sPath ) const
return c; return c;
} }
return NULL; return nullptr;
} }
Course* SongManager::GetCourseFromName( RString sName ) const Course* SongManager::GetCourseFromName( RString sName ) const
{ {
if( sName == "" ) if( sName == "" )
return NULL; return nullptr;
for (Course *c : m_pCourses) for (Course *c : m_pCourses)
if( sName.CompareNoCase(c->GetDisplayFullTitle()) == 0 ) if( sName.CompareNoCase(c->GetDisplayFullTitle()) == 0 )
return c; return c;
return NULL; return nullptr;
} }
@@ -1350,7 +1350,7 @@ Song *SongManager::FindSong( RString sPath ) const
else if( bits.size() == 2 ) else if( bits.size() == 2 )
return FindSong( bits[0], bits[1] ); return FindSong( bits[0], bits[1] );
return NULL; return nullptr;
} }
Song *SongManager::FindSong( RString sGroup, RString sSong ) const Song *SongManager::FindSong( RString sGroup, RString sSong ) const
@@ -1363,7 +1363,7 @@ Song *SongManager::FindSong( RString sGroup, RString sSong ) const
return s; return s;
} }
return NULL; return nullptr;
} }
Course *SongManager::FindCourse( RString sPath ) const Course *SongManager::FindCourse( RString sPath ) const
@@ -1377,7 +1377,7 @@ Course *SongManager::FindCourse( RString sPath ) const
else if( bits.size() == 2 ) else if( bits.size() == 2 )
return FindCourse( bits[0], bits[1] ); return FindCourse( bits[0], bits[1] );
return NULL; return nullptr;
} }
Course *SongManager::FindCourse( RString sGroup, RString sName ) const Course *SongManager::FindCourse( RString sGroup, RString sName ) const
@@ -1388,7 +1388,7 @@ Course *SongManager::FindCourse( RString sGroup, RString sName ) const
return c; return c;
} }
return NULL; return nullptr;
} }
void SongManager::UpdatePopular() void SongManager::UpdatePopular()
+5 -5
View File
@@ -158,7 +158,7 @@ Steps* SongUtil::GetOneSteps(
vector<Steps*> vpSteps; vector<Steps*> vpSteps;
GetSteps( pSong, vpSteps, st, dc, iMeterLow, iMeterHigh, sDescription, sCredit, bIncludeAutoGen, uHash, 1 ); // get max 1 GetSteps( pSong, vpSteps, st, dc, iMeterLow, iMeterHigh, sDescription, sCredit, bIncludeAutoGen, uHash, 1 ); // get max 1
if( vpSteps.empty() ) if( vpSteps.empty() )
return NULL; return nullptr;
else else
return vpSteps[0]; return vpSteps[0];
} }
@@ -178,7 +178,7 @@ Steps* SongUtil::GetStepsByDifficulty( const Song *pSong, StepsType st, Difficul
return pSteps; return pSteps;
} }
return NULL; return nullptr;
} }
Steps* SongUtil::GetStepsByMeter( const Song *pSong, StepsType st, int iMeterLow, int iMeterHigh ) Steps* SongUtil::GetStepsByMeter( const Song *pSong, StepsType st, int iMeterLow, int iMeterHigh )
@@ -196,7 +196,7 @@ Steps* SongUtil::GetStepsByMeter( const Song *pSong, StepsType st, int iMeterLow
return pSteps; return pSteps;
} }
return NULL; return nullptr;
} }
Steps* SongUtil::GetStepsByDescription( const Song *pSong, StepsType st, RString sDescription ) Steps* SongUtil::GetStepsByDescription( const Song *pSong, StepsType st, RString sDescription )
@@ -204,7 +204,7 @@ Steps* SongUtil::GetStepsByDescription( const Song *pSong, StepsType st, RString
vector<Steps*> vNotes; vector<Steps*> vNotes;
GetSteps( pSong, vNotes, st, Difficulty_Invalid, -1, -1, sDescription, "" ); GetSteps( pSong, vNotes, st, Difficulty_Invalid, -1, -1, sDescription, "" );
if( vNotes.size() == 0 ) if( vNotes.size() == 0 )
return NULL; return nullptr;
else else
return vNotes[0]; return vNotes[0];
} }
@@ -214,7 +214,7 @@ Steps* SongUtil::GetStepsByCredit( const Song *pSong, StepsType st, RString sCre
vector<Steps*> vNotes; vector<Steps*> vNotes;
GetSteps(pSong, vNotes, st, Difficulty_Invalid, -1, -1, "", sCredit ); GetSteps(pSong, vNotes, st, Difficulty_Invalid, -1, -1, "", sCredit );
if( vNotes.size() == 0 ) if( vNotes.size() == 0 )
return NULL; return nullptr;
else else
return vNotes[0]; return vNotes[0];
} }
+1 -1
View File
@@ -243,7 +243,7 @@ void StepsID::FromSteps( const Steps *p )
Steps *StepsID::ToSteps( const Song *p, bool bAllowNull ) const Steps *StepsID::ToSteps( const Song *p, bool bAllowNull ) const
{ {
if( st == StepsType_Invalid || dc == Difficulty_Invalid ) if( st == StepsType_Invalid || dc == Difficulty_Invalid )
return NULL; return nullptr;
SongID songID; SongID songID;
songID.FromSong( p ); songID.FromSong( p );
+1 -1
View File
@@ -24,7 +24,7 @@ const Style *StyleID::ToStyle() const
{ {
const Game* pGame = GAMEMAN->StringToGame( sGame ); const Game* pGame = GAMEMAN->StringToGame( sGame );
if( pGame == nullptr ) if( pGame == nullptr )
return NULL; return nullptr;
return GAMEMAN->GameAndStringToStyle( pGame, sStyle ); return GAMEMAN->GameAndStringToStyle( pGame, sStyle );
} }
+5 -5
View File
@@ -203,7 +203,7 @@ const UnlockEntry *UnlockManager::FindSong( const Song *pSong ) const
for (UnlockEntry const &e : m_UnlockEntries) for (UnlockEntry const &e : m_UnlockEntries)
if( e.m_Song.ToSong() == pSong && e.m_dc == Difficulty_Invalid ) if( e.m_Song.ToSong() == pSong && e.m_dc == Difficulty_Invalid )
return &e; return &e;
return NULL; return nullptr;
} }
const UnlockEntry *UnlockManager::FindSteps( const Song *pSong, const Steps *pSteps ) const const UnlockEntry *UnlockManager::FindSteps( const Song *pSong, const Steps *pSteps ) const
@@ -212,7 +212,7 @@ const UnlockEntry *UnlockManager::FindSteps( const Song *pSong, const Steps *pSt
for (UnlockEntry const &e : m_UnlockEntries) for (UnlockEntry const &e : m_UnlockEntries)
if( e.m_Song.ToSong() == pSong && e.m_dc == pSteps->GetDifficulty() ) if( e.m_Song.ToSong() == pSong && e.m_dc == pSteps->GetDifficulty() )
return &e; return &e;
return NULL; return nullptr;
} }
const UnlockEntry *UnlockManager::FindStepsType(const Song *pSong, const UnlockEntry *UnlockManager::FindStepsType(const Song *pSong,
@@ -225,7 +225,7 @@ const UnlockEntry *UnlockManager::FindStepsType(const Song *pSong,
e.m_dc == pSteps->GetDifficulty() && e.m_dc == pSteps->GetDifficulty() &&
e.m_StepsType == pSteps->m_StepsType) e.m_StepsType == pSteps->m_StepsType)
return &e; return &e;
return NULL; return nullptr;
} }
const UnlockEntry *UnlockManager::FindCourse( const Course *pCourse ) const const UnlockEntry *UnlockManager::FindCourse( const Course *pCourse ) const
@@ -233,7 +233,7 @@ const UnlockEntry *UnlockManager::FindCourse( const Course *pCourse ) const
for (UnlockEntry const &e : m_UnlockEntries) for (UnlockEntry const &e : m_UnlockEntries)
if( e.m_Course.ToCourse() == pCourse ) if( e.m_Course.ToCourse() == pCourse )
return &e; return &e;
return NULL; return nullptr;
} }
const UnlockEntry *UnlockManager::FindModifier( const RString &sOneMod ) const const UnlockEntry *UnlockManager::FindModifier( const RString &sOneMod ) const
@@ -241,7 +241,7 @@ const UnlockEntry *UnlockManager::FindModifier( const RString &sOneMod ) const
for (UnlockEntry const &e : m_UnlockEntries) for (UnlockEntry const &e : m_UnlockEntries)
if( e.GetModifier().CompareNoCase(sOneMod) == 0 ) if( e.GetModifier().CompareNoCase(sOneMod) == 0 )
return &e; return &e;
return NULL; return nullptr;
} }
static float GetArcadePoints( const Profile *pProfile ) static float GetArcadePoints( const Profile *pProfile )
+2 -2
View File
@@ -320,7 +320,7 @@ WheelItemBaseData* WheelBase::GetItem( unsigned int iIndex )
if( !m_bEmpty && iIndex < m_CurWheelItemData.size() ) if( !m_bEmpty && iIndex < m_CurWheelItemData.size() )
return m_CurWheelItemData[iIndex]; return m_CurWheelItemData[iIndex];
return NULL; return nullptr;
} }
int WheelBase::IsMoving() const int WheelBase::IsMoving() const
@@ -502,7 +502,7 @@ void WheelBase::RebuildWheelItems( int iDist )
WheelItemBaseData* WheelBase::LastSelected() WheelItemBaseData* WheelBase::LastSelected()
{ {
if( m_bEmpty ) if( m_bEmpty )
return NULL; return nullptr;
else else
return m_LastSelection; return m_LastSelection;
} }
+1 -1
View File
@@ -61,7 +61,7 @@ public:
bool IsEmpty() { return m_bEmpty; } bool IsEmpty() { return m_bEmpty; }
WheelItemBaseData* GetItem(unsigned int index); WheelItemBaseData* GetItem(unsigned int index);
WheelItemBaseData* LastSelected(); WheelItemBaseData* LastSelected();
WheelItemBase *GetWheelItem( int i ) { if( i < 0 || i >= (int) m_WheelBaseItems.size() ) return NULL; return m_WheelBaseItems[i]; } WheelItemBase *GetWheelItem( int i ) { if( i < 0 || i >= (int) m_WheelBaseItems.size() ) return nullptr; return m_WheelBaseItems[i]; }
RString GetExpandedSectionName() { return m_sExpandedSectionName; } RString GetExpandedSectionName() { return m_sExpandedSectionName; }
int GetCurrentIndex() { return m_iSelection; } int GetCurrentIndex() { return m_iSelection; }
+4 -4
View File
@@ -73,7 +73,7 @@ const XNodeValue *XNode::GetAttr( const RString &attrname ) const
XAttrs::const_iterator it = m_attrs.find( attrname ); XAttrs::const_iterator it = m_attrs.find( attrname );
if( it != m_attrs.end() ) if( it != m_attrs.end() )
return it->second; return it->second;
return NULL; return nullptr;
} }
bool XNode::PushAttrValue( lua_State *L, const RString &sName ) const bool XNode::PushAttrValue( lua_State *L, const RString &sName ) const
@@ -93,7 +93,7 @@ XNodeValue *XNode::GetAttr( const RString &attrname )
XAttrs::iterator it = m_attrs.find( attrname ); XAttrs::iterator it = m_attrs.find( attrname );
if( it != m_attrs.end() ) if( it != m_attrs.end() )
return it->second; return it->second;
return NULL; return nullptr;
} }
XNode *XNode::GetChild( const RString &sName ) XNode *XNode::GetChild( const RString &sName )
@@ -103,7 +103,7 @@ XNode *XNode::GetChild( const RString &sName )
if( it->GetName() == sName ) if( it->GetName() == sName )
return it; return it;
} }
return NULL; return nullptr;
} }
bool XNode::PushChildValue( lua_State *L, const RString &sName ) const bool XNode::PushChildValue( lua_State *L, const RString &sName ) const
@@ -125,7 +125,7 @@ const XNode *XNode::GetChild( const RString &sName ) const
if( it->GetName() == sName ) if( it->GetName() == sName )
return it; return it;
} }
return NULL; return nullptr;
} }
XNode *XNode::AppendChild( XNode *node ) XNode *XNode::AppendChild( XNode *node )
+1 -1
View File
@@ -40,7 +40,7 @@ DialogDriver *DialogDriver::Create()
LOG->Info( "Couldn't load driver %s: %s", Driver.c_str(), sError.c_str() ); LOG->Info( "Couldn't load driver %s: %s", Driver.c_str(), sError.c_str() );
SAFE_DELETE( pRet ); SAFE_DELETE( pRet );
} }
return NULL; return nullptr;
} }
@@ -180,7 +180,7 @@ static HIDDevice *MakeDevice( InputDevice id )
return new JoystickDevice; return new JoystickDevice;
if( IsPump(id) ) if( IsPump(id) )
return new PumpDevice; return new PumpDevice;
return NULL; return nullptr;
} }
void InputHandler_MacOSX_HID::AddDevices( int usagePage, int usage, InputDevice &id ) void InputHandler_MacOSX_HID::AddDevices( int usagePage, int usage, InputDevice &id )
@@ -49,7 +49,7 @@ extern "C" const char *Init( int *argc, char ***argv )
gtk_widget_show_all(window); gtk_widget_show_all(window);
gtk_main_iteration_do(FALSE); gtk_main_iteration_do(FALSE);
return NULL; return nullptr;
} }
extern "C" void Shutdown() extern "C" void Shutdown()
@@ -74,7 +74,7 @@ static HBITMAP LoadWin32Surface( RString sFile, HWND hWnd )
RString error; RString error;
RageSurface *pSurface = RageSurfaceUtils::LoadFile( sFile, error ); RageSurface *pSurface = RageSurfaceUtils::LoadFile( sFile, error );
if( pSurface == nullptr ) if( pSurface == nullptr )
return NULL; return nullptr;
HBITMAP ret = LoadWin32Surface( pSurface, hWnd ); HBITMAP ret = LoadWin32Surface( pSurface, hWnd );
delete pSurface; delete pSurface;
+1 -1
View File
@@ -33,7 +33,7 @@ public:
virtual const VideoModeParams &GetActualVideoModeParams() const = 0; virtual const VideoModeParams &GetActualVideoModeParams() const = 0;
virtual bool SupportsRenderToTexture() const { return false; } virtual bool SupportsRenderToTexture() const { return false; }
virtual RenderTarget *CreateRenderTarget() { return NULL; } virtual RenderTarget *CreateRenderTarget() { return nullptr; }
virtual bool SupportsThreadedRendering() { return false; } virtual bool SupportsThreadedRendering() { return false; }
virtual void BeginConcurrentRenderingMainThread() { } virtual void BeginConcurrentRenderingMainThread() { }
+2 -2
View File
@@ -13,11 +13,11 @@ void DriverList::Add( const istring &sName, CreateRageDriverFn pfn )
RageDriver *DriverList::Create( const RString &sDriverName ) RageDriver *DriverList::Create( const RString &sDriverName )
{ {
if( m_pRegistrees == nullptr ) if( m_pRegistrees == nullptr )
return NULL; return nullptr;
map<istring, CreateRageDriverFn>::const_iterator iter = m_pRegistrees->find( istring(sDriverName) ); map<istring, CreateRageDriverFn>::const_iterator iter = m_pRegistrees->find( istring(sDriverName) );
if( iter == m_pRegistrees->end() ) if( iter == m_pRegistrees->end() )
return NULL; return nullptr;
return (iter->second)(); return (iter->second)();
} }
+1 -1
View File
@@ -34,7 +34,7 @@ RageSoundDriver *RageSoundDriver::Create( const RString& sDrivers )
LOG->Info( "Couldn't load driver %s: %s", driverString, sError.c_str() ); LOG->Info( "Couldn't load driver %s: %s", driverString, sError.c_str() );
SAFE_DELETE( pRet ); SAFE_DELETE( pRet );
} }
return NULL; return nullptr;
} }
/* /*
+12 -12
View File
@@ -284,13 +284,13 @@ WinWdmPin *WinWdmFilter::CreatePin( unsigned long iPinId, RString &sError )
&communication, sizeof(KSPIN_COMMUNICATION), sError) ) &communication, sizeof(KSPIN_COMMUNICATION), sError) )
{ {
sError = "KSPROPERTY_PIN_COMMUNICATION: " + sError; sError = "KSPROPERTY_PIN_COMMUNICATION: " + sError;
return NULL; return nullptr;
} }
if( communication != KSPIN_COMMUNICATION_SINK && communication != KSPIN_COMMUNICATION_BOTH ) if( communication != KSPIN_COMMUNICATION_SINK && communication != KSPIN_COMMUNICATION_BOTH )
{ {
sError = "Not an audio output device"; sError = "Not an audio output device";
return NULL; return nullptr;
} }
} }
@@ -301,13 +301,13 @@ WinWdmPin *WinWdmFilter::CreatePin( unsigned long iPinId, RString &sError )
&dataFlow, sizeof(KSPIN_DATAFLOW), sError) ) &dataFlow, sizeof(KSPIN_DATAFLOW), sError) )
{ {
sError = "KSPROPERTY_PIN_DATAFLOW: " + sError; sError = "KSPROPERTY_PIN_DATAFLOW: " + sError;
return NULL; return nullptr;
} }
if( dataFlow != KSPIN_DATAFLOW_IN ) if( dataFlow != KSPIN_DATAFLOW_IN )
{ {
sError = "Not KSPIN_DATAFLOW_IN"; sError = "Not KSPIN_DATAFLOW_IN";
return NULL; return nullptr;
} }
} }
@@ -317,7 +317,7 @@ WinWdmPin *WinWdmFilter::CreatePin( unsigned long iPinId, RString &sError )
if( !WdmGetPinPropertyMulti(m_hHandle, iPinId, &KSPROPSETID_Pin, KSPROPERTY_PIN_INTERFACES, &pItem, sError) ) if( !WdmGetPinPropertyMulti(m_hHandle, iPinId, &KSPROPSETID_Pin, KSPROPERTY_PIN_INTERFACES, &pItem, sError) )
{ {
sError = "KSPROPERTY_PIN_INTERFACES: " + sError; sError = "KSPROPERTY_PIN_INTERFACES: " + sError;
return NULL; return nullptr;
} }
KSIDENTIFIER *identifier = (KSIDENTIFIER *) &pItem[1]; KSIDENTIFIER *identifier = (KSIDENTIFIER *) &pItem[1];
@@ -337,7 +337,7 @@ WinWdmPin *WinWdmFilter::CreatePin( unsigned long iPinId, RString &sError )
free( pItem ); free( pItem );
if( sError != "" ) if( sError != "" )
return NULL; return nullptr;
} }
/* Get the MEDIUM properties list */ /* Get the MEDIUM properties list */
@@ -346,7 +346,7 @@ WinWdmPin *WinWdmFilter::CreatePin( unsigned long iPinId, RString &sError )
if( !WdmGetPinPropertyMulti( m_hHandle, iPinId, &KSPROPSETID_Pin, KSPROPERTY_PIN_MEDIUMS, &pItem, sError) ) if( !WdmGetPinPropertyMulti( m_hHandle, iPinId, &KSPROPSETID_Pin, KSPROPERTY_PIN_MEDIUMS, &pItem, sError) )
{ {
sError = "KSPROPERTY_PIN_MEDIUMS: " + sError; sError = "KSPROPERTY_PIN_MEDIUMS: " + sError;
return NULL; return nullptr;
} }
const KSIDENTIFIER *identifier = (KSIDENTIFIER *) &pItem[1]; const KSIDENTIFIER *identifier = (KSIDENTIFIER *) &pItem[1];
@@ -366,7 +366,7 @@ WinWdmPin *WinWdmFilter::CreatePin( unsigned long iPinId, RString &sError )
free( pItem ); free( pItem );
if( sError != "" ) if( sError != "" )
return NULL; return nullptr;
} }
/* Allocate the new PIN object */ /* Allocate the new PIN object */
@@ -421,7 +421,7 @@ WinWdmPin *WinWdmFilter::CreatePin( unsigned long iPinId, RString &sError )
error: error:
/* Error cleanup */ /* Error cleanup */
delete pPin; delete pPin;
return NULL; return nullptr;
} }
/* If the pin handle is open, close it */ /* If the pin handle is open, close it */
@@ -575,7 +575,7 @@ WinWdmFilter *WinWdmFilter::Create( const RString &sFilterName, const RString &s
error: error:
/* Error cleanup */ /* Error cleanup */
delete pFilter; delete pFilter;
return NULL; return nullptr;
} }
/* /*
@@ -634,7 +634,7 @@ WinWdmPin *WinWdmFilter::InstantiateRenderPin( const WAVEFORMATEX *wfex, RString
} }
sError = "No pin supports format"; sError = "No pin supports format";
return NULL; return nullptr;
} }
template<typename T, typename U> template<typename T, typename U>
@@ -790,7 +790,7 @@ WinWdmPin *WinWdmFilter::InstantiateRenderPin(
} }
sError = "No compatible format found"; sError = "No compatible format found";
return NULL; return nullptr;
} }
static bool GetDevicePath( HANDLE hHandle, SP_DEVICE_INTERFACE_DATA *pInterfaceData, RString &sPath ) static bool GetDevicePath( HANDLE hHandle, SP_DEVICE_INTERFACE_DATA *pInterfaceData, RString &sPath )
+1 -1
View File
@@ -26,7 +26,7 @@ HANDLE Win32ThreadIdToHandle( uint64_t iID )
return g_ThreadHandles[i]; return g_ThreadHandles[i];
} }
return NULL; return nullptr;
} }
void ThreadImpl_Win32::Halt( bool Kill ) void ThreadImpl_Win32::Halt( bool Kill )
+1 -1
View File
@@ -217,7 +217,7 @@ static const char *osx_find_link_edit( const struct mach_header *header )
return (char *) ( scmd->vmaddr - scmd->fileoff ); return (char *) ( scmd->vmaddr - scmd->fileoff );
} }
return NULL; return nullptr;
} }
void BacktraceNames::FromAddr( const void *p ) void BacktraceNames::FromAddr( const void *p )
+2 -2
View File
@@ -119,9 +119,9 @@ static void *CreateStack( int size )
p = (char *) mmap( NULL, size+PageSize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 ); p = (char *) mmap( NULL, size+PageSize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 );
if( p == (void *) -1 ) if( p == (void *) -1 )
return NULL; return nullptr;
// if( posix_memalign( (void**) &p, PageSize, RealSize ) != 0 ) // if( posix_memalign( (void**) &p, PageSize, RealSize ) != 0 )
// return NULL; // return nullptr;
if( find_stack_direction() < 0 ) if( find_stack_direction() < 0 )
{ {
+4 -4
View File
@@ -58,7 +58,7 @@ static const char *LookupException( DWORD code )
if( exceptions[i].code == code ) if( exceptions[i].code == code )
return exceptions[i].name; return exceptions[i].name;
return NULL; return nullptr;
} }
static CrashInfo g_CrashInfo; static CrashInfo g_CrashInfo;
@@ -154,13 +154,13 @@ static const char *CrashGetModuleBaseName(HMODULE hmod, char *pszBaseName)
__try { __try {
if( !GetModuleFileName(hmod, szPath1, sizeof(szPath1)) ) if( !GetModuleFileName(hmod, szPath1, sizeof(szPath1)) )
return NULL; return nullptr;
char *pszFile; char *pszFile;
DWORD dw = GetFullPathName( szPath1, sizeof(szPath2), szPath2, &pszFile ); DWORD dw = GetFullPathName( szPath1, sizeof(szPath2), szPath2, &pszFile );
if( !dw || dw > sizeof(szPath2) ) if( !dw || dw > sizeof(szPath2) )
return NULL; return nullptr;
strcpy( pszBaseName, pszFile ); strcpy( pszBaseName, pszFile );
@@ -174,7 +174,7 @@ static const char *CrashGetModuleBaseName(HMODULE hmod, char *pszBaseName)
if( period ) if( period )
*period = 0; *period = 0;
} __except(1) { } __except(1) {
return NULL; return nullptr;
} }
return pszBaseName; return pszBaseName;
+1 -1
View File
@@ -286,7 +286,7 @@ namespace SymbolLookup
pSymbol->MaxNameLen = sizeof(buffer) - sizeof(SYMBOL_INFO) + 1; pSymbol->MaxNameLen = sizeof(buffer) - sizeof(SYMBOL_INFO) + 1;
if( !SymFromAddr(g_hParent, ptr, &disp, pSymbol) ) if( !SymFromAddr(g_hParent, ptr, &disp, pSymbol) )
return NULL; return nullptr;
return pSymbol; return pSymbol;
} }
@@ -158,7 +158,7 @@ NetworkStream *CreateNetworkStream()
WSADATA WSAData; WSADATA WSAData;
WORD iVersionRequested = MAKEWORD(2,0); WORD iVersionRequested = MAKEWORD(2,0);
if( WSAStartup(iVersionRequested, &WSAData) != 0 ) if( WSAStartup(iVersionRequested, &WSAData) != 0 )
return NULL; return nullptr;
} }
return new NetworkStream_Win32; return new NetworkStream_Win32;
+4 -4
View File
@@ -36,14 +36,14 @@ static bool GetRegKeyType( const RString &sIn, RString &sOut, HKEY &key )
} }
/* Given a full key, eg. "HKEY_LOCAL_MACHINE\hardware\foo", open it and return it. /* Given a full key, eg. "HKEY_LOCAL_MACHINE\hardware\foo", open it and return it.
* On error, return NULL. */ * On error, return nullptr. */
enum RegKeyMode { READ, WRITE }; enum RegKeyMode { READ, WRITE };
static HKEY OpenRegKey( const RString &sKey, RegKeyMode mode, bool bWarnOnError = true ) static HKEY OpenRegKey( const RString &sKey, RegKeyMode mode, bool bWarnOnError = true )
{ {
RString sSubkey; RString sSubkey;
HKEY hType; HKEY hType;
if( !GetRegKeyType(sKey, sSubkey, hType) ) if( !GetRegKeyType(sKey, sSubkey, hType) )
return NULL; return nullptr;
HKEY hRetKey; HKEY hRetKey;
LONG retval = RegOpenKeyEx( hType, sSubkey, 0, (mode==READ) ? KEY_READ:KEY_WRITE, &hRetKey ); LONG retval = RegOpenKeyEx( hType, sSubkey, 0, (mode==READ) ? KEY_READ:KEY_WRITE, &hRetKey );
@@ -51,7 +51,7 @@ static HKEY OpenRegKey( const RString &sKey, RegKeyMode mode, bool bWarnOnError
{ {
if( bWarnOnError ) if( bWarnOnError )
LOG->Warn( werr_ssprintf(retval, "RegOpenKeyEx(%x,%s) error", hType, sSubkey.c_str()) ); LOG->Warn( werr_ssprintf(retval, "RegOpenKeyEx(%x,%s) error", hType, sSubkey.c_str()) );
return NULL; return nullptr;
} }
return hRetKey; return hRetKey;
@@ -196,7 +196,7 @@ bool RegistryAccess::CreateKey( const RString &sKey )
RString sSubkey; RString sSubkey;
HKEY hType; HKEY hType;
if( !GetRegKeyType(sKey, sSubkey, hType) ) if( !GetRegKeyType(sKey, sSubkey, hType) )
return NULL; return nullptr;
HKEY hKey; HKEY hKey;
DWORD dwDisposition = 0; DWORD dwDisposition = 0;
+2 -2
View File
@@ -83,7 +83,7 @@ HICON IconFromSurface( const RageSurface *pSrcImg )
if( icon == nullptr ) if( icon == nullptr )
{ {
LOG->Trace( "%s", werr_ssprintf( GetLastError(), "CreateIconFromResourceEx" ).c_str() ); LOG->Trace( "%s", werr_ssprintf( GetLastError(), "CreateIconFromResourceEx" ).c_str() );
return NULL; return nullptr;
} }
return icon; return icon;
@@ -96,7 +96,7 @@ HICON IconFromFile( const RString &sIconFile )
if( pImg == nullptr ) if( pImg == nullptr )
{ {
LOG->Warn( "Couldn't open icon \"%s\": %s", sIconFile.c_str(), sError.c_str() ); LOG->Warn( "Couldn't open icon \"%s\": %s", sIconFile.c_str(), sError.c_str() );
return NULL; return nullptr;
} }
HICON icon = IconFromSurface( pImg ); HICON icon = IconFromSurface( pImg );