From 8e18d84d10f93592c8a71499f3bb40bff831560d Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 31 Oct 2002 02:11:52 +0000 Subject: [PATCH] some s/GetSize/size/ --- stepmania/src/ActorFrame.cpp | 6 +++--- stepmania/src/AnnouncerManager.cpp | 14 +++++++------- stepmania/src/Course.cpp | 21 +++++++++++---------- stepmania/src/RageUtil.cpp | 26 +++++++++++++------------- 4 files changed, 34 insertions(+), 33 deletions(-) diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index 4c0be2910c..323a3b0a46 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -22,7 +22,7 @@ void ActorFrame::AddChild( Actor* pActor) void ActorFrame::DrawPrimitives() { // draw all sub-ActorFrames while we're in the ActorFrame's local coordinate space - for( int i=0; iDraw(); } } @@ -36,7 +36,7 @@ void ActorFrame::Update( float fDeltaTime ) // update all sub-Actors - for( int i=0; iUpdate(fDeltaTime); } @@ -46,6 +46,6 @@ void ActorFrame::SetDiffuse( RageColor c ) Actor::SetDiffuse( c ); // set all sub-Actors - for( int i=0; iSetDiffuse(c ); } diff --git a/stepmania/src/AnnouncerManager.cpp b/stepmania/src/AnnouncerManager.cpp index 2387979226..5afaed85a1 100644 --- a/stepmania/src/AnnouncerManager.cpp +++ b/stepmania/src/AnnouncerManager.cpp @@ -31,13 +31,13 @@ void AnnouncerManager::GetAnnouncerNames( CStringArray& AddTo ) GetDirListing( ANNOUNCERS_DIR+"*", AddTo, true ); // strip out the folder called "CVS" and EMPTY_ANNOUNCER_NAME - for( int i=AddTo.GetSize()-1; i>=0; i-- ) - { - if( 0 == stricmp( AddTo[i], "cvs" ) ) + for( int i=AddTo.size()-1; i>=0; i-- ) + if( !stricmp( AddTo[i], "cvs" ) ) AddTo.RemoveAt(i); - if( 0 == stricmp( AddTo[i], EMPTY_ANNOUNCER_NAME ) ) + + for( int i=AddTo.size()-1; i>=0; i-- ) + if( !stricmp( AddTo[i], EMPTY_ANNOUNCER_NAME ) ) AddTo.RemoveAt(i); - } } bool AnnouncerManager::DoesAnnouncerExist( CString sAnnouncerName ) @@ -47,7 +47,7 @@ bool AnnouncerManager::DoesAnnouncerExist( CString sAnnouncerName ) CStringArray asAnnouncerNames; GetAnnouncerNames( asAnnouncerNames ); - for( int i=0; i 0; + return !asFileNames.empty(); } diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 5322044f18..584e799dc1 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -37,7 +37,7 @@ void Course::LoadFromCRSFile( CString sPath, CArray &apSongs ) GetDirListing( "Courses\\" + sFName + ".jpg", arrayPossibleBanners, false, true ); GetDirListing( "Courses\\" + sFName + ".bmp", arrayPossibleBanners, false, true ); GetDirListing( "Courses\\" + sFName + ".gif", arrayPossibleBanners, false, true ); - if( arrayPossibleBanners.GetSize() > 0 ) + if( !arrayPossibleBanners.empty() ) m_sBannerPath = arrayPossibleBanners[0]; for( int i=0; i &apSongs ) CStringArray split_SongDir; split( sSongDir, "\\", split_SongDir, true ); - if( split_SongDir.GetSize() > 2 ) + if( split_SongDir.size() > 2 ) { LOG->Warn( "Course file \"%s\" path \"%s\" should contain " "at most one backslash; ignored.", @@ -107,14 +107,14 @@ void Course::LoadFromCRSFile( CString sPath, CArray &apSongs ) Song *pSong = NULL; // foreach song - for( int i = 0; pSong == NULL && i < apSongs.GetSize(); i++ ) + for( unsigned i = 0; pSong == NULL && i < apSongs.size(); i++ ) { CStringArray splitted; split( apSongs[i]->m_sSongDir, "\\", splitted, true ); bool matches = true; - int split_no = splitted.GetSize()-1; - int SongDir_no = split_SongDir.GetSize()-1; + int split_no = splitted.size()-1; + int SongDir_no = split_SongDir.size()-1; while( split_no >= 0 && SongDir_no >= 0 ) { if( stricmp(splitted[split_no--], split_SongDir[SongDir_no--] ) ) @@ -147,7 +147,7 @@ void Course::CreateEndlessCourseFromGroupAndDifficulty( CString sGroupName, Diff GetDirListing( "Songs\\" + sGroupName + "\\banner.jpg", asPossibleBannerPaths, false, true ); GetDirListing( "Songs\\" + sGroupName + "\\banner.gif", asPossibleBannerPaths, false, true ); GetDirListing( "Songs\\" + sGroupName + "\\banner.bmp", asPossibleBannerPaths, false, true ); - if( asPossibleBannerPaths.GetSize() > 0 ) + if( !asPossibleBannerPaths.empty() ) m_sBannerPath = asPossibleBannerPaths[0]; CString sShortGroupName = SONGMAN->ShortenGroupName( sGroupName ); @@ -160,7 +160,7 @@ void Course::CreateEndlessCourseFromGroupAndDifficulty( CString sGroupName, Diff case DIFFICULTY_HARD: m_sName += "Hard"; break; } - for( int s=0; sm_apNotes.GetSize(); i++ ) + unsigned i; + + for( i=0; im_apNotes.size(); i++ ) { Notes* pNotes = pSong->m_apNotes[i]; if( 0==stricmp(pNotes->m_sDescription, sDescription) && @@ -192,7 +193,7 @@ Notes* Course::GetNotesForStage( int iStage ) // Didn't find a matching description. Try to match the Difficulty instead. Difficulty dc = Notes::DifficultyFromDescriptionAndMeter( sDescription, 5 ); - for( i=0; im_apNotes.GetSize(); i++ ) + for( i=0; im_apNotes.size(); i++ ) { Notes* pNotes = pSong->m_apNotes[i]; if( pNotes->m_Difficulty == dc && diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 0b8a0cde4e..a42c2101aa 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -37,7 +37,7 @@ float TimeToSeconds( CString sHMS ) CStringArray arrayBits; split( sHMS, ":", arrayBits, false ); - while( arrayBits.GetSize() < 3 ) + while( arrayBits.size() < 3 ) arrayBits.insert(arrayBits.begin(), "0" ); // pad missing bits float fSeconds = 0; @@ -96,13 +96,13 @@ CString vssprintf( const char *fmt, va_list argList) //----------------------------------------------------------------------------- CString join( const CString &Deliminator, const CStringArray& Source) { - if( Source.GetSize() == 0 ) + if( Source.empty() ) return ""; CString csTmp; // Loop through the Array and Append the Deliminator - for( int iNum = 0; iNum < Source.GetSize()-1; iNum++ ) { + for( unsigned iNum = 0; iNum < Source.size()-1; iNum++ ) { csTmp += Source[iNum]; csTmp += Deliminator; } @@ -227,14 +227,14 @@ void splitrelpath( const CString &Path, CString& Dir, CString& FName, CString& E FName = ""; Ext = ""; } - else if( sFNameAndExtBits.GetSize() == 1 ) // file doesn't have extension + else if( sFNameAndExtBits.size() == 1 ) // file doesn't have extension { FName = sFNameAndExtBits[0]; Ext = ""; } - else if( sFNameAndExtBits.GetSize() > 1 ) // file has extension and possibly multiple periods + else if( sFNameAndExtBits.size() > 1 ) // file has extension and possibly multiple periods { - Ext = sFNameAndExtBits[ sFNameAndExtBits.GetSize()-1 ]; + Ext = sFNameAndExtBits[ sFNameAndExtBits.size()-1 ]; // subtract the Ext and last period from FNameAndExt FName = sFNameAndExt.Left( sFNameAndExt.GetLength()-Ext.GetLength()-1 ); @@ -249,7 +249,7 @@ bool CreateDirectories( CString Path ) Path.Replace("\\", "/"); split(Path, "/", parts); - for(int i = 0; i < parts.GetSize(); ++i) + for(unsigned i = 0; i < parts.size(); ++i) { curpath += parts[i] + "/"; if(CreateDirectory( curpath, NULL )) @@ -340,7 +340,7 @@ private: void DirCache::FlushCache() { - for(int i = 0; i < directory_cache.GetSize(); ++i) + for(unsigned i = 0; i < directory_cache.size(); ++i) delete directory_cache[i]; directory_cache.clear(); } @@ -389,11 +389,11 @@ DirCache::CacheEntry *DirCache::LoadDirCache( const CString &sPath ) /* Return a CacheEntry object for a directory, reading it if necessary. */ const DirCache::CacheEntry *DirCache::SearchDirCache( const CString &sPath ) { - int i; - for(i = 0; i < directory_cache.GetSize(); ++i) + unsigned i; + for(i = 0; i < directory_cache.size(); ++i) if(directory_cache[i]->dir == sPath) break; - if(i == directory_cache.GetSize()) + if(i == directory_cache.size()) /* Didn't find it. */ return LoadDirCache( sPath ); @@ -436,7 +436,7 @@ bool GetExtDirListingV( const CString &sPath, CStringArray &AddTo, bool bOnlyDir const DirCache::CacheEntry *cache = DirectoryCache.SearchDirCache(sDir); if(!cache) return false; - for(int i = 0; i < cache->files.GetSize(); ++i) + for(unsigned i = 0; i < cache->files.size(); ++i) { if( bOnlyDirs && !(cache->Attributes[i] & FILE_ATTRIBUTE_DIRECTORY) ) continue; // skip @@ -630,7 +630,7 @@ unsigned int GetHashForDirectory( CString sDir ) CStringArray arrayFiles; GetDirListing( sDir+"\\*.*", arrayFiles, false ); - for( int i=0; i