Author: carnold
Date: Tue Oct 11 07:26:02 2005
New Revision: 312892
URL: http://svn.apache.org/viewcvs?rev=312892&view=rev
Log:
LOGCXX-105: Infinite loop in File::convertBackSlashes
Modified:
logging/log4cxx/trunk/src/file.cpp
logging/log4cxx/trunk/tests/src/filetestcase.cpp
Modified: logging/log4cxx/trunk/src/file.cpp
URL:
http://svn.apache.org/viewcvs/logging/log4cxx/trunk/src/file.cpp?rev=312892&r1=312891&r2=312892&view=diff
==============================================================================
--- logging/log4cxx/trunk/src/file.cpp (original)
+++ logging/log4cxx/trunk/src/file.cpp Tue Oct 11 07:26:02 2005
@@ -88,7 +88,7 @@
std::string mod(src);
while(pos != std::string::npos) {
mod[pos] = '/';
- pos = src.find('\\');
+ pos = mod.find('\\');
}
return mod;
}
Modified: logging/log4cxx/trunk/tests/src/filetestcase.cpp
URL:
http://svn.apache.org/viewcvs/logging/log4cxx/trunk/tests/src/filetestcase.cpp?rev=312892&r1=312891&r2=312892&view=diff
==============================================================================
--- logging/log4cxx/trunk/tests/src/filetestcase.cpp (original)
+++ logging/log4cxx/trunk/tests/src/filetestcase.cpp Tue Oct 11 07:26:02 2005
@@ -39,6 +39,7 @@
#endif
CPPUNIT_TEST(copyConstructor);
CPPUNIT_TEST(assignment);
+ CPPUNIT_TEST(deleteBackslashedFileName);
CPPUNIT_TEST_SUITE_END();
public:
@@ -129,6 +130,16 @@
LogString reply(outFile.read(pool));
CPPUNIT_ASSERT_EQUAL(greeting, reply);
+ }
+
+ /**
+ * Tests conversion of backslash containing file names.
+ * Would cause infinite loop due to bug LOGCXX-105.
+ */
+ void deleteBackslashedFileName() {
+ File file("output\\bogus.txt");
+ Pool pool;
+ bool deleted = file.deleteFile(pool);
}
};