diff options
| author | Max Horn | 2006-04-03 21:54:26 +0000 |
|---|---|---|
| committer | Max Horn | 2006-04-03 21:54:26 +0000 |
| commit | 4226aa761dd43e8515f4f4f6790f142fdd8b3927 (patch) | |
| tree | 62d3312ed578e3d3b88c2372682361cbdb957e32 /backends/fs/fs.cpp | |
| parent | 5595ec568097b86a72b26ada55507426c254f853 (diff) | |
| download | scummvm-rg350-4226aa761dd43e8515f4f4f6790f142fdd8b3927.tar.gz scummvm-rg350-4226aa761dd43e8515f4f4f6790f142fdd8b3927.tar.bz2 scummvm-rg350-4226aa761dd43e8515f4f4f6790f142fdd8b3927.zip | |
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)
svn-id: r21581
Diffstat (limited to 'backends/fs/fs.cpp')
| -rw-r--r-- | backends/fs/fs.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/backends/fs/fs.cpp b/backends/fs/fs.cpp index a3746575e6..60766cb073 100644 --- a/backends/fs/fs.cpp +++ b/backends/fs/fs.cpp @@ -38,11 +38,14 @@ void FSList::sort() { 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 @@ FilesystemNode::FilesystemNode(const FilesystemNode &node) ++(*_refCount); } -FilesystemNode::FilesystemNode(const String &p) { +FilesystemNode::FilesystemNode(const Common::String &p) { _realNode = getNodeForPath(p); _refCount = new int(1); } @@ -92,3 +95,23 @@ FilesystemNode FilesystemNode::getParent() const { 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); +} |
