Changeset 167114 in webkit


Ignore:
Timestamp:
Apr 10, 2014 11:16:32 PM (10 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/16582465> [Cocoa] Avoid casts from CF types to unrelated Objective-C types
https://bugs.webkit.org/show_bug.cgi?id=131529

Reviewed by Mark Rowe.

  • Shared/API/c/cf/WKStringCF.mm:

(WKStringCreateWithCFString): Cast the CFStringRef into its toll-free-bridged counterpart,
NSString, then cast the NSString into a WKNSString.

  • Shared/API/c/cf/WKURLCF.mm:

(WKURLCreateWithCFURL): Cast the CFURLRef into its toll-free-bridged counterpart, NSURL,
then cast the NSURL into a WKNSURL.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r167113 r167114  
     12014-04-10  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/16582465> [Cocoa] Avoid casts from CF types to unrelated Objective-C types
     4        https://bugs.webkit.org/show_bug.cgi?id=131529
     5
     6        Reviewed by Mark Rowe.
     7
     8        * Shared/API/c/cf/WKStringCF.mm:
     9        (WKStringCreateWithCFString): Cast the CFStringRef into its toll-free-bridged counterpart,
     10        NSString, then cast the NSString into a WKNSString.
     11        * Shared/API/c/cf/WKURLCF.mm:
     12        (WKURLCreateWithCFURL): Cast the CFURLRef into its toll-free-bridged counterpart, NSURL,
     13        then cast the NSURL into a WKNSURL.
     14
    1152014-04-10  Dan Bernstein  <mitz@apple.com>
    216
  • trunk/Source/WebKit2/Shared/API/c/cf/WKStringCF.mm

    r160608 r167114  
    5151#if WK_API_ENABLED
    5252    // Since WKNSString is an internal class with no subclasses, we can do a simple equality check.
    53     if (object_getClass((NSString *)cfString) == wkNSStringClass()) {
    54         return toAPI(static_cast<API::String*>(&[(WKNSString *)cfString retain]._apiObject));
    55     }
     53    if (object_getClass((NSString *)cfString) == wkNSStringClass())
     54        return toAPI(static_cast<API::String*>(&[(WKNSString *)[(NSString *)cfString retain] _apiObject]));
    5655#endif
    5756    String string(cfString);
  • trunk/Source/WebKit2/Shared/API/c/cf/WKURLCF.mm

    r160969 r167114  
    5555#if WK_API_ENABLED
    5656    // Since WKNSURL is an internal class with no subclasses, we can do a simple equality check.
    57     if (object_getClass((NSURL *)cfURL) == wkNSURLClass()) {
    58         return toAPI(static_cast<API::URL*>(&[(WKNSURL *)cfURL retain]._apiObject));
    59     }
     57    if (object_getClass((NSURL *)cfURL) == wkNSURLClass())
     58        return toAPI(static_cast<API::URL*>(&[(WKNSURL *)[(NSURL *)cfURL retain] _apiObject]));
    6059#endif
    6160
Note: See TracChangeset for help on using the changeset viewer.