From 1470dadb1de3250dfceeaa246604ca0f26889bbf Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 14 Apr 2006 01:48:51 +0000 Subject: Changed File::open to take a Common::String as file name parameter svn-id: r21867 --- engines/scumm/file.cpp | 20 ++++++++++---------- engines/scumm/file.h | 16 ++++++++-------- engines/scumm/resource.cpp | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp index 7a17d8c97b..efc23e53c8 100644 --- a/engines/scumm/file.cpp +++ b/engines/scumm/file.cpp @@ -56,7 +56,7 @@ void ScummFile::resetSubfile() { seek(0, SEEK_SET); } -bool ScummFile::open(const char *filename, AccessMode mode) { +bool ScummFile::open(const Common::String &filename, AccessMode mode) { if (File::open(filename, mode)) { resetSubfile(); return true; @@ -65,7 +65,7 @@ bool ScummFile::open(const char *filename, AccessMode mode) { } } -bool ScummFile::openSubFile(const char *filename) { +bool ScummFile::openSubFile(const Common::String &filename) { assert(isOpen()); // Disable the XOR encryption and reset any current subfile range @@ -112,7 +112,7 @@ bool ScummFile::openSubFile(const char *filename) { return false; } - if (scumm_stricmp(file_name, filename) == 0) { + if (scumm_stricmp(file_name, filename.c_str()) == 0) { // We got a match! setSubfileRange(file_off, file_len); return true; @@ -1380,11 +1380,11 @@ bool ScummNESFile::generateIndex() { return true; } -bool ScummNESFile::open(const char *filename, AccessMode mode) { +bool ScummNESFile::open(const Common::String &filename, AccessMode mode) { uint8 md5sum[16]; if (_ROMset == kROMsetNum) { - if (Common::md5_file(filename, md5sum)) { + if (Common::md5_file(filename.c_str(), md5sum)) { char md5str[32+1]; for (int j = 0; j < 16; j++) { sprintf(md5str + j*2, "%02x", (int)md5sum[j]); @@ -1439,10 +1439,10 @@ void ScummNESFile::close() { File::close(); } -bool ScummNESFile::openSubFile(const char *filename) { +bool ScummNESFile::openSubFile(const Common::String &filename) { assert(isOpen()); - const char *ext = strrchr(filename, '.'); + const char *ext = strrchr(filename.c_str(), '.'); char resNum[3]; int res; @@ -1556,7 +1556,7 @@ bool ScummC64File::openDisk(char num) { return true; } -bool ScummC64File::open(const char *filename, AccessMode mode) { +bool ScummC64File::open(const Common::String &filename, AccessMode mode) { uint16 signature; // check signature @@ -1708,10 +1708,10 @@ void ScummC64File::close() { File::close(); } -bool ScummC64File::openSubFile(const char *filename) { +bool ScummC64File::openSubFile(const Common::String &filename) { assert(isOpen()); - const char *ext = strrchr(filename, '.'); + const char *ext = strrchr(filename.c_str(), '.'); char resNum[3]; int res; diff --git a/engines/scumm/file.h b/engines/scumm/file.h index fa5e4d35a5..2fbf9f01e4 100644 --- a/engines/scumm/file.h +++ b/engines/scumm/file.h @@ -31,8 +31,8 @@ class BaseScummFile : public Common::File { public: virtual void setEnc(byte value) = 0; - virtual bool open(const char *filename, AccessMode mode = kFileReadMode) = 0; - virtual bool openSubFile(const char *filename) = 0; + virtual bool open(const Common::String &filename, AccessMode mode = kFileReadMode) = 0; + virtual bool openSubFile(const Common::String &filename) = 0; virtual bool eof() = 0; virtual uint32 pos() = 0; @@ -54,8 +54,8 @@ public: void setSubfileRange(uint32 start, uint32 len); void resetSubfile(); - bool open(const char *filename, AccessMode mode = kFileReadMode); - bool openSubFile(const char *filename); + bool open(const Common::String &filename, AccessMode mode = kFileReadMode); + bool openSubFile(const Common::String &filename); bool eof(); uint32 pos(); @@ -96,8 +96,8 @@ public: ScummNESFile(); void setEnc(byte value); - bool open(const char *filename, AccessMode mode = kFileReadMode); - bool openSubFile(const char *filename); + bool open(const Common::String &filename, AccessMode mode = kFileReadMode); + bool openSubFile(const Common::String &filename); void close(); bool eof() { return _stream->eos(); } @@ -142,8 +142,8 @@ public: ScummC64File(const char *disk1, const char *disk2, bool maniac); void setEnc(byte value); - bool open(const char *filename, AccessMode mode = kFileReadMode); - bool openSubFile(const char *filename); + bool open(const Common::String &filename, AccessMode mode = kFileReadMode); + bool openSubFile(const Common::String &filename); void close(); bool eof() { return _stream->eos(); } diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index f54b80b239..d8eba584ee 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -250,7 +250,7 @@ bool ScummEngine::openFile(BaseScummFile &file, const char *filename, bool resou char name[128]; file.close(); - file.open(_containerFile.c_str()); + file.open(_containerFile); assert(file.isOpen()); strncpy(name, filename, 128); -- cgit v1.2.3