From e439ae2a965ad9d512de9b3e777c88c148ff6df9 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 2 Sep 2005 00:14:07 +0000 Subject: [PATCH] return "" -> return NULL --- stepmania/src/AnnouncerManager.cpp | 4 ++-- stepmania/src/Character.cpp | 10 ++++----- stepmania/src/Command.cpp | 2 +- stepmania/src/CourseUtil.cpp | 2 +- stepmania/src/CryptManager.cpp | 2 +- stepmania/src/DateTime.cpp | 2 +- stepmania/src/Font.cpp | 4 ++-- stepmania/src/GameManager.cpp | 6 ++--- stepmania/src/MsdFile.cpp | 4 ++-- stepmania/src/MsdFile.h | 2 +- stepmania/src/NetworkSyncManager.cpp | 4 ++-- stepmania/src/NoteSkinManager.cpp | 2 +- stepmania/src/Profile.cpp | 2 +- stepmania/src/ProfileManager.cpp | 2 +- stepmania/src/RageDisplay.cpp | 8 +++---- stepmania/src/RageDisplay.h | 4 ++-- stepmania/src/RageDisplay_D3D.cpp | 4 ++-- stepmania/src/RageDisplay_Null.h | 2 +- stepmania/src/RageDisplay_OGL.cpp | 8 +++---- stepmania/src/RageFile.cpp | 4 ++-- stepmania/src/RageFileBasic.h | 4 ++-- stepmania/src/RageFileManager.cpp | 4 ++-- stepmania/src/RageInputDevice.cpp | 6 ++--- stepmania/src/RageSoundReader_WAV.cpp | 2 +- stepmania/src/RageUtil.cpp | 25 ++++++++++++++------- stepmania/src/RageUtil.h | 1 + stepmania/src/RageUtil_BackgroundLoader.cpp | 4 ++-- stepmania/src/ScreenEdit.cpp | 2 +- stepmania/src/ScreenEnding.cpp | 8 +++---- stepmania/src/ScreenMessage.cpp | 2 +- stepmania/src/ScreenOptions.cpp | 2 +- stepmania/src/ScreenPackages.cpp | 2 +- stepmania/src/ScreenProfileOptions.cpp | 4 ++-- stepmania/src/ScreenSMOnlineLogin.cpp | 2 +- stepmania/src/ScreenSystemLayer.cpp | 4 ++-- stepmania/src/Song.cpp | 4 ++-- stepmania/src/SongManager.cpp | 12 +++++----- stepmania/src/SongUtil.cpp | 12 +++++----- stepmania/src/Sprite.cpp | 2 +- stepmania/src/StepMania.cpp | 2 +- stepmania/src/StepMania.h | 2 +- 41 files changed, 97 insertions(+), 87 deletions(-) diff --git a/stepmania/src/AnnouncerManager.cpp b/stepmania/src/AnnouncerManager.cpp index 578a11dc67..c5cd103540 100644 --- a/stepmania/src/AnnouncerManager.cpp +++ b/stepmania/src/AnnouncerManager.cpp @@ -84,7 +84,7 @@ static const char *aliases[][2] = { CString AnnouncerManager::GetPathTo( CString sAnnouncerName, CString sFolderName ) { if(sAnnouncerName == "") - return ""; /* announcer disabled */ + return NULL; /* announcer disabled */ 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 ); #endif - return ""; + return NULL; } CString AnnouncerManager::GetPathTo( CString sFolderName ) diff --git a/stepmania/src/Character.cpp b/stepmania/src/Character.cpp index 630128b495..1a7dd983d4 100644 --- a/stepmania/src/Character.cpp +++ b/stepmania/src/Character.cpp @@ -66,7 +66,7 @@ CString GetRandomFileInDir( CString sDir ) CStringArray asFiles; GetDirListing( sDir, asFiles, false, true ); if( asFiles.empty() ) - return ""; + return NULL; else return asFiles[rand()%asFiles.size()]; } @@ -78,7 +78,7 @@ CString Character::GetModelPath() const if( DoesFileExist(s) ) return s; else - return ""; + return NULL; } 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.bmp", as, false, true ); if( as.empty() ) - return ""; + return NULL; else return as[0]; } @@ -115,7 +115,7 @@ CString Character::GetSongSelectIconPath() const GetDirListing( m_sCharDir+"icon.gif", as, false, true ); GetDirListing( m_sCharDir+"icon.bmp", as, false, true ); if( as.empty() ) - return ""; + return NULL; else return as[0]; } @@ -141,7 +141,7 @@ CString Character::GetStageIconPath() const GetDirListing( m_sCharDir+"card.gif", as, false, true ); GetDirListing( m_sCharDir+"card.bmp", as, false, true ); if( as.empty() ) - return ""; + return NULL; else return as[0]; } diff --git a/stepmania/src/Command.cpp b/stepmania/src/Command.cpp index 484a8b2f20..d4efd0ca7b 100644 --- a/stepmania/src/Command.cpp +++ b/stepmania/src/Command.cpp @@ -17,7 +17,7 @@ void IncorrectNumberArgsWarning( const Command &command, int iMaxIndexAccessed ) CString Command::GetName() const { if( m_vsArgs.empty() ) - return ""; + return NULL; CString s = m_vsArgs[0]; s.MakeLower(); return s; diff --git a/stepmania/src/CourseUtil.cpp b/stepmania/src/CourseUtil.cpp index 12946713a3..3e3a82a17e 100644 --- a/stepmania/src/CourseUtil.cpp +++ b/stepmania/src/CourseUtil.cpp @@ -278,7 +278,7 @@ CString CourseID::ToString() const return sPath; if( !sFullTitle.empty() ) return sFullTitle; - return ""; + return NULL; } bool CourseID::IsValid() const diff --git a/stepmania/src/CryptManager.cpp b/stepmania/src/CryptManager.cpp index 64fab9383a..248b7bafae 100644 --- a/stepmania/src/CryptManager.cpp +++ b/stepmania/src/CryptManager.cpp @@ -244,7 +244,7 @@ CString CryptManager::GetMD5( CString fn ) if( !file.Open( fn, RageFile::READ ) ) { LOG->Warn( "GetMD5: Failed to open file '%s'", fn.c_str() ); - return ""; + return NULL; } MD5Init(&md5c); diff --git a/stepmania/src/DateTime.cpp b/stepmania/src/DateTime.cpp index ff349a3d5f..3c773a7afb 100644 --- a/stepmania/src/DateTime.cpp +++ b/stepmania/src/DateTime.cpp @@ -197,7 +197,7 @@ static const CString MONTH_TO_NAME[MONTHS_IN_YEAR] = CString MonthToString( int iMonthIndex ) { if( iMonthIndex < 0 || iMonthIndex >= (int) sizeof(MONTH_TO_NAME) ) - return ""; + return NULL; return MONTH_TO_NAME[iMonthIndex]; } LuaFunction( MonthToString, MonthToString( IArg(1) ) ); diff --git a/stepmania/src/Font.cpp b/stepmania/src/Font.cpp index c92310a1bc..aff14015d8 100644 --- a/stepmania/src/Font.cpp +++ b/stepmania/src/Font.cpp @@ -695,7 +695,7 @@ CString FontPageSettings::MapRange( CString sMapping, int iMapOffset, int iGlyph iCount--; } - return ""; + return NULL; } const wchar_t *pMapping = FontCharmaps::get_char_map( sMapping ); @@ -726,7 +726,7 @@ CString FontPageSettings::MapRange( CString sMapping, int iMapOffset, int iGlyph if( iCount ) return "Map overflow"; /* there aren't enough characters in the map */ - return ""; + return NULL; } static CStringArray LoadStack; diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index c753acf577..7aca99d5b0 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -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 * 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. * * 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) { if( !bUsedInGameplay && pGame->m_DedicatedMenuButton[m] == gb ) - return ""; + return NULL; else if( bUsedInGameplay && pGame->m_SecondaryMenuButton[m] == gb ) return szSecondaryNames[m]; } - return ""; // only used in gameplay + return NULL; // only used in gameplay } diff --git a/stepmania/src/MsdFile.cpp b/stepmania/src/MsdFile.cpp index fdbdeac583..2fb55aa91b 100644 --- a/stepmania/src/MsdFile.cpp +++ b/stepmania/src/MsdFile.cpp @@ -160,8 +160,8 @@ void MsdFile::ReadFromString( const CString &sString ) CString MsdFile::GetParam(unsigned val, unsigned par) const { - if(val >= GetNumValues()) return ""; - if(par >= GetNumParams(val)) return ""; + if(val >= GetNumValues()) return NULL; + if(par >= GetNumParams(val)) return NULL; return values[val].params[par]; } diff --git a/stepmania/src/MsdFile.h b/stepmania/src/MsdFile.h index 49bd7b9261..6e4f49f55e 100644 --- a/stepmania/src/MsdFile.h +++ b/stepmania/src/MsdFile.h @@ -11,7 +11,7 @@ public: { vector 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() { } diff --git a/stepmania/src/NetworkSyncManager.cpp b/stepmania/src/NetworkSyncManager.cpp index 87267ed26e..7ecb528e86 100644 --- a/stepmania/src/NetworkSyncManager.cpp +++ b/stepmania/src/NetworkSyncManager.cpp @@ -13,7 +13,7 @@ NetworkSyncManager::~NetworkSyncManager () { } void NetworkSyncManager::CloseConnection() { } void NetworkSyncManager::PostStartUp(const CString& ServerIP ) { } 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::ReportTiming(float offset, int PlayerNumber) { } 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; } void NetworkSyncManager::SendChat(const CString& message) { } void NetworkSyncManager::SelectUserSong() { } -CString NetworkSyncManager::MD5Hex( const CString &sInput ) { return ""; } +CString NetworkSyncManager::MD5Hex( const CString &sInput ) { return NULL; } int NetworkSyncManager::GetSMOnlineSalt() { return 0; } #else #include "ezsockets.h" diff --git a/stepmania/src/NoteSkinManager.cpp b/stepmania/src/NoteSkinManager.cpp index 2bd71ed0d0..7d3d5ed054 100644 --- a/stepmania/src/NoteSkinManager.cpp +++ b/stepmania/src/NoteSkinManager.cpp @@ -273,7 +273,7 @@ CString NoteSkinManager::GetPathFromDirAndFile( const CString &sDir, const CStri GetDirListing( sDir+sFileName+"*", matches, false, true ); if( matches.empty() ) - return ""; + return NULL; if( matches.size() > 1 ) { diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index 1b563ebe77..5a628d0b0c 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -186,7 +186,7 @@ CString Profile::GetDisplayNameOrHighScoreName() const else if( !m_sLastUsedHighScoreName.empty() ) return m_sLastUsedHighScoreName; else - return ""; + return NULL; } Character *Profile::GetCharacter() const diff --git a/stepmania/src/ProfileManager.cpp b/stepmania/src/ProfileManager.cpp index 79fec3d064..d9c9b5fe6c 100644 --- a/stepmania/src/ProfileManager.cpp +++ b/stepmania/src/ProfileManager.cpp @@ -538,7 +538,7 @@ CString ProfileManager::GetProfileDirImportedFrom( ProfileSlot slot ) const case PROFILE_SLOT_PLAYER_2: return m_sProfileDirImportedFrom[slot]; case PROFILE_SLOT_MACHINE: - return ""; + return NULL; default: ASSERT(0); } diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index 488fd065fd..2cd254b59a 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -54,20 +54,20 @@ CString RageDisplay::SetVideoMode( VideoModeParams p, bool &bNeedReloadTextures CString err; err = this->TryVideoMode(p,bNeedReloadTextures); if( err == "" ) - return ""; + return NULL; LOG->Trace( "TryVideoMode failed: %s", err.c_str() ); // fall back p.windowed = false; if( this->TryVideoMode(p,bNeedReloadTextures) == "" ) - return ""; + return NULL; p.bpp = 16; if( this->TryVideoMode(p,bNeedReloadTextures) == "" ) - return ""; + return NULL; p.width = 640; p.height = 480; if( this->TryVideoMode(p,bNeedReloadTextures) == "" ) - return ""; + return NULL; return ssprintf( "SetVideoMode failed: %s", err.c_str() ); } diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index 029e815f45..1fd7a2bd70 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -222,7 +222,7 @@ public: }; 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. protected: @@ -235,7 +235,7 @@ protected: virtual void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth ); 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 // need to be reloaded. virtual CString TryVideoMode( VideoModeParams params, bool &bNewDeviceOut ) = 0; diff --git a/stepmania/src/RageDisplay_D3D.cpp b/stepmania/src/RageDisplay_D3D.cpp index 5948048dc3..308e7727fb 100644 --- a/stepmania/src/RageDisplay_D3D.cpp +++ b/stepmania/src/RageDisplay_D3D.cpp @@ -392,7 +392,7 @@ CString SetD3DParams( bool &bNewDeviceOut ) } } - return ""; + return NULL; } /* 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. */ g_TexResourceToPaletteIndex.clear(); - return ""; // mode change successful + return NULL; // mode change successful } void RageDisplay_D3D::ResolutionChanged() diff --git a/stepmania/src/RageDisplay_Null.h b/stepmania/src/RageDisplay_Null.h index 73183f2b3c..0ba9b8cbfa 100644 --- a/stepmania/src/RageDisplay_Null.h +++ b/stepmania/src/RageDisplay_Null.h @@ -74,7 +74,7 @@ protected: void DrawLineStripInternal( const RageSpriteVertex v[], int iNumVerts, float LineWidth ) { } 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(); void SetViewport(int shift_left, int shift_down) { } RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf ); diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 7e339e4fc5..7fe0f8d44c 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -334,7 +334,7 @@ CString GetInfoLog( GLhandleARB h ) GLint iLength; GLExt.glGetObjectParameterivARB( h, GL_OBJECT_INFO_LOG_LENGTH_ARB, &iLength ); if( !iLength ) - return ""; + return NULL; GLcharARB *pInfoLog = new GLcharARB[iLength]; GLExt.glGetInfoLogARB( h, iLength, &iLength, pInfoLog ); @@ -477,7 +477,7 @@ CString RageDisplay_OGL::Init( VideoModeParams p, bool bAllowUnacceleratedRender InitScalingScript(); - return ""; + return NULL; } #if defined(UNIX) && defined(HAVE_LIBXTST) @@ -698,7 +698,7 @@ CString RageDisplay_OGL::TryVideoMode( VideoModeParams p, bool &bNewDeviceOut ) ResolutionChanged(); - return ""; // successfully set mode + return NULL; // successfully set mode } 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 { - return ""; + return NULL; } void RageDisplay_OGL::SetAlphaTest( bool b ) diff --git a/stepmania/src/RageFile.cpp b/stepmania/src/RageFile.cpp index bfc1b946fe..3caedcf499 100644 --- a/stepmania/src/RageFile.cpp +++ b/stepmania/src/RageFile.cpp @@ -33,7 +33,7 @@ RageFileBasic *RageFile::Copy() const CString RageFile::GetPath() const { if ( !IsOpen() ) - return ""; + return NULL; CString sRet = m_File->GetDisplayPath(); 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 ) { if( sError.size() != 0 ) - return ""; + return NULL; CString sBuf; int ret = f.Read( sBuf, size ); diff --git a/stepmania/src/RageFileBasic.h b/stepmania/src/RageFileBasic.h index 6be5ae6090..d03bae1952 100644 --- a/stepmania/src/RageFileBasic.h +++ b/stepmania/src/RageFileBasic.h @@ -42,7 +42,7 @@ public: virtual int Flush() = 0; /* 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; @@ -88,7 +88,7 @@ public: bool GetCRC32( uint32_t *iRet ); virtual int GetFileSize() const = 0; - virtual CString GetDisplayPath() const { return ""; } + virtual CString GetDisplayPath() const { return NULL; } virtual RageFileBasic *Copy() const { FAIL_M( "Copying unimplemented" ); } protected: diff --git a/stepmania/src/RageFileManager.cpp b/stepmania/src/RageFileManager.cpp index 5126c91d3b..129f34d673 100644 --- a/stepmania/src/RageFileManager.cpp +++ b/stepmania/src/RageFileManager.cpp @@ -329,11 +329,11 @@ CString LoadedDriver::GetPath( const CString &path ) if( path.size() >= 2 && path[1] == '@' ) { if( MountPoint.size() < 2 || MountPoint[1] != '@' ) - return ""; + return NULL; } 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. */ CString sRet = path.Right( path.size() - MountPoint.size() + 1 ); diff --git a/stepmania/src/RageInputDevice.cpp b/stepmania/src/RageInputDevice.cpp index 45ec59c05a..5944bbe058 100644 --- a/stepmania/src/RageInputDevice.cpp +++ b/stepmania/src/RageInputDevice.cpp @@ -270,8 +270,8 @@ CString DeviceButtonToString( InputDevice device, DeviceButton i ) case DEVICE_PUMP2: return PumpPadButtonToString( (PumpPadButton)i ); case DEVICE_MIDI: return MidiButtonToString( i ); case DEVICE_PARA1: return ParaPadButtonToString( (ParaPadButton)i ); - case DEVICE_NONE: return ""; - default: ASSERT(0); return ""; + case DEVICE_NONE: return NULL; + default: ASSERT(0); return NULL; } } @@ -337,7 +337,7 @@ int GetNumDeviceButtons( InputDevice device ) CString DeviceInput::toString() const { if( device == DEVICE_NONE ) - return ""; + return NULL; CString s = InputDeviceToString(device) + "_" + DeviceButtonToString(device,button); return s; diff --git a/stepmania/src/RageSoundReader_WAV.cpp b/stepmania/src/RageSoundReader_WAV.cpp index 8fc333de4f..78a0a02653 100644 --- a/stepmania/src/RageSoundReader_WAV.cpp +++ b/stepmania/src/RageSoundReader_WAV.cpp @@ -357,7 +357,7 @@ public: CString ReadString( RageFile &f, int iSize, CString &sError ) { if( sError.size() != 0 ) - return ""; + return NULL; CString sBuf; char *pBuf = sBuf.GetBuffer( iSize ); diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index f37cd31a55..705acbd767 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -277,7 +277,7 @@ CString werr_ssprintf( int err, const char *fmt, ...) CString ConvertWstringToACP( wstring s ) { if( s.empty() ) - return ""; + return NULL; int iBytes = WideCharToMultiByte( CP_ACP, 0, s.data(), s.size(), NULL, 0, NULL, FALSE ); @@ -301,7 +301,7 @@ CString ConvertUTF8ToACP( CString s ) CString join( const CString &Deliminator, const CStringArray& Source) { if( Source.empty() ) - return ""; + return NULL; 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 ) { if( begin == end ) - return ""; + return NULL; CString ret; while( begin != end ) @@ -512,11 +512,11 @@ CString GetExtension( const CString &sPath ) { size_t pos = sPath.rfind( '.' ); if( pos == sPath.npos ) - return ""; + return NULL; size_t slash = sPath.find( '/', pos ); 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 ); } @@ -660,6 +660,15 @@ void StripCrnl(CString &s) 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 &vs ) { for( unsigned i=0; i &vs ); // remove all items that end in "cvs" diff --git a/stepmania/src/RageUtil_BackgroundLoader.cpp b/stepmania/src/RageUtil_BackgroundLoader.cpp index e12584e984..32bc544c5b 100644 --- a/stepmania/src/RageUtil_BackgroundLoader.cpp +++ b/stepmania/src/RageUtil_BackgroundLoader.cpp @@ -69,11 +69,11 @@ BackgroundLoader::~BackgroundLoader() CString BackgroundLoader::GetRequest() { if( !g_bEnableBackgroundLoading ) - return ""; + return NULL; LockMut( m_Mutex ); if( !m_CacheRequests.size() ) - return ""; + return NULL; CString ret; ret = m_CacheRequests.front(); diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index db86b16a24..0a02376451 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -540,7 +540,7 @@ static CString GetOneBakedRandomFile( Song *pSong, bool bTryGenre = true ) if( !vsNamesOut.empty() ) return vsNamesOut[rand()%vsNamesOut.size()]; else - return ""; + return NULL; } static MenuDef g_InsertTapAttack( diff --git a/stepmania/src/ScreenEnding.cpp b/stepmania/src/ScreenEnding.cpp index a3c7624ee3..0ae0406c39 100644 --- a/stepmania/src/ScreenEnding.cpp +++ b/stepmania/src/ScreenEnding.cpp @@ -43,7 +43,7 @@ CString GetStatsLineTitle( PlayerNumber pn, EndingStatsLine line ) CourseDifficulty cd = (CourseDifficulty)(DIFFICULTY_EASY+line-PERCENT_COMPLETE_EASY); ASSERT( cd >= 0 && cd < NUM_COURSE_DIFFICULTIES ); if( !GAMESTATE->IsCourseDifficultyShown(cd) ) - return ""; + return NULL; return CourseDifficultyToThemedString(cd); } else @@ -53,7 +53,7 @@ CString GetStatsLineTitle( PlayerNumber pn, EndingStatsLine line ) 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); ASSERT( cd >= 0 && cd < NUM_COURSE_DIFFICULTIES ); if( !GAMESTATE->IsCourseDifficultyShown(cd) ) - return ""; + return NULL; CString sDifficulty = CourseDifficultyToThemedString(cd); fPercent = pProfile->GetCoursesPercentComplete(st,cd); } @@ -120,7 +120,7 @@ CString GetStatsLineValue( PlayerNumber pn, EndingStatsLine line ) } return ssprintf( "%05.2f%%", fPercent*100 ); } - default: ASSERT(0); return ""; + default: ASSERT(0); return NULL; } } diff --git a/stepmania/src/ScreenMessage.cpp b/stepmania/src/ScreenMessage.cpp index 8f7373aec7..83df5e225d 100644 --- a/stepmania/src/ScreenMessage.cpp +++ b/stepmania/src/ScreenMessage.cpp @@ -45,7 +45,7 @@ CString ASMHClass::NumberToString( ScreenMessage SM ) if ( SM == iter->second ) return (*iter).first; - return ""; + return NULL; } /* diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index be69a4ee82..8e80ad3e10 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -367,7 +367,7 @@ CString ScreenOptions::GetExplanationText( int iRow ) const bool bAllowExplanation = row.GetRowDef().m_bAllowExplanation; bool bShowExplanations = bAllowExplanation && SHOW_EXPLANATIONS.GetValue(); if( !bShowExplanations ) - return ""; + return NULL; CString sLineName = row.GetRowDef().m_sName; ASSERT( !sLineName.empty() ); diff --git a/stepmania/src/ScreenPackages.cpp b/stepmania/src/ScreenPackages.cpp index 98cd87cfbe..b5953dabca 100644 --- a/stepmania/src/ScreenPackages.cpp +++ b/stepmania/src/ScreenPackages.cpp @@ -408,7 +408,7 @@ CString ScreenPackages::URLEncode( const CString &URL ) CString ScreenPackages::StripOutContainers( const CString & In ) { if( In.size() == 0 ) - return ""; + return NULL; unsigned i = 0; char t = In.at(i); diff --git a/stepmania/src/ScreenProfileOptions.cpp b/stepmania/src/ScreenProfileOptions.cpp index f0bf4d76b5..d090a52bcf 100644 --- a/stepmania/src/ScreenProfileOptions.cpp +++ b/stepmania/src/ScreenProfileOptions.cpp @@ -228,7 +228,7 @@ CString ScreenProfileOptions::GetSelectedProfileID() const OptionRow &row = *m_pRows[GetCurrentRow()]; const int Selection = row.GetOneSharedSelection(); if( !Selection ) - return ""; + return NULL; return vsProfiles[ Selection-1 ]; } @@ -237,7 +237,7 @@ CString ScreenProfileOptions::GetSelectedProfileName() const OptionRow &row = *m_pRows[GetCurrentRow()]; const int Selection = row.GetOneSharedSelection(); if( !Selection ) - return ""; + return NULL; return g_ProfileOptionsLines[PO_PLAYER1].m_vsChoices[ Selection ]; } diff --git a/stepmania/src/ScreenSMOnlineLogin.cpp b/stepmania/src/ScreenSMOnlineLogin.cpp index f91a0c5853..fbea96136a 100644 --- a/stepmania/src/ScreenSMOnlineLogin.cpp +++ b/stepmania/src/ScreenSMOnlineLogin.cpp @@ -169,7 +169,7 @@ CString ScreenSMOnlineLogin::GetSelectedProfileID() const OptionRow &row = *m_pRows[GetCurrentRow()]; const int Selection = row.GetOneSharedSelection(); if( !Selection ) - return ""; + return NULL; return vsProfiles[ Selection-1 ]; } diff --git a/stepmania/src/ScreenSystemLayer.cpp b/stepmania/src/ScreenSystemLayer.cpp index 256be020ce..21f08843d6 100644 --- a/stepmania/src/ScreenSystemLayer.cpp +++ b/stepmania/src/ScreenSystemLayer.cpp @@ -132,7 +132,7 @@ void ScreenSystemLayer::ReloadCreditsText() CString ScreenSystemLayer::GetCreditsMessage( PlayerNumber pn ) const { if( (bool)CREDITS_JOIN_ONLY && !GAMESTATE->PlayersCanJoin() ) - return ""; + return NULL; bool bShowCreditsMessage; if( SCREENMAN && SCREENMAN->GetTopScreen() && SCREENMAN->GetTopScreen()->GetScreenType() == system_menu ) @@ -160,7 +160,7 @@ CString ScreenSystemLayer::GetCreditsMessage( PlayerNumber pn ) const else if( GAMESTATE->PlayersCanJoin() ) return CREDITS_INSERT_CARD.GetValue(); else - return ""; + return NULL; 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(); diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 0cf1697e2f..974c4f1137 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -1245,7 +1245,7 @@ vector &Song::GetForegroundChanges() CString GetSongAssetPath( CString sPath, const CString &sSongPath ) { if( sPath == "" ) - return ""; + return NULL; /* If there's no path in the file, the file is in the same directory * 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 * of them at the beginning of the path. Ignore the path entirely. */ if( sPath.Left(3) == "../" ) - return ""; + return NULL; return sPath; } diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index d360c235b2..65c4ce6b9e 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -316,7 +316,7 @@ CString SongManager::GetSongGroupBannerPath( CString sSongGroup ) return m_sSongGroupBannerPaths[i]; } - return ""; + return NULL; } void SongManager::GetSongGroupNames( CStringArray &AddTo ) @@ -385,7 +385,7 @@ CString SongManager::GetCourseGroupBannerPath( const CString &sCourseGroup ) if( iter == m_mapCourseGroupToInfo.end() ) { ASSERT_M( 0, ssprintf("requested banner for course group '%s' that doesn't exist",sCourseGroup.c_str()) ); - return ""; + return NULL; } else { @@ -1439,7 +1439,7 @@ CString GetCurrentSongDisplayTitle() { const Song* pSong = GAMESTATE->m_pCurSong; if( pSong == NULL ) - return ""; + return NULL; return pSong->GetDisplayFullTitle(); } @@ -1447,7 +1447,7 @@ CString GetCurrentSongDisplayArtist() { const Song* pSong = GAMESTATE->m_pCurSong; if( pSong == NULL ) - return ""; + return NULL; return pSong->GetDisplayArtist(); } @@ -1455,7 +1455,7 @@ CString GetCurrentSongCredit() { const Song* pSong = GAMESTATE->m_pCurSong; if( pSong == NULL ) - return ""; + return NULL; return pSong->m_sCredit; } @@ -1463,7 +1463,7 @@ CString GetCurrentStepsCredits() { const Song* pSong = GAMESTATE->m_pCurSong; if( pSong == NULL ) - return ""; + return NULL; CString s; diff --git a/stepmania/src/SongUtil.cpp b/stepmania/src/SongUtil.cpp index 0695ecdf03..3cab86c2af 100644 --- a/stepmania/src/SongUtil.cpp +++ b/stepmania/src/SongUtil.cpp @@ -212,12 +212,12 @@ void SongUtil::SortSongPointerArrayByNumPlays( vector &vpSongsInOut, cons CString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so ) { if( pSong == NULL ) - return ""; + return NULL; switch( so ) { case SORT_PREFERRED: - return ""; + return NULL; case SORT_GROUP: // guaranteed not empty return pSong->m_sGroupName; @@ -234,7 +234,7 @@ CString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so s = MakeSortString(s); // resulting string will be uppercase if( s.empty() ) - return ""; + return NULL; else if( s[0] >= '0' && s[0] <= '9' ) return "NUM"; 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); } case SORT_POPULARITY: - return ""; + return NULL; case SORT_TOP_GRADES: { int iCounts[NUM_Grade]; @@ -299,14 +299,14 @@ CString SongUtil::GetSectionNameFromSongAndSort( const Song* pSong, SortOrder so return "N/A"; } case SORT_MODE_MENU: - return ""; + return NULL; case SORT_ALL_COURSES: case SORT_NONSTOP_COURSES: case SORT_ONI_COURSES: case SORT_ENDLESS_COURSES: default: ASSERT(0); - return ""; + return NULL; } } diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 985c1c74d0..509b2b81d6 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -721,7 +721,7 @@ void Sprite::SetSecondsIntoAnimation( float fSeconds ) CString Sprite::GetTexturePath() const { if( m_pTexture==NULL ) - return ""; + return NULL; return m_pTexture->GetID().filename; } diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 40225b7045..c09e79f4f5 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -1236,7 +1236,7 @@ CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature, if( !bResult ) { SCREENMAN->PlayInvalidSound(); - return ""; + return NULL; } SCREENMAN->PlayScreenshotSound(); diff --git a/stepmania/src/StepMania.h b/stepmania/src/StepMania.h index 0dcd9c7c90..66b9274ecd 100644 --- a/stepmania/src/StepMania.h +++ b/stepmania/src/StepMania.h @@ -18,7 +18,7 @@ void ChangeCurrentGame( const Game* g ); void FocusChanged( bool bHasFocus ); 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 ); void InsertCoin( int iNum = 1, const RageTimer *pTime = NULL );