diff options
author | Max Horn | 2006-04-04 20:54:55 +0000 |
---|---|---|
committer | Max Horn | 2006-04-04 20:54:55 +0000 |
commit | 112ba72222bf191a9c1e4d1ef8e83af1d43d3082 (patch) | |
tree | dd8d76377e0c1b3cd72e6083f50ac0fe0a1e60dc /backends/fs | |
parent | bca4dd001fae016b5c137d00d7c13d58c9f7937f (diff) | |
download | scummvm-rg350-112ba72222bf191a9c1e4d1ef8e83af1d43d3082.tar.gz scummvm-rg350-112ba72222bf191a9c1e4d1ef8e83af1d43d3082.tar.bz2 scummvm-rg350-112ba72222bf191a9c1e4d1ef8e83af1d43d3082.zip |
Removing more pseudo copy constructors in favor of the standard copy constructor (gee, everybody is copying my bad code, it seems ;-)
svn-id: r21597
Diffstat (limited to 'backends/fs')
-rw-r--r-- | backends/fs/amigaos4/amigaos4-fs.cpp | 4 | ||||
-rw-r--r-- | backends/fs/morphos/abox-fs.cpp | 11 | ||||
-rw-r--r-- | backends/fs/palmos/palmos-fs.cpp | 33 | ||||
-rw-r--r-- | backends/fs/ps2/ps2-fs.cpp | 10 | ||||
-rw-r--r-- | backends/fs/symbian/symbian-fs.cpp | 13 | ||||
-rw-r--r-- | backends/fs/windows/windows-fs.cpp | 35 |
6 files changed, 29 insertions, 77 deletions
diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index ffa1e61343..1dc9218d6a 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -55,7 +55,6 @@ class AmigaOSFilesystemNode : public AbstractFilesystemNode { public: AmigaOSFilesystemNode(); - AmigaOSFilesystemNode(const AmigaOSFilesystemNode *pNode); AmigaOSFilesystemNode(BPTR pLock, const char *pDisplayName = 0); AmigaOSFilesystemNode(const String &p); @@ -69,7 +68,6 @@ class AmigaOSFilesystemNode : public AbstractFilesystemNode { virtual FSList listDir(ListMode mode = kListDirectoriesOnly) const; virtual FSList listVolumes(void) const; virtual AbstractFilesystemNode *parent() const; - virtual AbstractFilesystemNode *clone() const { return new AmigaOSFilesystemNode(this); }; }; AbstractFilesystemNode *FilesystemNode::getRoot() { @@ -308,7 +306,7 @@ AbstractFilesystemNode *AmigaOSFilesystemNode::parent() const { if (_pFileLock == 0) { //debug(6, "Root node\n"); LEAVE(); - return clone(); + return return new AmigaOSFilesystemNode(*this); } BPTR parentDir = IDOS->ParentDir( _pFileLock ); diff --git a/backends/fs/morphos/abox-fs.cpp b/backends/fs/morphos/abox-fs.cpp index 4cdd3bbc6f..8900314fe6 100644 --- a/backends/fs/morphos/abox-fs.cpp +++ b/backends/fs/morphos/abox-fs.cpp @@ -43,7 +43,6 @@ class ABoxFilesystemNode : public AbstractFilesystemNode { public: ABoxFilesystemNode(); ABoxFilesystemNode(BPTR lock, CONST_STRPTR display_name = NULL); - ABoxFilesystemNode(const ABoxFilesystemNode *node); ~ABoxFilesystemNode(); virtual String displayName() const { return _displayName; } @@ -54,7 +53,6 @@ class ABoxFilesystemNode : public AbstractFilesystemNode { virtual FSList listDir(ListMode mode = kListDirectoriesOnly) const; static FSList listRoot(); virtual AbstractFilesystemNode *parent() const; - virtual AbstractFilesystemNode *clone() const { return new ABoxFilesystemNode(this); } }; @@ -120,15 +118,6 @@ ABoxFilesystemNode::ABoxFilesystemNode(BPTR lock, CONST_STRPTR display_name) FreeDosObject(DOS_FIB, fib); } -ABoxFilesystemNode::ABoxFilesystemNode(const ABoxFilesystemNode *node) -{ - _displayName = node->_displayName; - _isValid = node->_isValid; - _isDirectory = node->_isDirectory; - _path = node->_path; - _lock = DupLock(node->_lock); -} - ABoxFilesystemNode::~ABoxFilesystemNode() { if (_lock) diff --git a/backends/fs/palmos/palmos-fs.cpp b/backends/fs/palmos/palmos-fs.cpp index 3db14979f4..301226685d 100644 --- a/backends/fs/palmos/palmos-fs.cpp +++ b/backends/fs/palmos/palmos-fs.cpp @@ -41,7 +41,6 @@ protected: public: PalmOSFilesystemNode(); PalmOSFilesystemNode(const Char *path); - PalmOSFilesystemNode(const PalmOSFilesystemNode *node); virtual String displayName() const { return _displayName; } virtual bool isValid() const { return _isValid; } @@ -55,6 +54,17 @@ private: static void addFile (FSList &list, ListMode mode, const Char *base, FileInfoType* find_data); }; +static const char *lastPathComponent(const Common::String &str) { + const char *start = str.c_str(); + const char *cur = start + str.size() - 2; + + while (cur > start && *cur != '/') { + --cur; + } + + return cur+1; +} + void PalmOSFilesystemNode::addFile(FSList &list, ListMode mode, const char *base, FileInfoType* find_data) { PalmOSFilesystemNode entry; bool isDirectory; @@ -74,7 +84,7 @@ void PalmOSFilesystemNode::addFile(FSList &list, ListMode mode, const char *base entry._isValid = true; entry._isPseudoRoot = false; - list.push_back(wrap(new PalmOSFilesystemNode(&entry))); + list.push_back(wrap(new PalmOSFilesystemNode(entry))); } AbstractFilesystemNode *FilesystemNode::getRoot() { @@ -89,14 +99,6 @@ PalmOSFilesystemNode::PalmOSFilesystemNode() { _isPseudoRoot = true; } -PalmOSFilesystemNode::PalmOSFilesystemNode(const PalmOSFilesystemNode *node) { - _displayName = node->_displayName; - _isDirectory = node->_isDirectory; - _isValid = node->_isValid; - _isPseudoRoot = node->_isPseudoRoot; - _path = node->_path; -} - FSList PalmOSFilesystemNode::listDir(ListMode mode) const { FSList myList; @@ -125,17 +127,6 @@ FSList PalmOSFilesystemNode::listDir(ListMode mode) const { return myList; } -const char *lastPathComponent(const Common::String &str) { - const char *start = str.c_str(); - const char *cur = start + str.size() - 2; - - while (cur > start && *cur != '/') { - --cur; - } - - return cur+1; -} - AbstractFilesystemNode *PalmOSFilesystemNode::parent() const { PalmOSFilesystemNode *p = 0; diff --git a/backends/fs/ps2/ps2-fs.cpp b/backends/fs/ps2/ps2-fs.cpp index 9396a09ac2..d409878dc0 100644 --- a/backends/fs/ps2/ps2-fs.cpp +++ b/backends/fs/ps2/ps2-fs.cpp @@ -36,7 +36,6 @@ protected: public: Ps2FilesystemNode(void); - Ps2FilesystemNode(const Ps2FilesystemNode *node); Ps2FilesystemNode(const String &path); virtual String displayName() const { return _displayName; } @@ -76,13 +75,6 @@ Ps2FilesystemNode::Ps2FilesystemNode(const String &path) { _isDirectory = true; } -Ps2FilesystemNode::Ps2FilesystemNode(const Ps2FilesystemNode *node) { - _displayName = node->_displayName; - _isDirectory = node->_isDirectory; - _path = node->_path; - _isRoot = node->_isRoot; -} - FSList Ps2FilesystemNode::listDir(ListMode mode) const { assert(_isDirectory); @@ -116,7 +108,7 @@ FSList Ps2FilesystemNode::listDir(ListMode mode) const { dirEntry._path += tocEntries[fCnt].filename; dirEntry._displayName = tocEntries[fCnt].filename; - myList.push_back(wrap(new Ps2FilesystemNode(&dirEntry))); + myList.push_back(wrap(new Ps2FilesystemNode(dirEntry))); } } return myList; diff --git a/backends/fs/symbian/symbian-fs.cpp b/backends/fs/symbian/symbian-fs.cpp index bf5f9e2b82..438e574f05 100644 --- a/backends/fs/symbian/symbian-fs.cpp +++ b/backends/fs/symbian/symbian-fs.cpp @@ -45,7 +45,6 @@ protected: public: SymbianFilesystemNode(bool aIsRoot); SymbianFilesystemNode(const String &path); - SymbianFilesystemNode(const SymbianFilesystemNode *node); virtual String displayName() const { return _displayName; } virtual bool isValid() const { return _isValid; } virtual bool isDirectory() const { return _isDirectory; } @@ -97,14 +96,6 @@ SymbianFilesystemNode::SymbianFilesystemNode(const String &path) { _isDirectory = true; } -SymbianFilesystemNode::SymbianFilesystemNode(const SymbianFilesystemNode *node) { - _displayName = node->_displayName; - _isValid = node->_isValid; - _isDirectory = node->_isDirectory; - _path = node->_path; - _isPseudoRoot = node->_isPseudoRoot; -} - FSList SymbianFilesystemNode::listDir(ListMode mode) const { assert(_isDirectory); FSList myList; @@ -144,7 +135,7 @@ FSList SymbianFilesystemNode::listDir(ListMode mode) const { entry._isValid = true; entry._isPseudoRoot = false; entry._path = path; - myList.push_back(wrap(new SymbianFilesystemNode(&entry))); + myList.push_back(wrap(new SymbianFilesystemNode(entry))); } } else { TPtrC8 ptr((const unsigned char*)_path.c_str(),_path.size()); @@ -173,7 +164,7 @@ FSList SymbianFilesystemNode::listDir(ListMode mode) const { if (entry._isDirectory) entry._path += "\\"; - myList.push_back(wrap(new SymbianFilesystemNode(&entry))); + myList.push_back(wrap(new SymbianFilesystemNode(entry))); } CleanupStack::PopAndDestroy(dirPtr); } diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp index b7a22a301f..5b220427d2 100644 --- a/backends/fs/windows/windows-fs.cpp +++ b/backends/fs/windows/windows-fs.cpp @@ -43,7 +43,6 @@ protected: public: WindowsFilesystemNode(); WindowsFilesystemNode(const String &path); - WindowsFilesystemNode(const WindowsFilesystemNode *node); virtual String displayName() const { return _displayName; } virtual bool isValid() const { return _isValid; } @@ -60,6 +59,17 @@ private: }; +static const char *lastPathComponent(const Common::String &str) { + const char *start = str.c_str(); + const char *cur = start + str.size() - 2; + + while (cur > start && *cur != '\\') { + --cur; + } + + return cur + 1; +} + char* WindowsFilesystemNode::toAscii(TCHAR *x) { #ifndef UNICODE @@ -105,7 +115,7 @@ void WindowsFilesystemNode::addFile(FSList &list, ListMode mode, const char *bas entry._isValid = true; entry._isPseudoRoot = false; - list.push_back(wrap(new WindowsFilesystemNode(&entry))); + list.push_back(wrap(new WindowsFilesystemNode(entry))); } AbstractFilesystemNode *FilesystemNode::getRoot() { @@ -161,14 +171,6 @@ WindowsFilesystemNode::WindowsFilesystemNode(const String &p) { } } -WindowsFilesystemNode::WindowsFilesystemNode(const WindowsFilesystemNode *node) { - _displayName = node->_displayName; - _isDirectory = node->_isDirectory; - _isValid = node->_isValid; - _isPseudoRoot = node->_isPseudoRoot; - _path = node->_path; -} - FSList WindowsFilesystemNode::listDir(ListMode mode) const { assert(_isDirectory); @@ -192,7 +194,7 @@ FSList WindowsFilesystemNode::listDir(ListMode mode) const { entry._isValid = true; entry._isPseudoRoot = false; entry._path = toAscii(current_drive); - myList.push_back(wrap(new WindowsFilesystemNode(&entry))); + myList.push_back(wrap(new WindowsFilesystemNode(entry))); } #endif } @@ -217,17 +219,6 @@ FSList WindowsFilesystemNode::listDir(ListMode mode) const { return myList; } -const char *lastPathComponent(const Common::String &str) { - const char *start = str.c_str(); - const char *cur = start + str.size() - 2; - - while (cur > start && *cur != '\\') { - --cur; - } - - return cur + 1; -} - AbstractFilesystemNode *WindowsFilesystemNode::parent() const { assert(_isValid || _isPseudoRoot); if (_isPseudoRoot) |