return "" -> return NULL

This commit is contained in:
Chris Danford
2005-09-02 00:14:07 +00:00
parent 7c4f2595ab
commit e439ae2a96
41 changed files with 97 additions and 87 deletions
+2 -2
View File
@@ -84,7 +84,7 @@ static const char *aliases[][2] = {
CString AnnouncerManager::GetPathTo( CString sAnnouncerName, CString sFolderName ) CString AnnouncerManager::GetPathTo( CString sAnnouncerName, CString sFolderName )
{ {
if(sAnnouncerName == "") if(sAnnouncerName == "")
return ""; /* announcer disabled */ return NULL; /* announcer disabled */
const CString AnnouncerPath = GetAnnouncerDirFromName(sAnnouncerName); const CString AnnouncerPath = GetAnnouncerDirFromName(sAnnouncerName);
@@ -112,7 +112,7 @@ CString AnnouncerManager::GetPathTo( CString sAnnouncerName, CString sFolderName
temp.Open( AnnouncerPath+sFolderName + "/announcer files go here.txt", RageFile::WRITE ); temp.Open( AnnouncerPath+sFolderName + "/announcer files go here.txt", RageFile::WRITE );
#endif #endif
return ""; return NULL;
} }
CString AnnouncerManager::GetPathTo( CString sFolderName ) CString AnnouncerManager::GetPathTo( CString sFolderName )
+5 -5
View File
@@ -66,7 +66,7 @@ CString GetRandomFileInDir( CString sDir )
CStringArray asFiles; CStringArray asFiles;
GetDirListing( sDir, asFiles, false, true ); GetDirListing( sDir, asFiles, false, true );
if( asFiles.empty() ) if( asFiles.empty() )
return ""; return NULL;
else else
return asFiles[rand()%asFiles.size()]; return asFiles[rand()%asFiles.size()];
} }
@@ -78,7 +78,7 @@ CString Character::GetModelPath() const
if( DoesFileExist(s) ) if( DoesFileExist(s) )
return s; return s;
else else
return ""; return NULL;
} }
CString Character::GetRestAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Rest/")); } CString Character::GetRestAnimationPath() const { return DerefRedir(GetRandomFileInDir(m_sCharDir + "Rest/")); }
@@ -92,7 +92,7 @@ CString Character::GetTakingABreakPath() const
GetDirListing( m_sCharDir+"break.gif", as, false, true ); GetDirListing( m_sCharDir+"break.gif", as, false, true );
GetDirListing( m_sCharDir+"break.bmp", as, false, true ); GetDirListing( m_sCharDir+"break.bmp", as, false, true );
if( as.empty() ) if( as.empty() )
return ""; return NULL;
else else
return as[0]; return as[0];
} }
@@ -115,7 +115,7 @@ CString Character::GetSongSelectIconPath() const
GetDirListing( m_sCharDir+"icon.gif", as, false, true ); GetDirListing( m_sCharDir+"icon.gif", as, false, true );
GetDirListing( m_sCharDir+"icon.bmp", as, false, true ); GetDirListing( m_sCharDir+"icon.bmp", as, false, true );
if( as.empty() ) if( as.empty() )
return ""; return NULL;
else else
return as[0]; return as[0];
} }
@@ -141,7 +141,7 @@ CString Character::GetStageIconPath() const
GetDirListing( m_sCharDir+"card.gif", as, false, true ); GetDirListing( m_sCharDir+"card.gif", as, false, true );
GetDirListing( m_sCharDir+"card.bmp", as, false, true ); GetDirListing( m_sCharDir+"card.bmp", as, false, true );
if( as.empty() ) if( as.empty() )
return ""; return NULL;
else else
return as[0]; return as[0];
} }
+1 -1
View File
@@ -17,7 +17,7 @@ void IncorrectNumberArgsWarning( const Command &command, int iMaxIndexAccessed )
CString Command::GetName() const CString Command::GetName() const
{ {
if( m_vsArgs.empty() ) if( m_vsArgs.empty() )
return ""; return NULL;
CString s = m_vsArgs[0]; CString s = m_vsArgs[0];
s.MakeLower(); s.MakeLower();
return s; return s;
+1 -1
View File
@@ -278,7 +278,7 @@ CString CourseID::ToString() const
return sPath; return sPath;
if( !sFullTitle.empty() ) if( !sFullTitle.empty() )
return sFullTitle; return sFullTitle;
return ""; return NULL;
} }
bool CourseID::IsValid() const bool CourseID::IsValid() const
+1 -1
View File
@@ -244,7 +244,7 @@ CString CryptManager::GetMD5( CString fn )
if( !file.Open( fn, RageFile::READ ) ) if( !file.Open( fn, RageFile::READ ) )
{ {
LOG->Warn( "GetMD5: Failed to open file '%s'", fn.c_str() ); LOG->Warn( "GetMD5: Failed to open file '%s'", fn.c_str() );
return ""; return NULL;
} }
MD5Init(&md5c); MD5Init(&md5c);
+1 -1
View File
@@ -197,7 +197,7 @@ static const CString MONTH_TO_NAME[MONTHS_IN_YEAR] =
CString MonthToString( int iMonthIndex ) CString MonthToString( int iMonthIndex )
{ {
if( iMonthIndex < 0 || iMonthIndex >= (int) sizeof(MONTH_TO_NAME) ) if( iMonthIndex < 0 || iMonthIndex >= (int) sizeof(MONTH_TO_NAME) )
return ""; return NULL;
return MONTH_TO_NAME[iMonthIndex]; return MONTH_TO_NAME[iMonthIndex];
} }
LuaFunction( MonthToString, MonthToString( IArg(1) ) ); LuaFunction( MonthToString, MonthToString( IArg(1) ) );
+2 -2
View File
@@ -695,7 +695,7 @@ CString FontPageSettings::MapRange( CString sMapping, int iMapOffset, int iGlyph
iCount--; iCount--;
} }
return ""; return NULL;
} }
const wchar_t *pMapping = FontCharmaps::get_char_map( sMapping ); const wchar_t *pMapping = FontCharmaps::get_char_map( sMapping );
@@ -726,7 +726,7 @@ CString FontPageSettings::MapRange( CString sMapping, int iMapOffset, int iGlyph
if( iCount ) if( iCount )
return "Map overflow"; /* there aren't enough characters in the map */ return "Map overflow"; /* there aren't enough characters in the map */
return ""; return NULL;
} }
static CStringArray LoadStack; static CStringArray LoadStack;
+3 -3
View File
@@ -2764,7 +2764,7 @@ CString GameManager::GetMenuButtonSecondaryFunction( const Game *pGame, GameButt
* it) and/or map to a menu button (if m_DedicatedMenuButton or m_SecondaryMenuButton * it) and/or map to a menu button (if m_DedicatedMenuButton or m_SecondaryMenuButton
* map to it). * map to it).
* *
* If a button is only used in gameplay or is only used in menus, return ""; the * If a button is only used in gameplay or is only used in menus, return NULL; the
* primary description is sufficient. * primary description is sufficient.
* *
* If a button is used in both gameplay and menus, return szSecondaryNames[] for * If a button is used in both gameplay and menus, return szSecondaryNames[] for
@@ -2800,12 +2800,12 @@ CString GameManager::GetMenuButtonSecondaryFunction( const Game *pGame, GameButt
FOREACH_MenuButton(m) FOREACH_MenuButton(m)
{ {
if( !bUsedInGameplay && pGame->m_DedicatedMenuButton[m] == gb ) if( !bUsedInGameplay && pGame->m_DedicatedMenuButton[m] == gb )
return ""; return NULL;
else if( bUsedInGameplay && pGame->m_SecondaryMenuButton[m] == gb ) else if( bUsedInGameplay && pGame->m_SecondaryMenuButton[m] == gb )
return szSecondaryNames[m]; return szSecondaryNames[m];
} }
return ""; // only used in gameplay return NULL; // only used in gameplay
} }
+2 -2
View File
@@ -160,8 +160,8 @@ void MsdFile::ReadFromString( const CString &sString )
CString MsdFile::GetParam(unsigned val, unsigned par) const CString MsdFile::GetParam(unsigned val, unsigned par) const
{ {
if(val >= GetNumValues()) return ""; if(val >= GetNumValues()) return NULL;
if(par >= GetNumParams(val)) return ""; if(par >= GetNumParams(val)) return NULL;
return values[val].params[par]; return values[val].params[par];
} }
+1 -1
View File
@@ -11,7 +11,7 @@ public:
{ {
vector<CString> params; vector<CString> params;
CString operator[](unsigned i) const { if(i >= params.size()) return ""; return params[i]; } CString operator[](unsigned i) const { if(i >= params.size()) return NULL; return params[i]; }
}; };
virtual ~MsdFile() { } virtual ~MsdFile() { }
+2 -2
View File
@@ -13,7 +13,7 @@ NetworkSyncManager::~NetworkSyncManager () { }
void NetworkSyncManager::CloseConnection() { } void NetworkSyncManager::CloseConnection() { }
void NetworkSyncManager::PostStartUp(const CString& ServerIP ) { } void NetworkSyncManager::PostStartUp(const CString& ServerIP ) { }
bool NetworkSyncManager::Connect(const CString& addy, unsigned short port) { return false; } bool NetworkSyncManager::Connect(const CString& addy, unsigned short port) { return false; }
CString NetworkSyncManager::GetServerName() { return ""; } CString NetworkSyncManager::GetServerName() { return NULL; }
void NetworkSyncManager::ReportNSSOnOff(int i) { } void NetworkSyncManager::ReportNSSOnOff(int i) { }
void NetworkSyncManager::ReportTiming(float offset, int PlayerNumber) { } void NetworkSyncManager::ReportTiming(float offset, int PlayerNumber) { }
void NetworkSyncManager::ReportScore(int playerID, int step, int score, int combo) { } void NetworkSyncManager::ReportScore(int playerID, int step, int score, int combo) { }
@@ -25,7 +25,7 @@ void NetworkSyncManager::Update( float fDeltaTime ) { }
bool NetworkSyncManager::ChangedScoreboard(int Column) { return false; } bool NetworkSyncManager::ChangedScoreboard(int Column) { return false; }
void NetworkSyncManager::SendChat(const CString& message) { } void NetworkSyncManager::SendChat(const CString& message) { }
void NetworkSyncManager::SelectUserSong() { } void NetworkSyncManager::SelectUserSong() { }
CString NetworkSyncManager::MD5Hex( const CString &sInput ) { return ""; } CString NetworkSyncManager::MD5Hex( const CString &sInput ) { return NULL; }
int NetworkSyncManager::GetSMOnlineSalt() { return 0; } int NetworkSyncManager::GetSMOnlineSalt() { return 0; }
#else #else
#include "ezsockets.h" #include "ezsockets.h"
+1 -1
View File
@@ -273,7 +273,7 @@ CString NoteSkinManager::GetPathFromDirAndFile( const CString &sDir, const CStri
GetDirListing( sDir+sFileName+"*", matches, false, true ); GetDirListing( sDir+sFileName+"*", matches, false, true );
if( matches.empty() ) if( matches.empty() )
return ""; return NULL;
if( matches.size() > 1 ) if( matches.size() > 1 )
{ {
+1 -1
View File
@@ -186,7 +186,7 @@ CString Profile::GetDisplayNameOrHighScoreName() const
else if( !m_sLastUsedHighScoreName.empty() ) else if( !m_sLastUsedHighScoreName.empty() )
return m_sLastUsedHighScoreName; return m_sLastUsedHighScoreName;
else else
return ""; return NULL;
} }
Character *Profile::GetCharacter() const Character *Profile::GetCharacter() const
+1 -1
View File
@@ -538,7 +538,7 @@ CString ProfileManager::GetProfileDirImportedFrom( ProfileSlot slot ) const
case PROFILE_SLOT_PLAYER_2: case PROFILE_SLOT_PLAYER_2:
return m_sProfileDirImportedFrom[slot]; return m_sProfileDirImportedFrom[slot];
case PROFILE_SLOT_MACHINE: case PROFILE_SLOT_MACHINE:
return ""; return NULL;
default: default:
ASSERT(0); ASSERT(0);
} }
+4 -4
View File
@@ -54,20 +54,20 @@ CString RageDisplay::SetVideoMode( VideoModeParams p, bool &bNeedReloadTextures
CString err; CString err;
err = this->TryVideoMode(p,bNeedReloadTextures); err = this->TryVideoMode(p,bNeedReloadTextures);
if( err == "" ) if( err == "" )
return ""; return NULL;
LOG->Trace( "TryVideoMode failed: %s", err.c_str() ); LOG->Trace( "TryVideoMode failed: %s", err.c_str() );
// fall back // fall back
p.windowed = false; p.windowed = false;
if( this->TryVideoMode(p,bNeedReloadTextures) == "" ) if( this->TryVideoMode(p,bNeedReloadTextures) == "" )
return ""; return NULL;
p.bpp = 16; p.bpp = 16;
if( this->TryVideoMode(p,bNeedReloadTextures) == "" ) if( this->TryVideoMode(p,bNeedReloadTextures) == "" )
return ""; return NULL;
p.width = 640; p.width = 640;
p.height = 480; p.height = 480;
if( this->TryVideoMode(p,bNeedReloadTextures) == "" ) if( this->TryVideoMode(p,bNeedReloadTextures) == "" )
return ""; return NULL;
return ssprintf( "SetVideoMode failed: %s", err.c_str() ); return ssprintf( "SetVideoMode failed: %s", err.c_str() );
} }
+2 -2
View File
@@ -222,7 +222,7 @@ public:
}; };
bool SaveScreenshot( CString sPath, GraphicsFileFormat format ); bool SaveScreenshot( CString sPath, GraphicsFileFormat format );
virtual CString GetTextureDiagnostics( unsigned id ) const { return ""; } virtual CString GetTextureDiagnostics( unsigned id ) const { return NULL; }
virtual RageSurface* CreateScreenshot() = 0; // allocates a surface. Caller must delete it. virtual RageSurface* CreateScreenshot() = 0; // allocates a surface. Caller must delete it.
protected: protected:
@@ -235,7 +235,7 @@ protected:
virtual void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth ); virtual void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth );
virtual void DrawCircleInternal( const RageSpriteVertex &v, float radius ); virtual void DrawCircleInternal( const RageSpriteVertex &v, float radius );
// Return "" if mode change was successful, an error message otherwise. // return NULL if mode change was successful, an error message otherwise.
// bNewDeviceOut is set true if a new device was created and textures // bNewDeviceOut is set true if a new device was created and textures
// need to be reloaded. // need to be reloaded.
virtual CString TryVideoMode( VideoModeParams params, bool &bNewDeviceOut ) = 0; virtual CString TryVideoMode( VideoModeParams params, bool &bNewDeviceOut ) = 0;
+2 -2
View File
@@ -392,7 +392,7 @@ CString SetD3DParams( bool &bNewDeviceOut )
} }
} }
return ""; return NULL;
} }
/* If the given parameters have failed, try to lower them. */ /* If the given parameters have failed, try to lower them. */
@@ -605,7 +605,7 @@ CString RageDisplay_D3D::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut )
/* Palettes were lost by Reset(), so mark them unloaded. */ /* Palettes were lost by Reset(), so mark them unloaded. */
g_TexResourceToPaletteIndex.clear(); g_TexResourceToPaletteIndex.clear();
return ""; // mode change successful return NULL; // mode change successful
} }
void RageDisplay_D3D::ResolutionChanged() void RageDisplay_D3D::ResolutionChanged()
+1 -1
View File
@@ -74,7 +74,7 @@ protected:
void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth ) { } void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth ) { }
VideoModeParams m_Params; VideoModeParams m_Params;
CString TryVideoMode( VideoModeParams params, bool &bNewDeviceOut ) { m_Params = params; return ""; } CString TryVideoMode( VideoModeParams params, bool &bNewDeviceOut ) { m_Params = params; return NULL; }
RageSurface* CreateScreenshot(); RageSurface* CreateScreenshot();
void SetViewport(int shift_left, int shift_down) { } void SetViewport(int shift_left, int shift_down) { }
RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf ); RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf );
+4 -4
View File
@@ -334,7 +334,7 @@ CString GetInfoLog( GLhandleARB h )
GLint iLength; GLint iLength;
GLExt.glGetObjectParameterivARB( h, GL_OBJECT_INFO_LOG_LENGTH_ARB, &iLength ); GLExt.glGetObjectParameterivARB( h, GL_OBJECT_INFO_LOG_LENGTH_ARB, &iLength );
if( !iLength ) if( !iLength )
return ""; return NULL;
GLcharARB *pInfoLog = new GLcharARB[iLength]; GLcharARB *pInfoLog = new GLcharARB[iLength];
GLExt.glGetInfoLogARB( h, iLength, &iLength, pInfoLog ); GLExt.glGetInfoLogARB( h, iLength, &iLength, pInfoLog );
@@ -477,7 +477,7 @@ CString RageDisplay_OGL::Init( VideoModeParams p, bool bAllowUnacceleratedRender
InitScalingScript(); InitScalingScript();
return ""; return NULL;
} }
#if defined(UNIX) && defined(HAVE_LIBXTST) #if defined(UNIX) && defined(HAVE_LIBXTST)
@@ -698,7 +698,7 @@ CString RageDisplay_OGL::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut )
ResolutionChanged(); ResolutionChanged();
return ""; // successfully set mode return NULL; // successfully set mode
} }
void RageDisplay_OGL::SetViewport(int shift_left, int shift_down) void RageDisplay_OGL::SetViewport(int shift_left, int shift_down)
@@ -1884,7 +1884,7 @@ void RageDisplay_OGL::SetLineWidth( float fWidth )
CString RageDisplay_OGL::GetTextureDiagnostics( unsigned id ) const CString RageDisplay_OGL::GetTextureDiagnostics( unsigned id ) const
{ {
return ""; return NULL;
} }
void RageDisplay_OGL::SetAlphaTest( bool b ) void RageDisplay_OGL::SetAlphaTest( bool b )
+2 -2
View File
@@ -33,7 +33,7 @@ RageFileBasic *RageFile::Copy() const
CString RageFile::GetPath() const CString RageFile::GetPath() const
{ {
if ( !IsOpen() ) if ( !IsOpen() )
return ""; return NULL;
CString sRet = m_File->GetDisplayPath(); CString sRet = m_File->GetDisplayPath();
if( sRet != "" ) if( sRet != "" )
@@ -219,7 +219,7 @@ void FileReading::ReadBytes( RageFileBasic &f, void *buf, int size, CString &sEr
CString FileReading::ReadString( RageFileBasic &f, int size, CString &sError ) CString FileReading::ReadString( RageFileBasic &f, int size, CString &sError )
{ {
if( sError.size() != 0 ) if( sError.size() != 0 )
return ""; return NULL;
CString sBuf; CString sBuf;
int ret = f.Read( sBuf, size ); int ret = f.Read( sBuf, size );
+2 -2
View File
@@ -42,7 +42,7 @@ public:
virtual int Flush() = 0; virtual int Flush() = 0;
/* This returns a descriptive path for the file, or "". */ /* This returns a descriptive path for the file, or "". */
virtual CString GetDisplayPath() const { return ""; } virtual CString GetDisplayPath() const { return NULL; }
virtual RageFileBasic *Copy() const = 0; virtual RageFileBasic *Copy() const = 0;
@@ -88,7 +88,7 @@ public:
bool GetCRC32( uint32_t *iRet ); bool GetCRC32( uint32_t *iRet );
virtual int GetFileSize() const = 0; virtual int GetFileSize() const = 0;
virtual CString GetDisplayPath() const { return ""; } virtual CString GetDisplayPath() const { return NULL; }
virtual RageFileBasic *Copy() const { FAIL_M( "Copying unimplemented" ); } virtual RageFileBasic *Copy() const { FAIL_M( "Copying unimplemented" ); }
protected: protected:
+2 -2
View File
@@ -329,11 +329,11 @@ CString LoadedDriver::GetPath( const CString &path )
if( path.size() >= 2 && path[1] == '@' ) if( path.size() >= 2 && path[1] == '@' )
{ {
if( MountPoint.size() < 2 || MountPoint[1] != '@' ) if( MountPoint.size() < 2 || MountPoint[1] != '@' )
return ""; return NULL;
} }
if( path.Left( MountPoint.size() ).CompareNoCase( MountPoint ) ) if( path.Left( MountPoint.size() ).CompareNoCase( MountPoint ) )
return ""; /* no match */ return NULL; /* no match */
/* Add one, so we don't cut off the leading slash. */ /* Add one, so we don't cut off the leading slash. */
CString sRet = path.Right( path.size() - MountPoint.size() + 1 ); CString sRet = path.Right( path.size() - MountPoint.size() + 1 );
+3 -3
View File
@@ -270,8 +270,8 @@ CString DeviceButtonToString( InputDevice device, DeviceButton i )
case DEVICE_PUMP2: return PumpPadButtonToString( (PumpPadButton)i ); case DEVICE_PUMP2: return PumpPadButtonToString( (PumpPadButton)i );
case DEVICE_MIDI: return MidiButtonToString( i ); case DEVICE_MIDI: return MidiButtonToString( i );
case DEVICE_PARA1: return ParaPadButtonToString( (ParaPadButton)i ); case DEVICE_PARA1: return ParaPadButtonToString( (ParaPadButton)i );
case DEVICE_NONE: return ""; case DEVICE_NONE: return NULL;
default: ASSERT(0); return ""; default: ASSERT(0); return NULL;
} }
} }
@@ -337,7 +337,7 @@ int GetNumDeviceButtons( InputDevice device )
CString DeviceInput::toString() const CString DeviceInput::toString() const
{ {
if( device == DEVICE_NONE ) if( device == DEVICE_NONE )
return ""; return NULL;
CString s = InputDeviceToString(device) + "_" + DeviceButtonToString(device,button); CString s = InputDeviceToString(device) + "_" + DeviceButtonToString(device,button);
return s; return s;
+1 -1
View File
@@ -357,7 +357,7 @@ public:
CString ReadString( RageFile &f, int iSize, CString &sError ) CString ReadString( RageFile &f, int iSize, CString &sError )
{ {
if( sError.size() != 0 ) if( sError.size() != 0 )
return ""; return NULL;
CString sBuf; CString sBuf;
char *pBuf = sBuf.GetBuffer( iSize ); char *pBuf = sBuf.GetBuffer( iSize );
+17 -8
View File
@@ -277,7 +277,7 @@ CString werr_ssprintf( int err, const char *fmt, ...)
CString ConvertWstringToACP( wstring s ) CString ConvertWstringToACP( wstring s )
{ {
if( s.empty() ) if( s.empty() )
return ""; return NULL;
int iBytes = WideCharToMultiByte( CP_ACP, 0, s.data(), s.size(), int iBytes = WideCharToMultiByte( CP_ACP, 0, s.data(), s.size(),
NULL, 0, NULL, FALSE ); NULL, 0, NULL, FALSE );
@@ -301,7 +301,7 @@ CString ConvertUTF8ToACP( CString s )
CString join( const CString &Deliminator, const CStringArray& Source) CString join( const CString &Deliminator, const CStringArray& Source)
{ {
if( Source.empty() ) if( Source.empty() )
return ""; return NULL;
CString csTmp; CString csTmp;
@@ -317,7 +317,7 @@ CString join( const CString &Deliminator, const CStringArray& Source)
CString join( const CString &Delimitor, CStringArray::const_iterator begin, CStringArray::const_iterator end ) CString join( const CString &Delimitor, CStringArray::const_iterator begin, CStringArray::const_iterator end )
{ {
if( begin == end ) if( begin == end )
return ""; return NULL;
CString ret; CString ret;
while( begin != end ) while( begin != end )
@@ -512,11 +512,11 @@ CString GetExtension( const CString &sPath )
{ {
size_t pos = sPath.rfind( '.' ); size_t pos = sPath.rfind( '.' );
if( pos == sPath.npos ) if( pos == sPath.npos )
return ""; return NULL;
size_t slash = sPath.find( '/', pos ); size_t slash = sPath.find( '/', pos );
if( slash != sPath.npos ) if( slash != sPath.npos )
return ""; /* rare: path/dir.ext/fn */ return NULL; /* rare: path/dir.ext/fn */
return sPath.substr( pos+1, sPath.size()-pos+1 ); return sPath.substr( pos+1, sPath.size()-pos+1 );
} }
@@ -660,6 +660,15 @@ void StripCrnl(CString &s)
s.erase(s.size()-1); s.erase(s.size()-1);
} }
bool EndsWith( const CString &sTestThis, const CString &sEnding )
{
ASSERT( !sEnding.empty() );
if( sTestThis.size() < sEnding.size() )
return false;
return sTestThis.Right( sEnding.size() ) == sEnding;
}
void StripCvs( vector<CString> &vs ) void StripCvs( vector<CString> &vs )
{ {
for( unsigned i=0; i<vs.size(); i++ ) for( unsigned i=0; i<vs.size(); i++ )
@@ -686,7 +695,7 @@ CString DerefRedir(const CString &_path)
/* Empty is invalid. */ /* Empty is invalid. */
if( sNewFileName == "" ) if( sNewFileName == "" )
return ""; return NULL;
FixSlashesInPlace( sNewFileName ); FixSlashesInPlace( sNewFileName );
@@ -1244,7 +1253,7 @@ CString Basename( const CString &dir )
{ {
size_t end = dir.find_last_not_of( "/\\" ); size_t end = dir.find_last_not_of( "/\\" );
if( end == dir.npos ) if( end == dir.npos )
return ""; return NULL;
size_t start = dir.find_last_of( "/\\", end ); size_t start = dir.find_last_of( "/\\", end );
if( start == dir.npos ) if( start == dir.npos )
@@ -1286,7 +1295,7 @@ CString Dirname( const CString &dir )
CString Capitalize( const CString &s ) CString Capitalize( const CString &s )
{ {
if( s.GetLength()==0 ) if( s.GetLength()==0 )
return ""; return NULL;
CString s2 = s; CString s2 = s;
/* XXX: utf-8 */ /* XXX: utf-8 */
if( !(s2[0] & 0x80) ) if( !(s2[0] & 0x80) )
+1
View File
@@ -313,6 +313,7 @@ inline T Decrement( T a ) { --a; return a; }
void TrimLeft(CString &str, const char *s = "\r\n\t "); void TrimLeft(CString &str, const char *s = "\r\n\t ");
void TrimRight(CString &str, const char *s = "\r\n\t "); void TrimRight(CString &str, const char *s = "\r\n\t ");
void StripCrnl(CString &s); void StripCrnl(CString &s);
bool EndsWith( const CString &sTestThis, const CString &sEnding );
void StripCvs( vector<CString> &vs ); // remove all items that end in "cvs" void StripCvs( vector<CString> &vs ); // remove all items that end in "cvs"
+2 -2
View File
@@ -69,11 +69,11 @@ BackgroundLoader::~BackgroundLoader()
CString BackgroundLoader::GetRequest() CString BackgroundLoader::GetRequest()
{ {
if( !g_bEnableBackgroundLoading ) if( !g_bEnableBackgroundLoading )
return ""; return NULL;
LockMut( m_Mutex ); LockMut( m_Mutex );
if( !m_CacheRequests.size() ) if( !m_CacheRequests.size() )
return ""; return NULL;
CString ret; CString ret;
ret = m_CacheRequests.front(); ret = m_CacheRequests.front();
+1 -1
View File
@@ -540,7 +540,7 @@ static CString GetOneBakedRandomFile( Song *pSong, bool bTryGenre = true )
if( !vsNamesOut.empty() ) if( !vsNamesOut.empty() )
return vsNamesOut[rand()%vsNamesOut.size()]; return vsNamesOut[rand()%vsNamesOut.size()];
else else
return ""; return NULL;
} }
static MenuDef g_InsertTapAttack( static MenuDef g_InsertTapAttack(
+4 -4
View File
@@ -43,7 +43,7 @@ CString GetStatsLineTitle( PlayerNumber pn, EndingStatsLine line )
CourseDifficulty cd = (CourseDifficulty)(DIFFICULTY_EASY+line-PERCENT_COMPLETE_EASY); CourseDifficulty cd = (CourseDifficulty)(DIFFICULTY_EASY+line-PERCENT_COMPLETE_EASY);
ASSERT( cd >= 0 && cd < NUM_COURSE_DIFFICULTIES ); ASSERT( cd >= 0 && cd < NUM_COURSE_DIFFICULTIES );
if( !GAMESTATE->IsCourseDifficultyShown(cd) ) if( !GAMESTATE->IsCourseDifficultyShown(cd) )
return ""; return NULL;
return CourseDifficultyToThemedString(cd); return CourseDifficultyToThemedString(cd);
} }
else else
@@ -53,7 +53,7 @@ CString GetStatsLineTitle( PlayerNumber pn, EndingStatsLine line )
return DifficultyToThemedString(dc); return DifficultyToThemedString(dc);
} }
} }
default: ASSERT(0); return ""; default: ASSERT(0); return NULL;
} }
} }
@@ -107,7 +107,7 @@ CString GetStatsLineValue( PlayerNumber pn, EndingStatsLine line )
CourseDifficulty cd = (CourseDifficulty)(DIFFICULTY_EASY+line-PERCENT_COMPLETE_EASY); CourseDifficulty cd = (CourseDifficulty)(DIFFICULTY_EASY+line-PERCENT_COMPLETE_EASY);
ASSERT( cd >= 0 && cd < NUM_COURSE_DIFFICULTIES ); ASSERT( cd >= 0 && cd < NUM_COURSE_DIFFICULTIES );
if( !GAMESTATE->IsCourseDifficultyShown(cd) ) if( !GAMESTATE->IsCourseDifficultyShown(cd) )
return ""; return NULL;
CString sDifficulty = CourseDifficultyToThemedString(cd); CString sDifficulty = CourseDifficultyToThemedString(cd);
fPercent = pProfile->GetCoursesPercentComplete(st,cd); fPercent = pProfile->GetCoursesPercentComplete(st,cd);
} }
@@ -120,7 +120,7 @@ CString GetStatsLineValue( PlayerNumber pn, EndingStatsLine line )
} }
return ssprintf( "%05.2f%%", fPercent*100 ); return ssprintf( "%05.2f%%", fPercent*100 );
} }
default: ASSERT(0); return ""; default: ASSERT(0); return NULL;
} }
} }
+1 -1
View File
@@ -45,7 +45,7 @@ CString ASMHClass::NumberToString( ScreenMessage SM )
if ( SM == iter->second ) if ( SM == iter->second )
return (*iter).first; return (*iter).first;
return ""; return NULL;
} }
/* /*
+1 -1
View File
@@ -367,7 +367,7 @@ CString ScreenOptions::GetExplanationText( int iRow ) const
bool bAllowExplanation = row.GetRowDef().m_bAllowExplanation; bool bAllowExplanation = row.GetRowDef().m_bAllowExplanation;
bool bShowExplanations = bAllowExplanation && SHOW_EXPLANATIONS.GetValue(); bool bShowExplanations = bAllowExplanation && SHOW_EXPLANATIONS.GetValue();
if( !bShowExplanations ) if( !bShowExplanations )
return ""; return NULL;
CString sLineName = row.GetRowDef().m_sName; CString sLineName = row.GetRowDef().m_sName;
ASSERT( !sLineName.empty() ); ASSERT( !sLineName.empty() );
+1 -1
View File
@@ -408,7 +408,7 @@ CString ScreenPackages::URLEncode( const CString &URL )
CString ScreenPackages::StripOutContainers( const CString & In ) CString ScreenPackages::StripOutContainers( const CString & In )
{ {
if( In.size() == 0 ) if( In.size() == 0 )
return ""; return NULL;
unsigned i = 0; unsigned i = 0;
char t = In.at(i); char t = In.at(i);
+2 -2
View File
@@ -228,7 +228,7 @@ CString ScreenProfileOptions::GetSelectedProfileID()
const OptionRow &row = *m_pRows[GetCurrentRow()]; const OptionRow &row = *m_pRows[GetCurrentRow()];
const int Selection = row.GetOneSharedSelection(); const int Selection = row.GetOneSharedSelection();
if( !Selection ) if( !Selection )
return ""; return NULL;
return vsProfiles[ Selection-1 ]; return vsProfiles[ Selection-1 ];
} }
@@ -237,7 +237,7 @@ CString ScreenProfileOptions::GetSelectedProfileName()
const OptionRow &row = *m_pRows[GetCurrentRow()]; const OptionRow &row = *m_pRows[GetCurrentRow()];
const int Selection = row.GetOneSharedSelection(); const int Selection = row.GetOneSharedSelection();
if( !Selection ) if( !Selection )
return ""; return NULL;
return g_ProfileOptionsLines[PO_PLAYER1].m_vsChoices[ Selection ]; return g_ProfileOptionsLines[PO_PLAYER1].m_vsChoices[ Selection ];
} }
+1 -1
View File
@@ -169,7 +169,7 @@ CString ScreenSMOnlineLogin::GetSelectedProfileID()
const OptionRow &row = *m_pRows[GetCurrentRow()]; const OptionRow &row = *m_pRows[GetCurrentRow()];
const int Selection = row.GetOneSharedSelection(); const int Selection = row.GetOneSharedSelection();
if( !Selection ) if( !Selection )
return ""; return NULL;
return vsProfiles[ Selection-1 ]; return vsProfiles[ Selection-1 ];
} }
+2 -2
View File
@@ -132,7 +132,7 @@ void ScreenSystemLayer::ReloadCreditsText()
CString ScreenSystemLayer::GetCreditsMessage( PlayerNumber pn ) const CString ScreenSystemLayer::GetCreditsMessage( PlayerNumber pn ) const
{ {
if( (bool)CREDITS_JOIN_ONLY && !GAMESTATE->PlayersCanJoin() ) if( (bool)CREDITS_JOIN_ONLY && !GAMESTATE->PlayersCanJoin() )
return ""; return NULL;
bool bShowCreditsMessage; bool bShowCreditsMessage;
if( SCREENMAN && SCREENMAN->GetTopScreen() && SCREENMAN->GetTopScreen()->GetScreenType() == system_menu ) if( SCREENMAN && SCREENMAN->GetTopScreen() && SCREENMAN->GetTopScreen()->GetScreenType() == system_menu )
@@ -160,7 +160,7 @@ CString ScreenSystemLayer::GetCreditsMessage( PlayerNumber pn ) const
else if( GAMESTATE->PlayersCanJoin() ) else if( GAMESTATE->PlayersCanJoin() )
return CREDITS_INSERT_CARD.GetValue(); return CREDITS_INSERT_CARD.GetValue();
else else
return ""; return NULL;
case MEMORY_CARD_STATE_ERROR: return THEME->GetMetric( m_sName, "CreditsCard" + MEMCARDMAN->GetCardError(pn) ); case MEMORY_CARD_STATE_ERROR: return THEME->GetMetric( m_sName, "CreditsCard" + MEMCARDMAN->GetCardError(pn) );
case MEMORY_CARD_STATE_TOO_LATE: return CREDITS_CARD_TOO_LATE.GetValue(); case MEMORY_CARD_STATE_TOO_LATE: return CREDITS_CARD_TOO_LATE.GetValue();
+2 -2
View File
@@ -1245,7 +1245,7 @@ vector<BackgroundChange> &Song::GetForegroundChanges()
CString GetSongAssetPath( CString sPath, const CString &sSongPath ) CString GetSongAssetPath( CString sPath, const CString &sSongPath )
{ {
if( sPath == "" ) if( sPath == "" )
return ""; return NULL;
/* If there's no path in the file, the file is in the same directory /* If there's no path in the file, the file is in the same directory
* as the song. (This is the preferred configuration.) */ * as the song. (This is the preferred configuration.) */
@@ -1264,7 +1264,7 @@ CString GetSongAssetPath( CString sPath, const CString &sSongPath )
/* If the path still begins with "../", then there were an unreasonable number /* If the path still begins with "../", then there were an unreasonable number
* of them at the beginning of the path. Ignore the path entirely. */ * of them at the beginning of the path. Ignore the path entirely. */
if( sPath.Left(3) == "../" ) if( sPath.Left(3) == "../" )
return ""; return NULL;
return sPath; return sPath;
} }
+6 -6
View File
@@ -316,7 +316,7 @@ CString SongManager::GetSongGroupBannerPath( CString sSongGroup )
return m_sSongGroupBannerPaths[i]; return m_sSongGroupBannerPaths[i];
} }
return ""; return NULL;
} }
void SongManager::GetSongGroupNames( CStringArray &AddTo ) void SongManager::GetSongGroupNames( CStringArray &AddTo )
@@ -385,7 +385,7 @@ CString SongManager::GetCourseGroupBannerPath( const CString &sCourseGroup )
if( iter == m_mapCourseGroupToInfo.end() ) if( iter == m_mapCourseGroupToInfo.end() )
{ {
ASSERT_M( 0, ssprintf("requested banner for course group '%s' that doesn't exist",sCourseGroup.c_str()) ); ASSERT_M( 0, ssprintf("requested banner for course group '%s' that doesn't exist",sCourseGroup.c_str()) );
return ""; return NULL;
} }
else else
{ {
@@ -1439,7 +1439,7 @@ CString GetCurrentSongDisplayTitle()
{ {
const Song* pSong = GAMESTATE->m_pCurSong; const Song* pSong = GAMESTATE->m_pCurSong;
if( pSong == NULL ) if( pSong == NULL )
return ""; return NULL;
return pSong->GetDisplayFullTitle(); return pSong->GetDisplayFullTitle();
} }
@@ -1447,7 +1447,7 @@ CString GetCurrentSongDisplayArtist()
{ {
const Song* pSong = GAMESTATE->m_pCurSong; const Song* pSong = GAMESTATE->m_pCurSong;
if( pSong == NULL ) if( pSong == NULL )
return ""; return NULL;
return pSong->GetDisplayArtist(); return pSong->GetDisplayArtist();
} }
@@ -1455,7 +1455,7 @@ CString GetCurrentSongCredit()
{ {
const Song* pSong = GAMESTATE->m_pCurSong; const Song* pSong = GAMESTATE->m_pCurSong;
if( pSong == NULL ) if( pSong == NULL )
return ""; return NULL;
return pSong->m_sCredit; return pSong->m_sCredit;
} }
@@ -1463,7 +1463,7 @@ CString GetCurrentStepsCredits()
{ {
const Song* pSong = GAMESTATE->m_pCurSong; const Song* pSong = GAMESTATE->m_pCurSong;
if( pSong == NULL ) if( pSong == NULL )
return ""; return NULL;
CString s; CString s;
+6 -6
View File
@@ -212,12 +212,12 @@ void SongUtil::SortSongPointerArrayByNumPlays( vector<Song*> &vpSongsInOut, cons
CString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so ) CString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so )
{ {
if( pSong == NULL ) if( pSong == NULL )
return ""; return NULL;
switch( so ) switch( so )
{ {
case SORT_PREFERRED: case SORT_PREFERRED:
return ""; return NULL;
case SORT_GROUP: case SORT_GROUP:
// guaranteed not empty // guaranteed not empty
return pSong->m_sGroupName; return pSong->m_sGroupName;
@@ -234,7 +234,7 @@ CString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so
s = MakeSortString(s); // resulting string will be uppercase s = MakeSortString(s); // resulting string will be uppercase
if( s.empty() ) if( s.empty() )
return ""; return NULL;
else if( s[0] >= '0' && s[0] <= '9' ) else if( s[0] >= '0' && s[0] <= '9' )
return "NUM"; return "NUM";
else if( s[0] < 'A' || s[0] > 'Z') else if( s[0] < 'A' || s[0] > 'Z')
@@ -256,7 +256,7 @@ CString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so
return ssprintf("%03d-%03d",iMaxBPM-(iBPMGroupSize-1), iMaxBPM); return ssprintf("%03d-%03d",iMaxBPM-(iBPMGroupSize-1), iMaxBPM);
} }
case SORT_POPULARITY: case SORT_POPULARITY:
return ""; return NULL;
case SORT_TOP_GRADES: case SORT_TOP_GRADES:
{ {
int iCounts[NUM_Grade]; int iCounts[NUM_Grade];
@@ -299,14 +299,14 @@ CString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so
return "N/A"; return "N/A";
} }
case SORT_MODE_MENU: case SORT_MODE_MENU:
return ""; return NULL;
case SORT_ALL_COURSES: case SORT_ALL_COURSES:
case SORT_NONSTOP_COURSES: case SORT_NONSTOP_COURSES:
case SORT_ONI_COURSES: case SORT_ONI_COURSES:
case SORT_ENDLESS_COURSES: case SORT_ENDLESS_COURSES:
default: default:
ASSERT(0); ASSERT(0);
return ""; return NULL;
} }
} }
+1 -1
View File
@@ -721,7 +721,7 @@ void Sprite::SetSecondsIntoAnimation( float fSeconds )
CString Sprite::GetTexturePath() const CString Sprite::GetTexturePath() const
{ {
if( m_pTexture==NULL ) if( m_pTexture==NULL )
return ""; return NULL;
return m_pTexture->GetID().filename; return m_pTexture->GetID().filename;
} }
+1 -1
View File
@@ -1236,7 +1236,7 @@ CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature,
if( !bResult ) if( !bResult )
{ {
SCREENMAN->PlayInvalidSound(); SCREENMAN->PlayInvalidSound();
return ""; return NULL;
} }
SCREENMAN->PlayScreenshotSound(); SCREENMAN->PlayScreenshotSound();
+1 -1
View File
@@ -18,7 +18,7 @@ void ChangeCurrentGame( const Game* g );
void FocusChanged( bool bHasFocus ); void FocusChanged( bool bHasFocus );
bool AppHasFocus(); bool AppHasFocus();
// If successful, return filename of screenshot in sDir, else return "" // If successful, return filename of screenshot in sDir, else return NULL
CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature, int iIndex = -1 ); CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature, int iIndex = -1 );
void InsertCoin( int iNum = 1, const RageTimer *pTime = NULL ); void InsertCoin( int iNum = 1, const RageTimer *pTime = NULL );