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

Side by Side Diff: third_party/WebKit/Source/platform/exported/WebString.cpp

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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/public/platform/WebString.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 WebString WebString::fromASCII(const std::string& s) { 149 WebString WebString::fromASCII(const std::string& s) {
150 DCHECK(base::IsStringASCII(s)); 150 DCHECK(base::IsStringASCII(s));
151 return fromLatin1(s); 151 return fromLatin1(s);
152 } 152 }
153 153
154 bool WebString::equals(const WebString& s) const { 154 bool WebString::equals(const WebString& s) const {
155 return equal(m_private.get(), s.m_private.get()); 155 return equal(m_private.get(), s.m_private.get());
156 } 156 }
157 157
158 bool WebString::equals(const char* characters) const { 158 bool WebString::equals(const char* characters, size_t length) const {
159 return equal(m_private.get(), reinterpret_cast<const LChar*>(characters)); 159 return equal(m_private.get(), characters, length);
160 } 160 }
161 161
162 WebString::WebString(const WTF::String& s) : m_private(s.impl()) {} 162 WebString::WebString(const WTF::String& s) : m_private(s.impl()) {}
163 163
164 WebString& WebString::operator=(const WTF::String& s) { 164 WebString& WebString::operator=(const WTF::String& s) {
165 assign(s.impl()); 165 assign(s.impl());
166 return *this; 166 return *this;
167 } 167 }
168 168
169 WebString::operator WTF::String() const { 169 WebString::operator WTF::String() const {
(...skipping 15 matching lines...) Expand all
185 185
186 WebString::operator WTF::AtomicString() const { 186 WebString::operator WTF::AtomicString() const {
187 return WTF::AtomicString(m_private.get()); 187 return WTF::AtomicString(m_private.get());
188 } 188 }
189 189
190 void WebString::assign(WTF::StringImpl* p) { 190 void WebString::assign(WTF::StringImpl* p) {
191 m_private = p; 191 m_private = p;
192 } 192 }
193 193
194 } // namespace blink 194 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/public/platform/WebString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698