Title: [231956] trunk/Source/WebKit
- Revision
- 231956
- Author
- [email protected]
- Date
- 2018-05-18 09:08:09 -0700 (Fri, 18 May 2018)
Log Message
-Wmemset-elt-size warning in LibWebRTCSocket constructor
https://bugs.webkit.org/show_bug.cgi?id=185555
<rdar://problem/40217250>
Reviewed by Darin Adler.
GetOption implementation was broken in that it was not initializing properly its array of options.
This patch fixes it by using an array of optional<int> which are initialized by default.
When no value is set, we return the error code -1.
In theory, we should go to NetworkProcess to get the actual value.
Since GetOption is not used in practice, we just do this best effort implementation of storing previously set values.
* WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
(WebKit::LibWebRTCSocket::LibWebRTCSocket):
(WebKit::LibWebRTCSocket::GetOption):
* WebProcess/Network/webrtc/LibWebRTCSocket.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (231955 => 231956)
--- trunk/Source/WebKit/ChangeLog 2018-05-18 15:22:55 UTC (rev 231955)
+++ trunk/Source/WebKit/ChangeLog 2018-05-18 16:08:09 UTC (rev 231956)
@@ -1,3 +1,22 @@
+2018-05-18 Youenn Fablet <[email protected]>
+
+ -Wmemset-elt-size warning in LibWebRTCSocket constructor
+ https://bugs.webkit.org/show_bug.cgi?id=185555
+ <rdar://problem/40217250>
+
+ Reviewed by Darin Adler.
+
+ GetOption implementation was broken in that it was not initializing properly its array of options.
+ This patch fixes it by using an array of optional<int> which are initialized by default.
+ When no value is set, we return the error code -1.
+ In theory, we should go to NetworkProcess to get the actual value.
+ Since GetOption is not used in practice, we just do this best effort implementation of storing previously set values.
+
+ * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
+ (WebKit::LibWebRTCSocket::LibWebRTCSocket):
+ (WebKit::LibWebRTCSocket::GetOption):
+ * WebProcess/Network/webrtc/LibWebRTCSocket.h:
+
2018-05-18 Antoine Quint <[email protected]>
[Web Animations] Turn Web Animations with CSS integration on for test runners
Modified: trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.cpp (231955 => 231956)
--- trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.cpp 2018-05-18 15:22:55 UTC (rev 231955)
+++ trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.cpp 2018-05-18 16:08:09 UTC (rev 231956)
@@ -54,7 +54,6 @@
, m_localAddress(localAddress)
, m_remoteAddress(remoteAddress)
{
- memset(&m_options, 1, MAX_SOCKET_OPTION);
}
LibWebRTCSocket::~LibWebRTCSocket()
@@ -157,10 +156,11 @@
int LibWebRTCSocket::GetOption(rtc::Socket::Option option, int* value)
{
ASSERT(option < MAX_SOCKET_OPTION);
- int storedValue = m_options[option];
- if (storedValue != -1)
- *value = m_options[option];
- return 0;
+ if (auto storedValue = m_options[option]) {
+ *value = *storedValue;
+ return 0;
+ }
+ return -1;
}
int LibWebRTCSocket::SetOption(rtc::Socket::Option option, int value)
Modified: trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h (231955 => 231956)
--- trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h 2018-05-18 15:22:55 UTC (rev 231955)
+++ trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h 2018-05-18 16:08:09 UTC (rev 231956)
@@ -93,7 +93,7 @@
State m_state { STATE_BINDING };
static const unsigned MAX_SOCKET_OPTION { rtc::Socket::OPT_RTP_SENDTIME_EXTN_ID + 1 };
- int m_options[MAX_SOCKET_OPTION];
+ std::optional<int> m_options[MAX_SOCKET_OPTION];
Deque<size_t> m_beingSentPacketSizes;
size_t m_availableSendingBytes { 65536 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes