Browse Source

Fix build with EASTL when it is configured to use size_type different from size_t.

Rokas Kupstys 5 years ago
parent
commit
21a7a5fc48

+ 1 - 1
Include/RmlUi/Core/Traits.h

@@ -62,7 +62,7 @@ protected:
 };
 
 template<typename T>
-class RMLUICORE_API Releaser final : public ReleaserBase {
+class RMLUICORE_API Releaser : public ReleaserBase {
 public:
 	void operator()(T* target) const {
 		static_assert(std::is_base_of<Releasable, T>::value, "Rml::Releaser can only operate with classes derived from ::Rml::Releasable.");

+ 3 - 3
Source/Core/Elements/WidgetTextInput.cpp

@@ -526,7 +526,7 @@ bool WidgetTextInput::AddCharacters(String string)
 
 	String value = GetElement()->GetAttribute< String >("value", "");
 	
-	value.insert(std::min(size_t(GetCursorIndex()), value.size()), string);
+	value.insert(std::min<size_t>(GetCursorIndex(), value.size()), string);
 
 	edit_index += (int)string.size();
 
@@ -563,7 +563,7 @@ bool WidgetTextInput::DeleteCharacters(CursorMovement direction)
 void WidgetTextInput::CopySelection()
 {
 	const String& value = GetElement()->GetAttribute< String >("value", "");
-	const String snippet = value.substr(std::min(size_t(selection_begin_index), value.size()), selection_length);
+	const String snippet = value.substr(std::min(size_t(selection_begin_index), size_t(value.size())), selection_length);
 	GetSystemInterface()->SetClipboardText(snippet);
 }
 
@@ -1186,7 +1186,7 @@ void WidgetTextInput::DeleteSelection()
 	{
 		const String& value = GetElement()->GetAttribute< String >("value", "");
 
-		String new_value = value.substr(0, selection_begin_index) + value.substr(std::min(size_t(selection_begin_index + selection_length), value.size()));
+		String new_value = value.substr(0, selection_begin_index) + value.substr(std::min(size_t(selection_begin_index + selection_length), size_t(value.size())));
 		GetElement()->SetAttribute("value", new_value);
 
 		// Move the cursor to the beginning of the old selection.

+ 1 - 1
Source/Core/StringUtilities.cpp

@@ -568,7 +568,7 @@ StringView::StringView(const String& string) : p_begin(string.data()), p_end(str
 {}
 StringView::StringView(const String& string, size_t offset) : p_begin(string.data() + offset), p_end(string.data() + string.size())
 {}
-StringView::StringView(const String& string, size_t offset, size_t count) : p_begin(string.data() + offset), p_end(string.data() + std::min(offset + count, string.size()))
+StringView::StringView(const String& string, size_t offset, size_t count) : p_begin(string.data() + offset), p_end(string.data() + std::min<size_t>(offset + count, string.size()))
 {}
 
 bool StringView::operator==(const StringView& other) const {