Fixed #7177 (MathLib: Does not handle '\xF6' properly)
This commit is contained in:
parent
bc08aee9ca
commit
fee0e4edfa
|
@ -349,7 +349,12 @@ static unsigned int encodeMultiChar(const std::string& str)
|
|||
MathLib::bigint MathLib::characterLiteralToLongNumber(const std::string& str)
|
||||
{
|
||||
if (str.empty())
|
||||
return 0; // for unit-testing...
|
||||
return 0; // <- only possible in unit testing
|
||||
|
||||
// '\xF6'
|
||||
if (str.size() == 4 && str.compare(0,2,"\\x")==0 && std::isxdigit(str[2]) && std::isxdigit(str[3])) {
|
||||
return std::strtoul(str.substr(2).c_str(), NULL, 16);
|
||||
}
|
||||
|
||||
// C99 6.4.4.4
|
||||
// The value of an integer character constant containing more than one character (e.g., 'ab'),
|
||||
|
|
|
@ -292,6 +292,7 @@ private:
|
|||
ASSERT_EQUALS((int)('\3'), MathLib::toLongNumber("'\\3'"));
|
||||
ASSERT_EQUALS((int)('\34'), MathLib::toLongNumber("'\\34'"));
|
||||
ASSERT_EQUALS((int)('\034'), MathLib::toLongNumber("'\\034'"));
|
||||
ASSERT_EQUALS((int)('\x34'), MathLib::toLongNumber("'\\x34'"));
|
||||
ASSERT_EQUALS((int)('\134'), MathLib::toLongNumber("'\\134'"));
|
||||
ASSERT_EQUALS((int)('\134t'), MathLib::toLongNumber("'\\134t'")); // Ticket #7452
|
||||
ASSERT_THROW(MathLib::toLongNumber("'\\9'"), InternalError);
|
||||
|
|
Loading…
Reference in New Issue