Permalink
Browse files

Fixed bug in implementation of isStringEqualNoCase().

  • Loading branch information...
vincent-richard committed Sep 5, 2018
1 parent 258f943 commit 7e29cf01fa76e42a017f94294cead3e577d69d69
Showing with 4 additions and 1 deletion.
  1. +1 −1 src/vmime/utility/stringUtils.cpp
  2. +3 −0 tests/utility/stringUtilsTest.cpp
@@ -62,7 +62,7 @@ bool stringUtils::isStringEqualNoCase(const string& s1, const string& s2) {
bool equal = true;
const string::const_iterator end = s1.end();
for (string::const_iterator i = s1.begin(), j = s2.begin(); i != end ; ++i, ++j) {
for (string::const_iterator i = s1.begin(), j = s2.begin() ; equal && i != end ; ++i, ++j) {
equal = (fac.tolower(static_cast <unsigned char>(*i)) == fac.tolower(static_cast <unsigned char>(*j)));
}
@@ -98,6 +98,9 @@ VMIME_TEST_SUITE_BEGIN(stringUtilsTest)
VASSERT_EQ("1", true, stringUtils::isStringEqualNoCase(vmime::string("foo"), vmime::string("foo")));
VASSERT_EQ("2", true, stringUtils::isStringEqualNoCase(vmime::string("FOo"), vmime::string("foo")));
VASSERT_EQ("3", true, stringUtils::isStringEqualNoCase(vmime::string("foO"), vmime::string("FOo")));
VASSERT_EQ("4", false, stringUtils::isStringEqualNoCase(vmime::string("foO"), vmime::string("bar")));
VASSERT_EQ("5", false, stringUtils::isStringEqualNoCase(vmime::string("foOO"), vmime::string("barO")));
}
void testIsStringEqualNoCase3() {

0 comments on commit 7e29cf0

Please sign in to comment.