Changeset 233660 in webkit
- Timestamp:
- Jul 9, 2018 3:30:40 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r233632 r233660 1 2018-07-09 Youenn Fablet <youenn@apple.com> 2 3 StringView operator==(char*) should check the length of the string 4 https://bugs.webkit.org/show_bug.cgi?id=187422 5 6 Reviewed by Chris Dumez. 7 8 * web-platform-tests/eventsource/format-field-parsing-expected.txt: 9 1 10 2018-07-08 Antoine Quint <graouts@apple.com> 2 11 -
trunk/LayoutTests/imported/w3c/web-platform-tests/eventsource/format-field-parsing-expected.txt
r220733 r233660 1 1 2 FAIL EventSource: field parsing assert_equals: expected "\0\n 2\n1\n3\n\n4" but got "\0\n 2\n2\n1\n3\n\n4" 2 PASS EventSource: field parsing 3 3 -
trunk/Source/WTF/ChangeLog
r233646 r233660 1 2018-07-09 Youenn Fablet <youenn@apple.com> 2 3 StringView operator==(char*) should check the length of the string 4 https://bugs.webkit.org/show_bug.cgi?id=187422 5 6 Reviewed by Chris Dumez. 7 8 Update StringView operator== to ensure that any character raw pointer comparison actually check the length of the raw pointer string. 9 This patch mimicks the behavior of String. 10 For instance, comparing a StringView with "he\0llo" and "he" will give the same result. 11 12 * wtf/linux/MemoryFootprintLinux.cpp: 13 (WTF::memoryFootprint): 14 * wtf/text/StringView.h: 15 (WTF::operator==): 16 (WTF::operator!=): 17 (WTF::equal): 18 (WTF::StringView::stripLeadingAndTrailingMatchedCharacters): 19 1 20 2018-07-09 Yusuke Suzuki <utatane.tea@gmail.com> 2 21 -
trunk/Source/WTF/wtf/linux/MemoryFootprintLinux.cpp
r233420 r233660 73 73 if (scannedCount == 7) { 74 74 StringView pathString(path); 75 isAnonymous = pathString == "[heap]" _s || pathString.startsWith("[stack");75 isAnonymous = pathString == "[heap]" | pathString.startsWith("[stack"); 76 76 return; 77 77 } -
trunk/Source/WTF/wtf/text/StringView.h
r232302 r233660 194 194 195 195 bool equal(StringView, StringView); 196 bool equal(StringView, const LChar*); 197 bool equal(StringView, const char*); 196 bool equal(StringView, const LChar* b); 198 197 199 198 bool equalIgnoringASCIICase(StringView, StringView); … … 203 202 204 203 inline bool operator==(StringView a, StringView b) { return equal(a, b); } 205 inline bool operator==(StringView a, const LChar* b) { return equal(a, b); } 206 inline bool operator==(StringView a, const char* b) { return equal(a, b); } 207 inline bool operator==(const LChar* a, StringView b) { return equal(b, a); } 204 inline bool operator==(StringView a, const LChar *b); 205 inline bool operator==(StringView a, const char *b) { return equal(a, reinterpret_cast<const LChar*>(b)); } 208 206 inline bool operator==(const char* a, StringView b) { return equal(b, a); } 209 207 … … 211 209 inline bool operator!=(StringView a, const LChar* b) { return !equal(a, b); } 212 210 inline bool operator!=(StringView a, const char* b) { return !equal(a, b); } 213 inline bool operator!=(const LChar* 214 inline bool operator!=(const char* 211 inline bool operator!=(const LChar*a, StringView b) { return !equal(b, a); } 212 inline bool operator!=(const char*a, StringView b) { return !equal(b, a); } 215 213 216 214 } … … 606 604 return a.length() == b.length(); 607 605 } 608 606 609 607 return equalCommon(a, b); 610 608 } … … 616 614 if (a.isEmpty()) 617 615 return !b; 616 618 617 unsigned aLength = a.length(); 618 if (aLength != strlen(reinterpret_cast<const char*>(b))) 619 return false; 620 619 621 if (a.is8Bit()) 620 622 return equal(a.characters8(), b, aLength); 621 623 return equal(a.characters16(), b, aLength); 622 }623 624 inline bool equal(StringView a, const char* b)625 {626 return equal(a, reinterpret_cast<const LChar*>(b));627 624 } 628 625 … … 957 954 unsigned start = 0; 958 955 unsigned end = m_length - 1; 959 956 960 957 while (start <= end && predicate(characters[start])) 961 958 ++start; 962 959 963 960 if (start > end) 964 961 return StringView::empty(); -
trunk/Source/WebCore/ChangeLog
r233652 r233660 1 2018-07-09 Youenn Fablet <youenn@apple.com> 2 3 StringView operator==(char*) should check the length of the string 4 https://bugs.webkit.org/show_bug.cgi?id=187422 5 6 Reviewed by Chris Dumez. 7 8 Covered by existing tests. 9 10 * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: 11 (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameFromEncodedFilename): 12 1 13 2018-07-09 Simon Fraser <simon.fraser@apple.com> 2 14 -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
r233122 r233660 738 738 String SQLiteIDBBackingStore::databaseNameFromEncodedFilename(const String& encodedName) 739 739 { 740 if (e qual(encodedName, "%00"_s))740 if (encodedName == "%00"_s) 741 741 return { }; 742 742 -
trunk/Tools/ChangeLog
r233651 r233660 1 2018-07-09 Youenn Fablet <youenn@apple.com> 2 3 StringView operator==(char*) should check the length of the string 4 https://bugs.webkit.org/show_bug.cgi?id=187422 5 6 Reviewed by Chris Dumez. 7 8 * TestWebKitAPI/Tests/WTF/StringView.cpp: 9 (TestWebKitAPI::equal2): 10 (TestWebKitAPI::TEST): 11 1 12 2018-07-09 Ross Kirsling <rkirsling@gmail.com> 2 13 -
trunk/Tools/TestWebKitAPI/Tests/WTF/StringView.cpp
r220982 r233660 299 299 } 300 300 301 TEST(WTF, StringViewEqualBasic) 302 { 303 String referenceHolder; 304 StringView a = stringViewFromUTF8(referenceHolder, "Hello World!"); 305 EXPECT_TRUE(a == "Hello World!"); 306 EXPECT_FALSE(a == "Hello World"); 307 EXPECT_FALSE(a == "Hello World!!"); 308 309 auto test = "Hell\0"; 310 a = StringView { (const LChar*)test, 5 }; 311 EXPECT_FALSE(a == "Hell\0"); 312 EXPECT_FALSE(a == "Hell"); 313 314 StringView test3 = "Hello"; 315 EXPECT_TRUE(test3 == "Hello\0"); 316 EXPECT_TRUE(test3 == "Hello"); 317 } 318 301 319 TEST(WTF, StringViewEqualIgnoringASCIICaseBasic) 302 320 {
Note: See TracChangeset
for help on using the changeset viewer.