aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2007-03-01 17:13:23 +0000
committerMax Horn2007-03-01 17:13:23 +0000
commit4203819b39d484a74da0ccbbb86e28989328bd80 (patch)
tree3716456d5a75ea0aba7cb33d32a6e0153ad9550d /engines
parent8466221fced5d1c7956d4d221661e19d6ccd5d99 (diff)
downloadscummvm-rg350-4203819b39d484a74da0ccbbb86e28989328bd80.tar.gz
scummvm-rg350-4203819b39d484a74da0ccbbb86e28989328bd80.tar.bz2
scummvm-rg350-4203819b39d484a74da0ccbbb86e28989328bd80.zip
Got rid of another use of File::incRef/decRef
svn-id: r25917
Diffstat (limited to 'engines')
-rw-r--r--engines/sword2/resman.cpp10
-rw-r--r--engines/sword2/resman.h2
2 files changed, 5 insertions, 7 deletions
diff --git a/engines/sword2/resman.cpp b/engines/sword2/resman.cpp
index cd482cc9f5..d016a5ad18 100644
--- a/engines/sword2/resman.cpp
+++ b/engines/sword2/resman.cpp
@@ -425,10 +425,7 @@ Common::File *ResourceManager::openCluFile(uint16 fileNum) {
void ResourceManager::readCluIndex(uint16 fileNum, Common::File *file) {
if (_resFiles[fileNum].entryTab == NULL) {
// we didn't read from this file before, get its index table
- if (file == NULL)
- file = openCluFile(fileNum);
- else
- file->incRef();
+ assert(file);
// 1st DWORD of a cluster is an offset to the look-up table
uint32 table_offset = file->readUint32LE();
@@ -446,7 +443,6 @@ void ResourceManager::readCluIndex(uint16 fileNum, Common::File *file) {
for (int tabCnt = 0; tabCnt < _resFiles[fileNum].numEntries * 2; tabCnt++)
_resFiles[fileNum].entryTab[tabCnt] = FROM_LE_32(_resFiles[fileNum].entryTab[tabCnt]);
#endif
- file->decRef();
}
}
@@ -491,7 +487,9 @@ uint32 ResourceManager::fetchLen(uint32 res) {
// open the cluster file
if (_resFiles[parent_res_file].entryTab == NULL) {
- readCluIndex(parent_res_file);
+ Common::File *file = openCluFile(parent_res_file);
+ readCluIndex(parent_res_file, file);
+ delete file;
}
return _resFiles[parent_res_file].entryTab[actual_res * 2 + 1];
}
diff --git a/engines/sword2/resman.h b/engines/sword2/resman.h
index 5afa292521..c1a8f3f117 100644
--- a/engines/sword2/resman.h
+++ b/engines/sword2/resman.h
@@ -54,7 +54,7 @@ struct ResourceFile {
class ResourceManager {
private:
Common::File *openCluFile(uint16 fileNum);
- void readCluIndex(uint16 fileNum, Common::File *file = NULL);
+ void readCluIndex(uint16 fileNum, Common::File *file);
void removeFromCacheList(Resource *res);
void addToCacheList(Resource *res);
void checkMemUsage();