diff options
Diffstat (limited to 'backends/fs')
-rw-r--r-- | backends/fs/fs.h | 11 | ||||
-rw-r--r-- | backends/fs/posix/posix-fs.cpp | 1 | ||||
-rw-r--r-- | backends/fs/windows/windows-fs.cpp | 16 |
3 files changed, 12 insertions, 16 deletions
diff --git a/backends/fs/fs.h b/backends/fs/fs.h index abade8f189..a001fb202c 100644 --- a/backends/fs/fs.h +++ b/backends/fs/fs.h @@ -148,14 +148,12 @@ public: */ class FSList : ScummVM::List<FilesystemNode *> { public: - ~FSList() - { + ~FSList() { for (int i = 0; i < _size; i++) delete _data[i]; } - void push_back(const FilesystemNode& element) - { + void push_back(const FilesystemNode &element) { ensureCapacity(_size + 1); // Determine where to insert the item. // TODO this is inefficient, should use binary search instead @@ -163,13 +161,12 @@ public: while (i < _size && *_data[i] < element) i++; if (i < _size) - memmove(&_data[i+1], &_data[i], (_size - i) * sizeof(FilesystemNode *)); + memmove(&_data[i + 1], &_data[i], (_size - i) * sizeof(FilesystemNode *)); _data[i] = element.clone(); _size++; } - const FilesystemNode& operator [](int idx) const - { + const FilesystemNode& operator [](int idx) const { assert(idx >= 0 && idx < _size); return *_data[idx]; } diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index 23ad5786fe..eec49da03e 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -141,7 +141,6 @@ const char *lastPathComponent(const ScummVM::String &str) { } FilesystemNode *POSIXFilesystemNode::parent() const { - POSIXFilesystemNode *p = new POSIXFilesystemNode(); // Root node is its own parent. Still we can't just return this diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp index 2cdb0d625c..cb7974a48e 100644 --- a/backends/fs/windows/windows-fs.cpp +++ b/backends/fs/windows/windows-fs.cpp @@ -186,22 +186,22 @@ FSList *WindowsFilesystemNode::listDir(ListMode mode) const { } const char *lastPathComponent(const ScummVM::String &str) { - const char *start = str.c_str(); - const char *cur = start + str.size() - 2; + const char *start = str.c_str(); + const char *cur = start + str.size() - 2; - while (cur > start && *cur != '\\') { - --cur; - } + while (cur > start && *cur != '\\') { + --cur; + } - return cur+1; + return cur + 1; } FilesystemNode *WindowsFilesystemNode::parent() const { assert(_isValid || _isPseudoRoot); WindowsFilesystemNode *p = new WindowsFilesystemNode(); if (!_isPseudoRoot && _path.size() > 3) { - const char *start = _path.c_str(); - const char *end = lastPathComponent(_path); + const char *start = _path.c_str(); + const char *end = lastPathComponent(_path); p->_path = String(start, end - start); p->_isValid = true; |