[Scummvm-cvs-logs] SF.net SVN: scummvm: [25917] scummvm/trunk/engines/sword2

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Mar 1 18:13:23 CET 2007


Revision: 25917
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25917&view=rev
Author:   fingolfin
Date:     2007-03-01 09:13:23 -0800 (Thu, 01 Mar 2007)

Log Message:
-----------
Got rid of another use of File::incRef/decRef

Modified Paths:
--------------
    scummvm/trunk/engines/sword2/resman.cpp
    scummvm/trunk/engines/sword2/resman.h

Modified: scummvm/trunk/engines/sword2/resman.cpp
===================================================================
--- scummvm/trunk/engines/sword2/resman.cpp	2007-03-01 17:04:50 UTC (rev 25916)
+++ scummvm/trunk/engines/sword2/resman.cpp	2007-03-01 17:13:23 UTC (rev 25917)
@@ -425,10 +425,7 @@
 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 @@
 		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 @@
 	// 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];
 }

Modified: scummvm/trunk/engines/sword2/resman.h
===================================================================
--- scummvm/trunk/engines/sword2/resman.h	2007-03-01 17:04:50 UTC (rev 25916)
+++ scummvm/trunk/engines/sword2/resman.h	2007-03-01 17:13:23 UTC (rev 25917)
@@ -54,7 +54,7 @@
 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();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list