diff options
author | Torbjörn Andersson | 2007-02-26 23:08:52 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2007-02-26 23:08:52 +0000 |
commit | 2c7bf36af8c351e207a5e1a7e29a3e4a211d70ff (patch) | |
tree | 76f1c23c62cf01b11ef9226c33db9b188c8feebb /engines/sky | |
parent | 41574458fc7bbb02566a1e7041ca096d49fc8145 (diff) | |
download | scummvm-rg350-2c7bf36af8c351e207a5e1a7e29a3e4a211d70ff.tar.gz scummvm-rg350-2c7bf36af8c351e207a5e1a7e29a3e4a211d70ff.tar.bz2 scummvm-rg350-2c7bf36af8c351e207a5e1a7e29a3e4a211d70ff.zip |
Close sky.dnr directly after reading it into memory. No need to keep it open
until the Disk object is deleted.
svn-id: r25889
Diffstat (limited to 'engines/sky')
-rw-r--r-- | engines/sky/disk.cpp | 16 | ||||
-rw-r--r-- | engines/sky/disk.h | 1 |
2 files changed, 8 insertions, 9 deletions
diff --git a/engines/sky/disk.cpp b/engines/sky/disk.cpp index 8e0779ef55..8d21fed5c6 100644 --- a/engines/sky/disk.cpp +++ b/engines/sky/disk.cpp @@ -37,17 +37,17 @@ static const char *dinnerFilename = "sky.dnr"; Disk::Disk() { _dataDiskHandle = new Common::File(); - _dnrHandle = new Common::File(); + Common::File *dnrHandle = new Common::File(); - _dnrHandle->open(dinnerFilename); - if (!_dnrHandle->isOpen()) + dnrHandle->open(dinnerFilename); + if (!dnrHandle->isOpen()) error("Could not open %s", dinnerFilename); - if (!(_dinnerTableEntries = _dnrHandle->readUint32LE())) + if (!(_dinnerTableEntries = dnrHandle->readUint32LE())) error("Error reading from sky.dnr"); //even though it was opened correctly?! _dinnerTableArea = (uint8 *)malloc(_dinnerTableEntries * 8); - uint32 entriesRead = _dnrHandle->read(_dinnerTableArea, 8 * _dinnerTableEntries) / 8; + uint32 entriesRead = dnrHandle->read(_dinnerTableArea, 8 * _dinnerTableEntries) / 8; if (entriesRead != _dinnerTableEntries) error("entriesRead != dinnerTableEntries. [%d/%d]", entriesRead, _dinnerTableEntries); @@ -60,16 +60,16 @@ Disk::Disk() { memset(_buildList, 0, 60 * 2); memset(_loadedFilesList, 0, 60 * 4); + + dnrHandle->close(); + delete dnrHandle; } Disk::~Disk(void) { - if (_dnrHandle->isOpen()) - _dnrHandle->close(); if (_dataDiskHandle->isOpen()) _dataDiskHandle->close(); fnFlushBuffers(); free(_dinnerTableArea); - delete _dnrHandle; delete _dataDiskHandle; } diff --git a/engines/sky/disk.h b/engines/sky/disk.h index e243dd3d43..99cb105740 100644 --- a/engines/sky/disk.h +++ b/engines/sky/disk.h @@ -64,7 +64,6 @@ protected: uint32 _dinnerTableEntries; uint8 *_dinnerTableArea; Common::File *_dataDiskHandle; - Common::File *_dnrHandle; RncDecoder _rncDecoder; uint16 _buildList[MAX_FILES_IN_LIST]; |