Changeset 231956 in webkit


Ignore:
Timestamp:
May 18, 2018 9:08:09 AM (6 years ago)
Author:
youenn@apple.com
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:
Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r231948 r231956  
     12018-05-18  Youenn Fablet  <youenn@apple.com>
     2
     3        -Wmemset-elt-size warning in LibWebRTCSocket constructor
     4        https://bugs.webkit.org/show_bug.cgi?id=185555
     5        <rdar://problem/40217250>
     6
     7        Reviewed by Darin Adler.
     8
     9        GetOption implementation was broken in that it was not initializing properly its array of options.
     10        This patch fixes it by using an array of optional<int> which are initialized by default.
     11        When no value is set, we return the error code -1.
     12        In theory, we should go to NetworkProcess to get the actual value.
     13        Since GetOption is not used in practice, we just do this best effort implementation of storing previously set values.
     14
     15        * WebProcess/Network/webrtc/LibWebRTCSocket.cpp:
     16        (WebKit::LibWebRTCSocket::LibWebRTCSocket):
     17        (WebKit::LibWebRTCSocket::GetOption):
     18        * WebProcess/Network/webrtc/LibWebRTCSocket.h:
     19
    1202018-05-18  Antoine Quint  <graouts@apple.com>
    221
  • trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.cpp

    r231781 r231956  
    5555    , m_remoteAddress(remoteAddress)
    5656{
    57     memset(&m_options, 1, MAX_SOCKET_OPTION);
    5857}
    5958
     
    158157{
    159158    ASSERT(option < MAX_SOCKET_OPTION);
    160     int storedValue = m_options[option];
    161     if (storedValue != -1)
    162         *value = m_options[option];
    163     return 0;
     159    if (auto storedValue = m_options[option]) {
     160        *value = *storedValue;
     161        return 0;
     162    }
     163    return -1;
    164164}
    165165
  • trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h

    r229378 r231956  
    9494
    9595    static const unsigned MAX_SOCKET_OPTION { rtc::Socket::OPT_RTP_SENDTIME_EXTN_ID + 1 };
    96     int m_options[MAX_SOCKET_OPTION];
     96    std::optional<int> m_options[MAX_SOCKET_OPTION];
    9797
    9898    Deque<size_t> m_beingSentPacketSizes;
Note: See TracChangeset for help on using the changeset viewer.