Bug 225573

Summary: Remove uses of the String::toInt family of functions from the WebCore/svg and WebCore/workers directories
Product: WebKit Reporter: Darin Adler <darin>
Component: WebCore Misc.Assignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, ews-watchlist, fmalita, gyuyoung.kim, pdr, sabouhallawa, sam, schenney, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch sam: review+

Description Darin Adler 2021-05-08 18:35:09 PDT
Remove uses of the String::toInt family of functions from the WebCore/svg and WebCore/workers directories
Comment 1 Darin Adler 2021-05-08 19:04:55 PDT Comment hidden (obsolete)
Comment 2 Darin Adler 2021-05-08 20:48:00 PDT Comment hidden (obsolete)
Comment 3 Darin Adler 2021-05-08 21:21:38 PDT
Created attachment 428111 [details]
Patch
Comment 4 Darin Adler 2021-05-08 21:53:42 PDT
Comment on attachment 428111 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=428111&action=review

> Source/WebCore/svg/SVGToOTFFontConversion.cpp:1456
> +            if (value && *value >= 0 && *value < 1000) {
> +                m_weight = std::max(std::min((*value + 50) / 100, static_cast<int>(std::numeric_limits<uint8_t>::max())), static_cast<int>(std::numeric_limits<uint8_t>::min()));

This std::max/min stuff is not needed. We can’t get a value outside the range 0-255 when we take a number that’s required to be in the range 0-999 and divide it by 100 (with rounding). That gives us a number in the range of 0-10, nowhere near 255, and not less than 0.

I’ll remove it.
Comment 5 Darin Adler 2021-05-09 11:40:25 PDT
Accidentally commit this along at the same time as the fix for bug 225577.

Committed r277245 (237514@main): <https://commits.webkit.org/237514@main>
Comment 6 Radar WebKit Bug Importer 2021-05-09 11:40:35 PDT
<rdar://problem/77717702>