- [SF 2513643] Seg fault in Poco::UTF8::toLower on 64-bit Linux

- removed support for 5- and 6-byte sequences
- fixed error counting in StreamConverterBuf::readFromDevice()
- added std::dec to poco_stdout_dbg and poco_stderr_dbg macros
This commit is contained in:
Aleksandar Fabijanic
2009-04-01 02:33:51 +00:00
parent 7007646ea2
commit d77ef57588
6 changed files with 78 additions and 65 deletions

View File

@@ -166,27 +166,13 @@ void TextIteratorTest::testOneUTF8()
assert (*it++ == 0xabcde);
assert (it == end);
// 5 byte sequence
// 5 byte sequence - not supported
n = encoding.convert(0xabcdef, data, sizeof(data));
assert (n == 5);
text.assign((char*) data, n);
it = TextIterator(text, encoding);
end = TextIterator(text);
assert (it != end);
assert (*it++ == 0xabcdef);
assert (it == end);
assert (n == 0);
// 6 byte sequence
// 6 byte sequence - not supported
n = encoding.convert(0xfabcdef, data, sizeof(data));
assert (n == 6);
text.assign((char*) data, n);
it = TextIterator(text, encoding);
end = TextIterator(text);
assert (it != end);
assert (*it++ == 0xfabcdef);
assert (it == end);
assert (n == 0);
}

View File

@@ -76,8 +76,8 @@ void UTF8StringTest::testCompare()
assert (UTF8::icompare(a5, b5) < 0);
std::string a6("\303\274\303\266\303\244"); // "u"a"o
std::string b6("\303\234\303\226\303\204"); // "U"A"O
std::string a6("\303\274\303\266\303\244"); // "u"o"a
std::string b6("\303\234\303\226\303\204"); // "U"O"A
assert (UTF8::icompare(a6, b6) == 0);
}
@@ -93,11 +93,15 @@ void UTF8StringTest::testTransform()
UTF8::toUpperInPlace(s2);
assert (s2 == "ABCDE123");
std::string s3("\303\274\303\266\303\244"); // "u"a"o
std::string s3("\303\274\303\266\303\244"); // "u"o"a
UTF8::toUpperInPlace(s3);
assert (s3 == "\303\234\303\226\303\204"); // "U"A"O
assert (s3 == "\303\234\303\226\303\204"); // "U"O"A
UTF8::toLowerInPlace(s3);
assert (s3 == "\303\274\303\266\303\244"); // "U"A"O
assert (s3 == "\303\274\303\266\303\244"); // "u"o"a
// a mix of invalid sequences
std::string str = "\xC2\xE5\xF0\xF8\xE8\xED\xFB+-++";
assert ("???" == UTF8::toLower(str));
}