Title: [239320] trunk/Source/WebCore
Revision
239320
Author
hironori.fu...@sony.com
Date
2018-12-17 21:49:32 -0800 (Mon, 17 Dec 2018)

Log Message

[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'.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239319 => 239320)


--- trunk/Source/WebCore/ChangeLog	2018-12-18 05:31:22 UTC (rev 239319)
+++ trunk/Source/WebCore/ChangeLog	2018-12-18 05:49:32 UTC (rev 239320)
@@ -1,3 +1,39 @@
+2018-12-17  Fujii Hironori  <hironori.fu...@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.carl...@apple.com>
 
         [MediaStream] A stream's first video frame should be rendered

Modified: trunk/Source/WebCore/platform/graphics/win/DIBPixelData.cpp (239319 => 239320)


--- trunk/Source/WebCore/platform/graphics/win/DIBPixelData.cpp	2018-12-18 05:31:22 UTC (rev 239319)
+++ trunk/Source/WebCore/platform/graphics/win/DIBPixelData.cpp	2018-12-18 05:49:32 UTC (rev 239320)
@@ -28,8 +28,10 @@
 
 namespace WebCore {
 
+#ifndef NDEBUG
 static const WORD bitmapType = 0x4d42; // BMP format
 static const WORD bitmapPixelsPerMeter = 2834; // 72 dpi
+#endif
 
 DIBPixelData::DIBPixelData(HBITMAP bitmap)
 {

Modified: trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp (239319 => 239320)


--- trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp	2018-12-18 05:31:22 UTC (rev 239319)
+++ trunk/Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp	2018-12-18 05:49:32 UTC (rev 239320)
@@ -80,7 +80,7 @@
     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));
     }
 

Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp (239319 => 239320)


--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp	2018-12-18 05:31:22 UTC (rev 239319)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextWin.cpp	2018-12-18 05:49:32 UTC (rev 239320)
@@ -186,8 +186,6 @@
     ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY);
 }
 
-static const double deg2rad = 0.017453292519943295769; // pi/180
-
 void GraphicsContextPlatformPrivate::rotate(float degreesAngle)
 {
     XFORM xform = TransformationMatrix().rotate(degreesAngle);

Modified: trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp (239319 => 239320)


--- trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp	2018-12-18 05:31:22 UTC (rev 239319)
+++ trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp	2018-12-18 05:49:32 UTC (rev 239320)
@@ -54,14 +54,11 @@
 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 @@
     , m_hasAudio(false)
     , m_hasVideo(false)
     , m_preparingToPlay(false)
+    , m_volume(1.0)
     , m_hwndVideo(nullptr)
-    , m_volume(1.0)
     , m_networkState(MediaPlayer::Empty)
     , m_readyState(MediaPlayer::HaveNothing)
 {
@@ -253,7 +250,7 @@
     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 @@
 
     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 @@
     // 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 @@
         return false;
 
     HRESULT hr = MFShutdownPtr()();
-    ASSERT(SUCCEEDED(hr));
+    ASSERT_UNUSED(hr, SUCCEEDED(hr));
 
     return true;
 }
@@ -905,7 +902,7 @@
 
     // 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 @@
         case D3DFMT_X8R8G8B8:
             cairoFormat = CAIRO_FORMAT_RGB24;
             break;
+        default:
+            break;
         }
 
         ASSERT(cairoFormat != CAIRO_FORMAT_INVALID);

Modified: trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp (239319 => 239320)


--- trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp	2018-12-18 05:31:22 UTC (rev 239319)
+++ trunk/Source/WebCore/platform/graphics/win/SimpleFontDataCairoWin.cpp	2018-12-18 05:49:32 UTC (rev 239320)
@@ -116,7 +116,7 @@
     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);

Modified: trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp (239319 => 239320)


--- trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp	2018-12-18 05:31:22 UTC (rev 239319)
+++ trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp	2018-12-18 05:49:32 UTC (rev 239320)
@@ -43,8 +43,6 @@
 
 namespace WebCore {
 
-const float cSmallCapsFontSizeMultiplier = 0.7f;
-
 static bool g_shouldApplyMacAscentHack;
 
 void Font::setShouldApplyMacAscentHack(bool b)
@@ -110,7 +108,7 @@
     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 @@
     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 @@
     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;
 

Modified: trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp (239319 => 239320)


--- trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp	2018-12-18 05:31:22 UTC (rev 239319)
+++ trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp	2018-12-18 05:49:32 UTC (rev 239320)
@@ -50,8 +50,8 @@
     , m_maxGlyphBoundingBoxX(numeric_limits<float>::min())
     , m_minGlyphBoundingBoxY(numeric_limits<float>::max())
     , m_maxGlyphBoundingBoxY(numeric_limits<float>::min())
+    , m_currentCharacter(0)
     , m_end(run.length())
-    , m_currentCharacter(0)
     , m_runWidthSoFar(0)
     , m_padding(run.expansion())
     , m_computingOffsetPosition(false)
@@ -87,7 +87,7 @@
     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 @@
     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) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to