Fix clang style warnings in webrtc/base

Mostly this consists of marking functions with override when
applicable, and moving function bodies from .h to .cc files.

Not inlining virtual functions with simple bodies such as

  { return false; }

strikes me as probably losing more in readability than we gain in
binary size and compilation time, but I guess it's just like any other
case where enabling a generally good warning forces us to write
slightly worse code in a couple of places.

BUG=163
R=kjellander@webrtc.org, tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/47429004

Cr-Commit-Position: refs/heads/master@{#8656}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8656 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kwiberg@webrtc.org
2015-03-09 22:21:53 +00:00
parent 2989204130
commit 67186fe00c
111 changed files with 1610 additions and 1061 deletions

View File

@ -31,10 +31,10 @@ class ByteBuffer;
class BufferedReadAdapter : public AsyncSocketAdapter {
public:
BufferedReadAdapter(AsyncSocket* socket, size_t buffer_size);
virtual ~BufferedReadAdapter();
~BufferedReadAdapter() override;
virtual int Send(const void* pv, size_t cb);
virtual int Recv(void* pv, size_t cb);
int Send(const void* pv, size_t cb) override;
int Recv(void* pv, size_t cb) override;
protected:
int DirectSend(const void* pv, size_t cb) {
@ -44,7 +44,7 @@ class BufferedReadAdapter : public AsyncSocketAdapter {
void BufferInput(bool on = true);
virtual void ProcessInput(char* data, size_t* len) = 0;
virtual void OnReadEvent(AsyncSocket * socket);
void OnReadEvent(AsyncSocket* socket) override;
private:
char * buffer_;
@ -58,8 +58,8 @@ class BufferedReadAdapter : public AsyncSocketAdapter {
// Interface for implementing proxy server sockets.
class AsyncProxyServerSocket : public BufferedReadAdapter {
public:
AsyncProxyServerSocket(AsyncSocket* socket, size_t buffer_size)
: BufferedReadAdapter(socket, buffer_size) {}
AsyncProxyServerSocket(AsyncSocket* socket, size_t buffer_size);
~AsyncProxyServerSocket() override;
sigslot::signal2<AsyncProxyServerSocket*,
const SocketAddress&> SignalConnectRequest;
virtual void SendConnectResult(int err, const SocketAddress& addr) = 0;
@ -73,11 +73,11 @@ class AsyncSSLSocket : public BufferedReadAdapter {
public:
explicit AsyncSSLSocket(AsyncSocket* socket);
virtual int Connect(const SocketAddress& addr);
int Connect(const SocketAddress& addr) override;
protected:
virtual void OnConnectEvent(AsyncSocket* socket);
virtual void ProcessInput(char* data, size_t* len);
void OnConnectEvent(AsyncSocket* socket) override;
void ProcessInput(char* data, size_t* len) override;
DISALLOW_EVIL_CONSTRUCTORS(AsyncSSLSocket);
};
@ -88,7 +88,7 @@ class AsyncSSLServerSocket : public BufferedReadAdapter {
explicit AsyncSSLServerSocket(AsyncSocket* socket);
protected:
virtual void ProcessInput(char* data, size_t* len);
void ProcessInput(char* data, size_t* len) override;
DISALLOW_EVIL_CONSTRUCTORS(AsyncSSLServerSocket);
};
@ -100,22 +100,22 @@ class AsyncHttpsProxySocket : public BufferedReadAdapter {
AsyncHttpsProxySocket(AsyncSocket* socket, const std::string& user_agent,
const SocketAddress& proxy,
const std::string& username, const CryptString& password);
virtual ~AsyncHttpsProxySocket();
~AsyncHttpsProxySocket() override;
// If connect is forced, the adapter will always issue an HTTP CONNECT to the
// target address. Otherwise, it will connect only if the destination port
// is not port 80.
void SetForceConnect(bool force) { force_connect_ = force; }
virtual int Connect(const SocketAddress& addr);
virtual SocketAddress GetRemoteAddress() const;
virtual int Close();
virtual ConnState GetState() const;
int Connect(const SocketAddress& addr) override;
SocketAddress GetRemoteAddress() const override;
int Close() override;
ConnState GetState() const override;
protected:
virtual void OnConnectEvent(AsyncSocket* socket);
virtual void OnCloseEvent(AsyncSocket* socket, int err);
virtual void ProcessInput(char* data, size_t* len);
void OnConnectEvent(AsyncSocket* socket) override;
void OnCloseEvent(AsyncSocket* socket, int err) override;
void ProcessInput(char* data, size_t* len) override;
bool ShouldIssueConnect() const;
void SendRequest();
@ -159,15 +159,16 @@ class AsyncSocksProxySocket : public BufferedReadAdapter {
public:
AsyncSocksProxySocket(AsyncSocket* socket, const SocketAddress& proxy,
const std::string& username, const CryptString& password);
~AsyncSocksProxySocket() override;
virtual int Connect(const SocketAddress& addr);
virtual SocketAddress GetRemoteAddress() const;
virtual int Close();
virtual ConnState GetState() const;
int Connect(const SocketAddress& addr) override;
SocketAddress GetRemoteAddress() const override;
int Close() override;
ConnState GetState() const override;
protected:
virtual void OnConnectEvent(AsyncSocket* socket);
virtual void ProcessInput(char* data, size_t* len);
void OnConnectEvent(AsyncSocket* socket) override;
void ProcessInput(char* data, size_t* len) override;
void SendHello();
void SendConnect();
@ -191,7 +192,7 @@ class AsyncSocksProxyServerSocket : public AsyncProxyServerSocket {
explicit AsyncSocksProxyServerSocket(AsyncSocket* socket);
private:
virtual void ProcessInput(char* data, size_t* len);
void ProcessInput(char* data, size_t* len) override;
void DirectSend(const ByteBuffer& buf);
void HandleHello(ByteBuffer* request);
@ -199,7 +200,7 @@ class AsyncSocksProxyServerSocket : public AsyncProxyServerSocket {
void HandleAuth(ByteBuffer* request);
void SendAuthReply(uint8 result);
void HandleConnect(ByteBuffer* request);
virtual void SendConnectResult(int result, const SocketAddress& addr);
void SendConnectResult(int result, const SocketAddress& addr) override;
void Error(int error);
@ -219,15 +220,15 @@ class LoggingSocketAdapter : public AsyncSocketAdapter {
LoggingSocketAdapter(AsyncSocket* socket, LoggingSeverity level,
const char * label, bool hex_mode = false);
virtual int Send(const void *pv, size_t cb);
virtual int SendTo(const void *pv, size_t cb, const SocketAddress& addr);
virtual int Recv(void *pv, size_t cb);
virtual int RecvFrom(void *pv, size_t cb, SocketAddress *paddr);
virtual int Close();
int Send(const void* pv, size_t cb) override;
int SendTo(const void* pv, size_t cb, const SocketAddress& addr) override;
int Recv(void* pv, size_t cb) override;
int RecvFrom(void* pv, size_t cb, SocketAddress* paddr) override;
int Close() override;
protected:
virtual void OnConnectEvent(AsyncSocket * socket);
virtual void OnCloseEvent(AsyncSocket * socket, int err);
void OnConnectEvent(AsyncSocket* socket) override;
void OnCloseEvent(AsyncSocket* socket, int err) override;
private:
LoggingSeverity level_;