Title: [291591] trunk/Source/WebKit
Revision
291591
Author
akeer...@apple.com
Date
2022-03-21 17:22:07 -0700 (Mon, 21 Mar 2022)

Log Message

Unreviewed, address post-landing feedback on r291445


* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView compareFoundRange:toRange:inDocument:]):

Subtraction to determine ordering is an anti-pattern, due to the
possibility of overflow. Use comparison operators.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (291590 => 291591)


--- trunk/Source/WebKit/ChangeLog	2022-03-22 00:17:14 UTC (rev 291590)
+++ trunk/Source/WebKit/ChangeLog	2022-03-22 00:22:07 UTC (rev 291591)
@@ -1,3 +1,13 @@
+2022-03-21  Aditya Keerthi  <akeer...@apple.com>
+
+        Unreviewed, address post-landing feedback on r291445
+
+        * UIProcess/ios/WKPDFView.mm:
+        (-[WKPDFView compareFoundRange:toRange:inDocument:]):
+
+        Subtraction to determine ordering is an anti-pattern, due to the
+        possibility of overflow. Use comparison operators.
+
 2022-03-21  Chris Dumez  <cdu...@apple.com>
 
         BroadcastChannel instances in distinct opaque origins can communicate

Modified: trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm (291590 => 291591)


--- trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm	2022-03-22 00:17:14 UTC (rev 291590)
+++ trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm	2022-03-22 00:22:07 UTC (rev 291591)
@@ -707,12 +707,10 @@
     if (!to)
         return NSOrderedSame;
 
-    NSInteger offset = from.index - to.index;
-
-    if (offset < 0)
+    if (from.index < to.index)
         return NSOrderedAscending;
 
-    if (offset > 0)
+    if (from.index > to.index)
         return NSOrderedDescending;
 
     return NSOrderedSame;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to