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

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

Issue 2655013004: Make WebString::equal take the length for const char* too (Closed)
Patch Set: 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..af7c497966f0ca544dbc597f60bf236a3db61161 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, strlen(b));
esprehn 2017/01/26 08:36:54 You need to null check, calling strlen with null w
kinuko 2017/01/26 09:41:04 Thanks for catching this! Done.
}
inline bool operator!=(const WebString& a, const char* b) {
@@ -237,7 +237,7 @@ inline bool operator!=(const WebString& a, const char* b) {
}
inline bool operator==(const char* a, const WebString& b) {
- return b.equals(a);
+ return b.equals(a, strlen(a));
esprehn 2017/01/26 08:36:54 ditto, or you could do: return b == a;
kinuko 2017/01/26 09:41:04 Done.
}
inline bool operator!=(const char* 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