Fix comparing String with StringView
This commit is contained in:
@@ -45,12 +45,12 @@ StringAnsi StringView::ToStringAnsi() const
|
||||
|
||||
bool operator==(const String& a, const StringView& b)
|
||||
{
|
||||
return StringUtils::Compare(a.GetText(), b.GetText()) == 0;
|
||||
return a.Length() == b.Length() && StringUtils::Compare(a.GetText(), b.GetText(), b.Length()) == 0;
|
||||
}
|
||||
|
||||
bool operator!=(const String& a, const StringView& b)
|
||||
{
|
||||
return StringUtils::Compare(a.GetText(), b.GetText()) != 0;
|
||||
return a.Length() != b.Length() || StringUtils::Compare(a.GetText(), b.GetText(), b.Length()) != 0;
|
||||
}
|
||||
|
||||
StringAnsiView StringAnsiView::Empty;
|
||||
@@ -95,10 +95,10 @@ StringAnsi StringAnsiView::ToStringAnsi() const
|
||||
|
||||
bool operator==(const StringAnsi& a, const StringAnsiView& b)
|
||||
{
|
||||
return StringUtils::Compare(a.GetText(), b.GetText()) == 0;
|
||||
return a.Length() == b.Length() && StringUtils::Compare(a.GetText(), b.GetText(), b.Length()) == 0;
|
||||
}
|
||||
|
||||
bool operator!=(const StringAnsi& a, const StringAnsiView& b)
|
||||
{
|
||||
return StringUtils::Compare(a.GetText(), b.GetText()) != 0;
|
||||
return a.Length() != b.Length() || StringUtils::Compare(a.GetText(), b.GetText(), b.Length()) != 0;
|
||||
}
|
||||
|
||||
@@ -347,8 +347,8 @@ inline uint32 GetHash(const StringView& key)
|
||||
return StringUtils::GetHashCode(key.Get(), key.Length());
|
||||
}
|
||||
|
||||
bool operator==(const String& a, const StringView& b);
|
||||
bool operator!=(const String& a, const StringView& b);
|
||||
bool FLAXENGINE_API operator==(const String& a, const StringView& b);
|
||||
bool FLAXENGINE_API operator!=(const String& a, const StringView& b);
|
||||
|
||||
namespace fmt
|
||||
{
|
||||
@@ -525,8 +525,8 @@ inline uint32 GetHash(const StringAnsiView& key)
|
||||
return StringUtils::GetHashCode(key.Get(), key.Length());
|
||||
}
|
||||
|
||||
bool operator==(const StringAnsi& a, const StringAnsiView& b);
|
||||
bool operator!=(const StringAnsi& a, const StringAnsiView& b);
|
||||
bool FLAXENGINE_API operator==(const StringAnsi& a, const StringAnsiView& b);
|
||||
bool FLAXENGINE_API operator!=(const StringAnsi& a, const StringAnsiView& b);
|
||||
|
||||
namespace fmt
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user