[Win] Fix MSVC warning C4701: potentially uninitialized local variable 'x' used
authorHironori.Fujii@sony.com <Hironori.Fujii@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Dec 2019 01:52:02 +0000 (01:52 +0000)
committerHironori.Fujii@sony.com <Hironori.Fujii@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Dec 2019 01:52:02 +0000 (01:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=205052

Reviewed by Don Olmstead.

Source/WebCore:

* platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::setLineCap): Zero-initialize a local variable cairoCap.
(WebCore::Cairo::setLineJoin): Zero-initialize a local variable cairoJoin
* platform/network/NetworkStorageSession.cpp:
(WebCore::NetworkStorageSession::shouldBlockCookies const): Added
ASSERT_NOT_REACHED() and return false at the end of the function.

Source/WebDriver:

* Session.cpp:
(WebDriver::Session::getToplevelBrowsingContextRect):
(WebDriver::Session::computeElementLayout):
Zero-initialized local variables.

Source/WebKit:

* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
* NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor const):
* NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
(WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const):
Zero-initialized local variables.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cairo/CairoOperations.cpp
Source/WebCore/platform/network/NetworkStorageSession.cpp
Source/WebDriver/ChangeLog
Source/WebDriver/Session.cpp
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp
Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp

index e025082..7c2d81c 100644 (file)
@@ -1,3 +1,17 @@
+2019-12-10  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        [Win] Fix MSVC warning C4701: potentially uninitialized local variable 'x' used
+        https://bugs.webkit.org/show_bug.cgi?id=205052
+
+        Reviewed by Don Olmstead.
+
+        * platform/graphics/cairo/CairoOperations.cpp:
+        (WebCore::Cairo::setLineCap): Zero-initialize a local variable cairoCap.
+        (WebCore::Cairo::setLineJoin): Zero-initialize a local variable cairoJoin
+        * platform/network/NetworkStorageSession.cpp:
+        (WebCore::NetworkStorageSession::shouldBlockCookies const): Added
+        ASSERT_NOT_REACHED() and return false at the end of the function.
+
 2019-12-10  Per Arne Vollan  <pvollan@apple.com>
 
         [iOS] Calls to the device motion API should be done in the UI process
index be0c5a3..62c79f1 100644 (file)
@@ -632,7 +632,7 @@ bool ShadowState::isRequired(PlatformContextCairo& platformContext) const
 
 void setLineCap(PlatformContextCairo& platformContext, LineCap lineCap)
 {
-    cairo_line_cap_t cairoCap;
+    cairo_line_cap_t cairoCap { };
     switch (lineCap) {
     case ButtCap:
         cairoCap = CAIRO_LINE_CAP_BUTT;
@@ -657,7 +657,7 @@ void setLineDash(PlatformContextCairo& platformContext, const DashArray& dashes,
 
 void setLineJoin(PlatformContextCairo& platformContext, LineJoin lineJoin)
 {
-    cairo_line_join_t cairoJoin;
+    cairo_line_join_t cairoJoin { };
     switch (lineJoin) {
     case MiterJoin:
         cairoJoin = CAIRO_LINE_JOIN_MITER;
index 93f254e..515dbf1 100644 (file)
@@ -123,6 +123,8 @@ bool NetworkStorageSession::shouldBlockCookies(const URL& firstPartyForCookies,
     case ThirdPartyCookieBlockingMode::OnlyAccordingToPerDomainPolicy:
         return shouldBlockThirdPartyCookies(resourceDomain);
     }
+    ASSERT_NOT_REACHED();
+    return false;
 }
 
 Optional<Seconds> NetworkStorageSession::maxAgeCacheCap(const ResourceRequest& request)
index 4defd70..27af852 100644 (file)
@@ -1,3 +1,15 @@
+2019-12-10  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        [Win] Fix MSVC warning C4701: potentially uninitialized local variable 'x' used
+        https://bugs.webkit.org/show_bug.cgi?id=205052
+
+        Reviewed by Don Olmstead.
+
+        * Session.cpp:
+        (WebDriver::Session::getToplevelBrowsingContextRect):
+        (WebDriver::Session::computeElementLayout):
+        Zero-initialized local variables.
+
 2019-12-03  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         WebDriver: handle elements of type file in send keys command
index 153de80..ce724e5 100644 (file)
@@ -728,7 +728,7 @@ void Session::getToplevelBrowsingContextRect(Function<void (CommandResult&&)>&&
             return;
         }
         RefPtr<JSON::Object> windowOrigin;
-        double x, y;
+        double x = 0, y = 0;
         if (!browsingContext->getObject("windowOrigin"_s, windowOrigin)
             || !windowOrigin->getDouble("x"_s, x)
             || !windowOrigin->getDouble("y"_s, y)) {
@@ -736,7 +736,7 @@ void Session::getToplevelBrowsingContextRect(Function<void (CommandResult&&)>&&
             return;
         }
         RefPtr<JSON::Object> windowSize;
-        double width, height;
+        double width = 0, height = 0;
         if (!browsingContext->getObject("windowSize"_s, windowSize)
             || !windowSize->getDouble("width"_s, width)
             || !windowSize->getDouble("height"_s, height)) {
@@ -996,7 +996,7 @@ void Session::computeElementLayout(const String& elementID, OptionSet<ElementLay
             completionHandler(rect, WTF::nullopt, isObscured, nullptr);
             return;
         }
-        int inViewCenterPointX, inViewCenterPointY;
+        int inViewCenterPointX = 0, inViewCenterPointY = 0;
         if (!inViewCenterPointObject->getInteger("x"_s, inViewCenterPointX)
             || !inViewCenterPointObject->getInteger("y"_s, inViewCenterPointY)) {
             completionHandler(WTF::nullopt, WTF::nullopt, isObscured, nullptr);
index 4f4dbc5..63db14f 100644 (file)
@@ -1,3 +1,17 @@
+2019-12-10  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        [Win] Fix MSVC warning C4701: potentially uninitialized local variable 'x' used
+        https://bugs.webkit.org/show_bug.cgi?id=205052
+
+        Reviewed by Don Olmstead.
+
+        * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
+        * NetworkProcess/Classifier/ResourceLoadStatisticsMemoryStore.cpp:
+        (WebKit::ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor const):
+        * NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:
+        (WebKit::ResourceLoadStatisticsStore::hasStatisticsExpired const):
+        Zero-initialized local variables.
+
 2019-12-10  Per Arne Vollan  <pvollan@apple.com>
 
         [iOS] Calls to the device motion API should be done in the UI process
index 553e052..bedecb2 100644 (file)
@@ -2167,7 +2167,7 @@ bool ResourceLoadStatisticsDatabaseStore::shouldRemoveAllButCookiesFor(const Dom
     bool isRemovalEnabled = firstPartyWebsiteDataRemovalMode() != FirstPartyWebsiteDataRemovalMode::None || resourceStatistic.isScheduledForAllButCookieDataRemoval;
     bool isResourceGrandfathered = shouldCheckForGrandfathering && resourceStatistic.grandfathered;
 
-    OperatingDatesWindow window;
+    OperatingDatesWindow window { };
     switch (firstPartyWebsiteDataRemovalMode()) {
     case FirstPartyWebsiteDataRemovalMode::AllButCookies:
         FALLTHROUGH;
index 8192853..7097958 100644 (file)
@@ -888,7 +888,7 @@ bool ResourceLoadStatisticsMemoryStore::shouldRemoveAllButCookiesFor(ResourceLoa
     bool isRemovalEnabled = firstPartyWebsiteDataRemovalMode() != FirstPartyWebsiteDataRemovalMode::None || resourceStatistic.gotLinkDecorationFromPrevalentResource;
     bool isResourceGrandfathered = shouldCheckForGrandfathering && resourceStatistic.grandfathered;
     
-    OperatingDatesWindow window;
+    OperatingDatesWindow window { };
     switch (firstPartyWebsiteDataRemovalMode()) {
     case FirstPartyWebsiteDataRemovalMode::AllButCookies:
         FALLTHROUGH;
index 7846b54..01e8f79 100644 (file)
@@ -504,7 +504,7 @@ bool ResourceLoadStatisticsStore::hasStatisticsExpired(WallTime mostRecentUserIn
 {
     ASSERT(!RunLoop::isMain());
 
-    unsigned operatingDatesWindowInDays;
+    unsigned operatingDatesWindowInDays = 0;
     switch (operatingDatesWindow) {
     case OperatingDatesWindow::Long:
         operatingDatesWindowInDays = operatingDatesWindowLong;