Title: [262814] trunk/Source/WTF
Revision
262814
Author
[email protected]
Date
2020-06-09 15:04:49 -0700 (Tue, 09 Jun 2020)

Log Message

Use bridge cast in String(NSString *) constructor
https://bugs.webkit.org/show_bug.cgi?id=212989

Reviewed by Darin Adler.

Use bridge cast in String(NSString *) constructor instead of a reinterpret_cast as this
is the preferred way of converting a NS Type to a CF one.

* wtf/text/cocoa/StringCocoa.mm:
(WTF::String::String):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (262813 => 262814)


--- trunk/Source/WTF/ChangeLog	2020-06-09 21:47:45 UTC (rev 262813)
+++ trunk/Source/WTF/ChangeLog	2020-06-09 22:04:49 UTC (rev 262814)
@@ -1,3 +1,16 @@
+2020-06-09  Chris Dumez  <[email protected]>
+
+        Use bridge cast in String(NSString *) constructor
+        https://bugs.webkit.org/show_bug.cgi?id=212989
+
+        Reviewed by Darin Adler.
+
+        Use bridge cast in String(NSString *) constructor instead of a reinterpret_cast as this
+        is the preferred way of converting a NS Type to a CF one.
+
+        * wtf/text/cocoa/StringCocoa.mm:
+        (WTF::String::String):
+
 2020-06-09  Per Arne Vollan  <[email protected]>
 
         All platforms should enable CFPrefs read only mode in the WebContent process

Modified: trunk/Source/WTF/wtf/text/cocoa/StringCocoa.mm (262813 => 262814)


--- trunk/Source/WTF/wtf/text/cocoa/StringCocoa.mm	2020-06-09 21:47:45 UTC (rev 262813)
+++ trunk/Source/WTF/wtf/text/cocoa/StringCocoa.mm	2020-06-09 22:04:49 UTC (rev 262814)
@@ -30,13 +30,13 @@
     if (!str)
         return;
 
-    CFIndex size = CFStringGetLength(reinterpret_cast<CFStringRef>(str));
+    CFIndex size = CFStringGetLength((__bridge CFStringRef)str);
     if (!size)
         m_impl = StringImpl::empty();
     else {
         Vector<LChar, 1024> lcharBuffer(size);
         CFIndex usedBufLen;
-        CFIndex convertedsize = CFStringGetBytes(reinterpret_cast<CFStringRef>(str), CFRangeMake(0, size), kCFStringEncodingISOLatin1, 0, false, lcharBuffer.data(), size, &usedBufLen);
+        CFIndex convertedsize = CFStringGetBytes((__bridge CFStringRef)str, CFRangeMake(0, size), kCFStringEncodingISOLatin1, 0, false, lcharBuffer.data(), size, &usedBufLen);
         if ((convertedsize == size) && (usedBufLen == size)) {
             m_impl = StringImpl::create(lcharBuffer.data(), size);
             return;
@@ -43,7 +43,7 @@
         }
 
         Vector<UChar, 1024> ucharBuffer(size);
-        CFStringGetCharacters(reinterpret_cast<CFStringRef>(str), CFRangeMake(0, size), reinterpret_cast<UniChar*>(ucharBuffer.data()));
+        CFStringGetCharacters((__bridge CFStringRef)str, CFRangeMake(0, size), reinterpret_cast<UniChar*>(ucharBuffer.data()));
         m_impl = StringImpl::create(ucharBuffer.data(), size);
     }
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to