From 8b151ac991478a90d5064966f710ed566982c47e Mon Sep 17 00:00:00 2001 From: AngryGamer Date: Thu, 27 Jun 2019 03:49:15 -0700 Subject: [PATCH] Fix Sort Line as Integer regression The regression was made by #5555: https://github.com/notepad-plus-plus/notepad-plus-plus/commit/ff20c264df4167943fff6247fec4b0c0ce6227fb Close #5843, fix #5839 --- PowerEditor/src/MISC/Common/Sorters.h | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/PowerEditor/src/MISC/Common/Sorters.h b/PowerEditor/src/MISC/Common/Sorters.h index 144e8c206..85cbc1acb 100644 --- a/PowerEditor/src/MISC/Common/Sorters.h +++ b/PowerEditor/src/MISC/Common/Sorters.h @@ -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