WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
239306
Replace calls to substring(0, x) with the more concise left(x)
https://bugs.webkit.org/show_bug.cgi?id=239306
Summary
Replace calls to substring(0, x) with the more concise left(x)
Chris Dumez
Reported
2022-04-13 15:27:45 PDT
Replace calls to substring(0, x) with the more concise left(x).
Attachments
Patch
(92.36 KB, patch)
2022-04-13 16:14 PDT
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(92.43 KB, patch)
2022-04-13 17:14 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(93.09 KB, patch)
2022-04-13 19:08 PDT
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(93.12 KB, patch)
2022-04-13 19:42 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2022-04-13 16:14:47 PDT
Created
attachment 457572
[details]
Patch
Chris Dumez
Comment 2
2022-04-13 17:14:53 PDT
Created
attachment 457578
[details]
Patch
Darin Adler
Comment 3
2022-04-13 18:22:06 PDT
Comment on
attachment 457578
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=457578&action=review
> Source/WebCore/platform/network/MIMEHeader.cpp:75 > + key = StringView(line).left(semiColonIndex).convertToASCIILowercase().stripWhiteSpace();
Seems *so* unlikely this (and the code above) really wants stripWhiteSpace. Almost certainly wants to strip based on some other definitions of spaces rather than "all Unicode whitespace". Should be MIME whitespace definition, which is probably like the HTML or HTTP whitespace definition. Almost every call to stripWhiteSpace is a mistake. Also cute that this capitalizes semicolon as if it was two words, or hyphenated.
> Source/WebCore/svg/SVGURIReference.cpp:72 > URL kurl(base, fragmentIdentifier);
Ah, yes, "kurl".
> Source/WebCore/workers/service/server/SWServer.cpp:1271 > + if (!scheme.startsWithIgnoringASCIICase("http"))
Nice one. Could use the even-more-optimized startsWithLettersIgnoringASCIICase.
> Source/WebKit/UIProcess/API/glib/InputMethodFilter.cpp:243 > + auto cursorPositionUTF8 = cursorPosition != text.length() ? StringView(text).left(cursorPosition).utf8().length() : textUTF8.length();
Not great to call utf8().length() instead of an algorithm that can compute a UTF-8 length, without also allocating memory and copying the characters. But doesn’t need to be fixed right now.
Chris Dumez
Comment 4
2022-04-13 19:08:53 PDT
Created
attachment 457586
[details]
Patch
Chris Dumez
Comment 5
2022-04-13 19:42:28 PDT
Created
attachment 457588
[details]
Patch
EWS
Comment 6
2022-04-13 21:51:46 PDT
Committed
r292857
(
249628@main
): <
https://commits.webkit.org/249628@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 457588
[details]
.
Radar WebKit Bug Importer
Comment 7
2022-04-13 21:52:14 PDT
<
rdar://problem/91734789
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug