CString -> RString
const string params where possible for easier debug stepping
This commit is contained in:
@@ -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) )
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<CString> parts;
|
||||
CString curpath;
|
||||
vector<RString> 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<CString> vsFilesToRemove;
|
||||
vector<RString> vsFilesToRemove;
|
||||
for( set<File>::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;
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
#include <fcntl.h>
|
||||
|
||||
#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
|
||||
|
||||
@@ -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;
|
||||
|
||||
/*
|
||||
|
||||
@@ -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;
|
||||
|
||||
/*
|
||||
|
||||
@@ -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 ); }
|
||||
|
||||
@@ -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" )
|
||||
{
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user