From dae612ebf8044be2eccda45053805cc7289f8106 Mon Sep 17 00:00:00 2001 From: "henrikg@webrtc.org" Date: Tue, 16 Sep 2014 15:29:02 +0000 Subject: [PATCH] Mark all virtual overrides in the hierarchies of UdpTransportData and UdpSocketWrapper as such. This will make further changes to these classes safer by ensuring that the compile breaks if the base class changes and not all overrides are fixed. This also removes an unused function. BUG=none TEST=none R=henrik.lundin@webrtc.org, henrikg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/23579004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7195 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../test/BWEStandAlone/BWEStandAlone.cc | 12 ++--- .../test/BWEStandAlone/TestSenderReceiver.h | 45 ++++++++++--------- .../test/channel_transport/udp_socket2_win.h | 31 ++++++------- .../channel_transport/udp_socket_posix.cc | 11 ++--- .../test/channel_transport/udp_socket_posix.h | 4 +- .../channel_transport/udp_transport_impl.h | 4 +- 6 files changed, 52 insertions(+), 55 deletions(-) diff --git a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/BWEStandAlone.cc b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/BWEStandAlone.cc index 71809755c0..9e706e7dd5 100644 --- a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/BWEStandAlone.cc +++ b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/BWEStandAlone.cc @@ -33,14 +33,14 @@ public: protected: // Inherited from UdpTransportData virtual void IncomingRTPPacket(const int8_t* incomingRtpPacket, - const int32_t rtpPacketLength, - const int8_t* fromIP, - const uint16_t fromPort); + const int32_t rtpPacketLength, + const int8_t* fromIP, + const uint16_t fromPort) OVERRIDE; virtual void IncomingRTCPPacket(const int8_t* incomingRtcpPacket, - const int32_t rtcpPacketLength, - const int8_t* fromIP, - const uint16_t fromPort); + const int32_t rtcpPacketLength, + const int8_t* fromIP, + const uint16_t fromPort) OVERRIDE; private: RtpRtcp *_rtpMod; diff --git a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h index 6edb380ed3..ade827e2fc 100644 --- a/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h +++ b/webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestSenderReceiver.h @@ -71,12 +71,15 @@ public: bool timeOutTriggered () { return (_timeOut); }; // Inherited from RtpFeedback - virtual int32_t OnInitializeDecoder(const int32_t id, - const int8_t payloadType, - const int8_t payloadName[RTP_PAYLOAD_NAME_SIZE], - const uint32_t frequency, - const uint8_t channels, - const uint32_t rate) { return(0);}; + virtual int32_t OnInitializeDecoder( + const int32_t id, + const int8_t payloadType, + const int8_t payloadName[RTP_PAYLOAD_NAME_SIZE], + const uint32_t frequency, + const uint8_t channels, + const uint32_t rate) OVERRIDE { + return 0; + } virtual void OnPacketTimeout(const int32_t id); @@ -86,31 +89,31 @@ public: virtual void OnPeriodicDeadOrAlive(const int32_t id, const RTPAliveType alive) {}; - virtual void OnIncomingSSRCChanged( const int32_t id, - const uint32_t SSRC) {}; + virtual void OnIncomingSSRCChanged(const int32_t id, + const uint32_t SSRC) OVERRIDE {} - virtual void OnIncomingCSRCChanged( const int32_t id, - const uint32_t CSRC, - const bool added) {}; + virtual void OnIncomingCSRCChanged(const int32_t id, + const uint32_t CSRC, + const bool added) OVERRIDE {} // Inherited from RtpData - - virtual int32_t OnReceivedPayloadData(const uint8_t* payloadData, - const uint16_t payloadSize, - const webrtc::WebRtcRTPHeader* rtpHeader); + virtual int32_t OnReceivedPayloadData( + const uint8_t* payloadData, + const uint16_t payloadSize, + const webrtc::WebRtcRTPHeader* rtpHeader) OVERRIDE; // Inherited from UdpTransportData virtual void IncomingRTPPacket(const int8_t* incomingRtpPacket, - const int32_t rtpPacketLength, - const int8_t* fromIP, - const uint16_t fromPort); + const int32_t rtpPacketLength, + const int8_t* fromIP, + const uint16_t fromPort) OVERRIDE; virtual void IncomingRTCPPacket(const int8_t* incomingRtcpPacket, - const int32_t rtcpPacketLength, - const int8_t* fromIP, - const uint16_t fromPort); + const int32_t rtcpPacketLength, + const int8_t* fromIP, + const uint16_t fromPort) OVERRIDE; diff --git a/webrtc/test/channel_transport/udp_socket2_win.h b/webrtc/test/channel_transport/udp_socket2_win.h index e4d6b8c23f..629c9c36d7 100644 --- a/webrtc/test/channel_transport/udp_socket2_win.h +++ b/webrtc/test/channel_transport/udp_socket2_win.h @@ -42,36 +42,37 @@ public: bool ipV6Enable = false, bool disableGQOS = false); virtual ~UdpSocket2Windows(); - virtual int32_t ChangeUniqueId(const int32_t id); + virtual int32_t ChangeUniqueId(const int32_t id) OVERRIDE; - virtual bool ValidHandle(); + virtual bool ValidHandle() OVERRIDE; - virtual bool SetCallback(CallbackObj, IncomingSocketCallback); + virtual bool SetCallback(CallbackObj, IncomingSocketCallback) OVERRIDE; - virtual bool Bind(const SocketAddress& name); + virtual bool Bind(const SocketAddress& name) OVERRIDE; virtual bool SetSockopt(int32_t level, int32_t optname, - const int8_t* optval, int32_t optlen); + const int8_t* optval, int32_t optlen) OVERRIDE; - virtual bool StartReceiving(const uint32_t receiveBuffers); - virtual inline bool StartReceiving() {return StartReceiving(8);} - virtual bool StopReceiving(); + virtual bool StartReceiving(const uint32_t receiveBuffers) OVERRIDE; + virtual inline bool StartReceiving() OVERRIDE {return StartReceiving(8);} + virtual bool StopReceiving() OVERRIDE; virtual int32_t SendTo(const int8_t* buf, int32_t len, - const SocketAddress& to); + const SocketAddress& to) OVERRIDE; - virtual void CloseBlocking(); + virtual void CloseBlocking() OVERRIDE; + + SOCKET GetFd() { return _socket;} - virtual SOCKET GetFd() { return _socket;} virtual bool SetQos(int32_t serviceType, int32_t tokenRate, int32_t bucketSize, int32_t peekBandwith, int32_t minPolicedSize, int32_t maxSduSize, const SocketAddress &stRemName, - int32_t overrideDSCP = 0); + int32_t overrideDSCP = 0) OVERRIDE; - virtual int32_t SetTOS(const int32_t serviceType); - virtual int32_t SetPCP(const int32_t pcp); + virtual int32_t SetTOS(const int32_t serviceType) OVERRIDE; + virtual int32_t SetPCP(const int32_t pcp) OVERRIDE; - virtual uint32_t ReceiveBuffers(){return _receiveBuffers.Value();} + virtual uint32_t ReceiveBuffers() OVERRIDE {return _receiveBuffers.Value();} protected: void IOCompleted(PerIoContext* pIOContext, uint32_t ioSize, uint32_t error); diff --git a/webrtc/test/channel_transport/udp_socket_posix.cc b/webrtc/test/channel_transport/udp_socket_posix.cc index 6fc9441d51..355da536f9 100644 --- a/webrtc/test/channel_transport/udp_socket_posix.cc +++ b/webrtc/test/channel_transport/udp_socket_posix.cc @@ -33,7 +33,6 @@ UdpSocketPosix::UdpSocketPosix(const int32_t id, UdpSocketManager* mgr, "UdpSocketPosix::UdpSocketPosix()"); _wantsIncoming = false; - _error = 0; _mgr = mgr; _id = id; @@ -129,9 +128,8 @@ bool UdpSocketPosix::SetSockopt(int32_t level, int32_t optname, return true; } - _error = errno; WEBRTC_TRACE(kTraceError, kTraceTransport, _id, - "UdpSocketPosix::SetSockopt(), error:%d", _error); + "UdpSocketPosix::SetSockopt(), error:%d", errno); return false; } @@ -151,9 +149,8 @@ bool UdpSocketPosix::Bind(const SocketAddress& name) { return true; } - _error = errno; WEBRTC_TRACE(kTraceError, kTraceTransport, _id, - "UdpSocketPosix::Bind() error: %d",_error); + "UdpSocketPosix::Bind() error: %d", errno); return false; } @@ -165,16 +162,14 @@ int32_t UdpSocketPosix::SendTo(const int8_t* buf, int32_t len, reinterpret_cast(&to), size); if(retVal == SOCKET_ERROR) { - _error = errno; WEBRTC_TRACE(kTraceError, kTraceTransport, _id, - "UdpSocketPosix::SendTo() error: %d", _error); + "UdpSocketPosix::SendTo() error: %d", errno); } return retVal; } SOCKET UdpSocketPosix::GetFd() { return _socket; } -int32_t UdpSocketPosix::GetError() { return _error; } bool UdpSocketPosix::ValidHandle() { diff --git a/webrtc/test/channel_transport/udp_socket_posix.h b/webrtc/test/channel_transport/udp_socket_posix.h index 9b2c037a13..8458ca0d74 100644 --- a/webrtc/test/channel_transport/udp_socket_posix.h +++ b/webrtc/test/channel_transport/udp_socket_posix.h @@ -52,8 +52,7 @@ public: // TODO (hellner): make destructor protected. virtual void CloseBlocking() OVERRIDE; - virtual SOCKET GetFd(); - virtual int32_t GetError(); + SOCKET GetFd(); virtual bool ValidHandle() OVERRIDE; @@ -76,7 +75,6 @@ private: int32_t _id; IncomingSocketCallback _incomingCb; CallbackObj _obj; - int32_t _error; SOCKET _socket; UdpSocketManager* _mgr; diff --git a/webrtc/test/channel_transport/udp_transport_impl.h b/webrtc/test/channel_transport/udp_transport_impl.h index 8c74daf98e..2b804c35bf 100644 --- a/webrtc/test/channel_transport/udp_transport_impl.h +++ b/webrtc/test/channel_transport/udp_transport_impl.h @@ -60,8 +60,8 @@ public: virtual int32_t InitializeSourcePorts( const uint16_t rtpPort, const uint16_t rtcpPort = 0) OVERRIDE; - virtual int32_t SourcePorts(uint16_t& rtpPort, uint16_t& rtcpPort) const - OVERRIDE; + virtual int32_t SourcePorts(uint16_t& rtpPort, + uint16_t& rtcpPort) const OVERRIDE; virtual int32_t ReceiveSocketInformation( char ipAddr[kIpAddressVersion6Length], uint16_t& rtpPort,