Fix Sort Line as Integer regression

The regression was made by #5555:
ff20c264df

Close #5843, fix #5839
This commit is contained in:
AngryGamer 2019-06-27 03:49:15 -07:00 committed by Don HO
parent e9277deaa6
commit 8b151ac991
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

View File

@ -167,16 +167,7 @@ public:
// Maximum value for a variable of type unsigned long long | 18446744073709551615
// So take the max length 18 to convert the number
const size_t maxLen = 18;
size_t aLen = a.length() - i, bLen = b.length() - i;
if (aLen > maxLen || bLen > maxLen)
{
delta = min(min(aLen, bLen), maxLen);
compareResult = std::stoll(a.substr(i, delta)) - std::stoll(b.substr(i, delta));
}
else
{
compareResult = std::stoll(a.substr(i)) - std::stoll(b.substr(i), &delta);
}
compareResult = std::stoll(a.substr(i, maxLen)) - std::stoll(b.substr(i, maxLen), &delta);
i += delta;
}
// Both are strings
@ -231,16 +222,7 @@ public:
// Maximum value for a variable of type unsigned long long | 18446744073709551615
// So take the max length 18 to convert the number
const size_t maxLen = 18;
size_t aLen = a.length() - i, bLen = b.length() - i;
if (aLen > maxLen || bLen > maxLen)
{
delta = min(min(aLen, bLen), maxLen);
compareResult = std::stoll(a.substr(i, delta)) - std::stoll(b.substr(i, delta));
}
else
{
compareResult = std::stoll(a.substr(i)) - std::stoll(b.substr(i), &delta);
}
compareResult = std::stoll(a.substr(i, maxLen)) - std::stoll(b.substr(i, maxLen), &delta);
i += delta;
}
// Both are strings