[Scummvm-cvs-logs] SF.net SVN: scummvm: [21581] scummvm/trunk/backends/fs
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Mon Apr 3 14:55:02 CEST 2006
Revision: 21581
Author: fingolfin
Date: 2006-04-03 14:54:26 -0700 (Mon, 03 Apr 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=21581&view=rev
Log Message:
-----------
Fix AbstractFilesystemNode::wrap to not call (indirectly) getRoot, just to throw away the result immediately again (which (a) caused a slowdown and (b) a leak, both fixed now)
Modified Paths:
--------------
scummvm/trunk/backends/fs/fs.cpp
scummvm/trunk/backends/fs/fs.h
Modified: scummvm/trunk/backends/fs/fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/fs.cpp 2006-04-03 21:18:24 UTC (rev 21580)
+++ scummvm/trunk/backends/fs/fs.cpp 2006-04-03 21:54:26 UTC (rev 21581)
@@ -38,11 +38,14 @@
FilesystemNode AbstractFilesystemNode::wrap(AbstractFilesystemNode *node) {
- FilesystemNode wrapper;
- wrapper._realNode = node;
+ FilesystemNode wrapper(node);
return wrapper;
}
+FilesystemNode::FilesystemNode(AbstractFilesystemNode *realNode) {
+ _realNode = realNode;
+ _refCount = new int(1);
+}
FilesystemNode::FilesystemNode() {
_realNode = getRoot();
@@ -56,7 +59,7 @@
++(*_refCount);
}
-FilesystemNode::FilesystemNode(const String &p) {
+FilesystemNode::FilesystemNode(const Common::String &p) {
_realNode = getNodeForPath(p);
_refCount = new int(1);
}
@@ -92,3 +95,23 @@
return AbstractFilesystemNode::wrap(node);
}
}
+
+Common::String FilesystemNode::displayName() const {
+ return _realNode->displayName();
+}
+
+bool FilesystemNode::isValid() const {
+ return _realNode->isValid();
+}
+
+bool FilesystemNode::isDirectory() const {
+ return _realNode->isDirectory();
+}
+
+Common::String FilesystemNode::path() const {
+ return _realNode->path();
+}
+
+FSList FilesystemNode::listDir(ListMode mode) const {
+ return _realNode->listDir(mode);
+}
Modified: scummvm/trunk/backends/fs/fs.h
===================================================================
--- scummvm/trunk/backends/fs/fs.h 2006-04-03 21:18:24 UTC (rev 21580)
+++ scummvm/trunk/backends/fs/fs.h 2006-04-03 21:54:26 UTC (rev 21581)
@@ -165,6 +165,8 @@
AbstractFilesystemNode *_realNode;
int *_refCount;
+ FilesystemNode(AbstractFilesystemNode *realNode);
+
/**
* Returns a special node representing the FS root. The starting point for
* any file system browsing.
@@ -199,12 +201,12 @@
FilesystemNode getParent() const;
- virtual String displayName() const { return _realNode->displayName(); }
- virtual bool isValid() const { return _realNode->isValid(); }
- virtual bool isDirectory() const { return _realNode->isDirectory(); }
- virtual String path() const { return _realNode->path(); }
+ virtual String displayName() const;
+ virtual bool isValid() const;
+ virtual bool isDirectory() const;
+ virtual String path() const;
- virtual FSList listDir(ListMode mode = kListDirectoriesOnly) const { return _realNode->listDir(mode); }
+ virtual FSList listDir(ListMode mode = kListDirectoriesOnly) const;
protected:
void decRefCount();
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