Author: afester Date: Mon Jul 17 13:26:24 2006 New Revision: 422839 URL: http://svn.apache.org/viewvc?rev=422839&view=rev Log: LOGCXX-14: use size_t and LogString::size_type to fix various "comparison between signed and unsigned integer expressions"
Modified: logging/log4cxx/trunk/include/log4cxx/pattern/patternparser.h logging/log4cxx/trunk/src/dailyrollingfileappender.cpp logging/log4cxx/trunk/src/nameabbreviator.cpp logging/log4cxx/trunk/src/patternparser.cpp logging/log4cxx/trunk/tests/src/helpers/charsetencodertestcase.cpp logging/log4cxx/trunk/tests/src/rolling/obsoletedailyrollingfileappendertest.cpp Modified: logging/log4cxx/trunk/include/log4cxx/pattern/patternparser.h URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/include/log4cxx/pattern/patternparser.h?rev=422839&r1=422838&r2=422839&view=diff ============================================================================== --- logging/log4cxx/trunk/include/log4cxx/pattern/patternparser.h (original) +++ logging/log4cxx/trunk/include/log4cxx/pattern/patternparser.h Mon Jul 17 13:26:24 2006 @@ -86,7 +86,7 @@ */ static int extractConverter( logchar lastChar, const LogString& pattern, - int i, LogString& convBuf, + LogString::size_type i, LogString& convBuf, LogString& currentLiteral); /** @@ -96,7 +96,7 @@ * @param options array to receive extracted options * @return position in pattern after options. */ - static int extractOptions(const LogString& pattern, int i, + static int extractOptions(const LogString& pattern, LogString::size_type i, std::vector<LogString>& options); public: Modified: logging/log4cxx/trunk/src/dailyrollingfileappender.cpp URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/dailyrollingfileappender.cpp?rev=422839&r1=422838&r2=422839&view=diff ============================================================================== --- logging/log4cxx/trunk/src/dailyrollingfileappender.cpp (original) +++ logging/log4cxx/trunk/src/dailyrollingfileappender.cpp Mon Jul 17 13:26:24 2006 @@ -62,7 +62,7 @@ bool inLiteral = false; bool inPattern = false; - for (int i = 0; i < datePattern.length(); i++) { + for (size_t i = 0; i < datePattern.length(); i++) { if (datePattern[i] == LOG4CXX_STR('\'')) { inLiteral = !inLiteral; Modified: logging/log4cxx/trunk/src/nameabbreviator.cpp URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/nameabbreviator.cpp?rev=422839&r1=422838&r2=422839&view=diff ============================================================================== --- logging/log4cxx/trunk/src/nameabbreviator.cpp (original) +++ logging/log4cxx/trunk/src/nameabbreviator.cpp Mon Jul 17 13:26:24 2006 @@ -111,7 +111,7 @@ /** * Count of initial characters of element to output. */ - int charCount; + LogString::size_type charCount; /** * Character used to represent dropped characters. @@ -266,7 +266,7 @@ LogString::size_type pos = 0; while ((pos < trimmed.length()) && (pos >= 0)) { - int ellipsisPos = pos; + LogString::size_type ellipsisPos = pos; if (trimmed[pos] == LOG4CXX_STR('*')) { charCount = INT_MAX; Modified: logging/log4cxx/trunk/src/patternparser.cpp URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/src/patternparser.cpp?rev=422839&r1=422838&r2=422839&view=diff ============================================================================== --- logging/log4cxx/trunk/src/patternparser.cpp (original) +++ logging/log4cxx/trunk/src/patternparser.cpp Mon Jul 17 13:26:24 2006 @@ -55,9 +55,9 @@ int PatternParser::extractConverter( logchar lastChar, const LogString& pattern, - int i, LogString& convBuf, + LogString::size_type i, LogString& convBuf, LogString& currentLiteral) { - if (!convBuf.empty()) { + if (!convBuf.empty()) { convBuf.erase(convBuf.begin(), convBuf.end()); } @@ -86,7 +86,7 @@ } -int PatternParser::extractOptions(const LogString& pattern, int i, +int PatternParser::extractOptions(const LogString& pattern, LogString::size_type i, std::vector<LogString>& options) { while ((i < pattern.length()) && (pattern[i] == LOG4CXX_STR('{'))) { int end = pattern.find(LOG4CXX_STR('}'), i); Modified: logging/log4cxx/trunk/tests/src/helpers/charsetencodertestcase.cpp URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/tests/src/helpers/charsetencodertestcase.cpp?rev=422839&r1=422838&r2=422839&view=diff ============================================================================== --- logging/log4cxx/trunk/tests/src/helpers/charsetencodertestcase.cpp (original) +++ logging/log4cxx/trunk/tests/src/helpers/charsetencodertestcase.cpp Mon Jul 17 13:26:24 2006 @@ -159,7 +159,7 @@ out.flip(); CPPUNIT_ASSERT_EQUAL((size_t) 13, out.limit()); - for(int i = 0; i < out.limit(); i++) { + for(size_t i = 0; i < out.limit(); i++) { CPPUNIT_ASSERT_EQUAL((int) utf8_greet[i], (int) out.data()[i]); } CPPUNIT_ASSERT(iter == greeting.end()); Modified: logging/log4cxx/trunk/tests/src/rolling/obsoletedailyrollingfileappendertest.cpp URL: http://svn.apache.org/viewvc/logging/log4cxx/trunk/tests/src/rolling/obsoletedailyrollingfileappendertest.cpp?rev=422839&r1=422838&r2=422839&view=diff ============================================================================== --- logging/log4cxx/trunk/tests/src/rolling/obsoletedailyrollingfileappendertest.cpp (original) +++ logging/log4cxx/trunk/tests/src/rolling/obsoletedailyrollingfileappendertest.cpp Mon Jul 17 13:26:24 2006 @@ -122,7 +122,7 @@ std::vector<LogString> files(File(dir).list(p)); int count = 0; - for (int i = 0; i < files.size(); i++) { + for (size_t i = 0; i < files.size(); i++) { if (StringHelper::startsWith(files[i], initial)) { count++; }