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
This commit is contained in:
Johannes Schickel 2006-08-28 13:34:15 +00:00
parent d9cb390a7b
commit ac45e290f7
6 changed files with 10 additions and 11 deletions

View File

@ -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 /...

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}