Changeset 221152 in webkit


Ignore:
Timestamp:
Aug 24, 2017 11:35:39 AM (7 years ago)
Author:
ddkilzer@apple.com
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.

Location:
trunk/Source/WebCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r221147 r221152  
     12017-08-24  David Kilzer  <ddkilzer@apple.com>
     2
     3        Fix -Wcast-qual and -Wunused-lambda-capture warnings in WebCore with new clang compiler
     4        <https://webkit.org/b/175910>
     5        <rdar://problem/33667497>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Fix -Wunused-lambda-capture warnings:
     10
     11        * Modules/fetch/FetchResponse.cpp:
     12        (WebCore::FetchResponse::setBodyData): Remove unused lambda
     13        capture of 'this'.
     14        * style/RenderTreeUpdater.cpp:
     15        (WebCore::RenderTreeUpdater::createRenderer): Add
     16        UNUSED_PARAM(style) when ENABLE(CSS_REGIONS) is turned off.
     17
     18        Fix -Wcast-qual warnings:
     19
     20        * crypto/mac/CryptoKeyRSAMac.cpp:
     21        (WebCore::CryptoKeyRSA::create): Switch from C-style cast to
     22        reinterpret_cast with const keyword.  This better matches the
     23        argument types used in CCRSACryptorCreateFromData().
     24        * platform/audio/mac/FFTFrameMac.cpp:
     25        (WebCore::FFTFrame::doFFT): Switch from C-style cast to
     26        reinterpret_cast with const keyword.  This better matches the
     27        argument type used in vDSP_ctoz().
     28        * platform/graphics/FontPlatformData.h: Only define
     29        WebCore::toCTFont() and WebCore::toNSFont() when building for
     30        Objective-C++.
     31        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
     32        (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
     33        Switch from C-style cast to reinterpret_cast with const keyword.
     34        This better matches the argument type used in
     35        Uint8Array::setRange().
     36        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
     37        (WebCore::CMTimebaseEffectiveRateChangedCallback): Use
     38        const_cast to avoid warning.
     39        * platform/mac/SSLKeyGeneratorMac.mm:
     40        (WebCore::signedPublicKeyAndChallengeString): Use const_cast to
     41        avoid warning, and switch C-style cast to reinterpret_cast.
     42        * xml/XSLTProcessorLibxslt.cpp:
     43        (WebCore::XSLTProcessor::transformToString):
     44        - Use const_cast to avoid warning, and switch C-style cast to
     45          reinterpret_cast.
     46        - Switch C-style cast to reinterpret_cast and add const keyword.
     47        * xml/parser/XMLDocumentParserLibxml2.cpp:
     48        (WebCore::XMLParserContext::createMemoryParser): Use const_cast
     49        to avoid warning, and switch C-style cast to reinterpret_cast.
     50
    1512017-08-22  Dave Hyatt  <hyatt@apple.com>
    252
  • trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp

    r220948 r221152  
    298298            setBody(FetchBody::loadingBody());
    299299        body().consumer().setData(WTFMove(buffer));
    300     }, [this](std::nullptr_t&) { });
     300    }, [](std::nullptr_t&) { });
    301301}
    302302
  • trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp

    r220954 r221152  
    137137    CCCryptorStatus status = CCRSACryptorCreateFromData(
    138138        keyData.type() == CryptoKeyRSAComponents::Type::Public ? ccRSAKeyPublic : ccRSAKeyPrivate,
    139         (uint8_t*)keyData.modulus().data(), keyData.modulus().size(),
    140         (uint8_t*)keyData.exponent().data(), keyData.exponent().size(),
    141         (uint8_t*)keyData.firstPrimeInfo().primeFactor.data(), keyData.firstPrimeInfo().primeFactor.size(),
    142         (uint8_t*)keyData.secondPrimeInfo().primeFactor.data(), keyData.secondPrimeInfo().primeFactor.size(),
     139        reinterpret_cast<const uint8_t*>(keyData.modulus().data()), keyData.modulus().size(),
     140        reinterpret_cast<const uint8_t*>(keyData.exponent().data()), keyData.exponent().size(),
     141        reinterpret_cast<const uint8_t*>(keyData.firstPrimeInfo().primeFactor.data()), keyData.firstPrimeInfo().primeFactor.size(),
     142        reinterpret_cast<const uint8_t*>(keyData.secondPrimeInfo().primeFactor.data()), keyData.secondPrimeInfo().primeFactor.size(),
    143143        &cryptor);
    144144
  • trunk/Source/WebCore/platform/audio/mac/FFTFrameMac.cpp

    r172431 r221152  
    130130void FFTFrame::doFFT(const float* data)
    131131{
    132     vDSP_ctoz((DSPComplex*)data, 2, &m_frame, 1, m_FFTSize / 2);
     132    vDSP_ctoz(reinterpret_cast<const DSPComplex*>(data), 2, &m_frame, 1, m_FFTSize / 2);
    133133    vDSP_fft_zrip(m_FFTSetup, &m_frame, 1, m_log2FFTSize, FFT_FORWARD);
    134134}
  • trunk/Source/WebCore/platform/graphics/FontPlatformData.h

    r219055 r221152  
    276276};
    277277
    278 #if USE(APPKIT)
     278#if USE(APPKIT) && defined(__OBJC__)
    279279
    280280// NSFonts and CTFontRefs are toll-free-bridged.
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r220979 r221152  
    18441844
    18451845        RefPtr<Uint8Array> initData = Uint8Array::create(utf8EncodedKeyId.length());
    1846         initData->setRange((JSC::Uint8Adaptor::Type*)utf8EncodedKeyId.data(), utf8EncodedKeyId.length(), 0);
     1846        initData->setRange(reinterpret_cast<const JSC::Uint8Adaptor::Type*>(utf8EncodedKeyId.data()), utf8EncodedKeyId.length(), 0);
    18471847
    18481848        auto keyData = player()->cachedKeyForKeyId(keyID);
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm

    r221098 r221152  
    116116static void CMTimebaseEffectiveRateChangedCallback(CMNotificationCenterRef, const void *listener, CFStringRef, const void *, CFTypeRef)
    117117{
    118     MediaPlayerPrivateMediaSourceAVFObjC* player = (MediaPlayerPrivateMediaSourceAVFObjC*)listener;
     118    MediaPlayerPrivateMediaSourceAVFObjC* player = (MediaPlayerPrivateMediaSourceAVFObjC*)const_cast<void*>(listener);
    119119    callOnMainThread([weakThis = player->createWeakPtr()] {
    120120        if (!weakThis)
  • trunk/Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm

    r215450 r221152  
    185185    // Length needs to account for the null terminator.
    186186    signedPublicKeyAndChallenge.publicKeyAndChallenge.challenge.Length = challenge.length() + 1;
    187     signedPublicKeyAndChallenge.publicKeyAndChallenge.challenge.Data = (uint8_t*)challenge.data();
     187    signedPublicKeyAndChallenge.publicKeyAndChallenge.challenge.Data = reinterpret_cast<uint8_t*>(const_cast<char*>(challenge.data()));
    188188
    189189    CSSM_DATA encodedPublicKeyAndChallenge { 0, nullptr };
  • trunk/Source/WebCore/style/RenderTreeUpdater.cpp

    r220956 r221152  
    359359        if (element.shouldMoveToFlowThread(style))
    360360            return RenderTreePosition::insertionPositionForFlowThread(renderTreePosition().parent().element(), element, style);
     361#else
     362        UNUSED_PARAM(style);
    361363#endif
    362364        renderTreePosition().computeNextSibling(element);
  • trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp

    r219191 r221152  
    318318    xmlChar* origMethod = sheet->method;
    319319    if (!origMethod && mimeType == "text/html")
    320         sheet->method = (xmlChar*)"html";
     320        sheet->method = reinterpret_cast<xmlChar*>(const_cast<char*>("html"));
    321321
    322322    bool success = false;
     
    362362        if ((success = saveResultToString(resultDoc, sheet, resultString))) {
    363363            mimeType = resultMIMEType(resultDoc, sheet);
    364             resultEncoding = (char*)resultDoc->encoding;
     364            resultEncoding = reinterpret_cast<const char*>(resultDoc->encoding);
    365365        }
    366366        xmlFreeDoc(resultDoc);
  • trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp

    r219237 r221152  
    549549    parser->instate = XML_PARSER_CONTENT; // We are parsing a CONTENT
    550550    parser->depth = 0;
    551     parser->str_xml = xmlDictLookup(parser->dict, BAD_CAST "xml", 3);
    552     parser->str_xmlns = xmlDictLookup(parser->dict, BAD_CAST "xmlns", 5);
     551    parser->str_xml = xmlDictLookup(parser->dict, reinterpret_cast<xmlChar*>(const_cast<char*>("xml")), 3);
     552    parser->str_xmlns = xmlDictLookup(parser->dict, reinterpret_cast<xmlChar*>(const_cast<char*>("xmlns")), 5);
    553553    parser->str_xml_ns = xmlDictLookup(parser->dict, XML_XML_NAMESPACE, 36);
    554554    parser->_private = userData;
Note: See TracChangeset for help on using the changeset viewer.