Title: [239487] trunk/Tools
Revision
239487
Author
hironori.fu...@sony.com
Date
2018-12-20 18:21:22 -0800 (Thu, 20 Dec 2018)

Log Message

[Win][Clang] Fix compilation warnings of DumpRenderTree
https://bugs.webkit.org/show_bug.cgi?id=192924

Reviewed by Alex Christensen.

* DumpRenderTree/AccessibilityController.h: Added member variable initializations in the class definition.
* DumpRenderTree/win/AccessibilityControllerWin.cpp:
(AccessibilityController::AccessibilityController): Moved member variable initializations to the class definition.
* DumpRenderTree/win/DumpRenderTree.cpp:
(dumpHistoryItem): String literals can't be converted non-const type. Use auto for them.
(resetWebPreferencesToConsistentValues): Pass a temporal _bstr_t
object to the argument of setDefaultTextEncodingName instead of a
const string literal.
(createWebViewAndOffscreenWindow): Use %lx for HRESULT (aka 'long').
(main): Exit if _dup2 fails. Use %lu for'DWORD'(aka 'unsigned long').
(setCacheFolder): Deleted.
* DumpRenderTree/win/DumpRenderTreeWin.h: Fix class/struct mismatch of FrameLoadDelegate and PolicyDelegate declarations.
* DumpRenderTree/win/EditingDelegate.cpp:
(dump): Use %d for int.
* DumpRenderTree/win/FrameLoadDelegate.cpp: Removed unused variable g_delegateWaitingOnTimer.
* DumpRenderTree/win/ResourceLoadDelegate.cpp:
(BSTRFromString): Deleted unused function.
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::setDatabaseQuota): Pass a temporal _bstr_t object to
the arguemnt of setQuota instead of const string literal.
* DumpRenderTree/win/WorkQueueItemWin.cpp:
(jsStringRefToWString): Deleted unused function.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (239486 => 239487)


--- trunk/Tools/ChangeLog	2018-12-21 02:17:19 UTC (rev 239486)
+++ trunk/Tools/ChangeLog	2018-12-21 02:21:22 UTC (rev 239487)
@@ -1,3 +1,33 @@
+2018-12-20  Fujii Hironori  <hironori.fu...@sony.com>
+
+        [Win][Clang] Fix compilation warnings of DumpRenderTree
+        https://bugs.webkit.org/show_bug.cgi?id=192924
+
+        Reviewed by Alex Christensen.
+
+        * DumpRenderTree/AccessibilityController.h: Added member variable initializations in the class definition.
+        * DumpRenderTree/win/AccessibilityControllerWin.cpp:
+        (AccessibilityController::AccessibilityController): Moved member variable initializations to the class definition.
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (dumpHistoryItem): String literals can't be converted non-const type. Use auto for them.
+        (resetWebPreferencesToConsistentValues): Pass a temporal _bstr_t
+        object to the argument of setDefaultTextEncodingName instead of a
+        const string literal.
+        (createWebViewAndOffscreenWindow): Use %lx for HRESULT (aka 'long').
+        (main): Exit if _dup2 fails. Use %lu for'DWORD'(aka 'unsigned long').
+        (setCacheFolder): Deleted.
+        * DumpRenderTree/win/DumpRenderTreeWin.h: Fix class/struct mismatch of FrameLoadDelegate and PolicyDelegate declarations.
+        * DumpRenderTree/win/EditingDelegate.cpp:
+        (dump): Use %d for int.
+        * DumpRenderTree/win/FrameLoadDelegate.cpp: Removed unused variable g_delegateWaitingOnTimer.
+        * DumpRenderTree/win/ResourceLoadDelegate.cpp:
+        (BSTRFromString): Deleted unused function.
+        * DumpRenderTree/win/TestRunnerWin.cpp:
+        (TestRunner::setDatabaseQuota): Pass a temporal _bstr_t object to
+        the arguemnt of setQuota instead of const string literal.
+        * DumpRenderTree/win/WorkQueueItemWin.cpp:
+        (jsStringRefToWString): Deleted unused function.
+
 2018-12-20  Chris Dumez  <cdu...@apple.com>
 
         Add API test coverage for customUserAgent client setting and service workers

Modified: trunk/Tools/DumpRenderTree/AccessibilityController.h (239486 => 239487)


--- trunk/Tools/DumpRenderTree/AccessibilityController.h	2018-12-21 02:17:19 UTC (rev 239486)
+++ trunk/Tools/DumpRenderTree/AccessibilityController.h	2018-12-21 02:21:22 UTC (rev 239487)
@@ -84,12 +84,12 @@
     static JSClassRef getJSClass();
 
 #if PLATFORM(WIN)
-    HWINEVENTHOOK m_focusEventHook;
-    HWINEVENTHOOK m_valueChangeEventHook;
-    HWINEVENTHOOK m_scrollingStartEventHook;
+    HWINEVENTHOOK m_focusEventHook { nullptr };
+    HWINEVENTHOOK m_valueChangeEventHook { nullptr };
+    HWINEVENTHOOK m_scrollingStartEventHook { nullptr };
 
-    HWINEVENTHOOK m_allEventsHook;
-    HWINEVENTHOOK m_notificationsEventHook;
+    HWINEVENTHOOK m_allEventsHook { nullptr };
+    HWINEVENTHOOK m_notificationsEventHook { nullptr };
     HashMap<PlatformUIElement, JSObjectRef> m_notificationListeners;
 #endif
 

Modified: trunk/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp (239486 => 239487)


--- trunk/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp	2018-12-21 02:17:19 UTC (rev 239486)
+++ trunk/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp	2018-12-21 02:21:22 UTC (rev 239487)
@@ -42,14 +42,7 @@
 #include <wtf/Assertions.h>
 #include <wtf/text/AtomicString.h>
 
-AccessibilityController::AccessibilityController()
-    : m_focusEventHook(0)
-    , m_scrollingStartEventHook(0)
-    , m_valueChangeEventHook(0)
-    , m_allEventsHook(0)
-    , m_notificationsEventHook(0)
-{
-}
+AccessibilityController::AccessibilityController() = default;
 
 AccessibilityController::~AccessibilityController()
 {

Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (239486 => 239487)


--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2018-12-21 02:17:19 UTC (rev 239486)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2018-12-21 02:21:22 UTC (rev 239487)
@@ -524,8 +524,8 @@
         return;
 
     if (wcsstr(static_cast<wchar_t*>(url), L"file:/") == static_cast<wchar_t*>(url)) {
-        static wchar_t* layoutTestsStringUnixPath = L"/LayoutTests/";
-        static wchar_t* layoutTestsStringDOSPath = L"\\LayoutTests\\";
+        auto layoutTestsStringUnixPath = L"/LayoutTests/";
+        auto layoutTestsStringDOSPath = L"\\LayoutTests\\";
         
         wchar_t* result = wcsstr(static_cast<wchar_t*>(url), layoutTestsStringUnixPath);
         if (!result)
@@ -832,7 +832,7 @@
     preferences->setDefaultFontSize(16);
     preferences->setDefaultFixedFontSize(13);
     preferences->setMinimumFontSize(0);
-    preferences->setDefaultTextEncodingName(L"ISO-8859-1");
+    preferences->setDefaultTextEncodingName(_bstr_t(L"ISO-8859-1"));
     preferences->setJavaEnabled(FALSE);
     preferences->setJavaScriptEnabled(TRUE);
     preferences->setEditableLinkBehavior(WebKitEditableLinkOnlyLiveWithShiftKey);
@@ -919,17 +919,6 @@
     }
 }
 
-static void setCacheFolder()
-{
-    String libraryPath = libraryPathForDumpRenderTree();
-
-    COMPtr<IWebCache> webCache;
-    if (SUCCEEDED(WebKitCreateInstance(CLSID_WebCache, 0, IID_IWebCache, (void**)&webCache))) {
-        _bstr_t cacheFolder = WebCore::FileSystem::pathByAppendingComponent(libraryPath, "LocalCache").utf8().data();
-        webCache->setCacheFolder(cacheFolder);
-    }
-}
-
 // Called once on DumpRenderTree startup.
 static void setDefaultsToConsistentValuesForTesting()
 {
@@ -1338,7 +1327,7 @@
     IWebView* webView = nullptr;
     HRESULT hr = WebKitCreateInstance(CLSID_WebView, 0, IID_IWebView, (void**)&webView);
     if (FAILED(hr)) {
-        fprintf(stderr, "Failed to create CLSID_WebView instance, error 0x%x\n", hr);
+        fprintf(stderr, "Failed to create CLSID_WebView instance, error 0x%lx\n", hr);
         return nullptr;
     }
 
@@ -1542,6 +1531,8 @@
     testResult = fdopen(fdStdout, "a+b");
     // Redirect stdout to stderr.
     int result = _dup2(_fileno(stderr), 1);
+    if (result)
+        return -5;
 
     // Tests involving the clipboard are flaky when running with multiple DRTs, since the clipboard is global.
     // We can fix this by assigning each DRT a separate window station (each window station has its own clipboard).
@@ -1553,14 +1544,14 @@
     auto windowsStation = ::CreateWindowStation(windowStationName.charactersWithNullTermination().data(), CWF_CREATE_ONLY, WINSTA_ALL_ACCESS, nullptr);
     if (windowsStation) {
         if (!::SetProcessWindowStation(windowsStation))
-            fprintf(stderr, "SetProcessWindowStation failed with error %d\n", ::GetLastError());
+            fprintf(stderr, "SetProcessWindowStation failed with error %lu\n", ::GetLastError());
 
         desktop = ::CreateDesktop(desktopName.charactersWithNullTermination().data(), nullptr, nullptr, 0, GENERIC_ALL, nullptr);
         if (!desktop)
-            fprintf(stderr, "Failed to create desktop with error %d\n", ::GetLastError());
+            fprintf(stderr, "Failed to create desktop with error %lu\n", ::GetLastError());
     } else {
         DWORD error = ::GetLastError();
-        fprintf(stderr, "Failed to create window station with error %d\n", error);
+        fprintf(stderr, "Failed to create window station with error %lu\n", error);
         if (error == ERROR_ACCESS_DENIED)
             fprintf(stderr, "DumpRenderTree should be run as Administrator!\n");
     }

Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTreeWin.h (239486 => 239487)


--- trunk/Tools/DumpRenderTree/win/DumpRenderTreeWin.h	2018-12-21 02:17:19 UTC (rev 239486)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTreeWin.h	2018-12-21 02:21:22 UTC (rev 239487)
@@ -32,8 +32,8 @@
 struct IWebFrame;
 struct IWebScriptWorld;
 struct IWebView;
-struct FrameLoadDelegate;
-struct PolicyDelegate;
+class FrameLoadDelegate;
+class PolicyDelegate;
 typedef const struct __CFString* CFStringRef;
 typedef struct HWND__* HWND;
 

Modified: trunk/Tools/DumpRenderTree/win/EditingDelegate.cpp (239486 => 239487)


--- trunk/Tools/DumpRenderTree/win/EditingDelegate.cpp	2018-12-21 02:17:19 UTC (rev 239486)
+++ trunk/Tools/DumpRenderTree/win/EditingDelegate.cpp	2018-12-21 02:21:22 UTC (rev 239487)
@@ -120,7 +120,7 @@
         return std::string();
 
     char buffer[1024];
-    snprintf(buffer, ARRAYSIZE(buffer), "range from %ld of %s to %ld of %s", startOffset, dumpPath(startContainer.get()).c_str(), endOffset, dumpPath(endContainer.get()).c_str());
+    snprintf(buffer, ARRAYSIZE(buffer), "range from %d of %s to %d of %s", startOffset, dumpPath(startContainer.get()).c_str(), endOffset, dumpPath(endContainer.get()).c_str());
     return buffer;
 }
 

Modified: trunk/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp (239486 => 239487)


--- trunk/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp	2018-12-21 02:17:19 UTC (rev 239486)
+++ trunk/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp	2018-12-21 02:21:22 UTC (rev 239487)
@@ -51,8 +51,6 @@
 
 using std::string;
 
-static FrameLoadDelegate* g_delegateWaitingOnTimer;
-
 string descriptionSuitableForTestResult(IWebFrame* webFrame)
 {
     COMPtr<IWebView> webView;

Modified: trunk/Tools/DumpRenderTree/win/ResourceLoadDelegate.cpp (239486 => 239487)


--- trunk/Tools/DumpRenderTree/win/ResourceLoadDelegate.cpp	2018-12-21 02:17:19 UTC (rev 239486)
+++ trunk/Tools/DumpRenderTree/win/ResourceLoadDelegate.cpp	2018-12-21 02:21:22 UTC (rev 239487)
@@ -52,14 +52,6 @@
     return ss.str();
 }
 
-static inline BSTR BSTRFromString(const string& str)
-{
-    int length = ::MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), 0, 0);
-    BSTR result = ::SysAllocStringLen(0, length);
-    ::MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), result, length);
-    return result;
-}
-
 wstring ResourceLoadDelegate::descriptionSuitableForTestResult(unsigned long identifier) const
 {
     IdentifierMap::const_iterator it = m_urlMap.find(identifier);

Modified: trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp (239486 => 239487)


--- trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2018-12-21 02:17:19 UTC (rev 239486)
+++ trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2018-12-21 02:21:22 UTC (rev 239487)
@@ -448,7 +448,7 @@
     if (FAILED(tmpDatabaseManager->sharedWebDatabaseManager(&databaseManager)))
         return;
 
-    databaseManager->setQuota(TEXT("file:///"), quota);
+    databaseManager->setQuota(_bstr_t("file:///"), quota);
 }
 
 void TestRunner::goBack()

Modified: trunk/Tools/DumpRenderTree/win/WorkQueueItemWin.cpp (239486 => 239487)


--- trunk/Tools/DumpRenderTree/win/WorkQueueItemWin.cpp	2018-12-21 02:17:19 UTC (rev 239486)
+++ trunk/Tools/DumpRenderTree/win/WorkQueueItemWin.cpp	2018-12-21 02:21:22 UTC (rev 239487)
@@ -43,16 +43,6 @@
 
 using std::wstring;
 
-static wstring jsStringRefToWString(JSStringRef jsStr)
-{
-    size_t length = JSStringGetLength(jsStr);
-    Vector<WCHAR> buffer(length + 1);
-    memcpy(buffer.data(), JSStringGetCharactersPtr(jsStr), length * sizeof(WCHAR));
-    buffer[length] = '\0';
-
-    return buffer.data();
-}
-
 bool LoadItem::invoke() const
 {
     _bstr_t targetBSTR(JSStringCopyBSTR(m_target.get()), false);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to