UNCONFIRMED 225593
Remove unnecessary comparison and casting in GlyphBuffer.h
https://bugs.webkit.org/show_bug.cgi?id=225593
Summary Remove unnecessary comparison and casting in GlyphBuffer.h
Eleni Maria Stea
Reported 2021-05-10 05:54:09 PDT
Variable result in checkedStringOffsetAt in GlyphBuffer.h is unsigned. Therefore, it can never be < 0 and static cast to unsigned before comparison is unnecessary.
Attachments
Patch (1.48 KB, patch)
2021-05-10 06:03 PDT, Eleni Maria Stea
sam: review-
ews-feeder: commit-queue-
Eleni Maria Stea
Comment 1 2021-05-10 06:03:39 PDT
Eleni Maria Stea
Comment 2 2021-05-10 07:17:18 PDT
I had only built this on Linux/GCC and received warnings about unsigned which were fixed when I removed the cast. But it seems that it was required (EWS failure) above. This bug report is invalid.
Sam Weinig
Comment 3 2021-05-10 09:05:05 PDT
Comment on attachment 428166 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=428166&action=review > Source/WebCore/platform/graphics/GlyphBuffer.h:81 > - if (result < 0 || static_cast<unsigned>(result) >= stringLength) > + if (result >= stringLength) This is not true on all platforms. When USE(CG) is true, GlyphBufferStringOffset (the type of result) is CFIndex which is 'signed long'. The real issue that we should try to solve is using the same types here if we can.
Sam Weinig
Comment 4 2021-05-10 09:05:36 PDT
Re-opening, I think we should at least see if we can converge on the same type.
Sam Weinig
Comment 5 2021-05-10 09:08:19 PDT Comment hidden (obsolete)
Sam Weinig
Comment 6 2021-05-10 09:08:52 PDT
Myles, can you think of anything good we can do to make it so non-CG ports and CG ports can use these types consistently?
Eleni Maria Stea
Comment 7 2021-05-10 11:57:21 PDT
I agree, sorry I closed it. Besides I think that at least the part where we check it's < 0 should be removed because we always use unsigned: either unsigned int or unsigned long
e.barg0089
Comment 8 2021-05-10 13:23:36 PDT
Comment on attachment 428166 [details] Patch Remove bug
e.barg0089
Comment 9 2021-05-10 13:25:22 PDT
Comment on attachment 428166 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=428166&action=review > Source/WebCore/platform/graphics/GlyphBuffer.h:79 > { Revert all properties
Sam Weinig
Comment 10 2021-05-10 14:24:05 PDT
Well, as I said above, USE(CG) uses CFIndex which is signed (either signed long or signed long long).
Radar WebKit Bug Importer
Comment 11 2022-03-14 08:56:39 PDT
Note You need to log in before you can comment on or make changes to this bug.