aboutsummaryrefslogtreecommitdiff
path: root/backends/fs/palmos
diff options
context:
space:
mode:
authorMax Horn2004-11-20 21:35:49 +0000
committerMax Horn2004-11-20 21:35:49 +0000
commit5d9b35510d7d6aad9408e12aaebed2a79e3ed826 (patch)
treea984b512f4bebfe2d001ab05eab21bd0c7f69b3b /backends/fs/palmos
parentc93f57b112cc1684a9d7d90587ff5de19a1530bd (diff)
downloadscummvm-rg350-5d9b35510d7d6aad9408e12aaebed2a79e3ed826.tar.gz
scummvm-rg350-5d9b35510d7d6aad9408e12aaebed2a79e3ed826.tar.bz2
scummvm-rg350-5d9b35510d7d6aad9408e12aaebed2a79e3ed826.zip
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 :-)
svn-id: r15848
Diffstat (limited to 'backends/fs/palmos')
-rw-r--r--backends/fs/palmos/palmos-fs.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/backends/fs/palmos/palmos-fs.cpp b/backends/fs/palmos/palmos-fs.cpp
index 2a5c599e6c..aeecb38d43 100644
--- a/backends/fs/palmos/palmos-fs.cpp
+++ b/backends/fs/palmos/palmos-fs.cpp
@@ -29,7 +29,7 @@
* Implementation of the ScummVM file system API based on PalmOS VFS API.
*/
-class PalmOSFilesystemNode : public FilesystemNode {
+class PalmOSFilesystemNode : public AbstractFilesystemNode {
protected:
String _displayName;
bool _isDirectory;
@@ -47,15 +47,14 @@ public:
virtual bool isDirectory() const { return _isDirectory; }
virtual String path() const { return _path; }
- virtual FSList *listDir(ListMode) const;
- virtual FilesystemNode *parent() const;
- virtual FilesystemNode *clone() const { return new PalmOSFilesystemNode(this); }
+ virtual FSList listDir(ListMode) const;
+ virtual AbstractFilesystemNode *parent() const;
private:
- static void addFile (FSList* list, ListMode mode, const Char *base, FileInfoType* find_data);
+ static void addFile (FSList &list, ListMode mode, const Char *base, FileInfoType* find_data);
};
-void PalmOSFilesystemNode::addFile(FSList* list, ListMode mode, const char *base, FileInfoType* find_data) {
+void PalmOSFilesystemNode::addFile(FSList &list, ListMode mode, const char *base, FileInfoType* find_data) {
PalmOSFilesystemNode entry;
bool isDirectory;
@@ -74,10 +73,10 @@ void PalmOSFilesystemNode::addFile(FSList* list, ListMode mode, const char *base
entry._isValid = true;
entry._isPseudoRoot = false;
- list->push_back(entry);
+ list.push_back(wrap(new PalmOSFilesystemNode(&entry)));
}
-FilesystemNode *FilesystemNode::getRoot() {
+AbstractFilesystemNode *FilesystemNode::getRoot() {
return new PalmOSFilesystemNode();
}
@@ -97,9 +96,9 @@ PalmOSFilesystemNode::PalmOSFilesystemNode(const PalmOSFilesystemNode *node) {
_path = node->_path;
}
-FSList *PalmOSFilesystemNode::listDir(ListMode mode) const {
+FSList PalmOSFilesystemNode::listDir(ListMode mode) const {
- FSList *myList = new FSList();
+ FSList myList;
Err e;
Char nameP[256];
FileInfoType desc;
@@ -136,7 +135,7 @@ const char *lastPathComponent(const Common::String &str) {
return cur+1;
}
-FilesystemNode *PalmOSFilesystemNode::parent() const {
+AbstractFilesystemNode *PalmOSFilesystemNode::parent() const {
PalmOSFilesystemNode *p = new PalmOSFilesystemNode();