[Scummvm-cvs-logs] SF.net SVN: scummvm:[42019] scummvm/branches/gsoc2009-draci/engines/draci

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Thu Jul 2 12:39:51 CEST 2009


Revision: 42019
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42019&view=rev
Author:   dkasak13
Date:     2009-07-02 10:39:51 +0000 (Thu, 02 Jul 2009)

Log Message:
-----------
Added BArchive::clearCache() method for clearing the data cache of opened files.

Modified Paths:
--------------
    scummvm/branches/gsoc2009-draci/engines/draci/barchive.cpp
    scummvm/branches/gsoc2009-draci/engines/draci/barchive.h

Modified: scummvm/branches/gsoc2009-draci/engines/draci/barchive.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/barchive.cpp	2009-07-02 10:31:56 UTC (rev 42018)
+++ scummvm/branches/gsoc2009-draci/engines/draci/barchive.cpp	2009-07-02 10:39:51 UTC (rev 42019)
@@ -377,6 +377,18 @@
 
 	return _files + i;
 }
+
+/**
+ * Clears the cache of the open files inside the archive without closing it.
+ * If the files are subsequently accessed, they are read from the disk.
+ */
+void BArchive::clearCache() {
+
+	// Delete all cached data
+	for (unsigned int i = 0; i < _fileCount; ++i) {
+		_files[i].closeFile();
+	}
+}
 	
 
 BAFile *BArchive::operator[](unsigned int i) const {

Modified: scummvm/branches/gsoc2009-draci/engines/draci/barchive.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/barchive.h	2009-07-02 10:31:56 UTC (rev 42018)
+++ scummvm/branches/gsoc2009-draci/engines/draci/barchive.h	2009-07-02 10:39:51 UTC (rev 42019)
@@ -70,6 +70,8 @@
 	 */	
 	bool isOpen() const { return _opened; }
 
+	void clearCache();
+
 	BAFile *operator[](unsigned int i) const;
 
 private:


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