CString -> RString
const string params where possible for easier debug stepping
This commit is contained in:
@@ -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;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user