[Win][Clang] Fix compilation warnings WebCore/platform/graphics directory
authorHironori.Fujii@sony.com <Hironori.Fujii@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Dec 2018 05:49:32 +0000 (05:49 +0000)
committerHironori.Fujii@sony.com <Hironori.Fujii@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Dec 2018 05:49:32 +0000 (05:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192752

Reviewed by Don Olmstead.

No new tests, no behavior changes.

* platform/graphics/win/DIBPixelData.cpp:
Enclosed bitmapType and bitmapPixelsPerMeter with #ifndef NDEBUG.
* platform/graphics/win/FontPlatformDataWin.cpp:
(WebCore::FontPlatformData::openTypeTable const): Use ASSERT_UNUSED instead of ASSERT.
* platform/graphics/win/GraphicsContextWin.cpp: Removed unused variable 'deg2rad'.
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
Removed unused soft links MFCreateSampleGrabberSinkActivate, MFCreateMemoryBuffer and MFCreateSample.
(WebCore::MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation):
Reorder the initializer list.
(WebCore::MediaPlayerPrivateMediaFoundation::seek): Use ASSERT_UNUSED instead of ASSERT.
(WebCore::MediaPlayerPrivateMediaFoundation::setAllChannelVolumes): Ditto.
(WebCore::MediaPlayerPrivateMediaFoundation::createSession): Ditto.
(WebCore::MediaPlayerPrivateMediaFoundation::endSession): Ditto.
(WebCore::MediaPlayerPrivateMediaFoundation::onCreatedMediaSource): Ditto.
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame): Added default case.
* platform/graphics/win/SimpleFontDataCairoWin.cpp:
(WebCore::Font::platformBoundsForGlyph const): Use inner braces to initialize subobjects of MAT2.
* platform/graphics/win/SimpleFontDataWin.cpp: Removed unused 'cSmallCapsFontSizeMultiplier'.
(WebCore::Font::initGDIFont): Use inner braces to initialize subobjects of MAT2.
(WebCore::Font::boundsForGDIGlyph const): Ditto.
(WebCore::Font::widthForGDIGlyph const): Ditto.
* platform/graphics/win/UniscribeController.cpp:
(WebCore::UniscribeController::UniscribeController):
Reorder the initializer list.
(WebCore::UniscribeController::offsetForPosition): Use parentheses to combine && and ||.
(WebCore::UniscribeController::shapeAndPlaceItem): Removed unused 'glyphCount'.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239320 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/win/DIBPixelData.cpp
Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp
Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp
Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp
Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp
Source/WebCore/platform/graphics/win/UniscribeController.cpp

index 6ff69a5..b5a5d71 100644 (file)
@@ -1,3 +1,39 @@
+2018-12-17  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        [Win][Clang] Fix compilation warnings WebCore/platform/graphics directory
+        https://bugs.webkit.org/show_bug.cgi?id=192752
+
+        Reviewed by Don Olmstead.
+
+        No new tests, no behavior changes.
+
+        * platform/graphics/win/DIBPixelData.cpp:
+        Enclosed bitmapType and bitmapPixelsPerMeter with #ifndef NDEBUG.
+        * platform/graphics/win/FontPlatformDataWin.cpp:
+        (WebCore::FontPlatformData::openTypeTable const): Use ASSERT_UNUSED instead of ASSERT.
+        * platform/graphics/win/GraphicsContextWin.cpp: Removed unused variable 'deg2rad'.
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+        Removed unused soft links MFCreateSampleGrabberSinkActivate, MFCreateMemoryBuffer and MFCreateSample.
+        (WebCore::MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation):
+        Reorder the initializer list.
+        (WebCore::MediaPlayerPrivateMediaFoundation::seek): Use ASSERT_UNUSED instead of ASSERT.
+        (WebCore::MediaPlayerPrivateMediaFoundation::setAllChannelVolumes): Ditto.
+        (WebCore::MediaPlayerPrivateMediaFoundation::createSession): Ditto.
+        (WebCore::MediaPlayerPrivateMediaFoundation::endSession): Ditto.
+        (WebCore::MediaPlayerPrivateMediaFoundation::onCreatedMediaSource): Ditto.
+        (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame): Added default case.
+        * platform/graphics/win/SimpleFontDataCairoWin.cpp:
+        (WebCore::Font::platformBoundsForGlyph const): Use inner braces to initialize subobjects of MAT2.
+        * platform/graphics/win/SimpleFontDataWin.cpp: Removed unused 'cSmallCapsFontSizeMultiplier'.
+        (WebCore::Font::initGDIFont): Use inner braces to initialize subobjects of MAT2.
+        (WebCore::Font::boundsForGDIGlyph const): Ditto.
+        (WebCore::Font::widthForGDIGlyph const): Ditto.
+        * platform/graphics/win/UniscribeController.cpp:
+        (WebCore::UniscribeController::UniscribeController):
+        Reorder the initializer list.
+        (WebCore::UniscribeController::offsetForPosition): Use parentheses to combine && and ||.
+        (WebCore::UniscribeController::shapeAndPlaceItem): Removed unused 'glyphCount'.
+
 2018-12-17  Eric Carlson  <eric.carlson@apple.com>
 
         [MediaStream] A stream's first video frame should be rendered
index a8fac23..c0a9dfc 100644 (file)
 
 namespace WebCore {
 
+#ifndef NDEBUG
 static const WORD bitmapType = 0x4d42; // BMP format
 static const WORD bitmapPixelsPerMeter = 2834; // 72 dpi
+#endif
 
 DIBPixelData::DIBPixelData(HBITMAP bitmap)
 {
index 26c0421..223a9d3 100644 (file)
@@ -80,7 +80,7 @@ RefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const
     if (size != GDI_ERROR) {
         Vector<char> data(size);
         DWORD result = GetFontData(hdc, table, 0, (PVOID)data.data(), size);
-        ASSERT(result == size);
+        ASSERT_UNUSED(result, result == size);
         buffer = SharedBuffer::create(WTFMove(data));
     }
 
index 72b1347..75039e3 100644 (file)
@@ -186,8 +186,6 @@ void GraphicsContextPlatformPrivate::scale(const FloatSize& size)
     ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY);
 }
 
-static const double deg2rad = 0.017453292519943295769; // pi/180
-
 void GraphicsContextPlatformPrivate::rotate(float degreesAngle)
 {
     XFORM xform = TransformationMatrix().rotate(degreesAngle);
index 1da241c..c848b61 100644 (file)
@@ -54,14 +54,11 @@ SOFT_LINK_OPTIONAL(Mf, MFCreateTopologyNode, HRESULT, STDAPICALLTYPE, (MF_TOPOLO
 SOFT_LINK_OPTIONAL(Mf, MFGetService, HRESULT, STDAPICALLTYPE, (IUnknown*, REFGUID, REFIID, LPVOID*));
 SOFT_LINK_OPTIONAL(Mf, MFCreateAudioRendererActivate, HRESULT, STDAPICALLTYPE, (IMFActivate**));
 SOFT_LINK_OPTIONAL(Mf, MFCreateVideoRendererActivate, HRESULT, STDAPICALLTYPE, (HWND, IMFActivate**));
-SOFT_LINK_OPTIONAL(Mf, MFCreateSampleGrabberSinkActivate, HRESULT, STDAPICALLTYPE, (IMFMediaType*, IMFSampleGrabberSinkCallback*, IMFActivate**));
 SOFT_LINK_OPTIONAL(Mf, MFGetSupportedMimeTypes, HRESULT, STDAPICALLTYPE, (PROPVARIANT*));
 
 SOFT_LINK_LIBRARY(Mfplat);
 SOFT_LINK_OPTIONAL(Mfplat, MFStartup, HRESULT, STDAPICALLTYPE, (ULONG, DWORD));
 SOFT_LINK_OPTIONAL(Mfplat, MFShutdown, HRESULT, STDAPICALLTYPE, ());
-SOFT_LINK_OPTIONAL(Mfplat, MFCreateMemoryBuffer, HRESULT, STDAPICALLTYPE, (DWORD, IMFMediaBuffer**));
-SOFT_LINK_OPTIONAL(Mfplat, MFCreateSample, HRESULT, STDAPICALLTYPE, (IMFSample**));
 SOFT_LINK_OPTIONAL(Mfplat, MFCreateMediaType, HRESULT, STDAPICALLTYPE, (IMFMediaType**));
 SOFT_LINK_OPTIONAL(Mfplat, MFFrameRateToAverageTimePerFrame, HRESULT, STDAPICALLTYPE, (UINT32, UINT32, UINT64*));
 
@@ -95,8 +92,8 @@ MediaPlayerPrivateMediaFoundation::MediaPlayerPrivateMediaFoundation(MediaPlayer
     , m_hasAudio(false)
     , m_hasVideo(false)
     , m_preparingToPlay(false)
-    , m_hwndVideo(nullptr)
     , m_volume(1.0)
+    , m_hwndVideo(nullptr)
     , m_networkState(MediaPlayer::Empty)
     , m_readyState(MediaPlayer::HaveNothing)
 {
@@ -253,7 +250,7 @@ void MediaPlayerPrivateMediaFoundation::seek(float time)
     propVariant.hVal.QuadPart = static_cast<__int64>(time * tenMegahertz);
     
     HRESULT hr = m_mediaSession->Start(&GUID_NULL, &propVariant);
-    ASSERT(SUCCEEDED(hr));
+    ASSERT_UNUSED(hr, SUCCEEDED(hr));
     PropVariantClear(&propVariant);
 
     m_player->timeChanged();
@@ -314,7 +311,7 @@ bool MediaPlayerPrivateMediaFoundation::setAllChannelVolumes(float volume)
 
     UINT32 channelsCount;
     HRESULT hr = audioVolume->GetChannelCount(&channelsCount);
-    ASSERT(SUCCEEDED(hr));
+    ASSERT_UNUSED(hr, SUCCEEDED(hr));
 
     Vector<float> volumes(channelsCount, volume);
     return SUCCEEDED(audioVolume->SetAllVolumes(channelsCount, volumes.data()));
@@ -426,7 +423,7 @@ bool MediaPlayerPrivateMediaFoundation::createSession()
     // Get next event.
     AsyncCallback* callback = new AsyncCallback(this, true);
     HRESULT hr = m_mediaSession->BeginGetEvent(callback, nullptr);
-    ASSERT(SUCCEEDED(hr));
+    ASSERT_UNUSED(hr, SUCCEEDED(hr));
 
     return true;
 }
@@ -459,7 +456,7 @@ bool MediaPlayerPrivateMediaFoundation::endSession()
         return false;
 
     HRESULT hr = MFShutdownPtr()();
-    ASSERT(SUCCEEDED(hr));
+    ASSERT_UNUSED(hr, SUCCEEDED(hr));
 
     return true;
 }
@@ -905,7 +902,7 @@ void MediaPlayerPrivateMediaFoundation::onCreatedMediaSource()
 
     // Set the topology on the media session.
     HRESULT hr = m_mediaSession->SetTopology(0, m_topology.get());
-    ASSERT(SUCCEEDED(hr));
+    ASSERT_UNUSED(hr, SUCCEEDED(hr));
 }
 
 void MediaPlayerPrivateMediaFoundation::onTopologySet()
@@ -2963,6 +2960,8 @@ void MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame(Web
         case D3DFMT_X8R8G8B8:
             cairoFormat = CAIRO_FORMAT_RGB24;
             break;
+        default:
+            break;
         }
 
         ASSERT(cairoFormat != CAIRO_FORMAT_INVALID);
index 2c711b8..157f80b 100644 (file)
@@ -116,7 +116,7 @@ FloatRect Font::platformBoundsForGlyph(Glyph glyph) const
     cairo_win32_scaled_font_select_font(scaledFont, dc);
 
     GLYPHMETRICS gdiMetrics;
-    static const MAT2 identity = { 0, 1,  0, 0,  0, 0,  0, 1 };
+    static const MAT2 identity = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 1 } };
     GetGlyphOutline(dc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gdiMetrics, 0, 0, &identity);
 
     cairo_win32_scaled_font_done_font(scaledFont);
index 562d2d4..143545f 100644 (file)
@@ -43,8 +43,6 @@
 
 namespace WebCore {
 
-const float cSmallCapsFontSizeMultiplier = 0.7f;
-
 static bool g_shouldApplyMacAscentHack;
 
 void Font::setShouldApplyMacAscentHack(bool b)
@@ -110,7 +108,7 @@ void Font::initGDIFont()
     m_maxCharWidth = textMetrics.tmMaxCharWidth;
     float xHeight = ascent * 0.56f; // Best guess for xHeight if no x glyph is present.
     GLYPHMETRICS gm;
-    static const MAT2 identity = { 0, 1,  0, 0,  0, 0,  0, 1 };
+    static const MAT2 identity = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 1 } };
     DWORD len = GetGlyphOutline(hdc, 'x', GGO_METRICS, &gm, 0, 0, &identity);
     if (len != GDI_ERROR && gm.gmptGlyphOrigin.y > 0)
         xHeight = gm.gmptGlyphOrigin.y;
@@ -177,7 +175,7 @@ FloatRect Font::boundsForGDIGlyph(Glyph glyph) const
     HGDIOBJ oldFont = SelectObject(hdc, m_platformData.hfont());
 
     GLYPHMETRICS gdiMetrics;
-    static const MAT2 identity = { 0, 1,  0, 0,  0, 0,  0, 1 };
+    static const MAT2 identity = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 1 } };
     GetGlyphOutline(hdc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gdiMetrics, 0, 0, &identity);
 
     SelectObject(hdc, oldFont);
@@ -193,7 +191,7 @@ float Font::widthForGDIGlyph(Glyph glyph) const
     HGDIOBJ oldFont = SelectObject(hdc, m_platformData.hfont());
 
     GLYPHMETRICS gdiMetrics;
-    static const MAT2 identity = { 0, 1,  0, 0,  0, 0,  0, 1 };
+    static const MAT2 identity = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 1 } };
     GetGlyphOutline(hdc, glyph, GGO_METRICS | GGO_GLYPH_INDEX, &gdiMetrics, 0, 0, &identity);
     float result = gdiMetrics.gmCellIncX + m_syntheticBoldOffset;
 
index 0b61626..ff37ac5 100644 (file)
@@ -50,8 +50,8 @@ UniscribeController::UniscribeController(const FontCascade* font, const TextRun&
     , m_maxGlyphBoundingBoxX(numeric_limits<float>::min())
     , m_minGlyphBoundingBoxY(numeric_limits<float>::max())
     , m_maxGlyphBoundingBoxY(numeric_limits<float>::min())
-    , m_end(run.length())
     , m_currentCharacter(0)
+    , m_end(run.length())
     , m_runWidthSoFar(0)
     , m_padding(run.expansion())
     , m_computingOffsetPosition(false)
@@ -87,7 +87,7 @@ int UniscribeController::offsetForPosition(int x, bool includePartialGlyphs)
     advance(m_run.length());
     if (m_computingOffsetPosition) {
         // The point is to the left or to the right of the entire run.
-        if (m_offsetX >= m_runWidthSoFar && m_run.ltr() || m_offsetX < 0 && m_run.rtl())
+        if ((m_offsetX >= m_runWidthSoFar && m_run.ltr()) || (m_offsetX < 0 && m_run.rtl()))
             m_offsetPosition = m_end;
     }
     m_computingOffsetPosition = false;
@@ -260,7 +260,6 @@ bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const F
     Vector<int> advances;
     offsets.resize(glyphs.size());
     advances.resize(glyphs.size());
-    int glyphCount = 0;
     HRESULT placeResult = ScriptPlace(0, fontData->scriptCache(), glyphs.data(), glyphs.size(), visualAttributes.data(),
                                       &item.a, advances.data(), offsets.data(), 0);
     if (placeResult == E_PENDING) {