Changeset - r23606:675adf28a8f7
[Not reviewed]
master
0 2 0
glx22 - 6 years ago 2019-04-10 18:55:53
glx22@users.noreply.github.com
Fix #7494: std::sort() and qsort() use different comparators (#7495)
2 files changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/widgets/dropdown.cpp
Show inline comments
 
@@ -51,12 +51,12 @@ void DropDownListStringItem::Draw(int le
 
 * @return true if \a first precedes \a second.
 
 * @warning All items in the list need to be derivates of DropDownListStringItem.
 
 */
 
/* static */ int DropDownListStringItem::NatSortFunc(std::unique_ptr<const DropDownListItem> const &first, std::unique_ptr<const DropDownListItem> const &second)
 
/* 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);
 
	return strnatcmp(buffer1, buffer2) < 0;
 
}
 

	
 
StringID DropDownListParamStringItem::String() const
src/widgets/dropdown_type.h
Show inline comments
 
@@ -49,7 +49,7 @@ public:
 
	void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const override;
 
	virtual StringID String() const { return this->string; }
 

	
 
	static int NatSortFunc(std::unique_ptr<const DropDownListItem> const &first, std::unique_ptr<const DropDownListItem> const &second);
 
	static bool NatSortFunc(std::unique_ptr<const DropDownListItem> const &first, std::unique_ptr<const DropDownListItem> const &second);
 
};
 

	
 
/**
0 comments (0 inline, 0 general)