Title: [221152] trunk/Source/WebCore
Revision
221152
Author
ddkil...@apple.com
Date
2017-08-24 11:35:39 -0700 (Thu, 24 Aug 2017)

Log Message

Fix -Wcast-qual and -Wunused-lambda-capture warnings in WebCore with new clang compiler
<https://webkit.org/b/175910>
<rdar://problem/33667497>

Reviewed by Alex Christensen.

Fix -Wunused-lambda-capture warnings:

* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::setBodyData): Remove unused lambda
capture of 'this'.
* style/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::createRenderer): Add
UNUSED_PARAM(style) when ENABLE(CSS_REGIONS) is turned off.

Fix -Wcast-qual warnings:

* crypto/mac/CryptoKeyRSAMac.cpp:
(WebCore::CryptoKeyRSA::create): Switch from C-style cast to
reinterpret_cast with const keyword.  This better matches the
argument types used in CCRSACryptorCreateFromData().
* platform/audio/mac/FFTFrameMac.cpp:
(WebCore::FFTFrame::doFFT): Switch from C-style cast to
reinterpret_cast with const keyword.  This better matches the
argument type used in vDSP_ctoz().
* platform/graphics/FontPlatformData.h: Only define
WebCore::toCTFont() and WebCore::toNSFont() when building for
Objective-C++.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
Switch from C-style cast to reinterpret_cast with const keyword.
This better matches the argument type used in
Uint8Array::setRange().
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::CMTimebaseEffectiveRateChangedCallback): Use
const_cast to avoid warning.
* platform/mac/SSLKeyGeneratorMac.mm:
(WebCore::signedPublicKeyAndChallengeString): Use const_cast to
avoid warning, and switch C-style cast to reinterpret_cast.
* xml/XSLTProcessorLibxslt.cpp:
(WebCore::XSLTProcessor::transformToString):
- Use const_cast to avoid warning, and switch C-style cast to
  reinterpret_cast.
- Switch C-style cast to reinterpret_cast and add const keyword.
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLParserContext::createMemoryParser): Use const_cast
to avoid warning, and switch C-style cast to reinterpret_cast.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (221151 => 221152)


--- trunk/Source/WebCore/ChangeLog	2017-08-24 18:27:54 UTC (rev 221151)
+++ trunk/Source/WebCore/ChangeLog	2017-08-24 18:35:39 UTC (rev 221152)
@@ -1,3 +1,53 @@
+2017-08-24  David Kilzer  <ddkil...@apple.com>
+
+        Fix -Wcast-qual and -Wunused-lambda-capture warnings in WebCore with new clang compiler
+        <https://webkit.org/b/175910>
+        <rdar://problem/33667497>
+
+        Reviewed by Alex Christensen.
+
+        Fix -Wunused-lambda-capture warnings:
+
+        * Modules/fetch/FetchResponse.cpp:
+        (WebCore::FetchResponse::setBodyData): Remove unused lambda
+        capture of 'this'.
+        * style/RenderTreeUpdater.cpp:
+        (WebCore::RenderTreeUpdater::createRenderer): Add
+        UNUSED_PARAM(style) when ENABLE(CSS_REGIONS) is turned off.
+
+        Fix -Wcast-qual warnings:
+
+        * crypto/mac/CryptoKeyRSAMac.cpp:
+        (WebCore::CryptoKeyRSA::create): Switch from C-style cast to
+        reinterpret_cast with const keyword.  This better matches the
+        argument types used in CCRSACryptorCreateFromData().
+        * platform/audio/mac/FFTFrameMac.cpp:
+        (WebCore::FFTFrame::doFFT): Switch from C-style cast to
+        reinterpret_cast with const keyword.  This better matches the
+        argument type used in vDSP_ctoz().
+        * platform/graphics/FontPlatformData.h: Only define
+        WebCore::toCTFont() and WebCore::toNSFont() when building for
+        Objective-C++.
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
+        Switch from C-style cast to reinterpret_cast with const keyword.
+        This better matches the argument type used in
+        Uint8Array::setRange().
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::CMTimebaseEffectiveRateChangedCallback): Use
+        const_cast to avoid warning.
+        * platform/mac/SSLKeyGeneratorMac.mm:
+        (WebCore::signedPublicKeyAndChallengeString): Use const_cast to
+        avoid warning, and switch C-style cast to reinterpret_cast.
+        * xml/XSLTProcessorLibxslt.cpp:
+        (WebCore::XSLTProcessor::transformToString):
+        - Use const_cast to avoid warning, and switch C-style cast to
+          reinterpret_cast.
+        - Switch C-style cast to reinterpret_cast and add const keyword.
+        * xml/parser/XMLDocumentParserLibxml2.cpp:
+        (WebCore::XMLParserContext::createMemoryParser): Use const_cast
+        to avoid warning, and switch C-style cast to reinterpret_cast.
+
 2017-08-22  Dave Hyatt  <hy...@apple.com>
 
         [Repaint Outside Layout] Add a pref for repainting outside of layout

Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp (221151 => 221152)


--- trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp	2017-08-24 18:27:54 UTC (rev 221151)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp	2017-08-24 18:35:39 UTC (rev 221152)
@@ -297,7 +297,7 @@
         if (isBodyNull())
             setBody(FetchBody::loadingBody());
         body().consumer().setData(WTFMove(buffer));
-    }, [this](std::nullptr_t&) { });
+    }, [](std::nullptr_t&) { });
 }
 
 #if ENABLE(STREAMS_API)

Modified: trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp (221151 => 221152)


--- trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp	2017-08-24 18:27:54 UTC (rev 221151)
+++ trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp	2017-08-24 18:35:39 UTC (rev 221152)
@@ -136,10 +136,10 @@
     // See <rdar://problem/15452324>.
     CCCryptorStatus status = CCRSACryptorCreateFromData(
         keyData.type() == CryptoKeyRSAComponents::Type::Public ? ccRSAKeyPublic : ccRSAKeyPrivate,
-        (uint8_t*)keyData.modulus().data(), keyData.modulus().size(),
-        (uint8_t*)keyData.exponent().data(), keyData.exponent().size(),
-        (uint8_t*)keyData.firstPrimeInfo().primeFactor.data(), keyData.firstPrimeInfo().primeFactor.size(),
-        (uint8_t*)keyData.secondPrimeInfo().primeFactor.data(), keyData.secondPrimeInfo().primeFactor.size(),
+        reinterpret_cast<const uint8_t*>(keyData.modulus().data()), keyData.modulus().size(),
+        reinterpret_cast<const uint8_t*>(keyData.exponent().data()), keyData.exponent().size(),
+        reinterpret_cast<const uint8_t*>(keyData.firstPrimeInfo().primeFactor.data()), keyData.firstPrimeInfo().primeFactor.size(),
+        reinterpret_cast<const uint8_t*>(keyData.secondPrimeInfo().primeFactor.data()), keyData.secondPrimeInfo().primeFactor.size(),
         &cryptor);
 
     if (status) {

Modified: trunk/Source/WebCore/platform/audio/mac/FFTFrameMac.cpp (221151 => 221152)


--- trunk/Source/WebCore/platform/audio/mac/FFTFrameMac.cpp	2017-08-24 18:27:54 UTC (rev 221151)
+++ trunk/Source/WebCore/platform/audio/mac/FFTFrameMac.cpp	2017-08-24 18:35:39 UTC (rev 221152)
@@ -129,7 +129,7 @@
 
 void FFTFrame::doFFT(const float* data)
 {
-    vDSP_ctoz((DSPComplex*)data, 2, &m_frame, 1, m_FFTSize / 2);
+    vDSP_ctoz(reinterpret_cast<const DSPComplex*>(data), 2, &m_frame, 1, m_FFTSize / 2);
     vDSP_fft_zrip(m_FFTSetup, &m_frame, 1, m_log2FFTSize, FFT_FORWARD);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.h (221151 => 221152)


--- trunk/Source/WebCore/platform/graphics/FontPlatformData.h	2017-08-24 18:27:54 UTC (rev 221151)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.h	2017-08-24 18:35:39 UTC (rev 221152)
@@ -275,7 +275,7 @@
 #endif
 };
 
-#if USE(APPKIT)
+#if USE(APPKIT) && defined(__OBJC__)
 
 // NSFonts and CTFontRefs are toll-free-bridged.
 inline CTFontRef toCTFont(NSFont *font)

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (221151 => 221152)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2017-08-24 18:27:54 UTC (rev 221151)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2017-08-24 18:35:39 UTC (rev 221152)
@@ -1843,7 +1843,7 @@
         CString utf8EncodedKeyId = UTF8Encoding().encode(keyIDView, URLEncodedEntitiesForUnencodables);
 
         RefPtr<Uint8Array> initData = Uint8Array::create(utf8EncodedKeyId.length());
-        initData->setRange((JSC::Uint8Adaptor::Type*)utf8EncodedKeyId.data(), utf8EncodedKeyId.length(), 0);
+        initData->setRange(reinterpret_cast<const JSC::Uint8Adaptor::Type*>(utf8EncodedKeyId.data()), utf8EncodedKeyId.length(), 0);
 
         auto keyData = player()->cachedKeyForKeyId(keyID);
         if (keyData) {

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (221151 => 221152)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2017-08-24 18:27:54 UTC (rev 221151)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2017-08-24 18:35:39 UTC (rev 221152)
@@ -115,7 +115,7 @@
 
 static void CMTimebaseEffectiveRateChangedCallback(CMNotificationCenterRef, const void *listener, CFStringRef, const void *, CFTypeRef)
 {
-    MediaPlayerPrivateMediaSourceAVFObjC* player = (MediaPlayerPrivateMediaSourceAVFObjC*)listener;
+    MediaPlayerPrivateMediaSourceAVFObjC* player = (MediaPlayerPrivateMediaSourceAVFObjC*)const_cast<void*>(listener);
     callOnMainThread([weakThis = player->createWeakPtr()] {
         if (!weakThis)
             return;

Modified: trunk/Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm (221151 => 221152)


--- trunk/Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm	2017-08-24 18:27:54 UTC (rev 221151)
+++ trunk/Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm	2017-08-24 18:35:39 UTC (rev 221152)
@@ -184,7 +184,7 @@
 
     // Length needs to account for the null terminator.
     signedPublicKeyAndChallenge.publicKeyAndChallenge.challenge.Length = challenge.length() + 1;
-    signedPublicKeyAndChallenge.publicKeyAndChallenge.challenge.Data = ""
+    signedPublicKeyAndChallenge.publicKeyAndChallenge.challenge.Data = ""
 
     CSSM_DATA encodedPublicKeyAndChallenge { 0, nullptr };
     if (SecAsn1EncodeItem(coder, &signedPublicKeyAndChallenge.publicKeyAndChallenge, publicKeyAndChallengeTemplate, &encodedPublicKeyAndChallenge) != noErr)

Modified: trunk/Source/WebCore/style/RenderTreeUpdater.cpp (221151 => 221152)


--- trunk/Source/WebCore/style/RenderTreeUpdater.cpp	2017-08-24 18:27:54 UTC (rev 221151)
+++ trunk/Source/WebCore/style/RenderTreeUpdater.cpp	2017-08-24 18:35:39 UTC (rev 221152)
@@ -358,6 +358,8 @@
 #if ENABLE(CSS_REGIONS)
         if (element.shouldMoveToFlowThread(style))
             return RenderTreePosition::insertionPositionForFlowThread(renderTreePosition().parent().element(), element, style);
+#else
+        UNUSED_PARAM(style);
 #endif
         renderTreePosition().computeNextSibling(element);
         return renderTreePosition();

Modified: trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp (221151 => 221152)


--- trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp	2017-08-24 18:27:54 UTC (rev 221151)
+++ trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp	2017-08-24 18:35:39 UTC (rev 221152)
@@ -317,7 +317,7 @@
 
     xmlChar* origMethod = sheet->method;
     if (!origMethod && mimeType == "text/html")
-        sheet->method = (xmlChar*)"html";
+        sheet->method = reinterpret_cast<xmlChar*>(const_cast<char*>("html"));
 
     bool success = false;
     bool shouldFreeSourceDoc = false;
@@ -361,7 +361,7 @@
 
         if ((success = saveResultToString(resultDoc, sheet, resultString))) {
             mimeType = resultMIMEType(resultDoc, sheet);
-            resultEncoding = (char*)resultDoc->encoding;
+            resultEncoding = reinterpret_cast<const char*>(resultDoc->encoding);
         }
         xmlFreeDoc(resultDoc);
     }

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp (221151 => 221152)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp	2017-08-24 18:27:54 UTC (rev 221151)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp	2017-08-24 18:35:39 UTC (rev 221152)
@@ -548,8 +548,8 @@
     parser->sax2 = 1;
     parser->instate = XML_PARSER_CONTENT; // We are parsing a CONTENT
     parser->depth = 0;
-    parser->str_xml = xmlDictLookup(parser->dict, BAD_CAST "xml", 3);
-    parser->str_xmlns = xmlDictLookup(parser->dict, BAD_CAST "xmlns", 5);
+    parser->str_xml = xmlDictLookup(parser->dict, reinterpret_cast<xmlChar*>(const_cast<char*>("xml")), 3);
+    parser->str_xmlns = xmlDictLookup(parser->dict, reinterpret_cast<xmlChar*>(const_cast<char*>("xmlns")), 5);
     parser->str_xml_ns = xmlDictLookup(parser->dict, XML_XML_NAMESPACE, 36);
     parser->_private = userData;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to