From e28210d401ae4ed1258b84c9b17a172a757190e8 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 20 Oct 2010 13:24:58 -0700 Subject: Add length-equality test in String operator== checks. Change-Id: I6ebc6ef85aac4539269f137c1f29f95b9828d4f9 --- include/utils/String8.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/utils/String8.h') diff --git a/include/utils/String8.h b/include/utils/String8.h index cef8eca..a129222 100644 --- a/include/utils/String8.h +++ b/include/utils/String8.h @@ -418,7 +418,9 @@ 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 -- cgit v1.1