Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2eabb009 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick Committed by Android (Google) Code Review
Browse files

Merge "Add length-equality test in String operator== checks."

parents e16a5182 075e7503
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -205,7 +205,9 @@ inline bool String16::operator<=(const String16& other) const


inline bool String16::operator==(const String16& other) const
inline bool String16::operator==(const String16& other) const
{
{
    return strzcmp16(mString, size(), other.mString, other.size()) == 0;
    const size_t n1 = size();
    const size_t n2 = other.size();
    return n1 == n2 && strzcmp16(mString, n1, other.mString, n2) == 0;
}
}


inline bool String16::operator!=(const String16& other) const
inline bool String16::operator!=(const String16& other) const
+3 −1
Original line number Original line Diff line number Diff line
@@ -418,7 +418,9 @@ inline bool String8::operator<=(const String8& other) const


inline bool String8::operator==(const String8& other) const
inline bool String8::operator==(const String8& other) const
{
{
    return strcmp(mString, other.mString) == 0;
    return (SharedBuffer::sizeFromData(mString) ==
            SharedBuffer::sizeFromData(other.mString)) &&
        strcmp(mString, other.mString) == 0;
}
}


inline bool String8::operator!=(const String8& other) const
inline bool String8::operator!=(const String8& other) const