From ac45e290f7550da70039c1d2051d7e6ed31cc7b7 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 28 Aug 2006 13:34:15 +0000 Subject: Fixing other FS backends to use the bug fixed version of the POSIX lastPathComponent too (also lets the Windows FS use the POSIX version of lastPathComponent too, since it's nicer than the fix I made) svn-id: r23796 --- backends/fs/dc/dc-fs.cpp | 3 ++- backends/fs/gp32/gp32-fs.cpp | 4 ++-- backends/fs/palmos/palmos-fs.cpp | 3 ++- backends/fs/psp/psp_fs.cpp | 4 ++-- backends/fs/symbian/symbian-fs.cpp | 2 +- backends/fs/windows/windows-fs.cpp | 5 +---- 6 files changed, 10 insertions(+), 11 deletions(-) (limited to 'backends/fs') diff --git a/backends/fs/dc/dc-fs.cpp b/backends/fs/dc/dc-fs.cpp index db097301ce..7294211e68 100644 --- a/backends/fs/dc/dc-fs.cpp +++ b/backends/fs/dc/dc-fs.cpp @@ -59,13 +59,14 @@ 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 != '/') { + while (cur >= start && *cur != '/') { --cur; } return cur + 1; } + AbstractFilesystemNode *AbstractFilesystemNode::getCurrentDirectory() { // Since there is no way to _set_ the current directory, // it will always be /... diff --git a/backends/fs/gp32/gp32-fs.cpp b/backends/fs/gp32/gp32-fs.cpp index c94460d727..1288622632 100644 --- a/backends/fs/gp32/gp32-fs.cpp +++ b/backends/fs/gp32/gp32-fs.cpp @@ -194,11 +194,11 @@ bool GP32FilesystemNode::listDir(AbstractFSList &myList, ListMode mode) const { return true; } -const char *lastPathComponent(const Common::String &str) { +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 != '\\') { + while (cur >= start && *cur != '/') { --cur; } diff --git a/backends/fs/palmos/palmos-fs.cpp b/backends/fs/palmos/palmos-fs.cpp index afdf26a4f5..4dfdb2f068 100644 --- a/backends/fs/palmos/palmos-fs.cpp +++ b/backends/fs/palmos/palmos-fs.cpp @@ -61,8 +61,9 @@ 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 != '/') + while (cur >= start && *cur != '/') { --cur; + } return cur + 1; } diff --git a/backends/fs/psp/psp_fs.cpp b/backends/fs/psp/psp_fs.cpp index 0ad98729a9..0f16ac8395 100644 --- a/backends/fs/psp/psp_fs.cpp +++ b/backends/fs/psp/psp_fs.cpp @@ -133,11 +133,11 @@ bool PSPFilesystemNode::listDir(AbstractFSList &myList, ListMode mode) const { } } -const char *lastPathComponent(const Common::String &str) { +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 != '/') { + while (cur >= start && *cur != '/') { --cur; } diff --git a/backends/fs/symbian/symbian-fs.cpp b/backends/fs/symbian/symbian-fs.cpp index b8a3e9312d..4dca90e1db 100644 --- a/backends/fs/symbian/symbian-fs.cpp +++ b/backends/fs/symbian/symbian-fs.cpp @@ -62,7 +62,7 @@ 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 != '\\') { + while (cur >= start && *cur != '/') { --cur; } diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp index 4819d38313..0472f248b2 100644 --- a/backends/fs/windows/windows-fs.cpp +++ b/backends/fs/windows/windows-fs.cpp @@ -65,13 +65,10 @@ 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 != '\\') { + while (cur >= start && *cur != '/') { --cur; } - if (cur == start) - return cur; - return cur + 1; } -- cgit v1.2.3