From 2e6ffb73e0a84405ba19f63e4bc40e46e79a8baf Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 25 Sep 2004 02:50:31 +0000 Subject: [PATCH] remove construct-and-open RageFile ctor --- stepmania/src/GameState.cpp | 5 ++--- stepmania/src/LyricsLoader.cpp | 7 +++---- stepmania/src/NotesLoaderBMS.cpp | 14 ++++++-------- stepmania/src/RageFile.cpp | 9 --------- stepmania/src/RageFile.h | 1 - stepmania/src/arch/MovieTexture/MovieTexture.cpp | 5 ++--- 6 files changed, 13 insertions(+), 28 deletions(-) diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 5c91b2a404..911cb0ec50 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -1610,9 +1610,8 @@ void GameState::StoreRankingName( PlayerNumber pn, CString name ) // Filter swear words from name // name.MakeUpper(); - RageFile file(NAMES_BLACKLIST_FILE); - - if (file.IsOpen()) + RageFile file; + if( file.Open(NAMES_BLACKLIST_FILE) ) { CString line; diff --git a/stepmania/src/LyricsLoader.cpp b/stepmania/src/LyricsLoader.cpp index 401832cf63..e821699157 100644 --- a/stepmania/src/LyricsLoader.cpp +++ b/stepmania/src/LyricsLoader.cpp @@ -20,11 +20,10 @@ bool LyricsLoader::LoadFromLRCFile(const CString& sPath, Song& out) { LOG->Trace( "LyricsLoader::LoadFromLRCFile(%s)", sPath.c_str() ); - RageFile input( sPath ); - - if (!input.IsOpen()) + RageFile input; + if( !input.Open(sPath) ) { - LOG->Warn("Error opening file '%s' for reading.", sPath.c_str()); + LOG->Warn("Error opening file '%s' for reading: %s", sPath.c_str(), input.GetError().c_str() ); return false; } diff --git a/stepmania/src/NotesLoaderBMS.cpp b/stepmania/src/NotesLoaderBMS.cpp index 0c8cd2374a..34cc4b6787 100644 --- a/stepmania/src/NotesLoaderBMS.cpp +++ b/stepmania/src/NotesLoaderBMS.cpp @@ -604,10 +604,9 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out ) * rather than open the file again. However, I'm not changing the logic, * only the implementation. -- Steve */ - RageFile file(sPath); //Why doesn't VC6 bitch here but it does with int?? - - if (!file.IsOpen()) - RageException::Throw( "Failed to open %s for reading.", sPath.c_str() ); + RageFile file; + if( !file.Open(sPath) ) + RageException::Throw( "Failed to open %s for reading: %s", sPath.c_str(), file.GetError().c_str() ); while (!file.AtEOF()) { CString line; @@ -663,10 +662,9 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out ) // open the song file again and and look for this tag's value - RageFile file(sPath); //Why doesn't VC6 bitch here but it does with int?? - - if (!file.IsOpen()) - RageException::Throw( "Failed to open %s for reading.", sPath.c_str() ); + RageFile file; + if( !file.Open(sPath) ) + RageException::Throw( "Failed to open %s for reading: %s", sPath.c_str(), file.GetError().c_str() ); while (!file.AtEOF()) { CString line; diff --git a/stepmania/src/RageFile.cpp b/stepmania/src/RageFile.cpp index 47555c2876..8035addb76 100644 --- a/stepmania/src/RageFile.cpp +++ b/stepmania/src/RageFile.cpp @@ -11,15 +11,6 @@ RageFile::RageFile() m_FilePos = 0; } -RageFile::RageFile( const CString& path, int mode ) -{ - m_File = NULL; - m_BufAvail = 0; - m_EOF = false; - m_FilePos = 0; - Open(path, mode); -} - RageFile::RageFile( const RageFile &cpy ) { ResetBuf(); diff --git a/stepmania/src/RageFile.h b/stepmania/src/RageFile.h index 42a934ff45..36580688d2 100644 --- a/stepmania/src/RageFile.h +++ b/stepmania/src/RageFile.h @@ -26,7 +26,6 @@ public: }; RageFile(); - RageFile( const CString& path, int mode = READ ); ~RageFile() { Close(); } RageFile( const RageFile &cpy ); diff --git a/stepmania/src/arch/MovieTexture/MovieTexture.cpp b/stepmania/src/arch/MovieTexture/MovieTexture.cpp index 280c5cf726..63e6bf6c53 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture.cpp @@ -45,9 +45,8 @@ bool RageMovieTexture::GetFourCC( CString fn, CString &handler, CString &type ) return false; \ } - RageFile file(fn); - - if( !file.IsOpen() ) + RageFile file; + if( !file.Open(fn) ) HANDLE_ERROR("Could not open file."); if( !file.Seek(0x70) ) HANDLE_ERROR("Could not seek.");