From 1fcfc2298148a16350ce0d28e11ebb64c74ca24c Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Wed, 28 Dec 2005 03:59:52 +0000 Subject: [PATCH] CString -> RString const string params where possible for easier debug stepping --- stepmania/src/RageFileDriver.cpp | 4 +- stepmania/src/RageFileDriver.h | 6 +- stepmania/src/RageFileDriverDirect.cpp | 46 ++++++------ stepmania/src/RageFileDriverDirect.h | 12 +-- stepmania/src/RageFileDriverDirectHelpers.cpp | 44 +++++------ stepmania/src/RageFileDriverDirectHelpers.h | 28 +++---- stepmania/src/RageFileDriverMemory.cpp | 2 +- stepmania/src/RageFileDriverTimeout.cpp | 74 +++++++++---------- stepmania/src/RageFileDriverTimeout.h | 10 +-- stepmania/src/RageFileDriverZip.cpp | 4 +- stepmania/src/RageFileDriverZip.h | 2 +- 11 files changed, 116 insertions(+), 116 deletions(-) diff --git a/stepmania/src/RageFileDriver.cpp b/stepmania/src/RageFileDriver.cpp index f28f5e67ae..b0d647dd77 100644 --- a/stepmania/src/RageFileDriver.cpp +++ b/stepmania/src/RageFileDriver.cpp @@ -70,7 +70,7 @@ void RageFileDriver::FlushDirCache( const RString &sPath ) const struct FileDriverEntry *g_pFileDriverList = NULL; -FileDriverEntry::FileDriverEntry( RString sType ) +FileDriverEntry::FileDriverEntry( const RString &sType ) { m_pLink = g_pFileDriverList; g_pFileDriverList = this; @@ -82,7 +82,7 @@ FileDriverEntry::~FileDriverEntry() g_pFileDriverList = NULL; /* invalidate */ } -RageFileDriver *MakeFileDriver( RString sType, RString sRoot ) +RageFileDriver *MakeFileDriver( const RString &sType, const RString &sRoot ) { for( const FileDriverEntry *p = g_pFileDriverList; p; p = p->m_pLink ) if( !p->m_sType.CompareNoCase(sType) ) diff --git a/stepmania/src/RageFileDriver.h b/stepmania/src/RageFileDriver.h index 78e77394c6..f89334772e 100644 --- a/stepmania/src/RageFileDriver.h +++ b/stepmania/src/RageFileDriver.h @@ -34,14 +34,14 @@ public: /* This is used to register the driver, so RageFileManager can see it. */ struct FileDriverEntry { - FileDriverEntry( RString sType ); + FileDriverEntry( const RString &sType ); virtual ~FileDriverEntry(); - virtual RageFileDriver *Create( RString sRoot ) const = 0; + virtual RageFileDriver *Create( const RString &sRoot ) const = 0; RString m_sType; const FileDriverEntry *m_pLink; }; -RageFileDriver *MakeFileDriver( RString Type, RString Root ); +RageFileDriver *MakeFileDriver( const RString &Type, const RString &Root ); #endif diff --git a/stepmania/src/RageFileDriverDirect.cpp b/stepmania/src/RageFileDriverDirect.cpp index 30a3ea99a0..49286bb943 100644 --- a/stepmania/src/RageFileDriverDirect.cpp +++ b/stepmania/src/RageFileDriverDirect.cpp @@ -24,7 +24,7 @@ static struct FileDriverEntry_DIR: public FileDriverEntry { FileDriverEntry_DIR(): FileDriverEntry( "DIR" ) { } - RageFileDriver *Create( CString Root ) const { return new RageFileDriverDirect( Root ); } + RageFileDriver *Create( const RString &sRoot ) const { return new RageFileDriverDirect( sRoot ); } } const g_RegisterDriver; /* This driver handles direct file access. */ @@ -32,14 +32,14 @@ static struct FileDriverEntry_DIR: public FileDriverEntry class RageFileObjDirect: public RageFileObj { public: - RageFileObjDirect( const CString &sPath, int iFD, int iMode ); + RageFileObjDirect( const RString &sPath, int iFD, int iMode ); virtual ~RageFileObjDirect(); virtual int ReadInternal( void *pBuffer, size_t iBytes ); virtual int WriteInternal( const void *pBuffer, size_t iBytes ); virtual int FlushInternal(); virtual int SeekInternal( int offset ); virtual RageFileBasic *Copy() const; - virtual CString GetDisplayPath() const { return m_sPath; } + virtual RString GetDisplayPath() const { return m_sPath; } virtual int GetFileSize() const; private: @@ -47,8 +47,8 @@ private: int m_iFD; int m_iMode; - CString m_sPath; /* for Copy */ - CString m_sWriteBuf; + RString m_sPath; /* for Copy */ + RString m_sWriteBuf; /* * When not streaming to disk, we write to a temporary file, and rename to the @@ -60,14 +60,14 @@ private: }; -RageFileDriverDirect::RageFileDriverDirect( CString sRoot ): +RageFileDriverDirect::RageFileDriverDirect( const RString &sRoot ): RageFileDriver( new DirectFilenameDB(sRoot) ) { Remount( sRoot ); } -static CString MakeTempFilename( const CString &sPath ) +static RString MakeTempFilename( const RString &sPath ) { /* "Foo/bar/baz" -> "Foo/bar/new.baz.new". Both prepend and append: we don't * want a wildcard search for the filename to match (foo.txt.new matches foo.txt*), @@ -76,7 +76,7 @@ static CString MakeTempFilename( const CString &sPath ) return Dirname(sPath) + "new." + Basename(sPath) + ".new"; } -RageFileObj *MakeFileObjDirect( CString sPath, int iMode, int &iError ) +RageFileObj *MakeFileObjDirect( RString sPath, int iMode, int &iError ) { int iFD; if( iMode & RageFile::READ ) @@ -89,7 +89,7 @@ RageFileObj *MakeFileObjDirect( CString sPath, int iMode, int &iError ) } else { - CString sOut; + RString sOut; if( iMode & RageFile::STREAMED ) sOut = sPath; else @@ -108,9 +108,9 @@ RageFileObj *MakeFileObjDirect( CString sPath, int iMode, int &iError ) return new RageFileObjDirect( sPath, iFD, iMode ); } -RageFileBasic *RageFileDriverDirect::Open( const CString &sPath_, int iMode, int &iError ) +RageFileBasic *RageFileDriverDirect::Open( const RString &sPath_, int iMode, int &iError ) { - CString sPath = sPath_; + RString sPath = sPath_; ASSERT( sPath.size() && sPath[0] == '/' ); /* This partially resolves. For example, if "abc/def" exists, and we're opening @@ -120,7 +120,7 @@ RageFileBasic *RageFileDriverDirect::Open( const CString &sPath_, int iMode, int if( iMode & RageFile::WRITE ) { - const CString dir = Dirname(sPath); + const RString dir = Dirname(sPath); if( this->GetFileType(dir) != RageFileManager::TYPE_DIR ) CreateDirectories( m_sRoot + dir ); } @@ -128,10 +128,10 @@ RageFileBasic *RageFileDriverDirect::Open( const CString &sPath_, int iMode, int return MakeFileObjDirect( m_sRoot + sPath, iMode, iError ); } -bool RageFileDriverDirect::Move( const CString &sOldPath_, const CString &sNewPath_ ) +bool RageFileDriverDirect::Move( const RString &sOldPath_, const RString &sNewPath_ ) { - CString sOldPath = sOldPath_; - CString sNewPath = sNewPath_; + RString sOldPath = sOldPath_; + RString sNewPath = sNewPath_; FDB->ResolvePath( sOldPath ); FDB->ResolvePath( sNewPath ); @@ -139,7 +139,7 @@ bool RageFileDriverDirect::Move( const CString &sOldPath_, const CString &sNewPa return false; { - const CString sDir = Dirname(sNewPath); + const RString sDir = Dirname(sNewPath); CreateDirectories( m_sRoot + sDir ); } @@ -153,9 +153,9 @@ bool RageFileDriverDirect::Move( const CString &sOldPath_, const CString &sNewPa return true; } -bool RageFileDriverDirect::Remove( const CString &sPath_ ) +bool RageFileDriverDirect::Remove( const RString &sPath_ ) { - CString sPath = sPath_; + RString sPath = sPath_; FDB->ResolvePath( sPath ); switch( this->GetFileType(sPath) ) { @@ -197,7 +197,7 @@ RageFileBasic *RageFileObjDirect::Copy() const return ret; } -bool RageFileDriverDirect::Remount( const CString &sPath ) +bool RageFileDriverDirect::Remount( const RString &sPath ) { m_sRoot = sPath; ((DirectFilenameDB *) FDB)->SetRoot( sPath ); @@ -209,7 +209,7 @@ bool RageFileDriverDirect::Remount( const CString &sPath ) } static const unsigned int BUFSIZE = 1024*64; -RageFileObjDirect::RageFileObjDirect( const CString &sPath, int iFD, int iMode ) +RageFileObjDirect::RageFileObjDirect( const RString &sPath, int iFD, int iMode ) { m_sPath = sPath; m_iFD = iFD; @@ -299,8 +299,8 @@ RageFileObjDirect::~RageFileObjDirect() * file. */ - CString sOldPath = MakeTempFilename(m_sPath); - CString sNewPath = m_sPath; + RString sOldPath = MakeTempFilename(m_sPath); + RString sNewPath = m_sPath; #if defined(WIN32) if( WinMoveFile(DoPathReplace(sOldPath), DoPathReplace(sNewPath)) ) @@ -308,7 +308,7 @@ RageFileObjDirect::~RageFileObjDirect() /* We failed. */ int err = GetLastError(); - const CString error = werr_ssprintf( err, "Error renaming \"%s\" to \"%s\"", sOldPath.c_str(), sNewPath.c_str() ); + const RString error = werr_ssprintf( err, "Error renaming \"%s\" to \"%s\"", sOldPath.c_str(), sNewPath.c_str() ); LOG->Warn( "%s", error.c_str() ); SetError( error ); break; diff --git a/stepmania/src/RageFileDriverDirect.h b/stepmania/src/RageFileDriverDirect.h index fb99dd87ec..50f2056ece 100644 --- a/stepmania/src/RageFileDriverDirect.h +++ b/stepmania/src/RageFileDriverDirect.h @@ -8,15 +8,15 @@ class RageFileDriverDirect: public RageFileDriver { public: - RageFileDriverDirect( CString sRoot ); + RageFileDriverDirect( const RString &sRoot ); - RageFileBasic *Open( const CString &sPath, int iMode, int &iError ); - bool Move( const CString &sOldPath, const CString &sNewPath ); - bool Remove( const CString &sPath ); - bool Remount( const CString &sPath ); + RageFileBasic *Open( const RString &sPath, int iMode, int &iError ); + bool Move( const RString &sOldPath, const RString &sNewPath ); + bool Remove( const RString &sPath ); + bool Remount( const RString &sPath ); private: - CString m_sRoot; + RString m_sRoot; }; #endif diff --git a/stepmania/src/RageFileDriverDirectHelpers.cpp b/stepmania/src/RageFileDriverDirectHelpers.cpp index b3726784ed..1d5285c23a 100644 --- a/stepmania/src/RageFileDriverDirectHelpers.cpp +++ b/stepmania/src/RageFileDriverDirectHelpers.cpp @@ -20,45 +20,45 @@ #if defined(_XBOX) /* Wrappers for low-level file functions, to work around Xbox issues: */ -int DoMkdir( const CString &sPath, int perm ) +int DoMkdir( const RString &sPath, int perm ) { return mkdir( DoPathReplace(sPath), perm ); } -int DoOpen( const CString &sPath, int flags, int perm ) +int DoOpen( const RString &sPath, int flags, int perm ) { return open( DoPathReplace(sPath), flags, perm ); } -int DoStat( const CString &sPath, struct stat *st ) +int DoStat( const RString &sPath, struct stat *st ) { return stat( DoPathReplace(sPath), st ); } -int DoRename( const CString &sOldPath, const CString &sNewPath ) +int DoRename( const RString &sOldPath, const RString &sNewPath ) { return rename( DoPathReplace(sOldPath), DoPathReplace(sNewPath) ); } -int DoRemove( const CString &sPath ) +int DoRemove( const RString &sPath ) { return remove( DoPathReplace(sPath) ); } -int DoRmdir( const CString &sPath ) +int DoRmdir( const RString &sPath ) { return rmdir( DoPathReplace(sPath) ); } -HANDLE DoFindFirstFile( const CString &sPath, WIN32_FIND_DATA *fd ) +HANDLE DoFindFirstFile( const RString &sPath, WIN32_FIND_DATA *fd ) { return FindFirstFile( DoPathReplace(sPath), fd ); } #endif -CString DoPathReplace(const CString &sPath) +RString DoPathReplace(const RString &sPath) { - CString TempPath = sPath; + RString TempPath = sPath; #if defined(XBOX) TempPath.Replace( "//", "\\" ); TempPath.Replace( "/", "\\" ); @@ -68,7 +68,7 @@ CString DoPathReplace(const CString &sPath) #if defined(WIN32) -static bool WinMoveFileInternal( const CString &sOldPath, const CString &sNewPath ) +static bool WinMoveFileInternal( const RString &sOldPath, const RString &sNewPath ) { static bool Win9x = false; @@ -102,7 +102,7 @@ static bool WinMoveFileInternal( const CString &sOldPath, const CString &sNewPat return !!MoveFile( sOldPath, sNewPath ); } -bool WinMoveFile( CString sOldPath, CString sNewPath ) +bool WinMoveFile( RString sOldPath, RString sNewPath ) { if( WinMoveFileInternal( DoPathReplace(sOldPath), DoPathReplace(sNewPath) ) ) return true; @@ -116,11 +116,11 @@ bool WinMoveFile( CString sOldPath, CString sNewPath ) #endif /* mkdir -p. Doesn't fail if Path already exists and is a directory. */ -bool CreateDirectories( CString Path ) +bool CreateDirectories( RString Path ) { /* XXX: handle "//foo/bar" paths in Windows */ - vector parts; - CString curpath; + vector parts; + RString curpath; /* If Path is absolute, add the initial slash ("ignore empty" will remove it). */ if( Path.Left(1) == "/" ) @@ -176,14 +176,14 @@ bool CreateDirectories( CString Path ) return true; } -DirectFilenameDB::DirectFilenameDB( CString root_ ) +DirectFilenameDB::DirectFilenameDB( RString root_ ) { ExpireSeconds = 30; SetRoot( root_ ); } -void DirectFilenameDB::SetRoot( CString root_ ) +void DirectFilenameDB::SetRoot( RString root_ ) { root = root_; @@ -196,9 +196,9 @@ void DirectFilenameDB::SetRoot( CString root_ ) } -void DirectFilenameDB::PopulateFileSet( FileSet &fs, const CString &path ) +void DirectFilenameDB::PopulateFileSet( FileSet &fs, const RString &path ) { - CString sPath = path; + RString sPath = path; #if defined(XBOX) /* Xbox doesn't handle path names which end with ".", which are used when using an @@ -293,21 +293,21 @@ void DirectFilenameDB::PopulateFileSet( FileSet &fs, const CString &path ) * performance-critical situations. To avoid incurring some of the overheard * due to ignore markers, delete the file instead instead of using an ignore marker. */ - static const CString IGNORE_MARKER_BEGINNING = "ignore-"; + static const RString IGNORE_MARKER_BEGINNING = "ignore-"; - vector vsFilesToRemove; + vector vsFilesToRemove; for( set::iterator iter = fs.files.lower_bound(IGNORE_MARKER_BEGINNING); iter != fs.files.end(); iter++ ) { if( !BeginsWith( iter->lname, IGNORE_MARKER_BEGINNING ) ) break; - CString sFileLNameToIgnore = iter->lname.Right( iter->lname.length() - IGNORE_MARKER_BEGINNING.length() ); + RString sFileLNameToIgnore = iter->lname.Right( iter->lname.length() - IGNORE_MARKER_BEGINNING.length() ); vsFilesToRemove.push_back( iter->name ); vsFilesToRemove.push_back( sFileLNameToIgnore ); } - FOREACH_CONST( CString, vsFilesToRemove, iter ) + FOREACH_CONST( RString, vsFilesToRemove, iter ) { // Erase the file corresponding to the ignore marker File fileToDelete; diff --git a/stepmania/src/RageFileDriverDirectHelpers.h b/stepmania/src/RageFileDriverDirectHelpers.h index 90864e1c82..98a12f1b4c 100644 --- a/stepmania/src/RageFileDriverDirectHelpers.h +++ b/stepmania/src/RageFileDriverDirectHelpers.h @@ -6,13 +6,13 @@ #include #if defined(_XBOX) -int DoMkdir( const CString &sPath, int perm ); -int DoOpen( const CString &sPath, int flags, int perm ); -int DoStat( const CString &sPath, struct stat *st ); -int DoRename( const CString &sOldPath, const CString &sNewPath ); -int DoRemove( const CString &sPath ); -int DoRmdir( const CString &sPath ); -HANDLE DoFindFirstFile( const CString &sPath, WIN32_FIND_DATA *fd ); +int DoMkdir( const RString &sPath, int perm ); +int DoOpen( const RString &sPath, int flags, int perm ); +int DoStat( const RString &sPath, struct stat *st ); +int DoRename( const RString &sOldPath, const RString &sNewPath ); +int DoRemove( const RString &sPath ); +int DoRmdir( const RString &sPath ); +HANDLE DoFindFirstFile( const RString &sPath, WIN32_FIND_DATA *fd ); #else #define DoOpen open #define DoStat stat @@ -22,28 +22,28 @@ HANDLE DoFindFirstFile( const CString &sPath, WIN32_FIND_DATA *fd ); #define DoRemove remove #define DoRmdir rmdir #endif -CString DoPathReplace( const CString &sPath ); +RString DoPathReplace( const RString &sPath ); #if defined(WIN32) -bool WinMoveFile( CString sOldPath, CString sNewPath ); +bool WinMoveFile( RString sOldPath, RString sNewPath ); #endif #if !defined(O_BINARY) #define O_BINARY 0 #endif -bool CreateDirectories( CString sPath ); +bool CreateDirectories( RString sPath ); #include "RageUtil_FileDB.h" class DirectFilenameDB: public FilenameDB { public: - DirectFilenameDB( CString root ); - void SetRoot( CString root ); + DirectFilenameDB( RString root ); + void SetRoot( RString root ); protected: - virtual void PopulateFileSet( FileSet &fs, const CString &sPath ); - CString root; + virtual void PopulateFileSet( FileSet &fs, const RString &sPath ); + RString root; }; #endif diff --git a/stepmania/src/RageFileDriverMemory.cpp b/stepmania/src/RageFileDriverMemory.cpp index 196d56e7c8..9b5d3f6b0f 100644 --- a/stepmania/src/RageFileDriverMemory.cpp +++ b/stepmania/src/RageFileDriverMemory.cpp @@ -177,7 +177,7 @@ bool RageFileDriverMem::Remove( const RString &sPath ) static struct FileDriverEntry_MEM: public FileDriverEntry { FileDriverEntry_MEM(): FileDriverEntry( "MEM" ) { } - RageFileDriver *Create( RString Root ) const { return new RageFileDriverMem(); } + RageFileDriver *Create( const RString &sRoot ) const { return new RageFileDriverMem(); } } const g_RegisterDriver; /* diff --git a/stepmania/src/RageFileDriverTimeout.cpp b/stepmania/src/RageFileDriverTimeout.cpp index 5353d188e2..6b39fbc2a7 100644 --- a/stepmania/src/RageFileDriverTimeout.cpp +++ b/stepmania/src/RageFileDriverTimeout.cpp @@ -69,25 +69,25 @@ enum ThreadRequest class ThreadedFileWorker: public RageWorkerThread { public: - ThreadedFileWorker( CString sPath ); + ThreadedFileWorker( RString sPath ); ~ThreadedFileWorker(); /* Threaded operations. If a file operation times out, the caller loses all access * to the file and should fail all future operations; this is because the thread * is still trying to finish the operation. The thread will clean up afterwards. */ - RageFileBasic *Open( const CString &sPath, int iMode, int &iErr ); + RageFileBasic *Open( const RString &sPath, int iMode, int &iErr ); void Close( RageFileBasic *pFile ); int GetFileSize( RageFileBasic *&pFile ); - int Seek( RageFileBasic *&pFile, int iPos, CString &sError ); - int Read( RageFileBasic *&pFile, void *pBuf, int iSize, CString &sError ); - int Write( RageFileBasic *&pFile, const void *pBuf, int iSize, CString &sError ); - int Flush( RageFileBasic *&pFile, CString &sError ); - RageFileBasic *Copy( RageFileBasic *&pFile, CString &sError ); + int Seek( RageFileBasic *&pFile, int iPos, RString &sError ); + int Read( RageFileBasic *&pFile, void *pBuf, int iSize, RString &sError ); + int Write( RageFileBasic *&pFile, const void *pBuf, int iSize, RString &sError ); + int Flush( RageFileBasic *&pFile, RString &sError ); + RageFileBasic *Copy( RageFileBasic *&pFile, RString &sError ); - bool FlushDirCache( const CString &sPath ); - int Move( const CString &sOldPath, const CString &sNewPath ); - int Remove( const CString &sPath ); - bool PopulateFileSet( FileSet &fs, const CString &sPath ); + bool FlushDirCache( const RString &sPath ); + int Move( const RString &sOldPath, const RString &sNewPath ); + int Remove( const RString &sPath ); + bool PopulateFileSet( FileSet &fs, const RString &sPath ); protected: void HandleRequest( int iRequest ); @@ -103,10 +103,10 @@ private: RageMutex m_DeletedFilesLock; /* REQ_OPEN, REQ_POPULATE_FILE_SET, REQ_FLUSH_DIR_CACHE, REQ_REMOVE, REQ_MOVE: */ - CString m_sRequestPath; /* in */ + RString m_sRequestPath; /* in */ /* REQ_MOVE: */ - CString m_sRequestPath2; /* in */ + RString m_sRequestPath2; /* in */ /* REQ_OPEN, REQ_COPY: */ RageFileBasic *m_pResultFile; /* out */ @@ -125,7 +125,7 @@ private: /* REQ_READ, REQ_WRITE */ int m_iRequestSize; /* in */ - CString m_sResultError; /* out */ + RString m_sResultError; /* out */ /* REQ_SEEK */ int m_iRequestPos; /* in */ @@ -150,7 +150,7 @@ void RageFileDriverTimeout::SetTimeout( float fSeconds ) } -ThreadedFileWorker::ThreadedFileWorker( CString sPath ): +ThreadedFileWorker::ThreadedFileWorker( RString sPath ): RageWorkerThread( sPath ), m_DeletedFilesLock( sPath + "DeletedFilesLock" ) { @@ -292,7 +292,7 @@ void ThreadedFileWorker::RequestTimedOut() SAFE_DELETE_ARRAY( m_pResultBuffer ); } -RageFileBasic *ThreadedFileWorker::Open( const CString &sPath, int iMode, int &iErr ) +RageFileBasic *ThreadedFileWorker::Open( const RString &sPath, int iMode, int &iErr ) { if( m_pChildDriver == NULL ) { @@ -377,7 +377,7 @@ int ThreadedFileWorker::GetFileSize( RageFileBasic *&pFile ) return m_iResultRequest; } -int ThreadedFileWorker::Seek( RageFileBasic *&pFile, int iPos, CString &sError ) +int ThreadedFileWorker::Seek( RageFileBasic *&pFile, int iPos, RString &sError ) { ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ @@ -412,7 +412,7 @@ int ThreadedFileWorker::Seek( RageFileBasic *&pFile, int iPos, CString &sError ) return m_iResultRequest; } -int ThreadedFileWorker::Read( RageFileBasic *&pFile, void *pBuf, int iSize, CString &sError ) +int ThreadedFileWorker::Read( RageFileBasic *&pFile, void *pBuf, int iSize, RString &sError ) { ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ @@ -454,7 +454,7 @@ int ThreadedFileWorker::Read( RageFileBasic *&pFile, void *pBuf, int iSize, CStr return iGot; } -int ThreadedFileWorker::Write( RageFileBasic *&pFile, const void *pBuf, int iSize, CString &sError ) +int ThreadedFileWorker::Write( RageFileBasic *&pFile, const void *pBuf, int iSize, RString &sError ) { ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ @@ -495,7 +495,7 @@ int ThreadedFileWorker::Write( RageFileBasic *&pFile, const void *pBuf, int iSiz return iGot; } -int ThreadedFileWorker::Flush( RageFileBasic *&pFile, CString &sError ) +int ThreadedFileWorker::Flush( RageFileBasic *&pFile, RString &sError ) { ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ @@ -530,7 +530,7 @@ int ThreadedFileWorker::Flush( RageFileBasic *&pFile, CString &sError ) return m_iResultRequest; } -RageFileBasic *ThreadedFileWorker::Copy( RageFileBasic *&pFile, CString &sError ) +RageFileBasic *ThreadedFileWorker::Copy( RageFileBasic *&pFile, RString &sError ) { ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ @@ -564,7 +564,7 @@ RageFileBasic *ThreadedFileWorker::Copy( RageFileBasic *&pFile, CString &sError } -bool ThreadedFileWorker::PopulateFileSet( FileSet &fs, const CString &sPath ) +bool ThreadedFileWorker::PopulateFileSet( FileSet &fs, const RString &sPath ) { if( m_pChildDriver == NULL ) return false; @@ -587,7 +587,7 @@ bool ThreadedFileWorker::PopulateFileSet( FileSet &fs, const CString &sPath ) return true; } -int ThreadedFileWorker::Move( const CString &sOldPath, const CString &sNewPath ) +int ThreadedFileWorker::Move( const RString &sOldPath, const RString &sNewPath ) { ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ @@ -607,7 +607,7 @@ int ThreadedFileWorker::Move( const CString &sOldPath, const CString &sNewPath ) return m_iResultRequest; } -int ThreadedFileWorker::Remove( const CString &sPath ) +int ThreadedFileWorker::Remove( const RString &sPath ) { ASSERT( m_pChildDriver != NULL ); /* how did you get a file to begin with? */ @@ -626,7 +626,7 @@ int ThreadedFileWorker::Remove( const CString &sPath ) return m_iResultRequest; } -bool ThreadedFileWorker::FlushDirCache( const CString &sPath ) +bool ThreadedFileWorker::FlushDirCache( const RString &sPath ) { /* FlushDirCache() is often called globally, on all drivers, which means it's called with * no timeout. Temporarily enable a timeout if needed. */ @@ -684,7 +684,7 @@ public: RageFileBasic *Copy() const { - CString sError; + RString sError; RageFileBasic *pCopy = m_pWorker->Copy( m_pFile, sError ); if( m_pFile == NULL ) @@ -705,7 +705,7 @@ public: protected: int SeekInternal( int iPos ) { - CString sError; + RString sError; int iRet = m_pWorker->Seek( m_pFile, iPos, sError ); if( m_pFile == NULL ) @@ -723,7 +723,7 @@ protected: int ReadInternal( void *pBuffer, size_t iBytes ) { - CString sError; + RString sError; int iRet = m_pWorker->Read( m_pFile, pBuffer, iBytes, sError ); if( m_pFile == NULL ) @@ -740,7 +740,7 @@ protected: int WriteInternal( const void *pBuffer, size_t iBytes ) { - CString sError; + RString sError; int iRet = m_pWorker->Write( m_pFile, pBuffer, iBytes, sError ); if( m_pFile == NULL ) @@ -757,7 +757,7 @@ protected: int FlushInternal() { - CString sError; + RString sError; int iRet = m_pWorker->Flush( m_pFile, sError ); if( m_pFile == NULL ) @@ -798,7 +798,7 @@ public: m_pWorker = pWorker; } - void PopulateFileSet( FileSet &fs, const CString &sPath ) + void PopulateFileSet( FileSet &fs, const RString &sPath ) { ASSERT( m_pWorker != NULL ); m_pWorker->PopulateFileSet( fs, sPath ); @@ -808,7 +808,7 @@ private: ThreadedFileWorker *m_pWorker; }; -RageFileDriverTimeout::RageFileDriverTimeout( CString sPath ): +RageFileDriverTimeout::RageFileDriverTimeout( const RString &sPath ): RageFileDriver( new TimedFilenameDB() ) { m_pWorker = new ThreadedFileWorker( sPath ); @@ -816,7 +816,7 @@ RageFileDriverTimeout::RageFileDriverTimeout( CString sPath ): ((TimedFilenameDB *) FDB)->SetWorker( m_pWorker ); } -RageFileBasic *RageFileDriverTimeout::Open( const CString &sPath, int iMode, int &iErr ) +RageFileBasic *RageFileDriverTimeout::Open( const RString &sPath, int iMode, int &iErr ) { RageFileBasic *pChildFile = m_pWorker->Open( sPath, iMode, iErr ); if( pChildFile == NULL ) @@ -840,13 +840,13 @@ RageFileBasic *RageFileDriverTimeout::Open( const CString &sPath, int iMode, int return new RageFileObjTimeout( m_pWorker, pChildFile, iSize ); } -void RageFileDriverTimeout::FlushDirCache( const CString &sPath ) +void RageFileDriverTimeout::FlushDirCache( const RString &sPath ) { RageFileDriver::FlushDirCache( sPath ); m_pWorker->FlushDirCache( sPath ); } -bool RageFileDriverTimeout::Move( const CString &sOldPath, const CString &sNewPath ) +bool RageFileDriverTimeout::Move( const RString &sOldPath, const RString &sNewPath ) { int iRet = m_pWorker->Move( sOldPath, sNewPath ); if( iRet == -1 ) @@ -858,7 +858,7 @@ bool RageFileDriverTimeout::Move( const CString &sOldPath, const CString &sNewPa return true; } -bool RageFileDriverTimeout::Remove( const CString &sPath ) +bool RageFileDriverTimeout::Remove( const RString &sPath ) { int iRet = m_pWorker->Remove( sPath ); if( iRet == -1 ) @@ -878,7 +878,7 @@ RageFileDriverTimeout::~RageFileDriverTimeout() static struct FileDriverEntry_Timeout: public FileDriverEntry { FileDriverEntry_Timeout(): FileDriverEntry( "TIMEOUT" ) { } - RageFileDriver *Create( CString Root ) const { return new RageFileDriverTimeout( Root ); } + RageFileDriver *Create( const RString &sRoot ) const { return new RageFileDriverTimeout( sRoot ); } } const g_RegisterDriver; /* diff --git a/stepmania/src/RageFileDriverTimeout.h b/stepmania/src/RageFileDriverTimeout.h index 8e4dcc1341..4a99368533 100644 --- a/stepmania/src/RageFileDriverTimeout.h +++ b/stepmania/src/RageFileDriverTimeout.h @@ -10,13 +10,13 @@ class ThreadedFileWorker; class RageFileDriverTimeout: public RageFileDriver { public: - RageFileDriverTimeout( CString path ); + RageFileDriverTimeout( const RString &path ); virtual ~RageFileDriverTimeout(); - RageFileBasic *Open( const CString &path, int mode, int &err ); - void FlushDirCache( const CString &sPath ); - bool Move( const CString &sOldPath, const CString &sNewPath ); - bool Remove( const CString &sPath ); + RageFileBasic *Open( const RString &path, int mode, int &err ); + void FlushDirCache( const RString &sPath ); + bool Move( const RString &sOldPath, const RString &sNewPath ); + bool Remove( const RString &sPath ); static void SetTimeout( float fSeconds ); static void ResetTimeout() { SetTimeout( -1 ); } diff --git a/stepmania/src/RageFileDriverZip.cpp b/stepmania/src/RageFileDriverZip.cpp index 3d638f495a..02c5fe09a7 100644 --- a/stepmania/src/RageFileDriverZip.cpp +++ b/stepmania/src/RageFileDriverZip.cpp @@ -15,7 +15,7 @@ static struct FileDriverEntry_ZIP: public FileDriverEntry { FileDriverEntry_ZIP(): FileDriverEntry( "ZIP" ) { } - RageFileDriver *Create( RString Root ) const { return new RageFileDriverZip( Root ); } + RageFileDriver *Create( const RString &sRoot ) const { return new RageFileDriverZip( sRoot ); } } const g_RegisterDriver; @@ -27,7 +27,7 @@ RageFileDriverZip::RageFileDriverZip(): m_pZip = NULL; } -RageFileDriverZip::RageFileDriverZip( RString sPath ): +RageFileDriverZip::RageFileDriverZip( const RString &sPath ): RageFileDriver( new NullFilenameDB ), m_Mutex( "RageFileDriverZip" ) { diff --git a/stepmania/src/RageFileDriverZip.h b/stepmania/src/RageFileDriverZip.h index eff5f57274..b61433834f 100644 --- a/stepmania/src/RageFileDriverZip.h +++ b/stepmania/src/RageFileDriverZip.h @@ -10,7 +10,7 @@ class RageFileDriverZip: public RageFileDriver { public: RageFileDriverZip(); - RageFileDriverZip( RString sPath ); + RageFileDriverZip( const RString &sPath ); bool Load( const RString &sPath ); bool Load( RageFileBasic *pFile );