[Scummvm-cvs-logs] SF.net SVN: scummvm:[52123] scummvm/trunk
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Mon Aug 16 18:01:31 CEST 2010
Revision: 52123
http://scummvm.svn.sourceforge.net/scummvm/?rev=52123&view=rev
Author: lordhoto
Date: 2010-08-16 16:01:31 +0000 (Mon, 16 Aug 2010)
Log Message:
-----------
Common: Fix bug in lastPathComponent.
Prior to this change lastPathComponent would not create a correct result,
when the input of lastPathComponent did not contain a single separator.
I also added a test case for this in our unit tests.
Modified Paths:
--------------
scummvm/trunk/common/str.cpp
scummvm/trunk/test/common/str.h
Modified: scummvm/trunk/common/str.cpp
===================================================================
--- scummvm/trunk/common/str.cpp 2010-08-16 15:22:43 UTC (rev 52122)
+++ scummvm/trunk/common/str.cpp 2010-08-16 16:01:31 UTC (rev 52123)
@@ -626,7 +626,7 @@
// Now scan the whole component
const char *first = last - 1;
- while (first >= str && *first != sep)
+ while (first > str && *first != sep)
--first;
if (*first == sep)
Modified: scummvm/trunk/test/common/str.h
===================================================================
--- scummvm/trunk/test/common/str.h 2010-08-16 15:22:43 UTC (rev 52122)
+++ scummvm/trunk/test/common/str.h 2010-08-16 16:01:31 UTC (rev 52123)
@@ -266,6 +266,8 @@
TS_ASSERT_EQUALS(Common::lastPathComponent("foo/./bar", '/'), "bar");
TS_ASSERT_EQUALS(Common::lastPathComponent("foo//./bar//", '/'), "bar");
TS_ASSERT_EQUALS(Common::lastPathComponent("foo//.bar//", '/'), ".bar");
+
+ TS_ASSERT_EQUALS(Common::lastPathComponent("foo", '/'), "foo");
}
void test_normalizePath() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list