diff options
-rw-r--r-- | engines/kyra/resource.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/disk_ns.cpp | 7 | ||||
-rw-r--r-- | engines/scumm/file.cpp | 20 | ||||
-rw-r--r-- | engines/scumm/file.h | 4 |
4 files changed, 12 insertions, 21 deletions
diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp index 3cf8336e7f..5929490f6d 100644 --- a/engines/kyra/resource.cpp +++ b/engines/kyra/resource.cpp @@ -374,7 +374,7 @@ Common::SeekableReadStream *Resource::getFileStream(const Common::String &file) return loader->loadFileFromArchive(file, parent, iter->_value); } else { Common::File *stream = new Common::File(); - if (!stream->open(file.c_str())) { + if (!stream->open(file)) { warning("Couldn't open file '%s'", file.c_str()); return 0; } diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index 9da299dce1..cdbe3458a7 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -70,11 +70,8 @@ void Archive::open(const char *file) { if (_archive.isOpen()) close(); - char path[PATH_LEN]; - - strcpy(path, file); - if (!_archive.open(path)) - error("archive '%s' not found", path); + if (!_archive.open(file)) + error("archive '%s' not found", file); _archiveName = file; diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp index b80be63d32..bc5fc38225 100644 --- a/engines/scumm/file.cpp +++ b/engines/scumm/file.cpp @@ -229,12 +229,9 @@ static uint16 write_word(Common::WriteStream *out, uint16 val) { return 2; } -ScummDiskImage::ScummDiskImage(const char *disk1, const char *disk2, GameSettings game) : _stream(0), _buf(0) { - _disk1 = disk1; - _disk2 = disk2; - _game = game; - - _openedDisk = 0; +ScummDiskImage::ScummDiskImage(const char *disk1, const char *disk2, GameSettings game) + : _stream(0), _buf(0), _game(game), + _disk1(disk1), _disk2(disk2), _openedDisk(0) { if (_game.id == GID_MANIAC) { _numGlobalObjects = 256; @@ -285,9 +282,9 @@ bool ScummDiskImage::openDisk(char num) { File::close(); if (num == 1) - File::open(_disk1.c_str()); + File::open(_disk1); else if (num == 2) - File::open(_disk2.c_str()); + File::open(_disk2); else { error("ScummDiskImage::open(): wrong disk (%c)", num); return false; @@ -468,17 +465,14 @@ bool ScummDiskImage::generateResource(int res) { extractResource(&out, res); - if (_stream) - delete _stream; - + delete _stream; _stream = new Common::MemoryReadStream(_buf, bufsize); return true; } void ScummDiskImage::close() { - if (_stream) - delete _stream; + delete _stream; _stream = 0; free(_buf); diff --git a/engines/scumm/file.h b/engines/scumm/file.h index 10ab031c7e..7064654f89 100644 --- a/engines/scumm/file.h +++ b/engines/scumm/file.h @@ -77,9 +77,9 @@ private: byte *_buf; - GameSettings _game; + const GameSettings _game; - Common::String _disk1, _disk2; + const Common::String _disk1, _disk2; int _openedDisk; int _numGlobalObjects; |