WINTERMUTE: Use const Common::String& for the file-accessors.

This commit is contained in:
Einar Johan Trøan Sømåen 2012-06-02 00:44:20 +02:00
parent b94c379263
commit b1e4f58fed
11 changed files with 14 additions and 13 deletions

View File

@ -53,7 +53,7 @@ CBDiskFile::~CBDiskFile() {
//////////////////////////////////////////////////////////////////////////
HRESULT CBDiskFile::Open(Common::String Filename) {
HRESULT CBDiskFile::Open(const Common::String &Filename) {
Close();
char FullPath[MAX_PATH];

View File

@ -45,7 +45,7 @@ public:
virtual HRESULT Seek(uint32 Pos, TSeek Origin = SEEK_TO_BEGIN);
virtual HRESULT Read(void *Buffer, uint32 Size);
virtual HRESULT Close();
virtual HRESULT Open(Common::String Filename);
virtual HRESULT Open(const Common::String &Filename);
private:
void CorrectSlashes(char *fileName);
Common::SeekableReadStream *_file;

View File

@ -52,7 +52,7 @@ public:
virtual HRESULT Seek(uint32 Pos, TSeek Origin = SEEK_TO_BEGIN) = 0;
virtual HRESULT Read(void *Buffer, uint32 Size) = 0;
virtual HRESULT Close() = 0;
virtual HRESULT Open(Common::String Filename) = 0;
virtual HRESULT Open(const Common::String &Filename) = 0;
virtual bool IsEOF();
CBFile(CBGame *inGame);
virtual ~CBFile();

View File

@ -785,10 +785,10 @@ HRESULT CBFileManager::CloseFile(CBFile *File) {
//////////////////////////////////////////////////////////////////////////
CBFile *CBFileManager::OpenFileRaw(const char *Filename) {
CBFile *CBFileManager::OpenFileRaw(const Common::String &Filename) {
RestoreCurrentDir();
if (scumm_strnicmp(Filename, "savegame:", 9) == 0) {
if (scumm_strnicmp(Filename.c_str(), "savegame:", 9) == 0) {
CBSaveThumbFile *SaveThumbFile = new CBSaveThumbFile(Game);
if (SUCCEEDED(SaveThumbFile->Open(Filename))) return SaveThumbFile;
else {
@ -809,7 +809,7 @@ CBFile *CBFileManager::OpenFileRaw(const char *Filename) {
if (SUCCEEDED(ResFile->Open(Filename))) return ResFile;
delete ResFile;
warning("BFileManager::OpenFileRaw - Failed to open %s", Filename);
warning("BFileManager::OpenFileRaw - Failed to open %s", Filename.c_str());
return NULL;
}

View File

@ -34,6 +34,7 @@
#include "coll_templ.h"
#include "BFileEntry.h"
#include "common/archive.h"
#include "common/str.h"
namespace Common {
class File;
@ -49,7 +50,7 @@ public:
HRESULT RestoreCurrentDir();
char *_basePath;
bool GetFullPath(const char *Filename, char *Fullname);
CBFile *OpenFileRaw(const char *Filename);
CBFile *OpenFileRaw(const Common::String &filename);
HRESULT CloseFile(CBFile *File);
CBFile *OpenFile(const char *Filename, bool AbsPathWarning = true);
CBFileEntry *GetPackageEntry(const char *Filename);

View File

@ -54,7 +54,7 @@ CBPkgFile::~CBPkgFile() {
//////////////////////////////////////////////////////////////////////////
HRESULT CBPkgFile::Open(Common::String Filename) {
HRESULT CBPkgFile::Open(const Common::String &Filename) {
Close();
char fileName[MAX_PATH];

View File

@ -50,7 +50,7 @@ public:
virtual HRESULT Seek(uint32 Pos, TSeek Origin = SEEK_TO_BEGIN);
virtual HRESULT Read(void *Buffer, uint32 Size);
virtual HRESULT Close();
virtual HRESULT Open(Common::String Filename);
virtual HRESULT Open(const Common::String &Filename);
private:
bool _inflateInit;
HRESULT SeekToPos(uint32 NewPos);

View File

@ -45,7 +45,7 @@ CBResourceFile::~CBResourceFile() {
//////////////////////////////////////////////////////////////////////////
HRESULT CBResourceFile::Open(Common::String Filename) {
HRESULT CBResourceFile::Open(const Common::String &Filename) {
Close();
if (CBResources::GetFile(Filename.c_str(), _data, _size)) {

View File

@ -40,7 +40,7 @@ public:
virtual HRESULT Seek(uint32 Pos, TSeek Origin = SEEK_TO_BEGIN);
virtual HRESULT Read(void *Buffer, uint32 Size);
virtual HRESULT Close();
virtual HRESULT Open(Common::String Filename);
virtual HRESULT Open(const Common::String &Filename);
private:
byte *_data;
};

View File

@ -51,7 +51,7 @@ CBSaveThumbFile::~CBSaveThumbFile() {
//////////////////////////////////////////////////////////////////////////
HRESULT CBSaveThumbFile::Open(Common::String Filename) {
HRESULT CBSaveThumbFile::Open(const Common::String &Filename) {
Close();
if (scumm_strnicmp(Filename.c_str(), "savegame:", 9) != 0) return E_FAIL;

View File

@ -41,7 +41,7 @@ public:
virtual HRESULT Seek(uint32 Pos, TSeek Origin = SEEK_TO_BEGIN);
virtual HRESULT Read(void *Buffer, uint32 Size);
virtual HRESULT Close();
virtual HRESULT Open(Common::String Filename);
virtual HRESULT Open(const Common::String &Filename);
private:
byte *_data;
};