[Win][Clang] Fix compilation warnings under Source/WebCore/platform/win
authorHironori.Fujii@sony.com <Hironori.Fujii@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2018 08:09:53 +0000 (08:09 +0000)
committerHironori.Fujii@sony.com <Hironori.Fujii@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2018 08:09:53 +0000 (08:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192693

Reviewed by Ross Kirsling.

No new tests, no behavior changes.

* platform/win/ClipboardUtilitiesWin.cpp: Reordered ClipboardDataItem members to match with the initializer list.
* platform/win/CursorWin.cpp:
(WebCore::loadCursorByName): Changed the argument type of 'name' to const char*.
* platform/win/DefWndProcWindowClass.cpp:
(WebCore::defWndProcWindowClassName): Removed an unused variable 'atom'.
* platform/win/DragImageWin.cpp: Removed an unused variable 'MinDragLabelWidthBeforeClip'.
* platform/win/PasteboardWin.cpp:
(WebCore::createGlobalImageFileDescriptor): Removed an unused variable 'hr'.
(WebCore::createGlobalHDropContent): Use reinterpret_cast to suppress warning.
* platform/win/PlatformMouseEventWin.cpp:
(WebCore::PlatformMouseEvent::PlatformMouseEvent): Reordered the initializer list.
* platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenuWin::paint): Removed an unused variable 'itemCount'.
* platform/win/PopupMenuWin.h: Marked override methods with 'override'.
* platform/win/SSLKeyGeneratorWin.cpp:
(WebCore::getSupportedKeySizes): Removed WebCore namespace prefix in WebCore namespace.
(WebCore::signedPublicKeyAndChallengeString): Ditto.
* platform/win/SearchPopupMenuDB.cpp:
(WebCore::SearchPopupMenuDB::createPreparedStatement): Use ASSERT_UNUSED instead of ASSERT.
* platform/win/StructuredExceptionHandlerSuppressor.h: Enclosed m_savedExceptionRegistration with #if defined(_M_IX86).
* platform/win/SystemInfo.cpp:
(WebCore::osVersionForUAString): Added default case.

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

13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp
Source/WebCore/platform/win/CursorWin.cpp
Source/WebCore/platform/win/DefWndProcWindowClass.cpp
Source/WebCore/platform/win/DragImageWin.cpp
Source/WebCore/platform/win/PasteboardWin.cpp
Source/WebCore/platform/win/PlatformMouseEventWin.cpp
Source/WebCore/platform/win/PopupMenuWin.cpp
Source/WebCore/platform/win/PopupMenuWin.h
Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp
Source/WebCore/platform/win/SearchPopupMenuDB.cpp
Source/WebCore/platform/win/StructuredExceptionHandlerSuppressor.h
Source/WebCore/platform/win/SystemInfo.cpp

index 4c6c381..955671a 100644 (file)
@@ -1,3 +1,35 @@
+2018-12-14  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        [Win][Clang] Fix compilation warnings under Source/WebCore/platform/win
+        https://bugs.webkit.org/show_bug.cgi?id=192693
+
+        Reviewed by Ross Kirsling.
+
+        No new tests, no behavior changes.
+
+        * platform/win/ClipboardUtilitiesWin.cpp: Reordered ClipboardDataItem members to match with the initializer list.
+        * platform/win/CursorWin.cpp:
+        (WebCore::loadCursorByName): Changed the argument type of 'name' to const char*.
+        * platform/win/DefWndProcWindowClass.cpp:
+        (WebCore::defWndProcWindowClassName): Removed an unused variable 'atom'.
+        * platform/win/DragImageWin.cpp: Removed an unused variable 'MinDragLabelWidthBeforeClip'.
+        * platform/win/PasteboardWin.cpp:
+        (WebCore::createGlobalImageFileDescriptor): Removed an unused variable 'hr'.
+        (WebCore::createGlobalHDropContent): Use reinterpret_cast to suppress warning.
+        * platform/win/PlatformMouseEventWin.cpp:
+        (WebCore::PlatformMouseEvent::PlatformMouseEvent): Reordered the initializer list.
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::PopupMenuWin::paint): Removed an unused variable 'itemCount'.
+        * platform/win/PopupMenuWin.h: Marked override methods with 'override'.
+        * platform/win/SSLKeyGeneratorWin.cpp:
+        (WebCore::getSupportedKeySizes): Removed WebCore namespace prefix in WebCore namespace.
+        (WebCore::signedPublicKeyAndChallengeString): Ditto.
+        * platform/win/SearchPopupMenuDB.cpp:
+        (WebCore::SearchPopupMenuDB::createPreparedStatement): Use ASSERT_UNUSED instead of ASSERT.
+        * platform/win/StructuredExceptionHandlerSuppressor.h: Enclosed m_savedExceptionRegistration with #if defined(_M_IX86).
+        * platform/win/SystemInfo.cpp:
+        (WebCore::osVersionForUAString): Added default case.
+
 2018-12-13  Youenn Fablet  <youenn@apple.com>
 
         RTCRtpTransceiver.stopped should be true when applying a remote description with the corresponding m section rejected
index 4c52bc0..0e4080b 100644 (file)
@@ -695,9 +695,9 @@ typedef void (*GetStringFunction)(IDataObject*, FORMATETC*, Vector<String>&);
 typedef void (*SetStringFunction)(IDataObject*, FORMATETC*, const Vector<String>&);
 
 struct ClipboardDataItem {
+    FORMATETC* format;
     GetStringFunction getString;
     SetStringFunction setString;
-    FORMATETC* format;
 
     ClipboardDataItem(FORMATETC* format, GetStringFunction getString, SetStringFunction setString): format(format), getString(getString), setString(setString) { }
 };
index d5c1f3f..f52ba20 100644 (file)
@@ -126,7 +126,7 @@ static Ref<SharedCursor> loadSharedCursor(HINSTANCE hInstance, LPCWSTR lpCursorN
     return SharedCursor::create(::LoadCursorW(hInstance, lpCursorName));
 }
 
-static Ref<SharedCursor> loadCursorByName(char* name, int x, int y)
+static Ref<SharedCursor> loadCursorByName(const char* name, int x, int y)
 {
     IntPoint hotSpot(x, y);
     RefPtr<Image> cursorImage(Image::loadPlatformResource(name));
index faeb669..b8de42c 100644 (file)
@@ -45,7 +45,7 @@ static ATOM registerClass()
 
 const wchar_t* defWndProcWindowClassName()
 {
-    static ATOM atom = registerClass();
+    registerClass();
     return className;
 }
 
index 8363e17..1255480 100644 (file)
@@ -96,7 +96,6 @@ const float DragLabelBorderY = 2;
 const float DragLabelRadius = 5;
 const float LabelBorderYOffset = 2;
 
-const float MinDragLabelWidthBeforeClip = 120;
 const float MaxDragLabelWidth = 200;
 const float MaxDragLabelStringWidth = (MaxDragLabelWidth - 2 * DragLabelBorderX);
 
index f4565ce..a5fd930 100644 (file)
@@ -888,7 +888,6 @@ static HGLOBAL createGlobalImageFileDescriptor(const String& url, const String&
     ASSERT_ARG(image, image);
     ASSERT(image->image()->data());
 
-    HRESULT hr = S_OK;
     String fsPath;
     HGLOBAL memObj = GlobalAlloc(GPTR, sizeof(FILEGROUPDESCRIPTOR));
     if (!memObj)
@@ -1015,7 +1014,7 @@ static HGLOBAL createGlobalHDropContent(const URL& url, String& fileName, Shared
 
     dropFiles->pFiles = sizeof(DROPFILES);
     dropFiles->fWide = TRUE;
-    wcscpy((LPWSTR)(dropFiles + 1), filePath);    
+    wcscpy(reinterpret_cast<LPWSTR>(dropFiles + 1), filePath);
     GlobalUnlock(memObj);
 
     return memObj;
index a50b420..f8b12d2 100644 (file)
@@ -84,8 +84,8 @@ PlatformMouseEvent::PlatformMouseEvent(HWND hWnd, UINT message, WPARAM wParam, L
     , m_position(positionForEvent(hWnd, lParam))
     , m_globalPosition(globalPositionForEvent(hWnd, lParam))
     , m_clickCount(0)
-    , m_didActivateWebView(didActivateWebView)
     , m_modifierFlags(wParam)
+    , m_didActivateWebView(didActivateWebView)
 {
     switch (message) {
         case WM_LBUTTONDOWN:
index 35bc4e7..522a340 100644 (file)
@@ -609,9 +609,7 @@ void PopupMenuWin::paint(const IntRect& damageRect, HDC hdc)
 
     GraphicsContext context(m_DC.get());
 
-    int itemCount = client()->listSize();
-
-    // listRect is the damageRect translated into the coordinates of the entire menu list (which is itemCount * m_itemHeight pixels tall)
+    // listRect is the damageRect translated into the coordinates of the entire menu list (which is listSize * m_itemHeight pixels tall)
     IntRect listRect = damageRect;
     listRect.move(IntSize(0, m_scrollOffset * m_itemHeight));
 
@@ -823,8 +821,6 @@ LRESULT CALLBACK PopupMenuWin::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM
     return ::DefWindowProc(hWnd, message, wParam, lParam);
 }
 
-const int smoothScrollAnimationDuration = 5000;
-
 LRESULT PopupMenuWin::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
     LRESULT lResult = 0;
index efd8ff8..363a0a3 100644 (file)
@@ -42,10 +42,10 @@ public:
     PopupMenuWin(PopupMenuClient*);
     ~PopupMenuWin();
 
-    virtual void show(const IntRect&, FrameView*, int index);
-    virtual void hide();
-    virtual void updateFromElement();
-    virtual void disconnectClient();
+    void show(const IntRect&, FrameView*, int index) override;
+    void hide() override;
+    void updateFromElement() override;
+    void disconnectClient() override;
 
     static LPCWSTR popupClassName();
 
index df35353..fd6806e 100644 (file)
 
 namespace WebCore {
 
-void WebCore::getSupportedKeySizes(Vector<String>& v)
+void getSupportedKeySizes(Vector<String>& v)
 {
     // FIXME: Strings should be localizable.
     v.append("High Grade");
 }
 
-String WebCore::signedPublicKeyAndChallengeString(unsigned index, const String& challenge, const URL& url)
+String signedPublicKeyAndChallengeString(unsigned index, const String& challenge, const URL& url)
 {
     String keyString;
 
@@ -62,7 +62,6 @@ String WebCore::signedPublicKeyAndChallengeString(unsigned index, const String&
 
         CERT_KEYGEN_REQUEST_INFO requestInfo { };
         requestInfo.dwVersion = CERT_KEYGEN_REQUEST_V1;
-        requestInfo.pwszChallengeString = L"";
         requestInfo.SubjectPublicKeyInfo = *pPubInfo;
 
         String localChallenge = challenge;
@@ -72,7 +71,7 @@ String WebCore::signedPublicKeyAndChallengeString(unsigned index, const String&
         requestInfo.pwszChallengeString = const_cast<wchar_t*>(localChallengeWide.data());
 
         CRYPT_ALGORITHM_IDENTIFIER signAlgo { };
-        signAlgo.pszObjId = szOID_RSA_SHA1RSA;
+        signAlgo.pszObjId = const_cast<char*>(szOID_RSA_SHA1RSA);
 
         DWORD dwEncodedLength;
         if (!CryptSignAndEncodeCertificate(hContext, AT_KEYEXCHANGE, X509_ASN_ENCODING, X509_KEYGEN_REQUEST_TO_BE_SIGNED, &requestInfo, &signAlgo, 0, 0, &dwEncodedLength))
index 1b8a4b8..9e6e4c5 100644 (file)
@@ -284,7 +284,7 @@ std::unique_ptr<SQLiteStatement> SearchPopupMenuDB::createPreparedStatement(cons
 {
     auto statement = std::make_unique<SQLiteStatement>(m_database, sql);
     int ret = statement->prepare();
-    ASSERT(ret == SQLITE_OK);
+    ASSERT_UNUSED(ret, ret == SQLITE_OK);
     return statement;
 }
 
index 19168dd..1b8c0c0 100644 (file)
@@ -45,7 +45,9 @@ public:
     ~StructuredExceptionHandlerSuppressor();
 
 private:
+#if defined(_M_IX86)
     void* m_savedExceptionRegistration;
+#endif
 };
 
 } // namespace WebCore
index 44398e5..70f6c1d 100644 (file)
@@ -97,6 +97,8 @@ static String osVersionForUAString()
         return "Windows 98; Win 9x 4.90";
     case WindowsNT4:
         return "WinNT4.0";
+    default:
+        break;
     }
 
     const char* familyName = (version >= WindowsNT3) ? "Windows NT " : "Windows CE ";