Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(926)

Unified Diff: third_party/WebKit/public/platform/WebString.h

Issue 2655013004: Make WebString::equal take the length for const char* too (Closed)
Patch Set: null crash fix Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/exported/WebString.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/public/platform/WebString.h
diff --git a/third_party/WebKit/public/platform/WebString.h b/third_party/WebKit/public/platform/WebString.h
index b5e4a896ccd590fefd45461a798cc42a5b7e2fa5..85a6832370540f71029f537c0134ede61b97b9a7 100644
--- a/third_party/WebKit/public/platform/WebString.h
+++ b/third_party/WebKit/public/platform/WebString.h
@@ -112,7 +112,7 @@ class WebString {
BLINK_COMMON_EXPORT void assign(const WebUChar* data, size_t len);
BLINK_COMMON_EXPORT bool equals(const WebString&) const;
- BLINK_COMMON_EXPORT bool equals(const char* characters) const;
+ BLINK_COMMON_EXPORT bool equals(const char* characters, size_t len) const;
BLINK_COMMON_EXPORT size_t length() const;
@@ -229,7 +229,7 @@ class WebString {
};
inline bool operator==(const WebString& a, const char* b) {
- return a.equals(b);
+ return a.equals(b, b ? strlen(b) : 0);
}
inline bool operator!=(const WebString& a, const char* b) {
@@ -237,11 +237,11 @@ inline bool operator!=(const WebString& a, const char* b) {
}
inline bool operator==(const char* a, const WebString& b) {
- return b.equals(a);
+ return b == a;
}
inline bool operator!=(const char* a, const WebString& b) {
- return !(a == b);
+ return !(b == a);
}
inline bool operator==(const WebString& a, const WebString& b) {
« no previous file with comments | « third_party/WebKit/Source/platform/exported/WebString.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698