[Scummvm-cvs-logs] CVS: scummvm/backends/fs/morphos abox-fs.cpp,1.7,1.8

Max Horn fingolfin at users.sourceforge.net
Sat Nov 20 13:36:16 CET 2004


Update of /cvsroot/scummvm/scummvm/backends/fs/morphos
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32450/backends/fs/morphos

Modified Files:
	abox-fs.cpp 
Log Message:
Changed the FilesystemNode implementation to make it easier to use (client code doesn't have to worry about the memory managment anymore, it's all 'automatic' now). May have introduced a mem leak or two, please check :-)

Index: abox-fs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/fs/morphos/abox-fs.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- abox-fs.cpp	6 Jan 2004 12:45:26 -0000	1.7
+++ abox-fs.cpp	20 Nov 2004 21:35:48 -0000	1.8
@@ -31,7 +31,7 @@
  * Implementation of the ScummVM file system API based on the MorphOS A-Box API.
  */
 
-class ABoxFilesystemNode : public FilesystemNode {
+class ABoxFilesystemNode : public AbstractFilesystemNode {
 	protected:
 		BPTR _lock;
 		String _displayName;
@@ -50,14 +50,14 @@
 		virtual bool isDirectory() const { return _isDirectory; }
 		virtual String path() const { return _path; }
 
-		virtual FSList *listDir(ListMode mode = kListDirectoriesOnly) const;
-		static  FSList *listRoot();
-		virtual FilesystemNode *parent() const;
-		virtual FilesystemNode *clone() const { return new ABoxFilesystemNode(this); }
+		virtual FSList listDir(ListMode mode = kListDirectoriesOnly) const;
+		static  FSList listRoot();
+		virtual AbstractFilesystemNode *parent() const;
+		virtual AbstractFilesystemNode *clone() const { return new ABoxFilesystemNode(this); }
 };
 
 
-FilesystemNode *FilesystemNode::getRoot()
+AbstractFilesystemNode *FilesystemNode::getRoot()
 {
 	return new ABoxFilesystemNode();
 }
@@ -137,9 +137,9 @@
 	}
 }
 
-FSList *ABoxFilesystemNode::listDir(ListMode mode) const
+FSList ABoxFilesystemNode::listDir(ListMode mode) const
 {
-	FSList *myList = new FSList();
+	FSList myList;
         
 	if (!_isValid)
 		error("listDir() called on invalid node");
@@ -182,8 +182,9 @@
 					if (entry)
 					{
 						if (entry->isValid())
-							myList->push_back(*entry);
-						delete entry;
+							myList.push_back(wrap(entry));
+						else
+							delete entry;
 					}
 					UnLock(lock);
 				}
@@ -199,9 +200,9 @@
 	return myList;
 }
 
-FilesystemNode *ABoxFilesystemNode::parent() const
+AbstractFilesystemNode *ABoxFilesystemNode::parent() const
 {
-	FilesystemNode *node = NULL;
+	AbstractFilesystemNode *node = NULL;
 
 	if (!_isDirectory)
 		error("parent() called on file node");
@@ -224,9 +225,9 @@
 	return node;
 }
 
-FSList *ABoxFilesystemNode::listRoot()
+FSList ABoxFilesystemNode::listRoot()
 {
-	FSList *myList = new FSList();
+	FSList myList;
 	DosList *dosList;
 	CONST ULONG lockDosListFlags = LDF_READ | LDF_VOLUMES;
 	char name[256];
@@ -261,8 +262,9 @@
 				if (entry)
 				{
 					if (entry->isValid())
-						myList->push_back(*entry);
-					delete entry;
+						myList.push_back(wrap(entry));
+					else
+						delete entry;
 				}
 				UnLock(volume_lock);
 			}





More information about the Scummvm-git-logs mailing list