From 112ba72222bf191a9c1e4d1ef8e83af1d43d3082 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 4 Apr 2006 20:54:55 +0000 Subject: Removing more pseudo copy constructors in favor of the standard copy constructor (gee, everybody is copying my bad code, it seems ;-) svn-id: r21597 --- backends/fs/windows/windows-fs.cpp | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) (limited to 'backends/fs/windows') 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) -- cgit v1.2.3