Codechange: replace strnatcmp with C++ string capable version

This commit is contained in:
Rubidium
2023-04-27 15:39:10 +02:00
committed by rubidium42
parent df19673fbd
commit c829930440
22 changed files with 47 additions and 54 deletions

View File

@@ -52,10 +52,9 @@ void DropDownListStringItem::Draw(const Rect &r, bool sel, Colours bg_colour) co
*/
/* static */ bool DropDownListStringItem::NatSortFunc(std::unique_ptr<const DropDownListItem> const &first, std::unique_ptr<const DropDownListItem> const &second)
{
char buffer1[512], buffer2[512];
GetString(buffer1, static_cast<const DropDownListStringItem*>(first.get())->String(), lastof(buffer1));
GetString(buffer2, static_cast<const DropDownListStringItem*>(second.get())->String(), lastof(buffer2));
return strnatcmp(buffer1, buffer2) < 0;
std::string str1 = GetString(static_cast<const DropDownListStringItem*>(first.get())->String());
std::string str2 = GetString(static_cast<const DropDownListStringItem*>(second.get())->String());
return StrNaturalCompare(str1, str2) < 0;
}
StringID DropDownListParamStringItem::String() const