Title: [233403] trunk/Source
Revision
233403
Author
[email protected]
Date
2018-06-30 17:06:38 -0700 (Sat, 30 Jun 2018)

Log Message

Fix clang static analyzer warnings: Garbage return value
<https://webkit.org/b/187224>

Reviewed by Eric Carlson.

Source/_javascript_Core:

* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedCodeBlock::lineNumberForBytecodeOffset):
- Use brace initialization for local variables.
* debugger/DebuggerCallFrame.cpp:
(class JSC::LineAndColumnFunctor):
- Use class member initialization for member variables.

Source/WebCore:

* platform/mediastream/MediaConstraints.h:
(WebCore::NumericConstraint::valueForCapabilityRange const):
- Use brace initialization for local variables.

Source/WebKit:

* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::changeCount):
(WebKit::WebPlatformStrategies::addTypes):
(WebKit::WebPlatformStrategies::setTypes):
(WebKit::WebPlatformStrategies::setBufferForType):
(WebKit::WebPlatformStrategies::setPathnamesForType):
(WebKit::WebPlatformStrategies::setStringForType):
(WebKit::WebPlatformStrategies::getNumberOfFiles):
(WebKit::WebPlatformStrategies::getPasteboardItemsCount):
(WebKit::WebPlatformStrategies::writeCustomData):
* WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
(WebKit::WebEditorClient::substitutionsPanelIsShowing):
- Use brace initialization for local variables.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (233402 => 233403)


--- trunk/Source/_javascript_Core/ChangeLog	2018-06-30 21:07:50 UTC (rev 233402)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-07-01 00:06:38 UTC (rev 233403)
@@ -1,3 +1,17 @@
+2018-06-30  David Kilzer  <[email protected]>
+
+        Fix clang static analyzer warnings: Garbage return value
+        <https://webkit.org/b/187224>
+
+        Reviewed by Eric Carlson.
+
+        * bytecode/UnlinkedCodeBlock.cpp:
+        (JSC::UnlinkedCodeBlock::lineNumberForBytecodeOffset):
+        - Use brace initialization for local variables.
+        * debugger/DebuggerCallFrame.cpp:
+        (class JSC::LineAndColumnFunctor):
+        - Use class member initialization for member variables.
+
 2018-06-29  Saam Barati  <[email protected]>
 
         Unreviewed. Try to fix Windows build after r233377

Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp (233402 => 233403)


--- trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp	2018-06-30 21:07:50 UTC (rev 233402)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp	2018-07-01 00:06:38 UTC (rev 233403)
@@ -118,11 +118,11 @@
 int UnlinkedCodeBlock::lineNumberForBytecodeOffset(unsigned bytecodeOffset)
 {
     ASSERT(bytecodeOffset < instructions().count());
-    int divot;
-    int startOffset;
-    int endOffset;
-    unsigned line;
-    unsigned column;
+    int divot { 0 };
+    int startOffset { 0 };
+    int endOffset { 0 };
+    unsigned line { 0 };
+    unsigned column { 0 };
     expressionRangeForBytecodeOffset(bytecodeOffset, divot, startOffset, endOffset, line, column);
     return line;
 }

Modified: trunk/Source/_javascript_Core/debugger/DebuggerCallFrame.cpp (233402 => 233403)


--- trunk/Source/_javascript_Core/debugger/DebuggerCallFrame.cpp	2018-06-30 21:07:50 UTC (rev 233402)
+++ trunk/Source/_javascript_Core/debugger/DebuggerCallFrame.cpp	2018-07-01 00:06:38 UTC (rev 233403)
@@ -57,8 +57,8 @@
     unsigned column() const { return m_column; }
 
 private:
-    mutable unsigned m_line;
-    mutable unsigned m_column;
+    mutable unsigned m_line { 0 };
+    mutable unsigned m_column { 0 };
 };
 
 Ref<DebuggerCallFrame> DebuggerCallFrame::create(VM& vm, CallFrame* callFrame)

Modified: trunk/Source/WebCore/ChangeLog (233402 => 233403)


--- trunk/Source/WebCore/ChangeLog	2018-06-30 21:07:50 UTC (rev 233402)
+++ trunk/Source/WebCore/ChangeLog	2018-07-01 00:06:38 UTC (rev 233403)
@@ -1,3 +1,14 @@
+2018-06-30  David Kilzer  <[email protected]>
+
+        Fix clang static analyzer warnings: Garbage return value
+        <https://webkit.org/b/187224>
+
+        Reviewed by Eric Carlson.
+
+        * platform/mediastream/MediaConstraints.h:
+        (WebCore::NumericConstraint::valueForCapabilityRange const):
+        - Use brace initialization for local variables.
+
 2018-06-30  Zalan Bujtas  <[email protected]>
 
         [LFC] Do not add the containing block's offset while computing the out-of-flow static position.

Modified: trunk/Source/WebCore/platform/mediastream/MediaConstraints.h (233402 => 233403)


--- trunk/Source/WebCore/platform/mediastream/MediaConstraints.h	2018-06-30 21:07:50 UTC (rev 233402)
+++ trunk/Source/WebCore/platform/mediastream/MediaConstraints.h	2018-07-01 00:06:38 UTC (rev 233403)
@@ -240,7 +240,7 @@
 
     ValueType valueForCapabilityRange(ValueType current, ValueType capabilityMin, ValueType capabilityMax) const
     {
-        ValueType value;
+        ValueType value { 0 };
         ValueType min = capabilityMin;
         ValueType max = capabilityMax;
 

Modified: trunk/Source/WebKit/ChangeLog (233402 => 233403)


--- trunk/Source/WebKit/ChangeLog	2018-06-30 21:07:50 UTC (rev 233402)
+++ trunk/Source/WebKit/ChangeLog	2018-07-01 00:06:38 UTC (rev 233403)
@@ -1,3 +1,24 @@
+2018-06-30  David Kilzer  <[email protected]>
+
+        Fix clang static analyzer warnings: Garbage return value
+        <https://webkit.org/b/187224>
+
+        Reviewed by Eric Carlson.
+
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::WebPlatformStrategies::changeCount):
+        (WebKit::WebPlatformStrategies::addTypes):
+        (WebKit::WebPlatformStrategies::setTypes):
+        (WebKit::WebPlatformStrategies::setBufferForType):
+        (WebKit::WebPlatformStrategies::setPathnamesForType):
+        (WebKit::WebPlatformStrategies::setStringForType):
+        (WebKit::WebPlatformStrategies::getNumberOfFiles):
+        (WebKit::WebPlatformStrategies::getPasteboardItemsCount):
+        (WebKit::WebPlatformStrategies::writeCustomData):
+        * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
+        (WebKit::WebEditorClient::substitutionsPanelIsShowing):
+        - Use brace initialization for local variables.
+
 2018-06-30  Michael Catanzaro  <[email protected]>
 
         Unreviewed, add missing PLATFORM(COCOA) guard after r233207

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (233402 => 233403)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2018-06-30 21:07:50 UTC (rev 233402)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2018-07-01 00:06:38 UTC (rev 233403)
@@ -182,7 +182,7 @@
 
     // Fallback to messaging the UI process for native pasteboard content.
     SharedMemory::Handle handle;
-    uint64_t size = 0;
+    uint64_t size { 0 };
     WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardBufferForType(pasteboardName, pasteboardType), Messages::WebPasteboardProxy::GetPasteboardBufferForType::Reply(handle, size), 0);
     if (handle.isNull())
         return nullptr;
@@ -211,7 +211,7 @@
 
 long WebPlatformStrategies::changeCount(const WTF::String &pasteboardName)
 {
-    uint64_t changeCount;
+    uint64_t changeCount { 0 };
     WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardChangeCount(pasteboardName), Messages::WebPasteboardProxy::GetPasteboardChangeCount::Reply(changeCount), 0);
     return changeCount;
 }
@@ -239,7 +239,7 @@
 
 long WebPlatformStrategies::addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
 {
-    uint64_t newChangeCount;
+    uint64_t newChangeCount { 0 };
     WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::AddPasteboardTypes(pasteboardName, pasteboardTypes), Messages::WebPasteboardProxy::AddPasteboardTypes::Reply(newChangeCount), 0);
     return newChangeCount;
 }
@@ -246,7 +246,7 @@
 
 long WebPlatformStrategies::setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
 {
-    uint64_t newChangeCount;
+    uint64_t newChangeCount { 0 };
     WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardTypes(pasteboardName, pasteboardTypes), Messages::WebPasteboardProxy::SetPasteboardTypes::Reply(newChangeCount), 0);
     return newChangeCount;
 }
@@ -263,7 +263,7 @@
             sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly);
         }
     }
-    uint64_t newChangeCount;
+    uint64_t newChangeCount { 0 };
     WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardBufferForType(pasteboardName, pasteboardType, handle, buffer ? buffer->size() : 0), Messages::WebPasteboardProxy::SetPasteboardBufferForType::Reply(newChangeCount), 0);
     return newChangeCount;
 }
@@ -270,7 +270,7 @@
 
 long WebPlatformStrategies::setPathnamesForType(const Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName)
 {
-    uint64_t newChangeCount;
+    uint64_t newChangeCount { 0 };
     WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardPathnamesForType(pasteboardName, pasteboardType, pathnames), Messages::WebPasteboardProxy::SetPasteboardPathnamesForType::Reply(newChangeCount), 0);
     return newChangeCount;
 }
@@ -277,7 +277,7 @@
 
 long WebPlatformStrategies::setStringForType(const String& string, const String& pasteboardType, const String& pasteboardName)
 {
-    uint64_t newChangeCount;
+    uint64_t newChangeCount { 0 };
     WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::SetPasteboardStringForType(pasteboardName, pasteboardType, string), Messages::WebPasteboardProxy::SetPasteboardStringForType::Reply(newChangeCount), 0);
     return newChangeCount;
 }
@@ -284,7 +284,7 @@
 
 int WebPlatformStrategies::getNumberOfFiles(const String& pasteboardName)
 {
-    uint64_t numberOfFiles;
+    uint64_t numberOfFiles { 0 };
     WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetNumberOfFiles(pasteboardName), Messages::WebPasteboardProxy::GetNumberOfFiles::Reply(numberOfFiles), 0);
     return numberOfFiles;
 }
@@ -317,7 +317,7 @@
 
 int WebPlatformStrategies::getPasteboardItemsCount(const String& pasteboardName)
 {
-    uint64_t itemsCount;
+    uint64_t itemsCount { 0 };
     WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::GetPasteboardItemsCount(pasteboardName), Messages::WebPasteboardProxy::GetPasteboardItemsCount::Reply(itemsCount), 0);
     return itemsCount;
 }
@@ -344,7 +344,7 @@
 RefPtr<WebCore::SharedBuffer> WebPlatformStrategies::readBufferFromPasteboard(int index, const String& pasteboardType, const String& pasteboardName)
 {
     SharedMemory::Handle handle;
-    uint64_t size = 0;
+    uint64_t size { 0 };
     WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::ReadBufferFromPasteboard(index, pasteboardType, pasteboardName), Messages::WebPasteboardProxy::ReadBufferFromPasteboard::Reply(handle, size), 0);
     if (handle.isNull())
         return nullptr;
@@ -423,7 +423,7 @@
 
 long WebPlatformStrategies::writeCustomData(const WebCore::PasteboardCustomData& data, const String& pasteboardName)
 {
-    uint64_t newChangeCount;
+    uint64_t newChangeCount { 0 };
     WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebPasteboardProxy::WriteCustomData(data, pasteboardName), Messages::WebPasteboardProxy::WriteCustomData::Reply(newChangeCount), 0);
     return newChangeCount;
 }

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm (233402 => 233403)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm	2018-06-30 21:07:50 UTC (rev 233402)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm	2018-07-01 00:06:38 UTC (rev 233403)
@@ -100,7 +100,7 @@
 
 bool WebEditorClient::substitutionsPanelIsShowing()
 {
-    bool isShowing;
+    bool isShowing { false };
     m_page->sendSync(Messages::WebPageProxy::SubstitutionsPanelIsShowing(), Messages::WebPageProxy::SubstitutionsPanelIsShowing::Reply(isShowing));
     return isShowing;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to