Changeset 230713 in webkit


Ignore:
Timestamp:
Apr 17, 2018 9:28:33 AM (6 years ago)
Author:
ddkilzer@apple.com
Message:

Implement checked cast for DDResultRef once DDResultGetTypeID() is available
<https://webkit.org/b/184554>
<rdar://problem/36241894>

Reviewed by Brent Fulgham.

  • editing/cocoa/DataDetection.mm:

(WebCore::detectItemAtPositionWithRange): Implement checked cast
for DDResultRef.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r230712 r230713  
     12018-04-17  David Kilzer  <ddkilzer@apple.com>
     2
     3        Implement checked cast for DDResultRef once DDResultGetTypeID() is available
     4        <https://webkit.org/b/184554>
     5        <rdar://problem/36241894>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        * editing/cocoa/DataDetection.mm:
     10        (WebCore::detectItemAtPositionWithRange): Implement checked cast
     11        for DDResultRef.
     12
    1132018-04-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
    214
  • trunk/Source/WebCore/editing/cocoa/DataDetection.mm

    r226483 r230713  
    5151#import <pal/spi/ios/DataDetectorsUISPI.h>
    5252#import <pal/spi/mac/DataDetectorsSPI.h>
     53#import <wtf/cf/TypeCastsCF.h>
    5354#import <wtf/text/StringBuilder.h>
    5455
    5556#import "DataDetectorsCoreSoftLink.h"
     57
     58#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
     59WTF_DECLARE_CF_TYPE_TRAIT(DDResult);
     60#endif
    5661
    5762namespace WebCore {
     
    7984    CFIndex resultCount = CFArrayGetCount(results.get());
    8085    for (CFIndex i = 0; i < resultCount; i++) {
    81         // FIXME: <rdar://problem/36241894> Implement checked cast for DDResultRef once DDResultGetTypeID() is available
     86#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
     87        DDResultRef result = checked_cf_cast<DDResultRef>(CFArrayGetValueAtIndex(results.get(), i));
     88#else
    8289        DDResultRef result = static_cast<DDResultRef>(const_cast<CF_BRIDGED_TYPE(id) void*>(CFArrayGetValueAtIndex(results.get(), i)));
     90#endif
    8391        CFRange resultRangeInContext = DDResultGetRange(result);
    8492        if (hitLocation >= resultRangeInContext.location && (hitLocation - resultRangeInContext.location) < resultRangeInContext.length) {
Note: See TracChangeset for help on using the changeset viewer.